Disable emoji view animation according to system setting (#1696)

This commit is contained in:
Eran Leshem 2025-06-11 22:29:06 +03:00 committed by GitHub
parent 9cec401e1e
commit f8d3795302
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 && ! 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;