mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-28 11:49:56 +00:00
Disable emoji view animation according to system setting
This commit is contained in:
parent
80ba394b95
commit
adb6eb4952
2 changed files with 18 additions and 2 deletions
|
@ -71,7 +71,7 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
|
||||
private final class PagerAdapter extends RecyclerView.Adapter<PagerViewHolder> {
|
||||
private boolean mInitialized;
|
||||
private Map<Integer, RecyclerView> mViews = new HashMap<>(mEmojiCategory.getShownCategories().size());
|
||||
private final Map<Integer, RecyclerView> mViews = new HashMap<>(mEmojiCategory.getShownCategories().size());
|
||||
|
||||
private PagerAdapter(ViewPager2 pager) {
|
||||
setHasStableIds(true);
|
||||
|
@ -403,7 +403,7 @@ public final class EmojiPalettesView extends LinearLayout
|
|||
if (mPager.getScrollState() != ViewPager2.SCROLL_STATE_DRAGGING) {
|
||||
// Not swiping
|
||||
mPager.setCurrentItem(mEmojiCategory.getTabIdFromCategoryId(
|
||||
mEmojiCategory.getCurrentCategoryId()), ! initial);
|
||||
mEmojiCategory.getCurrentCategoryId()), ! initial && ! Settings.getValues().mAnimationDisabled);
|
||||
}
|
||||
|
||||
if (Settings.getValues().mSecondaryStripVisible) {
|
||||
|
|
|
@ -49,6 +49,10 @@ public class SettingsValues {
|
|||
public final Locale mLocale;
|
||||
public final boolean mHasHardwareKeyboard;
|
||||
public final int mDisplayOrientation;
|
||||
|
||||
// From system
|
||||
public final boolean mAnimationDisabled;
|
||||
|
||||
// From preferences
|
||||
public final boolean mAutoCap;
|
||||
public final boolean mVibrateOn;
|
||||
|
@ -159,6 +163,8 @@ public class SettingsValues {
|
|||
mDisplayOrientation = res.getConfiguration().orientation;
|
||||
final InputMethodSubtype selectedSubtype = SubtypeSettings.INSTANCE.getSelectedSubtype(prefs);
|
||||
|
||||
mAnimationDisabled = isAnimationDisabled(context);
|
||||
|
||||
// Store the input attributes
|
||||
mInputAttributes = inputAttributes;
|
||||
|
||||
|
@ -424,4 +430,14 @@ public class SettingsValues {
|
|||
sb.append("\n mAppWorkarounds = ");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static boolean isAnimationDisabled(Context context) {
|
||||
return isZeroSetting(android.provider.Settings.Global.ANIMATOR_DURATION_SCALE, context)
|
||||
&& isZeroSetting(android.provider.Settings.Global.TRANSITION_ANIMATION_SCALE, context)
|
||||
&& isZeroSetting(android.provider.Settings.Global.WINDOW_ANIMATION_SCALE, context);
|
||||
}
|
||||
|
||||
private static boolean isZeroSetting(String name, Context context) {
|
||||
return android.provider.Settings.Global.getFloat(context.getContentResolver(), name, 1.0f) == 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue