Search in sources :

Example 71 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project LearnApp by YouCii.

the class RecyclerItemDecoration method drawVertical.

public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        android.support.v7.widget.RecyclerView v = new android.support.v7.widget.RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 72 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

the class BottomNavigationMenuCustom method onLayout.

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final int count = getChildCount();
    final int width = right - left;
    final int height = bottom - top;
    int used = 0;
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == GONE) {
            continue;
        }
        if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL) {
            child.layout(width - used - child.getMeasuredWidth(), 0, width - used, height);
        } else {
            child.layout(used, 0, child.getMeasuredWidth() + used, height);
        }
        used += child.getMeasuredWidth();
    }
}
Also used : MenuView(android.support.v7.view.menu.MenuView) View(android.view.View)

Example 73 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by DirtyUnicorns.

the class InputMethodAndSubtypeEnabler method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    // Input method id should be available from an Intent when this preference is launched as a
    // single Activity (see InputMethodAndSubtypeEnablerActivity). It should be available
    // from a preference argument when the preference is launched as a part of the other
    // Activity (like a right pane of 2-pane Settings app)
    final String targetImi = getStringExtraFromIntentOrArguments(android.provider.Settings.EXTRA_INPUT_METHOD_ID);
    final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getPrefContext());
    mManager = new InputMethodAndSubtypeEnablerManager(this);
    mManager.init(this, targetImi, root);
    setPreferenceScreen(root);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) InputMethodAndSubtypeEnablerManager(com.android.settingslib.inputmethod.InputMethodAndSubtypeEnablerManager)

Example 74 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by DirtyUnicorns.

the class SearchFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.search_panel, container, false);
    mResultsRecyclerView = view.findViewById(R.id.list_results);
    mResultsRecyclerView.setAdapter(mSearchAdapter);
    mResultsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mResultsRecyclerView.addOnScrollListener(mScrollListener);
    mNoResultsView = view.findViewById(R.id.no_results_layout);
    Toolbar toolbar = view.findViewById(R.id.search_toolbar);
    getActivity().setActionBar(toolbar);
    getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
    mSearchView = toolbar.findViewById(R.id.search_view);
    mSearchView.setQuery(mQuery, false);
    mSearchView.setOnQueryTextListener(this);
    mSearchView.requestFocus();
    // Updating internal views inside SearchView was the easiest way to get this too look right.
    // Instead of grabbing the TextView directly, we grab it as a view and do an instanceof
    // check. This ensures if we return, say, a LinearLayout in the tests, they won't fail.
    View searchText = mSearchView.findViewById(com.android.internal.R.id.search_src_text);
    if (searchText instanceof TextView) {
        TextView searchTextView = (TextView) searchText;
        searchTextView.setTextColor(getContext().getColorStateList(com.android.internal.R.color.text_color_primary));
        searchTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.search_bar_text_size));
    }
    View editFrame = mSearchView.findViewById(com.android.internal.R.id.search_edit_frame);
    if (editFrame != null) {
        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) editFrame.getLayoutParams();
        params.setMarginStart(0);
        editFrame.setLayoutParams(params);
    }
    ActionBarShadowController.attachToRecyclerView(view.findViewById(R.id.search_bar_container), getLifecycle(), mResultsRecyclerView);
    return view;
}
Also used : ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) SearchView(android.widget.SearchView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.widget.Toolbar)

Example 75 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by DirtyUnicorns.

the class ProgressiveDisclosureMixin method addPreference.

/**
 * Adds preference to screen. If there are too many preference on screen, adds it to
 * collapsed list instead.
 */
public void addPreference(PreferenceScreen screen, Preference pref) {
    // Either add to screen, or to collapsed list.
    if (isCollapsed()) {
        // insert the preference to right position.
        final int lastPreferenceIndex = screen.getPreferenceCount() - 2;
        if (lastPreferenceIndex >= 0) {
            final Preference lastPreference = screen.getPreference(lastPreferenceIndex);
            if (lastPreference.getOrder() > pref.getOrder()) {
                // insert to screen and move the last pref to collapsed list.
                screen.removePreference(lastPreference);
                screen.addPreference(pref);
                addToCollapsedList(lastPreference);
            } else {
                // Insert to collapsed list.
                addToCollapsedList(pref);
            }
        } else {
            // Couldn't find last preference on screen, just add to collapsed list.
            addToCollapsedList(pref);
        }
    } else if (shouldCollapse(screen)) {
        // About to have too many tiles on scree, collapse and add pref to collapsed list.
        screen.addPreference(pref);
        collapse(screen);
    } else {
        // No need to collapse, add to screen directly.
        screen.addPreference(pref);
    }
}
Also used : Preference(android.support.v7.preference.Preference)

Aggregations

View (android.view.View)315 RecyclerView (android.support.v7.widget.RecyclerView)294 Paint (android.graphics.Paint)47 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)29 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)27 ViewGroup (android.view.ViewGroup)15 Intent (android.content.Intent)13 Rect (android.graphics.Rect)12 Preference (android.support.v7.preference.Preference)12 GridLayoutManager (android.support.v7.widget.GridLayoutManager)11 SuppressLint (android.annotation.SuppressLint)10 AlertDialog (android.support.v7.app.AlertDialog)10 Bundle (android.os.Bundle)9 Bitmap (android.graphics.Bitmap)8 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)8 Button (android.widget.Button)8 PreferenceScreen (android.support.v7.preference.PreferenceScreen)7 ArrayList (java.util.ArrayList)7 Animator (android.animation.Animator)6