aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libs/emojicon/src/main/AndroidManifest.xml11
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiAdapter.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiAdapter.java)48
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconEditText.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconEditText.java)31
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconGridFragment.java119
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconHandler.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java)52
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecents.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecents.java)6
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsGridFragment.java85
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsManager.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsManager.java)49
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconSpan.java95
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconTextView.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconTextView.java)31
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsFragment.java291
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsPopup.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java)87
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Emojicon.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Emojicon.java)85
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Nature.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Nature.java)4
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Objects.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Objects.java)4
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/People.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/People.java)4
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Places.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Places.java)4
-rw-r--r--libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Symbols.java (renamed from libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Symbols.java)4
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconGridView.java78
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsGridView.java62
-rw-r--r--libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconSpan.java51
-rw-r--r--libs/emojicon/src/main/res/drawable-hdpi/ic_launcher.pngbin9397 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-hdpi/keyboard_background_holo.9.pngbin227 -> 248 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-mdpi/ic_launcher.pngbin5237 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-mdpi/keyboard_background_holo.9.pngbin204 -> 242 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-nodpi/emoji_1f4bd.pngbin5691 -> 4246 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-nodpi/emoji_1f555.pngbin4486 -> 3744 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/ic_launcher.pngbin14383 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/keyboard_background_holo.9.pngbin267 -> 268 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_normal.pngbin3384 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_pressed.pngbin3390 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_normal.pngbin1882 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_pressed.pngbin3078 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_normal.pngbin2956 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_pressed.pngbin2947 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow.pngbin1126 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow_reversed.pngbin1076 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_horizontal.9.pngbin95 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_vertical.9.pngbin95 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_normal.pngbin687 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_pressed.pngbin1365 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_normal.pngbin441 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_pressed.pngbin1088 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab.9.pngbin106 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_active.9.pngbin109 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_dark.9.pngbin110 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_pressed.9.pngbin116 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_top_divider.9.pngbin113 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_back_normal.pngbin1659 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_normal.pngbin1174 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_pressed.pngbin2289 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_cars.pngbin1806 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_nature.pngbin2551 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_objects.pngbin2023 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_people.pngbin2011 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_punctuation.pngbin1490 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_back_normal.pngbin1383 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_normal.pngbin1028 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_pressed.pngbin1987 -> 0 bytes
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_composer_attach_camera_button.xml6
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_composer_attach_location_button.xml21
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_composer_attach_photo_button.xml6
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_composer_popup_button.xml6
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_composer_popup_button_active.xml6
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_emoji_backspace_front_button.xml5
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_emoji_more_front_button.xml5
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_emoji_tab_background.xml7
-rw-r--r--libs/emojicon/src/main/res/drawable/orca_emoji_tab_dark_background.xml22
-rw-r--r--libs/emojicon/src/main/res/layout/emojicon_item.xml6
-rw-r--r--libs/emojicon/src/main/res/layout/emojicons.xml219
-rw-r--r--libs/emojicon/src/main/res/values/attrs.xml30
-rw-r--r--libs/emojicon/src/main/res/values/colors.xml20
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java18
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditMessage.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java2
-rw-r--r--src/main/res/layout/conversation_list_row.xml2
-rw-r--r--src/main/res/layout/message_received.xml2
-rw-r--r--src/main/res/layout/message_sent.xml2
80 files changed, 1032 insertions, 560 deletions
diff --git a/libs/emojicon/src/main/AndroidManifest.xml b/libs/emojicon/src/main/AndroidManifest.xml
index a07b8e21..dbdb705b 100644
--- a/libs/emojicon/src/main/AndroidManifest.xml
+++ b/libs/emojicon/src/main/AndroidManifest.xml
@@ -1,12 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="github.ankushsachdeva.emojicon">
-
- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
-
- <application android:allowBackup="true"
- android:label="@string/app_name"
- android:icon="@drawable/ic_launcher">
-
- </application>
+ package="com.rockerhieu.emojicon">
+ <application android:label="@string/app_name"/>
</manifest>
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiAdapter.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiAdapter.java
index e3dc221d..9c98aedf 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiAdapter.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,61 +14,59 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.EmojiconGridView.OnEmojiconClickedListener;
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
+package com.rockerhieu.emojicon;
import java.util.List;
import android.content.Context;
import android.view.View;
-import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import github.ankushsachdeva.emojicon.R;
+import com.rockerhieu.emojicon.emoji.Emojicon;
/**
- * @author Ankush Sachdeva (sankush@yahoo.co.in)
+ * @author Hieu Rocker (rockerhieu@gmail.com)
*/
class EmojiAdapter extends ArrayAdapter<Emojicon> {
- OnEmojiconClickedListener emojiClickListener;
+ private boolean mUseSystemDefault = false;
+
public EmojiAdapter(Context context, List<Emojicon> data) {
super(context, R.layout.emojicon_item, data);
+ mUseSystemDefault = false;
+ }
+
+ public EmojiAdapter(Context context, List<Emojicon> data, boolean useSystemDefault) {
+ super(context, R.layout.emojicon_item, data);
+ mUseSystemDefault = useSystemDefault;
}
public EmojiAdapter(Context context, Emojicon[] data) {
super(context, R.layout.emojicon_item, data);
+ mUseSystemDefault = false;
}
-
- public void setEmojiClickListener(OnEmojiconClickedListener listener){
- this.emojiClickListener = listener;
+
+ public EmojiAdapter(Context context, Emojicon[] data, boolean useSystemDefault) {
+ super(context, R.layout.emojicon_item, data);
+ mUseSystemDefault = useSystemDefault;
}
-
+
@Override
- public View getView(final int position, View convertView, ViewGroup parent) {
+ public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
v = View.inflate(getContext(), R.layout.emojicon_item, null);
ViewHolder holder = new ViewHolder();
- holder.icon = (TextView) v.findViewById(R.id.emojicon_icon);
+ holder.icon = (EmojiconTextView) v.findViewById(R.id.emojicon_icon);
+ holder.icon.setUseSystemDefault(mUseSystemDefault);
v.setTag(holder);
}
Emojicon emoji = getItem(position);
ViewHolder holder = (ViewHolder) v.getTag();
holder.icon.setText(emoji.getEmoji());
- holder.icon.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- emojiClickListener.onEmojiconClicked(getItem(position));
- }
- });
return v;
}
- class ViewHolder {
- TextView icon;
+ static class ViewHolder {
+ EmojiconTextView icon;
}
} \ No newline at end of file
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconEditText.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconEditText.java
index 8301dd14..2d009ce5 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconEditText.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconEditText.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.R;
+package com.rockerhieu.emojicon;
import android.content.Context;
import android.content.res.TypedArray;
+import android.text.style.DynamicDrawableSpan;
import android.util.AttributeSet;
import android.widget.EditText;
@@ -28,11 +27,14 @@ import android.widget.EditText;
*/
public class EmojiconEditText extends EditText {
private int mEmojiconSize;
+ private int mEmojiconAlignment;
+ private int mEmojiconTextSize;
+ private boolean mUseSystemDefault = false;
public EmojiconEditText(Context context) {
super(context);
mEmojiconSize = (int) getTextSize();
-
+ mEmojiconTextSize = (int) getTextSize();
}
public EmojiconEditText(Context context, AttributeSet attrs) {
@@ -48,14 +50,16 @@ public class EmojiconEditText extends EditText {
private void init(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
+ mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
+ mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
a.recycle();
+ mEmojiconTextSize = (int) getTextSize();
setText(getText());
}
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
- super.onTextChanged(text,start,lengthBefore,lengthAfter);
- EmojiconHandler.addEmojis(getContext(), getText(), mEmojiconSize);
+ updateText();
}
/**
@@ -63,5 +67,18 @@ public class EmojiconEditText extends EditText {
*/
public void setEmojiconSize(int pixels) {
mEmojiconSize = pixels;
+
+ updateText();
+ }
+
+ private void updateText() {
+ EmojiconHandler.addEmojis(getContext(), getText(), mEmojiconSize, mEmojiconAlignment, mEmojiconTextSize, mUseSystemDefault);
+ }
+
+ /**
+ * Set whether to use system default emojicon
+ */
+ public void setUseSystemDefault(boolean useSystemDefault) {
+ mUseSystemDefault = useSystemDefault;
}
}
diff --git a/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconGridFragment.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconGridFragment.java
new file mode 100644
index 00000000..0e13c4c3
--- /dev/null
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconGridFragment.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2014 Hieu Rocker
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.rockerhieu.emojicon;
+
+import com.rockerhieu.emojicon.emoji.Emojicon;
+import com.rockerhieu.emojicon.emoji.People;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.GridView;
+
+/**
+ * @author Hieu Rocker (rockerhieu@gmail.com)
+ */
+public class EmojiconGridFragment extends Fragment implements AdapterView.OnItemClickListener {
+ private OnEmojiconClickedListener mOnEmojiconClickedListener;
+ private EmojiconRecents mRecents;
+ private Emojicon[] mData;
+ private boolean mUseSystemDefault = false;
+
+ private static final String USE_SYSTEM_DEFAULT_KEY = "useSystemDefaults";
+ private static final String EMOJICONS_KEY = "emojicons";
+
+ protected static EmojiconGridFragment newInstance(Emojicon[] emojicons, EmojiconRecents recents) {
+ return newInstance(emojicons, recents, false);
+ }
+
+ protected static EmojiconGridFragment newInstance(Emojicon[] emojicons, EmojiconRecents recents, boolean useSystemDefault) {
+ EmojiconGridFragment emojiGridFragment = new EmojiconGridFragment();
+ Bundle args = new Bundle();
+ args.putParcelableArray(EMOJICONS_KEY, emojicons);
+ args.putBoolean(USE_SYSTEM_DEFAULT_KEY, useSystemDefault);
+ emojiGridFragment.setArguments(args);
+ emojiGridFragment.setRecents(recents);
+ return emojiGridFragment;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.emojicon_grid, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ GridView gridView = (GridView) view.findViewById(R.id.Emoji_GridView);
+ Bundle bundle = getArguments();
+ if (bundle == null) {
+ mData = People.DATA;
+ mUseSystemDefault = false;
+ } else {
+ mData = (Emojicon[]) getArguments().getParcelableArray(EMOJICONS_KEY);
+ mUseSystemDefault = bundle.getBoolean(USE_SYSTEM_DEFAULT_KEY);
+ }
+ gridView.setAdapter(new EmojiAdapter(view.getContext(), mData, mUseSystemDefault));
+ gridView.setOnItemClickListener(this);
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putParcelableArray(EMOJICONS_KEY, mData);
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ if (activity instanceof OnEmojiconClickedListener) {
+ mOnEmojiconClickedListener = (OnEmojiconClickedListener) activity;
+ } else if (getParentFragment() instanceof OnEmojiconClickedListener) {
+ mOnEmojiconClickedListener = (OnEmojiconClickedListener) getParentFragment();
+ } else {
+ throw new IllegalArgumentException(activity + " must implement interface " + OnEmojiconClickedListener.class.getSimpleName());
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ mOnEmojiconClickedListener = null;
+ super.onDetach();
+ }
+
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ if (mOnEmojiconClickedListener != null) {
+ mOnEmojiconClickedListener.onEmojiconClicked((Emojicon) parent.getItemAtPosition(position));
+ }
+ if (mRecents != null) {
+ mRecents.addRecentEmoji(view.getContext(), ((Emojicon) parent
+ .getItemAtPosition(position)));
+ }
+ }
+
+ private void setRecents(EmojiconRecents recents) {
+ mRecents = recents;
+ }
+
+ public interface OnEmojiconClickedListener {
+ void onEmojiconClicked(Emojicon emojicon);
+ }
+}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconHandler.java
index c84bebb8..2f819fd6 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconHandler.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,9 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.R;
+package com.rockerhieu.emojicon;
import android.content.Context;
import android.text.Spannable;
@@ -1379,9 +1377,11 @@ public final class EmojiconHandler {
* @param context
* @param text
* @param emojiSize
+ * @param emojiAlignment
+ * @param textSize
*/
- public static void addEmojis(Context context, Spannable text, int emojiSize) {
- addEmojis(context, text, emojiSize, 0, -1);
+ public static void addEmojis(Context context, Spannable text, int emojiSize, int emojiAlignment, int textSize) {
+ addEmojis(context, text, emojiSize, emojiAlignment, textSize, 0, -1, false);
}
/**
@@ -1390,10 +1390,46 @@ public final class EmojiconHandler {
* @param context
* @param text
* @param emojiSize
+ * @param emojiAlignment
+ * @param textSize
* @param index
* @param length
*/
- public static void addEmojis(Context context, Spannable text, int emojiSize, int index, int length) {
+ public static void addEmojis(Context context, Spannable text, int emojiSize, int emojiAlignment, int textSize, int index, int length) {
+ addEmojis(context, text, emojiSize, emojiAlignment, textSize, index, length, false);
+ }
+
+ /**
+ * Convert emoji characters of the given Spannable to the according emojicon.
+ *
+ * @param context
+ * @param text
+ * @param emojiSize
+ * @param emojiAlignment
+ * @param textSize
+ * @param useSystemDefault
+ */
+ public static void addEmojis(Context context, Spannable text, int emojiSize, int emojiAlignment, int textSize, boolean useSystemDefault) {
+ addEmojis(context, text, emojiSize, emojiAlignment, textSize, 0, -1, useSystemDefault);
+ }
+
+ /**
+ * Convert emoji characters of the given Spannable to the according emojicon.
+ *
+ * @param context
+ * @param text
+ * @param emojiSize
+ * @param emojiAlignment
+ * @param textSize
+ * @param index
+ * @param length
+ * @param useSystemDefault
+ */
+ public static void addEmojis(Context context, Spannable text, int emojiSize, int emojiAlignment, int textSize, int index, int length, boolean useSystemDefault) {
+ if (useSystemDefault) {
+ return;
+ }
+
int textLength = text.length();
int textLengthToProcessMax = textLength - index;
int textLengthToProcess = length < 0 || length >= textLengthToProcessMax ? textLength : (length+index);
@@ -1508,7 +1544,7 @@ public final class EmojiconHandler {
}
if (icon > 0) {
- text.setSpan(new EmojiconSpan(context, icon, emojiSize), i, i + skip, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ text.setSpan(new EmojiconSpan(context, icon, emojiSize, emojiAlignment, textSize), i, i + skip, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecents.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecents.java
index 195c86ab..8adfe5e3 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecents.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecents.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
+package com.rockerhieu.emojicon;
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
+import com.rockerhieu.emojicon.emoji.Emojicon;
import android.content.Context;
diff --git a/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsGridFragment.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsGridFragment.java
new file mode 100644
index 00000000..620c192a
--- /dev/null
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsGridFragment.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2014 Hieu Rocker
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.rockerhieu.emojicon;
+
+import com.rockerhieu.emojicon.emoji.Emojicon;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.GridView;
+
+/**
+ * @author Daniele Ricci
+ */
+public class EmojiconRecentsGridFragment extends EmojiconGridFragment implements EmojiconRecents {
+ private EmojiAdapter mAdapter;
+ private boolean mUseSystemDefault = false;
+
+ private static final String USE_SYSTEM_DEFAULT_KEY = "useSystemDefaults";
+
+ protected static EmojiconRecentsGridFragment newInstance() {
+ return newInstance(false);
+ }
+
+ protected static EmojiconRecentsGridFragment newInstance(boolean useSystemDefault) {
+ EmojiconRecentsGridFragment fragment = new EmojiconRecentsGridFragment();
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(USE_SYSTEM_DEFAULT_KEY, useSystemDefault);
+ fragment.setArguments(bundle);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mUseSystemDefault = getArguments().getBoolean(USE_SYSTEM_DEFAULT_KEY);
+ } else {
+ mUseSystemDefault = false;
+ }
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ EmojiconRecentsManager recents = EmojiconRecentsManager
+ .getInstance(view.getContext());
+
+ mAdapter = new EmojiAdapter(view.getContext(), recents, mUseSystemDefault);
+ GridView gridView = (GridView) view.findViewById(R.id.Emoji_GridView);
+ gridView.setAdapter(mAdapter);
+ gridView.setOnItemClickListener(this);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ mAdapter = null;
+ }
+
+ @Override
+ public void addRecentEmoji(Context context, Emojicon emojicon) {
+ EmojiconRecentsManager recents = EmojiconRecentsManager
+ .getInstance(context);
+ recents.push(emojicon);
+
+ // notify dataset changed
+ if (mAdapter != null)
+ mAdapter.notifyDataSetChanged();
+ }
+
+}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsManager.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsManager.java
index 9fbb987e..2c56ce3d 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsManager.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconRecentsManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,28 +14,28 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
+package com.rockerhieu.emojicon;
import java.util.ArrayList;
import java.util.StringTokenizer;
+import com.rockerhieu.emojicon.emoji.Emojicon;
+
import android.content.Context;
import android.content.SharedPreferences;
-
/**
* @author Daniele Ricci
*/
public class EmojiconRecentsManager extends ArrayList<Emojicon> {
-
+ private static final String DELIMITER = ",";
private static final String PREFERENCE_NAME = "emojicon";
private static final String PREF_RECENTS = "recent_emojis";
private static final String PREF_PAGE = "recent_page";
private static final Object LOCK = new Object();
private static EmojiconRecentsManager sInstance;
+ private static int maximumSize = 40;
private Context mContext;
@@ -75,20 +75,39 @@ public class EmojiconRecentsManager extends ArrayList<Emojicon> {
@Override
public boolean add(Emojicon object) {
boolean ret = super.add(object);
+
+ while (this.size() > EmojiconRecentsManager.maximumSize) {
+ super.remove(0);
+ }
+
+ saveRecents();
return ret;
}
@Override
public void add(int index, Emojicon object) {
super.add(index, object);
+
+ if (index == 0) {
+ while (this.size() > EmojiconRecentsManager.maximumSize) {
+ super.remove(EmojiconRecentsManager.maximumSize);
+ }
+ } else {
+ while (this.size() > EmojiconRecentsManager.maximumSize) {
+ super.remove(0);
+ }
+ }
+
+ saveRecents();
}
@Override
public boolean remove(Object object) {
boolean ret = super.remove(object);
+ saveRecents();
return ret;
}
-
+
private SharedPreferences getPreferences() {
return mContext.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
}
@@ -96,17 +115,12 @@ public class EmojiconRecentsManager extends ArrayList<Emojicon> {
private void loadRecents() {
SharedPreferences prefs = getPreferences();
String str = prefs.getString(PREF_RECENTS, "");
- StringTokenizer tokenizer = new StringTokenizer(str, "~");
+ StringTokenizer tokenizer = new StringTokenizer(str, EmojiconRecentsManager.DELIMITER);
while (tokenizer.hasMoreTokens()) {
- try {
- add(new Emojicon(tokenizer.nextToken()));
- }
- catch (NumberFormatException e) {
- // ignored
- }
+ add(Emojicon.fromChars(tokenizer.nextToken()));
}
}
-
+
public void saveRecents() {
StringBuilder str = new StringBuilder();
int c = size();
@@ -114,11 +128,14 @@ public class EmojiconRecentsManager extends ArrayList<Emojicon> {
Emojicon e = get(i);
str.append(e.getEmoji());
if (i < (c - 1)) {
- str.append('~');
+ str.append(EmojiconRecentsManager.DELIMITER);
}
}
SharedPreferences prefs = getPreferences();
prefs.edit().putString(PREF_RECENTS, str.toString()).commit();
}
+ public static void setMaximumSize(int maximumSize) {
+ EmojiconRecentsManager.maximumSize = maximumSize;
+ }
}
diff --git a/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconSpan.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconSpan.java
new file mode 100644
index 00000000..94ebdc0d
--- /dev/null
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconSpan.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2014 Hieu Rocker
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.rockerhieu.emojicon;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+import android.text.style.DynamicDrawableSpan;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * @author Hieu Rocker (rockerhieu@gmail.com)
+ */
+class EmojiconSpan extends DynamicDrawableSpan {
+
+ private final Context mContext;
+
+ private final int mResourceId;
+
+ private final int mSize;
+
+ private final int mTextSize;
+
+ private int mHeight;
+
+ private int mWidth;
+
+ private int mTop;
+
+ private Drawable mDrawable;
+
+ private WeakReference<Drawable> mDrawableRef;
+
+ public EmojiconSpan(Context context, int resourceId, int size, int alignment, int textSize) {
+ super(alignment);
+ mContext = context;
+ mResourceId = resourceId;
+ mWidth = mHeight = mSize = size;
+ mTextSize = textSize;
+ }
+
+ public Drawable getDrawable() {
+ if (mDrawable == null) {
+ try {
+ mDrawable = mContext.getResources().getDrawable(mResourceId);
+ mHeight = mSize;
+ mWidth = mHeight * mDrawable.getIntrinsicWidth() / mDrawable.getIntrinsicHeight();
+ mTop = (mTextSize - mHeight) / 2;
+ mDrawable.setBounds(0, mTop, mWidth, mTop + mHeight);
+ } catch (Exception e) {
+ // swallow
+ }
+ }
+ return mDrawable;
+ }
+
+ @Override
+ public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
+ //super.draw(canvas, text, start, end, x, top, y, bottom, paint);
+ Drawable b = getCachedDrawable();
+ canvas.save();
+
+ int transY = bottom - b.getBounds().bottom;
+ if (mVerticalAlignment == ALIGN_BASELINE) {
+ transY = top + ((bottom - top) / 2) - ((b.getBounds().bottom - b.getBounds().top) / 2) - mTop;
+ }
+
+ canvas.translate(x, transY);
+ b.draw(canvas);
+ canvas.restore();
+ }
+
+ private Drawable getCachedDrawable() {
+ if (mDrawableRef == null || mDrawableRef.get() == null) {
+ mDrawableRef = new WeakReference<Drawable>(getDrawable());
+ }
+ return mDrawableRef.get();
+ }
+} \ No newline at end of file
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconTextView.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconTextView.java
index 5822e478..3e502aef 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconTextView.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconTextView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.R;
+package com.rockerhieu.emojicon;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.SpannableStringBuilder;
+import android.text.TextUtils;
+import android.text.style.DynamicDrawableSpan;
import android.util.AttributeSet;
import android.widget.TextView;
@@ -29,8 +29,11 @@ import android.widget.TextView;
*/
public class EmojiconTextView extends TextView {
private int mEmojiconSize;
+ private int mEmojiconAlignment;
+ private int mEmojiconTextSize;
private int mTextStart = 0;
private int mTextLength = -1;
+ private boolean mUseSystemDefault = false;
public EmojiconTextView(Context context) {
super(context);
@@ -48,13 +51,16 @@ public class EmojiconTextView extends TextView {
}
private void init(AttributeSet attrs) {
+ mEmojiconTextSize = (int) getTextSize();
if (attrs == null) {
mEmojiconSize = (int) getTextSize();
} else {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
+ mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
mTextStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
mTextLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
+ mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
a.recycle();
}
setText(getText());
@@ -62,9 +68,12 @@ public class EmojiconTextView extends TextView {
@Override
public void setText(CharSequence text, BufferType type) {
- SpannableStringBuilder builder = new SpannableStringBuilder(text);
- EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mTextStart, mTextLength);
- super.setText(builder, type);
+ if (!TextUtils.isEmpty(text)) {
+ SpannableStringBuilder builder = new SpannableStringBuilder(text);
+ EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mEmojiconAlignment, mEmojiconTextSize, mTextStart, mTextLength, mUseSystemDefault);
+ text = builder;
+ }
+ super.setText(text, type);
}
/**
@@ -72,5 +81,13 @@ public class EmojiconTextView extends TextView {
*/
public void setEmojiconSize(int pixels) {
mEmojiconSize = pixels;
+ super.setText(getText());
+ }
+
+ /**
+ * Set whether to use system default emojicon
+ */
+ public void setUseSystemDefault(boolean useSystemDefault) {
+ mUseSystemDefault = useSystemDefault;
}
}
diff --git a/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsFragment.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsFragment.java
new file mode 100644
index 00000000..88a2dc4f
--- /dev/null
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsFragment.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright 2014 Hieu Rocker
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.rockerhieu.emojicon;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.SystemClock;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentStatePagerAdapter;
+import android.support.v4.view.PagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.view.*;
+import android.widget.EditText;
+import com.rockerhieu.emojicon.emoji.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Hieu Rocker (rockerhieu@gmail.com).
+ */
+public class EmojiconsFragment extends Fragment implements ViewPager.OnPageChangeListener, EmojiconRecents {
+ private OnEmojiconBackspaceClickedListener mOnEmojiconBackspaceClickedListener;
+ private int mEmojiTabLastSelectedIndex = -1;
+ private View[] mEmojiTabs;
+ private PagerAdapter mEmojisAdapter;
+ private EmojiconRecentsManager mRecentsManager;
+ private boolean mUseSystemDefault = false;
+
+ private static final String USE_SYSTEM_DEFAULT_KEY = "useSystemDefaults";
+
+ public static EmojiconsFragment newInstance(boolean useSystemDefault) {
+ EmojiconsFragment fragment = new EmojiconsFragment();
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(USE_SYSTEM_DEFAULT_KEY, useSystemDefault);
+ fragment.setArguments(bundle);
+ return fragment;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.emojicons, container, false);
+ final ViewPager emojisPager = (ViewPager) view.findViewById(R.id.emojis_pager);
+ emojisPager.setOnPageChangeListener(this);
+ // we handle recents
+ EmojiconRecents recents = this;
+ mEmojisAdapter = new EmojisPagerAdapter(getFragmentManager(), Arrays.asList(
+ EmojiconRecentsGridFragment.newInstance(mUseSystemDefault),
+ EmojiconGridFragment.newInstance(People.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Nature.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Objects.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Places.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Symbols.DATA, recents, mUseSystemDefault)
+ ));
+ emojisPager.setAdapter(mEmojisAdapter);
+
+ mEmojiTabs = new View[6];
+ mEmojiTabs[0] = view.findViewById(R.id.emojis_tab_0_recents);
+ mEmojiTabs[1] = view.findViewById(R.id.emojis_tab_1_people);
+ mEmojiTabs[2] = view.findViewById(R.id.emojis_tab_2_nature);
+ mEmojiTabs[3] = view.findViewById(R.id.emojis_tab_3_objects);
+ mEmojiTabs[4] = view.findViewById(R.id.emojis_tab_4_cars);
+ mEmojiTabs[5] = view.findViewById(R.id.emojis_tab_5_punctuation);
+ for (int i = 0; i < mEmojiTabs.length; i++) {
+ final int position = i;
+ mEmojiTabs[i].setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ emojisPager.setCurrentItem(position);
+ }
+ });
+ }
+ view.findViewById(R.id.emojis_backspace).setOnTouchListener(new RepeatListener(1000, 50, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mOnEmojiconBackspaceClickedListener != null) {
+ mOnEmojiconBackspaceClickedListener.onEmojiconBackspaceClicked(v);
+ }
+ }
+ }));
+
+ // get last selected page
+ mRecentsManager = EmojiconRecentsManager.getInstance(view.getContext());
+ int page = mRecentsManager.getRecentPage();
+ // last page was recents, check if there are recents to use
+ // if none was found, go to page 1
+ if (page == 0 && mRecentsManager.size() == 0) {
+ page = 1;
+ }
+
+ if (page == 0) {
+ onPageSelected(page);
+ }
+ else {
+ emojisPager.setCurrentItem(page, false);
+ }
+ return view;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ if (getActivity() instanceof OnEmojiconBackspaceClickedListener) {
+ mOnEmojiconBackspaceClickedListener = (OnEmojiconBackspaceClickedListener) getActivity();
+ } else if(getParentFragment() instanceof OnEmojiconBackspaceClickedListener) {
+ mOnEmojiconBackspaceClickedListener = (OnEmojiconBackspaceClickedListener) getParentFragment();
+ } else {
+ throw new IllegalArgumentException(activity + " must implement interface " + OnEmojiconBackspaceClickedListener.class.getSimpleName());
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ mOnEmojiconBackspaceClickedListener = null;
+ super.onDetach();
+ }
+
+ public static void input(EditText editText, Emojicon emojicon) {
+ if (editText == null || emojicon == null) {
+ return;
+ }
+
+ int start = editText.getSelectionStart();
+ int end = editText.getSelectionEnd();
+ if (start < 0) {
+ editText.append(emojicon.getEmoji());
+ } else {
+ editText.getText().replace(Math.min(start, end), Math.max(start, end), emojicon.getEmoji(), 0, emojicon.getEmoji().length());
+ }
+ }
+
+ @Override
+ public void addRecentEmoji(Context context, Emojicon emojicon) {
+ final ViewPager emojisPager = (ViewPager) getView().findViewById(R.id.emojis_pager);
+ EmojiconRecentsGridFragment fragment = (EmojiconRecentsGridFragment) mEmojisAdapter.instantiateItem(emojisPager, 0);
+ fragment.addRecentEmoji(context, emojicon);
+ }
+
+ public static void backspace(EditText editText) {
+ KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
+ editText.dispatchKeyEvent(event);
+ }
+
+ @Override
+ public void onPageScrolled(int i, float v, int i2) {
+ }
+
+ @Override
+ public void onPageSelected(int i) {
+ if (mEmojiTabLastSelectedIndex == i) {
+ return;
+ }
+ switch (i) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ if (mEmojiTabLastSelectedIndex >= 0 && mEmojiTabLastSelectedIndex < mEmojiTabs.length) {
+ mEmojiTabs[mEmojiTabLastSelectedIndex].setSelected(false);
+ }
+ mEmojiTabs[i].setSelected(true);
+ mEmojiTabLastSelectedIndex = i;
+ mRecentsManager.setRecentPage(i);
+ break;
+ }
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int i) {
+ }
+
+ private static class EmojisPagerAdapter extends FragmentStatePagerAdapter {
+ private List<EmojiconGridFragment> fragments;
+
+ public EmojisPagerAdapter(FragmentManager fm, List<EmojiconGridFragment> fragments) {
+ super(fm);
+ this.fragments = fragments;
+ }
+
+ @Override
+ public Fragment getItem(int i) {
+ return fragments.get(i);
+ }
+
+ @Override
+ public int getCount() {
+ return fragments.size();
+ }
+ }
+
+ /**
+ * A class, that can be used as a TouchListener on any view (e.g. a Button).
+ * It cyclically runs a clickListener, emulating keyboard-like behaviour. First
+ * click is fired immediately, next before initialInterval, and subsequent before
+ * normalInterval.
+ * <p/>
+ * <p>Interval is scheduled before the onClick completes, so it has to run fast.
+ * If it runs slow, it does not generate skipped onClicks.
+ */
+ public static class RepeatListener implements View.OnTouchListener {
+
+ private Handler handler = new Handler();
+
+ private int initialInterval;
+ private final int normalInterval;
+ private final View.OnClickListener clickListener;
+
+ private Runnable handlerRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (downView == null) {
+ return;
+ }
+ handler.removeCallbacksAndMessages(downView);
+ handler.postAtTime(this, downView, SystemClock.uptimeMillis() + normalInterval);
+ clickListener.onClick(downView);
+ }
+ };
+
+ private View downView;
+
+ /**
+ * @param initialInterval The interval before first click event
+ * @param normalInterval The interval before second and subsequent click
+ * events
+ * @param clickListener The OnClickListener, that will be called
+ * periodically
+ */
+ public RepeatListener(int initialInterval, int normalInterval, View.OnClickListener clickListener) {
+ if (clickListener == null)
+ throw new IllegalArgumentException("null runnable");
+ if (initialInterval < 0 || normalInterval < 0)
+ throw new IllegalArgumentException("negative interval");
+
+ this.initialInterval = initialInterval;
+ this.normalInterval = normalInterval;
+ this.clickListener = clickListener;
+ }
+
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ switch (motionEvent.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ downView = view;
+ handler.removeCallbacks(handlerRunnable);
+ handler.postAtTime(handlerRunnable, downView, SystemClock.uptimeMillis() + initialInterval);
+ clickListener.onClick(view);
+ return true;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ case MotionEvent.ACTION_OUTSIDE:
+ handler.removeCallbacksAndMessages(downView);
+ downView = null;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public interface OnEmojiconBackspaceClickedListener {
+ void onEmojiconBackspaceClicked(View v);
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mUseSystemDefault = getArguments().getBoolean(USE_SYSTEM_DEFAULT_KEY);
+ } else {
+ mUseSystemDefault = false;
+ }
+ }
+}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsPopup.java
index 12bc16e0..9a8d8769 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconsPopup.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/EmojiconsPopup.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon;
+package com.rockerhieu.emojicon;
-import github.ankushsachdeva.emojicon.EmojiconGridView.OnEmojiconClickedListener;
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
-import github.ankushsachdeva.emojicon.emoji.Nature;
-import github.ankushsachdeva.emojicon.emoji.Objects;
-import github.ankushsachdeva.emojicon.emoji.People;
-import github.ankushsachdeva.emojicon.emoji.Places;
-import github.ankushsachdeva.emojicon.emoji.Symbols;
+import com.rockerhieu.emojicon.emoji.Emojicon;
+import com.rockerhieu.emojicon.emoji.Nature;
+import com.rockerhieu.emojicon.emoji.Objects;
+import com.rockerhieu.emojicon.emoji.People;
+import com.rockerhieu.emojicon.emoji.Places;
+import com.rockerhieu.emojicon.emoji.Symbols;
import java.util.Arrays;
import java.util.List;
@@ -32,6 +31,10 @@ import android.content.Context;
import android.graphics.Rect;
import android.os.Handler;
import android.os.SystemClock;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentStatePagerAdapter;
+import android.support.v4.app.FragmentManager;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
@@ -43,6 +46,7 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.WindowManager.LayoutParams;
import android.widget.PopupWindow;
+import com.rockerhieu.emojicon.EmojiconGridFragment.OnEmojiconClickedListener;
/**
@@ -62,6 +66,7 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
OnSoftKeyboardOpenCloseListener onSoftKeyboardOpenCloseListener;
View rootView;
Context mContext;
+ private boolean mUseSystemDefault = false;
private ViewPager emojisPager;
/**
@@ -93,6 +98,7 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
this.onEmojiconClickedListener = listener;
}
+
/**
* Set the listener for the event when backspace on emojicon popup is clicked
*/
@@ -200,16 +206,14 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
emojisPager = (ViewPager) view.findViewById(R.id.emojis_pager);
emojisPager.setOnPageChangeListener(this);
EmojiconRecents recents = this;
- mEmojisAdapter = new EmojisPagerAdapter(
- Arrays.asList(
- new EmojiconRecentsGridView(mContext, null, null, this),
- new EmojiconGridView(mContext, People.DATA, recents, this),
- new EmojiconGridView(mContext, Nature.DATA, recents, this),
- new EmojiconGridView(mContext, Objects.DATA, recents, this),
- new EmojiconGridView(mContext, Places.DATA, recents, this),
- new EmojiconGridView(mContext, Symbols.DATA, recents, this)
- )
- );
+ mEmojisAdapter = new EmojisPagerAdapter(Arrays.asList(
+ EmojiconRecentsGridFragment.newInstance(mUseSystemDefault),
+ EmojiconGridFragment.newInstance(People.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Nature.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Objects.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Places.DATA, recents, mUseSystemDefault),
+ EmojiconGridFragment.newInstance(Symbols.DATA, recents, mUseSystemDefault)
+ ));
emojisPager.setAdapter(mEmojisAdapter);
mEmojiTabs = new View[6];
mEmojiTabs[0] = view.findViewById(R.id.emojis_tab_0_recents);
@@ -256,7 +260,7 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
@Override
public void addRecentEmoji(Context context, Emojicon emojicon) {
- EmojiconRecentsGridView fragment = ((EmojisPagerAdapter)emojisPager.getAdapter()).getRecentFragment();
+ EmojiconRecentsGridFragment fragment = ((EmojisPagerAdapter)emojisPager.getAdapter()).getRecentFragment();
fragment.addRecentEmoji(context, emojicon);
}
@@ -292,28 +296,29 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
}
private static class EmojisPagerAdapter extends PagerAdapter {
- private List<EmojiconGridView> views;
- public EmojiconRecentsGridView getRecentFragment(){
- for (EmojiconGridView it : views) {
- if(it instanceof EmojiconRecentsGridView)
- return (EmojiconRecentsGridView)it;
+ private List<EmojiconGridFragment> fragments;
+
+ public EmojiconRecentsGridFragment getRecentFragment(){
+ for (EmojiconGridFragment it : fragments) {
+ if(it instanceof EmojiconRecentsGridFragment)
+ return (EmojiconRecentsGridFragment)it;
}
return null;
}
- public EmojisPagerAdapter(List<EmojiconGridView> views) {
+
+ public EmojisPagerAdapter(List<EmojiconGridFragment> fragments) {
super();
- this.views = views;
+ this.fragments = fragments;
}
@Override
public int getCount() {
- return views.size();
+ return fragments.size();
}
-
@Override
public Object instantiateItem(ViewGroup container, int position) {
- View v = views.get(position).rootView;
+ View v = fragments.get(position).getView();
((ViewPager)container).addView(v, 0);
return v;
}
@@ -380,18 +385,18 @@ public class EmojiconsPopup extends PopupWindow implements ViewPager.OnPageChang
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
- case MotionEvent.ACTION_DOWN:
- downView = view;
- handler.removeCallbacks(handlerRunnable);
- handler.postAtTime(handlerRunnable, downView, SystemClock.uptimeMillis() + initialInterval);
- clickListener.onClick(view);
- return true;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_OUTSIDE:
- handler.removeCallbacksAndMessages(downView);
- downView = null;
- return true;
+ case MotionEvent.ACTION_DOWN:
+ downView = view;
+ handler.removeCallbacks(handlerRunnable);
+ handler.postAtTime(handlerRunnable, downView, SystemClock.uptimeMillis() + initialInterval);
+ clickListener.onClick(view);
+ return true;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ case MotionEvent.ACTION_OUTSIDE:
+ handler.removeCallbacksAndMessages(downView);
+ downView = null;
+ return true;
}
return false;
}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Emojicon.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Emojicon.java
index 2ba8ca1e..db4088cf 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Emojicon.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Emojicon.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,20 +14,60 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
-import java.io.Serializable;
+import android.os.Parcel;
+import android.os.Parcelable;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
*/
-public class Emojicon implements Serializable {
- private static final long serialVersionUID = 1L;
+public class Emojicon implements Parcelable {
+
+ public static final Creator<Emojicon> CREATOR = new Creator<Emojicon>() {
+ @Override
+ public Emojicon createFromParcel(Parcel in) {
+ return new Emojicon(in);
+ }
+
+ @Override
+ public Emojicon[] newArray(int size) {
+ return new Emojicon[size];
+ }
+ };
+
+ private int icon;
+
+ private char value;
+
private String emoji;
+ public Emojicon(int icon, char value, String emoji) {
+ this.icon = icon;
+ this.value = value;
+ this.emoji = emoji;
+ }
+
+ public Emojicon(Parcel in) {
+ this.icon = in.readInt();
+ this.value = (char) in.readInt();
+ this.emoji = in.readString();
+ }
+
private Emojicon() {
}
+ public Emojicon(String emoji) {
+ this.emoji = emoji;
+ }
+
+ public static Emojicon fromResource(int icon, int value) {
+ Emojicon emoji = new Emojicon();
+ emoji.icon = icon;
+ emoji.value = (char) value;
+ return emoji;
+ }
+
public static Emojicon fromCodePoint(int codePoint) {
Emojicon emoji = new Emojicon();
emoji.emoji = newString(codePoint);
@@ -46,8 +86,32 @@ public class Emojicon implements Serializable {
return emoji;
}
- public Emojicon(String emoji) {
- this.emoji = emoji;
+ public static final String newString(int codePoint) {
+ if (Character.charCount(codePoint) == 1) {
+ return String.valueOf(codePoint);
+ } else {
+ return new String(Character.toChars(codePoint));
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(icon);
+ dest.writeInt(value);
+ dest.writeString(emoji);
+ }
+
+ public char getValue() {
+ return value;
+ }
+
+ public int getIcon() {
+ return icon;
}
public String getEmoji() {
@@ -64,11 +128,4 @@ public class Emojicon implements Serializable {
return emoji.hashCode();
}
- public static final String newString(int codePoint) {
- if (Character.charCount(codePoint) == 1) {
- return String.valueOf(codePoint);
- } else {
- return new String(Character.toChars(codePoint));
- }
- }
}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Nature.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Nature.java
index b354c9a0..7d43906b 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Nature.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Nature.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Objects.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Objects.java
index 222c9bac..354dccc6 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Objects.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Objects.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/People.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/People.java
index 93e34f59..c64da08e 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/People.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/People.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Places.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Places.java
index cf2f0e5a..617cf61e 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Places.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Places.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Symbols.java b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Symbols.java
index b81c322f..82655946 100644
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/emoji/Symbols.java
+++ b/libs/emojicon/src/main/java/com/rockerhieu/emojicon/emoji/Symbols.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ankush Sachdeva
+ * Copyright 2014 Hieu Rocker
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package github.ankushsachdeva.emojicon.emoji;
+package com.rockerhieu.emojicon.emoji;
/**
* @author Hieu Rocker (rockerhieu@gmail.com)
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconGridView.java b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconGridView.java
deleted file mode 100644
index 38df8b13..00000000
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconGridView.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2014 Ankush Sachdeva
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
-import github.ankushsachdeva.emojicon.emoji.People;
-
-import java.util.Arrays;
-
-import android.app.Activity;
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.GridView;
-
-import github.ankushsachdeva.emojicon.R;
-
-/**
- * @author Hieu Rocker (rockerhieu@gmail.com)
- * @author Ankush Sachdeva (sankush@yahoo.co.in)
- */
-public class EmojiconGridView{
- public View rootView;
- EmojiconsPopup mEmojiconPopup;
- EmojiconRecents mRecents;
- Emojicon[] mData;
-
- public EmojiconGridView(Context context, Emojicon[] emojicons, EmojiconRecents recents, EmojiconsPopup emojiconPopup) {
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
- mEmojiconPopup = emojiconPopup;
- rootView = inflater.inflate(R.layout.emojicon_grid, null);
- setRecents(recents);
- GridView gridView = (GridView) rootView.findViewById(R.id.Emoji_GridView);
- if (emojicons== null) {
- mData = People.DATA;
- } else {
- Object[] o = (Object[]) emojicons;
- mData = Arrays.asList(o).toArray(new Emojicon[o.length]);
- }
- EmojiAdapter mAdapter = new EmojiAdapter(rootView.getContext(), mData);
- mAdapter.setEmojiClickListener(new OnEmojiconClickedListener() {
-
- @Override
- public void onEmojiconClicked(Emojicon emojicon) {
- if (mEmojiconPopup.onEmojiconClickedListener != null) {
- mEmojiconPopup.onEmojiconClickedListener.onEmojiconClicked(emojicon);
- }
- if (mRecents != null) {
- mRecents.addRecentEmoji(rootView.getContext(), emojicon);
- }
- }
- });
- gridView.setAdapter(mAdapter);
- }
-
- private void setRecents(EmojiconRecents recents) {
- mRecents = recents;
- }
-
- public interface OnEmojiconClickedListener {
- void onEmojiconClicked(Emojicon emojicon);
- }
-
-}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsGridView.java b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsGridView.java
deleted file mode 100644
index 2aecbb59..00000000
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconRecentsGridView.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2014 Ankush Sachdeva
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package github.ankushsachdeva.emojicon;
-
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
-import android.content.Context;
-import android.widget.GridView;
-
-import github.ankushsachdeva.emojicon.R;
-
-/**
- * @author Daniele Ricci
- * @author Ankush Sachdeva (sankush@yahoo.co.in)
- */
-public class EmojiconRecentsGridView extends EmojiconGridView implements EmojiconRecents {
- EmojiAdapter mAdapter;
-
- public EmojiconRecentsGridView(Context context, Emojicon[] emojicons,
- EmojiconRecents recents,EmojiconsPopup emojiconsPopup) {
- super(context, emojicons, recents, emojiconsPopup);
- EmojiconRecentsManager recents1 = EmojiconRecentsManager
- .getInstance(rootView.getContext());
- mAdapter = new EmojiAdapter(rootView.getContext(), recents1);
- mAdapter.setEmojiClickListener(new OnEmojiconClickedListener() {
-
- @Override
- public void onEmojiconClicked(Emojicon emojicon) {
- if (mEmojiconPopup.onEmojiconClickedListener != null) {
- mEmojiconPopup.onEmojiconClickedListener.onEmojiconClicked(emojicon);
- }
- }
- });
- GridView gridView = (GridView) rootView.findViewById(R.id.Emoji_GridView);
- gridView.setAdapter(mAdapter);
- }
-
- @Override
- public void addRecentEmoji(Context context, Emojicon emojicon) {
- EmojiconRecentsManager recents = EmojiconRecentsManager
- .getInstance(context);
- recents.push(emojicon);
-
- // notify dataset changed
- if (mAdapter != null)
- mAdapter.notifyDataSetChanged();
- }
-
-}
diff --git a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconSpan.java b/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconSpan.java
deleted file mode 100644
index 1afeea95..00000000
--- a/libs/emojicon/src/main/java/github/ankushsachdeva/emojicon/EmojiconSpan.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014 Ankush Sachdeva
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package github.ankushsachdeva.emojicon;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.text.style.DynamicDrawableSpan;
-
-/**
- * @author Hieu Rocker (rockerhieu@gmail.com)
- */
-class EmojiconSpan extends DynamicDrawableSpan {
- private final Context mContext;
- private final int mResourceId;
- private final int mSize;
- private Drawable mDrawable;
-
- public EmojiconSpan(Context context, int resourceId, int size) {
- super();
- mContext = context;
- mResourceId = resourceId;
- mSize = size;
- }
-
- public Drawable getDrawable() {
- if (mDrawable == null) {
- try {
- mDrawable = mContext.getResources().getDrawable(mResourceId);
- int size = mSize;
- mDrawable.setBounds(0, 0, size, size);
- } catch (Exception e) {
- // swallow
- }
- }
- return mDrawable;
- }
-} \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable-hdpi/ic_launcher.png b/libs/emojicon/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e5..00000000
--- a/libs/emojicon/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-hdpi/keyboard_background_holo.9.png b/libs/emojicon/src/main/res/drawable-hdpi/keyboard_background_holo.9.png
index 73868751..87972f06 100644
--- a/libs/emojicon/src/main/res/drawable-hdpi/keyboard_background_holo.9.png
+++ b/libs/emojicon/src/main/res/drawable-hdpi/keyboard_background_holo.9.png
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-mdpi/ic_launcher.png b/libs/emojicon/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047df..00000000
--- a/libs/emojicon/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-mdpi/keyboard_background_holo.9.png b/libs/emojicon/src/main/res/drawable-mdpi/keyboard_background_holo.9.png
index fbe97f7a..6bbf7206 100644
--- a/libs/emojicon/src/main/res/drawable-mdpi/keyboard_background_holo.9.png
+++ b/libs/emojicon/src/main/res/drawable-mdpi/keyboard_background_holo.9.png
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f4bd.png b/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f4bd.png
index a4ede2fe..c955947f 100644
--- a/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f4bd.png
+++ b/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f4bd.png
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f555.png b/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f555.png
index 279c7f3f..e95f923c 100644
--- a/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f555.png
+++ b/libs/emojicon/src/main/res/drawable-nodpi/emoji_1f555.png
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/ic_launcher.png b/libs/emojicon/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d760..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/keyboard_background_holo.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/keyboard_background_holo.9.png
index f5c9df3e..2d0dc1fb 100644
--- a/libs/emojicon/src/main/res/drawable-xhdpi/keyboard_background_holo.9.png
+++ b/libs/emojicon/src/main/res/drawable-xhdpi/keyboard_background_holo.9.png
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_normal.png
deleted file mode 100644
index d1c02cf6..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_pressed.png
deleted file mode 100644
index 9bb11a42..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_camera_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_normal.png
deleted file mode 100644
index af8a2fda..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_pressed.png
deleted file mode 100644
index 12b8608a..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_location_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_normal.png
deleted file mode 100644
index 86f17352..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_pressed.png
deleted file mode 100644
index d6d1869b..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attach_photo_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow.png
deleted file mode 100644
index b339725e..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow_reversed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow_reversed.png
deleted file mode 100644
index 918d0baf..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_attachments_arrow_reversed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_horizontal.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_horizontal.9.png
deleted file mode 100644
index f10e37bf..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_horizontal.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_vertical.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_vertical.9.png
deleted file mode 100644
index 523493ca..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_divider_vertical.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_normal.png
deleted file mode 100644
index 08ccb0fc..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_pressed.png
deleted file mode 100644
index b91b2063..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_active_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_normal.png
deleted file mode 100644
index d5f15ac1..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_pressed.png
deleted file mode 100644
index ddb6e9b7..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_popup_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab.9.png
deleted file mode 100644
index 1a6c0fed..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_active.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_active.9.png
deleted file mode 100644
index c636c870..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_active.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_dark.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_dark.9.png
deleted file mode 100644
index 33d4b909..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_pressed.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_pressed.9.png
deleted file mode 100644
index fa7c6809..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_tab_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_top_divider.9.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_top_divider.9.png
deleted file mode 100644
index c80da27e..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_composer_top_divider.9.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_back_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_back_normal.png
deleted file mode 100644
index 861ce7ba..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_back_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_normal.png
deleted file mode 100644
index d1d49c41..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_pressed.png
deleted file mode 100644
index 807a000e..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_backspace_front_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_cars.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_cars.png
deleted file mode 100644
index 91a51df4..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_cars.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_nature.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_nature.png
deleted file mode 100644
index 52b9003f..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_nature.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_objects.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_objects.png
deleted file mode 100644
index e5965e81..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_objects.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_people.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_people.png
deleted file mode 100644
index 437692e7..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_people.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_punctuation.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_punctuation.png
deleted file mode 100644
index cef75d77..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_category_punctuation.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_back_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_back_normal.png
deleted file mode 100644
index 57a22ee0..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_back_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_normal.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_normal.png
deleted file mode 100644
index 2fe38cc0..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_normal.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_pressed.png b/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_pressed.png
deleted file mode 100644
index 57b04f8d..00000000
--- a/libs/emojicon/src/main/res/drawable-xhdpi/orca_emoji_more_front_pressed.png
+++ /dev/null
Binary files differ
diff --git a/libs/emojicon/src/main/res/drawable/orca_composer_attach_camera_button.xml b/libs/emojicon/src/main/res/drawable/orca_composer_attach_camera_button.xml
deleted file mode 100644
index 0b255fb2..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_composer_attach_camera_button.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_attach_camera_pressed" />
- <item android:drawable="@drawable/orca_attach_camera_normal" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_composer_attach_location_button.xml b/libs/emojicon/src/main/res/drawable/orca_composer_attach_location_button.xml
deleted file mode 100644
index 4971113a..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_composer_attach_location_button.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2013 Klamr. All rights reserved.
- ~
- ~ This software is the confidential and proprietary information of Klamr or one of its
- ~ subsidiaries. You shall not disclose this confidential information and shall use it only in
- ~ accordance with the terms of the license agreement or other applicable agreement you entered into
- ~ with Klamr.
- ~
- ~ KLAMR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER
- ~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- ~ FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KLAMR SHALL NOT BE LIABLE FOR ANY LOSSES
- ~ OR DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR
- ~ ITS DERIVATIVES.
- -->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_attach_location_pressed"/>
- <item android:drawable="@drawable/orca_attach_location_normal"/>
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_composer_attach_photo_button.xml b/libs/emojicon/src/main/res/drawable/orca_composer_attach_photo_button.xml
deleted file mode 100644
index ca7508dd..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_composer_attach_photo_button.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_attach_photo_pressed" />
- <item android:drawable="@drawable/orca_attach_photo_normal" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_composer_popup_button.xml b/libs/emojicon/src/main/res/drawable/orca_composer_popup_button.xml
deleted file mode 100644
index d43dc26e..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_composer_popup_button.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_composer_popup_pressed" />
- <item android:drawable="@drawable/orca_composer_popup_normal" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_composer_popup_button_active.xml b/libs/emojicon/src/main/res/drawable/orca_composer_popup_button_active.xml
deleted file mode 100644
index f5e40ef8..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_composer_popup_button_active.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_composer_popup_active_pressed" />
- <item android:drawable="@drawable/orca_composer_popup_active_normal" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_emoji_backspace_front_button.xml b/libs/emojicon/src/main/res/drawable/orca_emoji_backspace_front_button.xml
deleted file mode 100644
index a2d2f5b6..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_emoji_backspace_front_button.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_emoji_backspace_front_pressed"/>
- <item android:drawable="@drawable/orca_emoji_backspace_front_normal"/>
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_emoji_more_front_button.xml b/libs/emojicon/src/main/res/drawable/orca_emoji_more_front_button.xml
deleted file mode 100644
index a799d56d..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_emoji_more_front_button.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_emoji_more_front_pressed"/>
- <item android:drawable="@drawable/orca_emoji_more_front_normal"/>
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_emoji_tab_background.xml b/libs/emojicon/src/main/res/drawable/orca_emoji_tab_background.xml
deleted file mode 100644
index f68e6212..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_emoji_tab_background.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_selected="true" android:drawable="@drawable/orca_composer_tab_pressed" />
- <item android:state_pressed="true" android:drawable="@drawable/orca_composer_tab_active" />
- <item android:drawable="@drawable/orca_composer_tab" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/drawable/orca_emoji_tab_dark_background.xml b/libs/emojicon/src/main/res/drawable/orca_emoji_tab_dark_background.xml
deleted file mode 100644
index 07ff608c..00000000
--- a/libs/emojicon/src/main/res/drawable/orca_emoji_tab_dark_background.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2013 Klamr. All rights reserved.
- ~
- ~ This software is the confidential and proprietary information of Klamr or one of its
- ~ subsidiaries. You shall not disclose this confidential information and shall use it only in
- ~ accordance with the terms of the license agreement or other applicable agreement you entered into
- ~ with Klamr.
- ~
- ~ KLAMR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER
- ~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- ~ FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KLAMR SHALL NOT BE LIABLE FOR ANY LOSSES
- ~ OR DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR
- ~ ITS DERIVATIVES.
- -->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/orca_composer_tab_pressed" />
- <item android:drawable="@drawable/orca_composer_tab_active" android:state_checked="true" />
- <item android:drawable="@drawable/orca_composer_tab_dark" />
-</selector> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/layout/emojicon_item.xml b/libs/emojicon/src/main/res/layout/emojicon_item.xml
index ed11041a..bdf521a4 100644
--- a/libs/emojicon/src/main/res/layout/emojicon_item.xml
+++ b/libs/emojicon/src/main/res/layout/emojicon_item.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright 2014 Ankush Sachdeva
+ ~ Copyright 2014 Hieu Rocker
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -20,13 +20,11 @@
xmlns:emojicon="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
- <github.ankushsachdeva.emojicon.EmojiconTextView
+ <com.rockerhieu.emojicon.EmojiconTextView
android:layout_gravity="center"
android:id="@+id/emojicon_icon"
android:layout_width="36dip"
android:layout_height="36dip"
emojicon:emojiconSize="30dip"
- android:focusable="false"
- android:focusableInTouchMode="false"
android:gravity="center"/>
</FrameLayout> \ No newline at end of file
diff --git a/libs/emojicon/src/main/res/layout/emojicons.xml b/libs/emojicon/src/main/res/layout/emojicons.xml
index 287923d1..888a9459 100644
--- a/libs/emojicon/src/main/res/layout/emojicons.xml
+++ b/libs/emojicon/src/main/res/layout/emojicons.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2014 Ankush Sachdeva
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright 2014 Hieu Rocker
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -16,104 +15,120 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="@drawable/keyboard_background_holo"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <LinearLayout
- android:id="@+id/emojis_tab"
- android:layout_width="match_parent"
- android:layout_height="50dip"
- android:layout_alignParentTop="true"
- android:orientation="horizontal">
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_0_recents"
- android:src="@drawable/ic_emoji_recent_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_1_people"
- android:src="@drawable/ic_emoji_people_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_2_nature"
- android:src="@drawable/ic_emoji_nature_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_3_objects"
- android:src="@drawable/ic_emoji_objects_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_4_cars"
- android:src="@drawable/ic_emoji_places_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:scaleType="center"
- android:id="@+id/emojis_tab_5_punctuation"
- android:src="@drawable/ic_emoji_symbols_light"/>
- <View
- android:layout_width="1px"
- android:layout_height="match_parent"
- android:background="#888888"/>
- <ImageButton
- android:background="@null"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:id="@+id/emojis_backspace"
- android:src="@drawable/sym_keyboard_delete_holo_dark"/>
- </LinearLayout>
- <android.support.v4.view.ViewPager
- android:layout_below="@id/emojis_tab"
- android:id="@+id/emojis_pager"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"/>
+ android:background="@drawable/keyboard_background_holo"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:id="@+id/emojis_tab"
+ android:layout_width="match_parent"
+ android:layout_height="50dip"
+ android:layout_alignParentTop="true"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_0_recents"
+ android:src="@drawable/ic_emoji_recent_light" />
+
+ <View
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_1_people"
+ android:src="@drawable/ic_emoji_people_light" />
+
<View
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:layout_below="@id/emojis_tab"
- android:background="#8f8f8f"/>
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_2_nature"
+ android:src="@drawable/ic_emoji_nature_light" />
+
+ <View
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_3_objects"
+ android:src="@drawable/ic_emoji_objects_light" />
+
+ <View
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_4_cars"
+ android:src="@drawable/ic_emoji_places_light" />
+
+ <View
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:scaleType="center"
+ android:id="@+id/emojis_tab_5_punctuation"
+ android:src="@drawable/ic_emoji_symbols_light" />
+
+ <View
+ android:layout_width="1px"
+ android:layout_height="match_parent"
+ android:background="@color/horizontal_vertical" />
+
+ <ImageButton
+ android:background="@null"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:id="@+id/emojis_backspace"
+ android:src="@drawable/sym_keyboard_delete_holo_dark" />
+ </LinearLayout>
+
+ <android.support.v4.view.ViewPager
+ android:layout_below="@id/emojis_tab"
+ android:id="@+id/emojis_pager"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1px"
+ android:layout_below="@id/emojis_tab"
+ android:background="@color/horizontal_divider" />
</RelativeLayout>
diff --git a/libs/emojicon/src/main/res/values/attrs.xml b/libs/emojicon/src/main/res/values/attrs.xml
index 9810158d..30e8aed5 100644
--- a/libs/emojicon/src/main/res/values/attrs.xml
+++ b/libs/emojicon/src/main/res/values/attrs.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright 2014 Ankush Sachdeva
+ ~ Copyright 2014 Hieu Rocker
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -13,27 +13,19 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--->
+ -->
<resources>
-
<declare-styleable name="Emojicon">
- <attr name="emojiconSize" format="dimension" />
- <attr name="emojiconTextStart" format="integer" />
- <attr name="emojiconTextLength" format="integer" />
+ <attr name="emojiconSize" format="dimension"/>
+ <attr name="emojiconAlignment" format="enum">
+ <enum name="bottom" value="0"/>
+ <enum name="baseline" value="1"/>
+ </attr>
+ <attr name="emojiconTextStart" format="integer"/>
+ <attr name="emojiconTextLength" format="integer"/>
+ <attr name="emojiconUseSystemDefault" format="boolean"/>
</declare-styleable>
<dimen name="keyboard_height">250dp</dimen>
-
- <style name="emojiDialog" parent="@android:style/Theme.Dialog">
- <item name="android:layout_width">fill_parent</item>
- <item name="android:layout_height">fill_parent</item>
-
- <!-- No backgrounds, titles or window float -->
- <item name="android:windowFrame">@null</item>
- <item name="android:windowBackground">@null</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowIsFloating">false</item>
- </style>
-
-</resources> \ No newline at end of file
+</resources>
diff --git a/libs/emojicon/src/main/res/values/colors.xml b/libs/emojicon/src/main/res/values/colors.xml
new file mode 100644
index 00000000..39e5a477
--- /dev/null
+++ b/libs/emojicon/src/main/res/values/colors.xml
@@ -0,0 +1,20 @@
+<!--
+ ~ Copyright 2014 Hieu Rocker
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+ <color name="horizontal_divider">#8f8f8f</color>
+ <color name="horizontal_vertical">#8f8f8f</color>
+</resources>
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index bf261dba..ef486128 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -47,7 +47,7 @@ import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
-import github.ankushsachdeva.emojicon.EmojiconEditText;
+import com.rockerhieu.emojicon.EmojiconEditText;
public class ConversationActivity extends XmppActivity
implements OnAccountUpdate, OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, XmppConnectionService.OnShowErrorToast {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index dc472360..d0dc89a2 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -65,9 +65,10 @@ import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jid.Jid;
-import github.ankushsachdeva.emojicon.EmojiconGridView;
-import github.ankushsachdeva.emojicon.EmojiconsPopup;
-import github.ankushsachdeva.emojicon.emoji.Emojicon;
+
+import com.rockerhieu.emojicon.EmojiconGridFragment;
+import com.rockerhieu.emojicon.EmojiconsPopup;
+import com.rockerhieu.emojicon.emoji.Emojicon;
public class ConversationFragment extends Fragment implements EditMessage.KeyboardListener {
@@ -289,15 +290,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
//Will automatically set size according to the soft keyboard size
mEmojPopup.setSizeForSoftKeyboard();
- //Set on emojicon click listener
- mEmojPopup.setOnEmojiconClickedListener(new EmojiconGridView.OnEmojiconClickedListener() {
-
- @Override
- public void onEmojiconClicked(Emojicon emojicon) {
- mEditMessage.append(emojicon.getEmoji());
- }
- });
-
//Set on backspace click listener
mEmojPopup.setOnEmojiconBackspaceClickedListener(new EmojiconsPopup.OnEmojiconBackspaceClickedListener() {
@@ -334,7 +326,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
});
//On emoji clicked, add it to edittext
- mEmojPopup.setOnEmojiconClickedListener(new EmojiconGridView.OnEmojiconClickedListener() {
+ mEmojPopup.setOnEmojiconClickedListener(new EmojiconGridFragment.OnEmojiconClickedListener() {
@Override
public void onEmojiconClicked(Emojicon emojicon) {
diff --git a/src/main/java/eu/siacs/conversations/ui/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/EditMessage.java
index a7aa2024..f18f63b3 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditMessage.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditMessage.java
@@ -7,7 +7,7 @@ import android.view.KeyEvent;
import android.widget.EditText;
import eu.siacs.conversations.Config;
-import github.ankushsachdeva.emojicon.EmojiconEditText;
+import com.rockerhieu.emojicon.EmojiconEditText;
public class EditMessage extends EmojiconEditText {
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index c42dd305..c57aa6dc 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -30,7 +30,7 @@ import eu.siacs.conversations.entities.Presences;
import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.utils.UIHelper;
-import github.ankushsachdeva.emojicon.EmojiconTextView;
+import com.rockerhieu.emojicon.EmojiconTextView;
import android.content.Context;
import android.graphics.Color;
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index b7ac3092..3adba669 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -39,7 +39,7 @@ import eu.siacs.conversations.entities.Message.FileParams;
import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.UIHelper;
-import github.ankushsachdeva.emojicon.EmojiconTextView;
+import com.rockerhieu.emojicon.EmojiconTextView;
public class MessageAdapter extends ArrayAdapter<Message> {
diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml
index c79628d4..db72d2ad 100644
--- a/src/main/res/layout/conversation_list_row.xml
+++ b/src/main/res/layout/conversation_list_row.xml
@@ -68,7 +68,7 @@
android:orientation="vertical"
android:paddingTop="3dp" >
- <github.ankushsachdeva.emojicon.EmojiconTextView
+ <com.rockerhieu.emojicon.EmojiconTextView
android:id="@+id/conversation_lastmsg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml
index 68ed5711..c5383a75 100644
--- a/src/main/res/layout/message_received.xml
+++ b/src/main/res/layout/message_received.xml
@@ -40,7 +40,7 @@
android:paddingBottom="2dp"
android:scaleType="centerCrop" />
- <github.ankushsachdeva.emojicon.EmojiconTextView
+ <com.rockerhieu.emojicon.EmojiconTextView
android:id="@+id/message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml
index 563e2e29..35b001c5 100644
--- a/src/main/res/layout/message_sent.xml
+++ b/src/main/res/layout/message_sent.xml
@@ -40,7 +40,7 @@
android:paddingBottom="2dp"
android:scaleType="centerCrop" />
- <github.ankushsachdeva.emojicon.EmojiconTextView
+ <com.rockerhieu.emojicon.EmojiconTextView
android:id="@+id/message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"