Fix the position of emoji palette

Change-Id: I07a3912cb9fef8e28f3605de4e73a201a900e95c
This commit is contained in:
Satoshi Kataoka 2013-10-08 20:58:47 +09:00
parent 0e01df9baf
commit f981fe7ed2

View File

@ -84,6 +84,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
private TabHost mTabHost; private TabHost mTabHost;
private ViewPager mEmojiPager; private ViewPager mEmojiPager;
private int mCurrentPagerPosition = 0;
private EmojiCategoryPageIndicatorView mEmojiCategoryPageIndicatorView; private EmojiCategoryPageIndicatorView mEmojiCategoryPageIndicatorView;
private KeyboardActionListener mKeyboardActionListener = KeyboardActionListener.EMPTY_LISTENER; private KeyboardActionListener mKeyboardActionListener = KeyboardActionListener.EMPTY_LISTENER;
@ -507,6 +508,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
setCurrentCategoryId(newPos.first /* categoryId */, false /* force */); setCurrentCategoryId(newPos.first /* categoryId */, false /* force */);
mEmojiCategory.setCurrentCategoryPageId(newPos.second /* categoryPageId */); mEmojiCategory.setCurrentCategoryPageId(newPos.second /* categoryPageId */);
updateEmojiCategoryPageIdView(); updateEmojiCategoryPageIdView();
mCurrentPagerPosition = position;
} }
@Override @Override
@ -569,15 +571,17 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
public void startEmojiPalettes() { public void startEmojiPalettes() {
if (DEBUG_PAGER) { if (DEBUG_PAGER) {
Log.d(TAG, "allocate emoji palettes memory"); Log.d(TAG, "allocate emoji palettes memory " + mCurrentPagerPosition);
} }
mEmojiPager.setAdapter(mEmojiPalettesAdapter); mEmojiPager.setAdapter(mEmojiPalettesAdapter);
mEmojiPager.setCurrentItem(mCurrentPagerPosition);
} }
public void stopEmojiPalettes() { public void stopEmojiPalettes() {
if (DEBUG_PAGER) { if (DEBUG_PAGER) {
Log.d(TAG, "deallocate emoji palettes memory"); Log.d(TAG, "deallocate emoji palettes memory");
} }
mEmojiPalettesAdapter.flushPendingRecentKeys();
mEmojiPager.setAdapter(null); mEmojiPager.setAdapter(null);
} }