use of com.klinker.android.twitter.data.sq_lite.Recent in project Talon-for-Twitter by klinker24.
the class EmojiKeyboard method onFinishInflate.
@Override
protected void onFinishInflate() {
try {
try {
getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial", PackageManager.GET_META_DATA);
} catch (Exception e) {
getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial_ios", PackageManager.GET_META_DATA);
}
emojiPager = (ViewPager) findViewById(R.id.emojiKeyboardPager);
backspace = (ImageButton) findViewById(R.id.delete);
Display d = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
keyboardHeight = (int) (d.getHeight() / 3.0);
dataSource = new EmojiDataSource(getContext());
dataSource.open();
recents = (ArrayList<Recent>) dataSource.getAllRecents();
emojiPager.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, keyboardHeight));
tabs = (PagerSlidingTabStrip) findViewById(R.id.emojiTabs);
tabs.setIndicatorColor(getResources().getColor(R.color.app_color));
emojiPagerAdapter = new EmojiPagerAdapter(getContext(), emojiPager);
emojiPager.setAdapter(emojiPagerAdapter);
tabs.setViewPager(emojiPager);
emojiPager.setCurrentItem(1);
backspace.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
removeText();
}
});
} catch (Exception e) {
}
}
use of com.klinker.android.twitter.data.sq_lite.Recent in project Talon-for-Twitter by klinker24.
the class EmojiKeyboard method insertEmoji.
public void insertEmoji(String emoji, int icon) {
input.setEnabled(false);
int beforeSelectionStart = input.getSelectionStart();
int beforeLength = input.getText().toString().length();
CharSequence before = input.getText().subSequence(0, beforeSelectionStart);
CharSequence after = input.getText().subSequence(input.getSelectionEnd(), beforeLength);
input.setText(android.text.TextUtils.concat(before, Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !EmojiUtils.ios ? emoji : EmojiUtils.getSmiledText(getContext(), emoji), after));
input.setEnabled(true);
input.setSelection(beforeSelectionStart + (input.getText().toString().length() - beforeLength));
for (Recent recent1 : recents) {
if (recent1.text.equals(emoji)) {
dataSource.updateRecent(icon + "");
recent1.count++;
return;
}
}
Recent recent = dataSource.createRecent(emoji, icon + "");
if (recent != null)
recents.add(recent);
}
Aggregations