Use ANIMATOR_DURATION_SCALE only.

Make local to `EmojiPalettesView`.
This commit is contained in:
eranl 2025-06-11 22:24:03 +03:00
parent adb6eb4952
commit a9044b710f
2 changed files with 6 additions and 17 deletions

View file

@ -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 && ! Settings.getValues().mAnimationDisabled);
mEmojiCategory.getCurrentCategoryId()), ! initial && ! isAnimationsDisabled());
}
if (Settings.getValues().mSecondaryStripVisible) {
@ -418,6 +418,11 @@ public final class EmojiPalettesView extends LinearLayout
}
}
private boolean isAnimationsDisabled() {
return android.provider.Settings.Global.getFloat(getContext().getContentResolver(),
android.provider.Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f) == 0.0f;
}
public void clearKeyboardCache() {
if (!initialized) {
return;

View file

@ -49,10 +49,6 @@ 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;
@ -163,8 +159,6 @@ public class SettingsValues {
mDisplayOrientation = res.getConfiguration().orientation;
final InputMethodSubtype selectedSubtype = SubtypeSettings.INSTANCE.getSelectedSubtype(prefs);
mAnimationDisabled = isAnimationDisabled(context);
// Store the input attributes
mInputAttributes = inputAttributes;
@ -430,14 +424,4 @@ 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;
}
}