use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionAdapterUtils method animateChange.
private static void animateChange(final View view, final View content, final View detailGroup, final boolean visible, final boolean hasButtons) {
setViewVisibility(detailGroup, R.id.divider, hasButtons);
setViewVisibility(detailGroup, R.id.buttonBar, hasButtons);
final int beforeBottom = content.getBottom();
setHeight(detailGroup, visible ? LayoutParams.WRAP_CONTENT : 0);
detailGroup.setVisibility(View.VISIBLE);
view.addOnLayoutChangeListener(new OnLayoutChangeListener() {
public static final long DURATION = 250;
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
final int afterBottom = content.getBottom();
v.removeOnLayoutChangeListener(this);
final ObjectAnimator animator = ObjectAnimator.ofInt(content, "bottom", beforeBottom, afterBottom);
animator.setDuration(DURATION);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!visible) {
detailGroup.setVisibility(View.GONE);
}
}
});
animator.start();
}
});
}
use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndSubtypeEnabler method onCreate.
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
final Configuration config = getResources().getConfiguration();
mHaveHardKeyboard = (config.keyboard == Configuration.KEYBOARD_QWERTY);
// 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);
mInputMethodInfoList = mImm.getInputMethodList();
mCollator = Collator.getInstance();
final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getActivity());
final int imiCount = mInputMethodInfoList.size();
for (int index = 0; index < imiCount; ++index) {
final InputMethodInfo imi = mInputMethodInfoList.get(index);
// Add subtype preferences of this IME when it is specified or no IME is specified.
if (imi.getId().equals(targetImi) || TextUtils.isEmpty(targetImi)) {
addInputMethodSubtypePreferences(imi, root);
}
}
setPreferenceScreen(root);
}
use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PixelAnimDurationSettings method refreshSettings.
public void refreshSettings() {
PreferenceScreen prefs = getPreferenceScreen();
if (prefs != null) {
prefs.removeAll();
}
addPreferencesFromResource(R.xml.pixel_anim_duration);
mContext = getActivity().getApplicationContext();
mContentRes = getActivity().getContentResolver();
final Resources res = getResources();
int defaultValue;
mPixelx = (SeekBarPreference) findPreference(PIXEL_X);
int xanim = Settings.System.getIntForUser(getContentResolver(), Settings.System.OPA_ANIM_DURATION_X, 133, UserHandle.USER_CURRENT);
mPixelx.setValue(xanim / 1);
mPixelx.setOnPreferenceChangeListener(this);
mPixely = (SeekBarPreference) findPreference(PIXEL_Y);
int yanim = Settings.System.getIntForUser(getContentResolver(), Settings.System.OPA_ANIM_DURATION_Y, 255, UserHandle.USER_CURRENT);
mPixely.setValue(yanim / 1);
mPixely.setOnPreferenceChangeListener(this);
mCollapse = (SeekBarPreference) findPreference(PIXEL_COLLAPSE);
int xcol = Settings.System.getIntForUser(getContentResolver(), Settings.System.COLLAPSE_ANIMATION_DURATION_RY, 83, UserHandle.USER_CURRENT);
mCollapse.setValue(xcol / 1);
mCollapse.setOnPreferenceChangeListener(this);
mBg = (SeekBarPreference) findPreference(PIXEL_BG);
int bg = Settings.System.getIntForUser(getContentResolver(), Settings.System.COLLAPSE_ANIMATION_DURATION_BG, 100, UserHandle.USER_CURRENT);
mBg.setValue(yanim / 1);
mBg.setOnPreferenceChangeListener(this);
mRetract = (SeekBarPreference) findPreference(PIXEL_RETRACT);
int ret = Settings.System.getIntForUser(getContentResolver(), Settings.System.RETRACT_ANIMATION_DURATION, 300, UserHandle.USER_CURRENT);
mRetract.setValue(ret / 1);
mRetract.setOnPreferenceChangeListener(this);
mDiamond = (SeekBarPreference) findPreference(PIXEL_DIAMOND);
int diam = Settings.System.getIntForUser(getContentResolver(), Settings.System.DIAMOND_ANIMATION_DURATION, 200, UserHandle.USER_CURRENT);
mDiamond.setValue(diam / 1);
mDiamond.setOnPreferenceChangeListener(this);
mDots = (SeekBarPreference) findPreference(PIXEL_DOTS);
int dots = Settings.System.getIntForUser(getContentResolver(), Settings.System.DOTS_RESIZE_DURATION, 200, UserHandle.USER_CURRENT);
mDots.setValue(dots / 1);
mDots.setOnPreferenceChangeListener(this);
mHome = (SeekBarPreference) findPreference(PIXEL_HOME);
int home = Settings.System.getIntForUser(getContentResolver(), Settings.System.HOME_RESIZE_DURATION, 255, UserHandle.USER_CURRENT);
mHome.setValue(home / 1);
mHome.setOnPreferenceChangeListener(this);
mColorCat = (PreferenceCategory) findPreference(COLOR_CAT);
mTopColor = (ColorPickerPreference) findPreference(TOP_COLOR);
mTopColor.setOnPreferenceChangeListener(this);
int top = Settings.System.getInt(mContentRes, Settings.System.DOT_TOP_COLOR, Color.RED);
String topHexColor = String.format("#%08x", (0x00ffffff & top));
mTopColor.setSummary(topHexColor);
mTopColor.setNewPreviewColor(top);
mBottomColor = (ColorPickerPreference) findPreference(BOTTOM_COLOR);
mBottomColor.setOnPreferenceChangeListener(this);
int bottom = Settings.System.getInt(mContentRes, Settings.System.DOT_BOTTOM_COLOR, Color.YELLOW);
String bottomHexColor = String.format("#%08x", (0x00ffffff & bottom));
mBottomColor.setSummary(bottomHexColor);
mBottomColor.setNewPreviewColor(bottom);
mRightColor = (ColorPickerPreference) findPreference(RIGHT_COLOR);
mRightColor.setOnPreferenceChangeListener(this);
int right = Settings.System.getInt(mContentRes, Settings.System.DOT_RIGHT_COLOR, Color.GREEN);
String rightHexColor = String.format("#%08x", (0x00ffffff & right));
mRightColor.setSummary(rightHexColor);
mRightColor.setNewPreviewColor(right);
mLeftColor = (ColorPickerPreference) findPreference(LEFT_COLOR);
mLeftColor.setOnPreferenceChangeListener(this);
int left = Settings.System.getInt(mContentRes, Settings.System.DOT_LEFT_COLOR, Color.RED);
String leftHexColor = String.format("#%08x", (0x00ffffff & left));
mLeftColor.setSummary(leftHexColor);
mLeftColor.setNewPreviewColor(left);
mColorStyle = (ListPreference) findPreference(COLOR_STYLE);
int style = Settings.System.getIntForUser(mContentRes, Settings.System.DOT_COLOR_SWITCH, 0, UserHandle.USER_CURRENT);
mColorStyle.setValue(String.valueOf(style));
mColorStyle.setSummary(mColorStyle.getEntry());
mColorStyle.setOnPreferenceChangeListener(this);
UpdateSettings(style);
}
use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project EasyRecyclerView by Jude95.
the class DividerDecoration method onDrawOver.
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (parent.getAdapter() == null) {
return;
}
int orientation = 0;
int headerCount = 0, footerCount = 0, dataCount;
if (parent.getAdapter() instanceof RecyclerArrayAdapter) {
headerCount = ((RecyclerArrayAdapter) parent.getAdapter()).getHeaderCount();
footerCount = ((RecyclerArrayAdapter) parent.getAdapter()).getFooterCount();
dataCount = ((RecyclerArrayAdapter) parent.getAdapter()).getCount();
} else {
dataCount = parent.getAdapter().getItemCount();
}
int dataStartPosition = headerCount;
int dataEndPosition = headerCount + dataCount;
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof StaggeredGridLayoutManager) {
orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation();
} else if (layoutManager instanceof GridLayoutManager) {
orientation = ((GridLayoutManager) layoutManager).getOrientation();
} else if (layoutManager instanceof LinearLayoutManager) {
orientation = ((LinearLayoutManager) layoutManager).getOrientation();
}
int start, end;
if (orientation == OrientationHelper.VERTICAL) {
start = parent.getPaddingLeft() + mPaddingLeft;
end = parent.getWidth() - parent.getPaddingRight() - mPaddingRight;
} else {
start = parent.getPaddingTop() + mPaddingLeft;
end = parent.getHeight() - parent.getPaddingBottom() - mPaddingRight;
}
int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
int position = parent.getChildAdapterPosition(child);
if (//数据项除了最后一项
position >= dataStartPosition && position < dataEndPosition - 1 || //数据项最后一项
(position == dataEndPosition - 1 && mDrawLastItem) || //header&footer且可绘制
(!(position >= dataStartPosition && position < dataEndPosition) && mDrawHeaderFooter)) {
if (orientation == OrientationHelper.VERTICAL) {
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin;
int bottom = top + mHeight;
mColorDrawable.setBounds(start, top, end, bottom);
mColorDrawable.draw(c);
} else {
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int left = child.getRight() + params.rightMargin;
int right = left + mHeight;
mColorDrawable.setBounds(left, start, right, end);
mColorDrawable.draw(c);
}
}
}
}
use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project UltimateAndroid by cymcsg.
the class DividerItemDecoration method drawHorizontal.
public void drawHorizontal(Canvas c, RecyclerView parent) {
final int top = parent.getPaddingTop();
final int bottom = parent.getHeight() - parent.getPaddingBottom();
final int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int left = child.getRight() + params.rightMargin;
final int right = left + mDivider.getIntrinsicHeight();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
Aggregations