2013-10-25 17:19:00 +02:00
|
|
|
/*
|
2013-12-20 20:25:49 +01:00
|
|
|
* This is the source code of Telegram for Android v. 1.3.2.
|
2013-10-25 17:19:00 +02:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
|
|
|
* Copyright Nikolai Kudashov, 2013.
|
|
|
|
*/
|
|
|
|
|
2014-12-01 18:56:31 +01:00
|
|
|
package org.telegram.ui.Components;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
|
|
|
import android.content.Context;
|
2014-06-20 02:18:13 +02:00
|
|
|
import android.database.DataSetObserver;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.support.v4.view.PagerAdapter;
|
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
|
import android.text.TextUtils;
|
2015-05-03 13:48:36 +02:00
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.HapticFeedbackConstants;
|
|
|
|
import android.view.MotionEvent;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.BaseAdapter;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.GridView;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
2014-07-03 00:39:05 +02:00
|
|
|
import org.telegram.android.AndroidUtilities;
|
|
|
|
import org.telegram.android.Emoji;
|
|
|
|
import org.telegram.android.LocaleController;
|
2015-05-03 13:48:36 +02:00
|
|
|
import org.telegram.android.NotificationCenter;
|
|
|
|
import org.telegram.android.query.StickersQuery;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.messenger.R;
|
2015-05-03 13:48:36 +02:00
|
|
|
import org.telegram.messenger.TLRPC;
|
|
|
|
import org.telegram.ui.Cells.StickerEmojiCell;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
public class EmojiView extends LinearLayout implements NotificationCenter.NotificationCenterDelegate {
|
|
|
|
|
|
|
|
public interface Listener {
|
|
|
|
boolean onBackspace();
|
|
|
|
void onEmojiSelected(String emoji);
|
|
|
|
void onStickerSelected(TLRPC.Document sticker);
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
|
|
|
|
private ArrayList<EmojiGridAdapter> adapters = new ArrayList<>();
|
2015-05-03 13:48:36 +02:00
|
|
|
private StickersGridAdapter stickersGridAdapter;
|
2013-10-25 17:19:00 +02:00
|
|
|
private int[] icons = {
|
|
|
|
R.drawable.ic_emoji_recent,
|
|
|
|
R.drawable.ic_emoji_smile,
|
|
|
|
R.drawable.ic_emoji_flower,
|
|
|
|
R.drawable.ic_emoji_bell,
|
|
|
|
R.drawable.ic_emoji_car,
|
2015-05-03 13:48:36 +02:00
|
|
|
R.drawable.ic_emoji_symbol,
|
|
|
|
R.drawable.ic_emoji_sticker};
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
private Listener listener;
|
|
|
|
private ViewPager pager;
|
|
|
|
private FrameLayout recentsWrap;
|
2015-04-09 20:00:14 +02:00
|
|
|
private ArrayList<GridView> views = new ArrayList<>();
|
2015-05-03 13:48:36 +02:00
|
|
|
private ImageView backspaceButton;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
private boolean backspacePressed;
|
|
|
|
private boolean backspaceOnce;
|
|
|
|
|
|
|
|
public EmojiView(boolean needStickers, Context context) {
|
|
|
|
super(context);
|
|
|
|
|
|
|
|
setOrientation(LinearLayout.VERTICAL);
|
|
|
|
for (int i = 0; i < Emoji.data.length; i++) {
|
|
|
|
GridView gridView = new GridView(context);
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
gridView.setColumnWidth(AndroidUtilities.dp(60));
|
|
|
|
} else {
|
|
|
|
gridView.setColumnWidth(AndroidUtilities.dp(45));
|
|
|
|
}
|
|
|
|
gridView.setNumColumns(-1);
|
|
|
|
views.add(gridView);
|
|
|
|
|
|
|
|
EmojiGridAdapter emojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]);
|
|
|
|
gridView.setAdapter(emojiGridAdapter);
|
|
|
|
AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xfff5f6f7);
|
|
|
|
adapters.add(emojiGridAdapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needStickers) {
|
|
|
|
GridView gridView = new GridView(context);
|
|
|
|
gridView.setColumnWidth(AndroidUtilities.dp(72));
|
|
|
|
gridView.setNumColumns(-1);
|
|
|
|
gridView.setPadding(0, AndroidUtilities.dp(4), 0, 0);
|
|
|
|
gridView.setClipToPadding(false);
|
|
|
|
views.add(gridView);
|
|
|
|
stickersGridAdapter = new StickersGridAdapter(context);
|
|
|
|
gridView.setAdapter(stickersGridAdapter);
|
|
|
|
AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xfff5f6f7);
|
|
|
|
}
|
|
|
|
|
|
|
|
setBackgroundColor(0xfff5f6f7);
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
pager = new ViewPager(context);
|
|
|
|
pager.setAdapter(new EmojiPagesAdapter());
|
|
|
|
|
|
|
|
LinearLayout linearLayout = new LinearLayout(context);
|
|
|
|
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
|
|
|
|
linearLayout.setBackgroundColor(0xfff5f6f7);
|
|
|
|
addView(linearLayout, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, AndroidUtilities.dp(48)));
|
|
|
|
|
|
|
|
PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(context);
|
|
|
|
tabs.setViewPager(pager);
|
|
|
|
tabs.setShouldExpand(true);
|
|
|
|
tabs.setIndicatorHeight(AndroidUtilities.dp(2));
|
|
|
|
tabs.setUnderlineHeight(AndroidUtilities.dp(1));
|
|
|
|
tabs.setIndicatorColor(0xff2b96e2);
|
|
|
|
tabs.setUnderlineColor(0xffe2e5e7);
|
|
|
|
linearLayout.addView(tabs, new LinearLayout.LayoutParams(0, AndroidUtilities.dp(48), 1.0f));
|
|
|
|
|
|
|
|
FrameLayout frameLayout = new FrameLayout(context);
|
|
|
|
linearLayout.addView(frameLayout, new LinearLayout.LayoutParams(AndroidUtilities.dp(52), AndroidUtilities.dp(48)));
|
|
|
|
|
|
|
|
backspaceButton = new ImageView(context) {
|
|
|
|
@Override
|
|
|
|
public boolean onTouchEvent(MotionEvent event) {
|
|
|
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
|
backspacePressed = true;
|
|
|
|
backspaceOnce = false;
|
|
|
|
postBackspaceRunnable(350);
|
|
|
|
} else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
backspacePressed = false;
|
|
|
|
if (!backspaceOnce) {
|
|
|
|
if (EmojiView.this.listener != null && EmojiView.this.listener.onBackspace()) {
|
|
|
|
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
super.onTouchEvent(event);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
backspaceButton.setImageResource(R.drawable.ic_smiles_backspace);
|
|
|
|
backspaceButton.setBackgroundResource(R.drawable.ic_emoji_backspace);
|
|
|
|
backspaceButton.setScaleType(ImageView.ScaleType.CENTER);
|
|
|
|
frameLayout.addView(backspaceButton, new FrameLayout.LayoutParams(AndroidUtilities.dp(52), AndroidUtilities.dp(48)));
|
|
|
|
|
|
|
|
View view = new View(context);
|
|
|
|
view.setBackgroundColor(0xffe2e5e7);
|
|
|
|
frameLayout.addView(view, new FrameLayout.LayoutParams(AndroidUtilities.dp(52), AndroidUtilities.dp(1), Gravity.LEFT | Gravity.BOTTOM));
|
|
|
|
|
|
|
|
recentsWrap = new FrameLayout(context);
|
|
|
|
recentsWrap.addView(views.get(0));
|
|
|
|
|
|
|
|
TextView textView = new TextView(context);
|
|
|
|
textView.setText(LocaleController.getString("NoRecent", R.string.NoRecent));
|
|
|
|
textView.setTextSize(18);
|
|
|
|
textView.setTextColor(0xff888888);
|
|
|
|
textView.setGravity(Gravity.CENTER);
|
|
|
|
recentsWrap.addView(textView);
|
|
|
|
views.get(0).setEmptyView(textView);
|
|
|
|
|
|
|
|
addView(pager);
|
|
|
|
|
|
|
|
loadRecents();
|
|
|
|
|
|
|
|
if (Emoji.data[0] == null || Emoji.data[0].length == 0) {
|
|
|
|
pager.setCurrentItem(1);
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
private void postBackspaceRunnable(final int time) {
|
|
|
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (!backspacePressed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (EmojiView.this.listener != null && EmojiView.this.listener.onBackspace()) {
|
|
|
|
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
|
|
|
}
|
|
|
|
backspaceOnce = true;
|
|
|
|
postBackspaceRunnable(Math.max(50, time - 100));
|
|
|
|
}
|
|
|
|
}, time);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
private void addToRecent(long code) {
|
|
|
|
if (pager.getCurrentItem() == 0) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-05-03 13:48:36 +02:00
|
|
|
ArrayList<Long> recent = new ArrayList<>();
|
2013-10-25 17:19:00 +02:00
|
|
|
long[] currentRecent = Emoji.data[0];
|
|
|
|
boolean was = false;
|
|
|
|
for (long aCurrentRecent : currentRecent) {
|
2015-05-03 13:48:36 +02:00
|
|
|
if (code == aCurrentRecent) {
|
|
|
|
recent.add(0, code);
|
2013-10-25 17:19:00 +02:00
|
|
|
was = true;
|
|
|
|
} else {
|
2015-05-03 13:48:36 +02:00
|
|
|
recent.add(aCurrentRecent);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!was) {
|
2015-05-03 13:48:36 +02:00
|
|
|
recent.add(0, code);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2015-05-03 13:48:36 +02:00
|
|
|
Emoji.data[0] = new long[Math.min(recent.size(), 50)];
|
2013-10-25 17:19:00 +02:00
|
|
|
for (int q = 0; q < Emoji.data[0].length; q++) {
|
2015-05-03 13:48:36 +02:00
|
|
|
Emoji.data[0][q] = recent.get(q);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
adapters.get(0).data = Emoji.data[0];
|
|
|
|
adapters.get(0).notifyDataSetChanged();
|
|
|
|
saveRecents();
|
|
|
|
}
|
|
|
|
|
|
|
|
private String convert(long paramLong) {
|
|
|
|
String str = "";
|
|
|
|
for (int i = 0; ; i++) {
|
|
|
|
if (i >= 4) {
|
|
|
|
return str;
|
|
|
|
}
|
2015-05-03 13:48:36 +02:00
|
|
|
int j = (int) (0xFFFF & paramLong >> 16 * (3 - i));
|
2013-10-25 17:19:00 +02:00
|
|
|
if (j != 0) {
|
2015-05-03 13:48:36 +02:00
|
|
|
str = str + (char) j;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void saveRecents() {
|
2015-04-09 20:00:14 +02:00
|
|
|
ArrayList<Long> localArrayList = new ArrayList<>();
|
2013-10-25 17:19:00 +02:00
|
|
|
long[] arrayOfLong = Emoji.data[0];
|
|
|
|
int i = arrayOfLong.length;
|
|
|
|
for (int j = 0; ; j++) {
|
|
|
|
if (j >= i) {
|
|
|
|
getContext().getSharedPreferences("emoji", 0).edit().putString("recents", TextUtils.join(",", localArrayList)).commit();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
localArrayList.add(arrayOfLong[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void loadRecents() {
|
|
|
|
String str = getContext().getSharedPreferences("emoji", 0).getString("recents", "");
|
|
|
|
String[] arrayOfString = null;
|
2015-05-03 13:48:36 +02:00
|
|
|
if (str != null && str.length() > 0) {
|
2013-10-25 17:19:00 +02:00
|
|
|
arrayOfString = str.split(",");
|
|
|
|
Emoji.data[0] = new long[arrayOfString.length];
|
|
|
|
for (int i = 0; i < arrayOfString.length; i++) {
|
|
|
|
Emoji.data[0][i] = Long.parseLong(arrayOfString[i]);
|
|
|
|
}
|
2015-05-03 13:48:36 +02:00
|
|
|
} else {
|
|
|
|
Emoji.data[0] = new long[]{0x00000000D83DDE02L, 0x00000000D83DDE18L, 0x0000000000002764L, 0x00000000D83DDE0DL, 0x00000000D83DDE0AL, 0x00000000D83DDE01L,
|
|
|
|
0x00000000D83DDC4DL, 0x000000000000263AL, 0x00000000D83DDE14L, 0x00000000D83DDE04L, 0x00000000D83DDE2DL, 0x00000000D83DDC8BL,
|
|
|
|
0x00000000D83DDE12L, 0x00000000D83DDE33L, 0x00000000D83DDE1CL, 0x00000000D83DDE48L, 0x00000000D83DDE09L, 0x00000000D83DDE03L,
|
|
|
|
0x00000000D83DDE22L, 0x00000000D83DDE1DL, 0x00000000D83DDE31L, 0x00000000D83DDE21L, 0x00000000D83DDE0FL, 0x00000000D83DDE1EL,
|
|
|
|
0x00000000D83DDE05L, 0x00000000D83DDE1AL, 0x00000000D83DDE4AL, 0x00000000D83DDE0CL, 0x00000000D83DDE00L, 0x00000000D83DDE0BL,
|
|
|
|
0x00000000D83DDE06L, 0x00000000D83DDC4CL, 0x00000000D83DDE10L, 0x00000000D83DDE15L};
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2015-05-03 13:48:36 +02:00
|
|
|
adapters.get(0).data = Emoji.data[0];
|
|
|
|
adapters.get(0).notifyDataSetChanged();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY));
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
public void setListener(Listener value) {
|
|
|
|
listener = value;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void invalidateViews() {
|
|
|
|
for (GridView gridView : views) {
|
|
|
|
if (gridView != null) {
|
|
|
|
gridView.invalidateViews();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-03 13:48:36 +02:00
|
|
|
@Override
|
|
|
|
protected void onAttachedToWindow() {
|
|
|
|
super.onAttachedToWindow();
|
|
|
|
if (stickersGridAdapter != null) {
|
|
|
|
NotificationCenter.getInstance().addObserver(this, NotificationCenter.stickersDidLoaded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onDetachedFromWindow() {
|
|
|
|
super.onDetachedFromWindow();
|
|
|
|
if (stickersGridAdapter != null) {
|
|
|
|
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.stickersDidLoaded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didReceivedNotification(int id, Object... args) {
|
|
|
|
if (id == NotificationCenter.stickersDidLoaded) {
|
|
|
|
stickersGridAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class StickersGridAdapter extends BaseAdapter {
|
|
|
|
|
|
|
|
Context context;
|
|
|
|
|
|
|
|
public StickersGridAdapter(Context context) {
|
|
|
|
this.context = context;
|
|
|
|
StickersQuery.checkStickers();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCount() {
|
|
|
|
return StickersQuery.getStickers().size();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Object getItem(int i) {
|
|
|
|
return StickersQuery.getStickers().get(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getItemId(int i) {
|
|
|
|
return StickersQuery.getStickers().get(i).id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public View getView(int i, View view, ViewGroup viewGroup) {
|
|
|
|
if (view == null) {
|
|
|
|
view = new StickerEmojiCell(context) {
|
|
|
|
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(82), MeasureSpec.EXACTLY));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
view.setOnClickListener(new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
if (listener != null) {
|
|
|
|
listener.onStickerSelected(((StickerEmojiCell) v).getSticker());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
((StickerEmojiCell) view).setSticker(StickersQuery.getStickers().get(i));
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void unregisterDataSetObserver(DataSetObserver observer) {
|
|
|
|
if (observer != null) {
|
|
|
|
super.unregisterDataSetObserver(observer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
private class EmojiGridAdapter extends BaseAdapter {
|
|
|
|
long[] data;
|
|
|
|
|
|
|
|
public EmojiGridAdapter(long[] arg2) {
|
|
|
|
this.data = arg2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCount() {
|
2014-09-28 15:37:26 +02:00
|
|
|
return data.length;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2014-09-28 15:37:26 +02:00
|
|
|
public Object getItem(int i) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-09-28 15:37:26 +02:00
|
|
|
public long getItemId(int i) {
|
|
|
|
return data[i];
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2014-09-28 15:37:26 +02:00
|
|
|
public View getView(int i, View view, ViewGroup paramViewGroup) {
|
|
|
|
ImageView imageView = (ImageView)view;
|
|
|
|
if (imageView == null) {
|
|
|
|
imageView = new ImageView(EmojiView.this.getContext()) {
|
2013-10-25 17:19:00 +02:00
|
|
|
public void onMeasure(int paramAnonymousInt1, int paramAnonymousInt2) {
|
|
|
|
setMeasuredDimension(View.MeasureSpec.getSize(paramAnonymousInt1), View.MeasureSpec.getSize(paramAnonymousInt1));
|
|
|
|
}
|
|
|
|
};
|
2014-09-28 15:37:26 +02:00
|
|
|
imageView.setOnClickListener(new View.OnClickListener() {
|
2014-06-15 01:23:36 +02:00
|
|
|
public void onClick(View view) {
|
2013-10-25 17:19:00 +02:00
|
|
|
if (EmojiView.this.listener != null) {
|
2014-06-15 01:23:36 +02:00
|
|
|
EmojiView.this.listener.onEmojiSelected(EmojiView.this.convert((Long)view.getTag()));
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-06-15 01:23:36 +02:00
|
|
|
EmojiView.this.addToRecent((Long)view.getTag());
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
});
|
2014-09-28 15:37:26 +02:00
|
|
|
imageView.setBackgroundResource(R.drawable.list_selector);
|
|
|
|
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-09-28 15:37:26 +02:00
|
|
|
imageView.setImageDrawable(Emoji.getEmojiBigDrawable(data[i]));
|
|
|
|
imageView.setTag(data[i]);
|
|
|
|
return imageView;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-06-20 02:18:13 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void unregisterDataSetObserver(DataSetObserver observer) {
|
|
|
|
if (observer != null) {
|
|
|
|
super.unregisterDataSetObserver(observer);
|
|
|
|
}
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private class EmojiPagesAdapter extends PagerAdapter implements PagerSlidingTabStrip.IconTabProvider {
|
|
|
|
|
|
|
|
public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject) {
|
|
|
|
View localObject;
|
|
|
|
if (paramInt == 0) {
|
2014-11-17 23:04:31 +01:00
|
|
|
localObject = recentsWrap;
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
2014-11-17 23:04:31 +01:00
|
|
|
localObject = views.get(paramInt);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
paramViewGroup.removeView(localObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCount() {
|
2014-11-17 23:04:31 +01:00
|
|
|
return views.size();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getPageIconResId(int paramInt) {
|
2014-11-17 23:04:31 +01:00
|
|
|
return icons[paramInt];
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Object instantiateItem(ViewGroup paramViewGroup, int paramInt) {
|
|
|
|
View localObject;
|
|
|
|
if (paramInt == 0) {
|
2014-11-17 23:04:31 +01:00
|
|
|
localObject = recentsWrap;
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
2014-11-17 23:04:31 +01:00
|
|
|
localObject = views.get(paramInt);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
paramViewGroup.addView(localObject);
|
|
|
|
return localObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isViewFromObject(View paramView, Object paramObject) {
|
|
|
|
return paramView == paramObject;
|
|
|
|
}
|
2014-06-20 02:18:13 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void unregisterDataSetObserver(DataSetObserver observer) {
|
|
|
|
if (observer != null) {
|
|
|
|
super.unregisterDataSetObserver(observer);
|
|
|
|
}
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|