Cancel keydown events immediately once the view starts scrolling
The motivation of this patch is to make sure a user never feel haptic feedback when scrolling the Emoji palette. In order to achieve it, EmojiPageKeyboardView#releaseCurrentKey() should be called whenever (delayed) keydown events should be canceled. This patch wires up ViewPager.OnPageChangeListener#onPageScrolled with EmojiPageKeyboardView#releaseCurrentKey() so that delayed keydown events will be canceled immediately once the ViewParger starts scrolling. BUG: 12964092 Change-Id: Iea8c3e090bb16a8622e6b4a850af2bf963aa77d0
This commit is contained in:
parent
351c8e6185
commit
4c259866c4
1 changed files with 9 additions and 0 deletions
|
@ -534,6 +534,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
|||
@Override
|
||||
public void onPageScrolled(final int position, final float positionOffset,
|
||||
final int positionOffsetPixels) {
|
||||
mEmojiPalettesAdapter.onPageScrolled();
|
||||
final Pair<Integer, Integer> newPos =
|
||||
mEmojiCategory.getCategoryIdAndPageIdFromPagePosition(position);
|
||||
final int newCategoryId = newPos.first;
|
||||
|
@ -718,6 +719,14 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
|||
}
|
||||
}
|
||||
|
||||
public void onPageScrolled() {
|
||||
// Make sure the delayed key-down event (highlight effect and haptic feedback) will be
|
||||
// canceled.
|
||||
final EmojiPageKeyboardView currentKeyboardView =
|
||||
mActiveKeyboardViews.get(mActivePosition);
|
||||
currentKeyboardView.releaseCurrentKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mEmojiCategory.getTotalPageCountOfAllCategories();
|
||||
|
|
Loading…
Reference in a new issue