本文整理汇总了Java中com.rockerhieu.emojicon.emoji.Emojicon类的典型用法代码示例。如果您正苦于以下问题:Java Emojicon类的具体用法?Java Emojicon怎么用?Java Emojicon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Emojicon类属于com.rockerhieu.emojicon.emoji包,在下文中一共展示了Emojicon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@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();
}
示例2: onViewCreated
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@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 {
Parcelable[] parcels = bundle.getParcelableArray(EMOJICONS_KEY);
mData = new Emojicon[parcels.length];
for (int i = 0; i < parcels.length; i++) {
mData[i] = (Emojicon) parcels[i];
}
mUseSystemDefault = bundle.getBoolean(USE_SYSTEM_DEFAULT_KEY);
}
gridView.setAdapter(new EmojiAdapter(view.getContext(), mData, mUseSystemDefault));
gridView.setOnItemClickListener(this);
}
示例3: addRecentEmoji
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@Override
public void addRecentEmoji(Context context, Emojicon emojicon) {
EmojiconRecentsManager recents = EmojiconRecentsManager
.getInstance(context);
recents.push(emojicon);
// notify dataset changed
if (mAdapter != null)
mAdapter.notifyDataSetChanged();
}
示例4: push
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
public void push(Emojicon object) {
// FIXME totally inefficient way of adding the emoji to the adapter
// TODO this should be probably replaced by a deque
if (contains(object)) {
super.remove(object);
}
add(0, object);
}
示例5: loadRecents
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
private void loadRecents() {
SharedPreferences prefs = getPreferences();
String str = prefs.getString(PREF_RECENTS, "");
StringTokenizer tokenizer = new StringTokenizer(str, EmojiconRecentsManager.DELIMITER);
while (tokenizer.hasMoreTokens()) {
add(Emojicon.fromChars(tokenizer.nextToken()));
}
}
示例6: saveRecents
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
private void saveRecents() {
StringBuilder str = new StringBuilder();
int c = size();
for (int i = 0; i < c; i++) {
Emojicon e = get(i);
str.append(e.getEmoji());
if (i < (c - 1)) {
str.append(EmojiconRecentsManager.DELIMITER);
}
}
SharedPreferences prefs = getPreferences();
prefs.edit().putString(PREF_RECENTS, str.toString()).commit();
}
示例7: newInstance
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
protected static EmojiconGridFragment newInstance(Emojicon[] emojicons, EmojiconRecents recents, boolean useSystemDefault) {
EmojiconGridFragment emojiGridFragment = new EmojiconGridFragment();
Bundle args = new Bundle();
args.putSerializable("emojicons", emojicons);
args.putBoolean(USE_SYSTEM_DEFAULT_KEY, useSystemDefault);
emojiGridFragment.setArguments(args);
emojiGridFragment.setRecents(recents);
return emojiGridFragment;
}
示例8: onViewCreated
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@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 {
Object[] o = (Object[]) getArguments().getSerializable("emojicons");
mData = Arrays.asList(o).toArray(new Emojicon[o.length]);
mUseSystemDefault = bundle.getBoolean(USE_SYSTEM_DEFAULT_KEY);
}
gridView.setAdapter(new EmojiAdapter(view.getContext(), mData, mUseSystemDefault));
gridView.setOnItemClickListener(this);
}
示例9: onItemClick
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@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)));
}
}
示例10: addRecentEmoji
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@Override
public void addRecentEmoji(Context context, Emojicon emojicon) {
EmojiconRecentsManager recents = EmojiconRecentsManager
.getInstance(context);
recents.push(emojicon);
// notify dataset changed
if (mAdapter != null)
mAdapter.notifyDataSetChanged();
}
示例11: newInstance
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
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;
}
示例12: onItemClick
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@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)));
}
}
示例13: input
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
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());
}
}
示例14: onEmojiconClicked
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@Override
public void onEmojiconClicked(Emojicon emojicon)
{
int currentPos = mTabLayout.getSelectedTabPosition();
if (currentPos == POS_CONDITION) return;
WriteMessageFragment fragment = (WriteMessageFragment) mFragments.get(currentPos);
fragment.setContent(emojicon.getEmoji());
}
示例15: onEmojiconClicked
import com.rockerhieu.emojicon.emoji.Emojicon; //导入依赖的package包/类
@Override
public void onEmojiconClicked(Emojicon emojicon)
{
String currContent = mEtContent.getText().toString();
mEtContent.setText(currContent + emojicon.getEmoji());
mEtContent.setSelection(mEtContent.getText().toString().length());
}