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);
}
}
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();
}
}
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);
}
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;
}
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);
}
}
Aggregations