GIFs picker with animojis

This commit is contained in:
Arne 2024-10-16 12:44:35 +02:00
parent bc47004f32
commit c543d36a09
4 changed files with 52 additions and 6 deletions

View file

@ -327,7 +327,7 @@ public class ConversationFragment extends XmppFragment
private File[] files;
private String[] filesPaths;
private String[] filesNames;
File dirGifs = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "Stickers"); //TODO: Change this to dedicated GIFs folder later
File dirGifs = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "Stickers" + File.separator + "Animoji");
private KeyboardHeightProvider.KeyboardHeightListener keyboardHeightListener = null;
private KeyboardHeightProvider keyboardHeightProvider = null;
@ -1826,9 +1826,6 @@ public class ConversationFragment extends XmppFragment
@Override
protected void onQuery(@Nullable CharSequence query) {
if (activity != null && activity.xmppConnectionService != null && !activity.xmppConnectionService.getBooleanPreference("message_autocomplete", R.bool.message_autocomplete))
return;
emojiDebounce.removeCallbacksAndMessages(null);
emojiDebounce.postDelayed(() -> {
if (getRecyclerView() == null) return;
@ -5576,6 +5573,7 @@ public class ConversationFragment extends XmppFragment
binding.gifsview.setVisibility(GONE);
backPressedLeaveEmojiPicker.setEnabled(true);
binding.textinput.requestFocus();
/* //TODO: For some reason this leads to crash, fix it later
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isEmpty(dirStickers.toPath())) {
Toast.makeText(activity, R.string.update_default_stickers, Toast.LENGTH_LONG).show();
@ -5583,6 +5581,8 @@ public class ConversationFragment extends XmppFragment
} catch (IOException e) {
throw new RuntimeException(e);
}
*/
if (binding.emojiPicker.getVisibility() == VISIBLE) {
binding.emojisButton.setBackground(ContextCompat.getDrawable(activity, R.drawable.selector_bubble));
binding.emojisButton.setTypeface(null, Typeface.BOLD);
@ -5626,6 +5626,7 @@ public class ConversationFragment extends XmppFragment
binding.gifsview.setVisibility(VISIBLE);
backPressedLeaveEmojiPicker.setEnabled(true);
binding.textinput.requestFocus();
/* //TODO: For some reason this leads to crash, fix it later
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isEmpty(dirGifs.toPath())) {
Toast.makeText(activity, R.string.copy_GIFs_to_GIFs_folder, Toast.LENGTH_LONG).show();
@ -5633,6 +5634,8 @@ public class ConversationFragment extends XmppFragment
} catch (IOException e) {
throw new RuntimeException(e);
}
*/
if (binding.emojiPicker.getVisibility() == VISIBLE) {
binding.emojisButton.setBackground(ContextCompat.getDrawable(activity, R.drawable.selector_bubble));
binding.emojisButton.setTypeface(null, Typeface.BOLD);

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:background="@drawable/background_selectable_list_item">
<TextView
android:id="@+id/nonunicode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:textSize="36sp"
app:emojiCompatEnabled="false"
android:visibility="gone" />
<TextView
android:id="@+id/unicode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="36sp"
android:gravity="center_vertical|center_horizontal"
android:textAppearance="?textAppearanceBodyMedium" />
<TextView
android:id="@+id/shortcode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="8dp"
android:visibility="gone"
android:textAppearance="?textAppearanceBodyMedium" />
</LinearLayout>
</layout>

View file

@ -209,7 +209,7 @@ public class EmojiSearchOld {
@Override
public View getView(int position, View view, ViewGroup parent) {
EmojiSearchRowBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.emoji_search_row, parent, false);
EmojiSearchRowBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.emoji_search_row_old, parent, false);
if (getItem(position) instanceof CustomEmoji) {
binding.nonunicode.setText(getItem(position).toInsert());
binding.nonunicode.setVisibility(View.VISIBLE);

View file

@ -12,7 +12,7 @@ import com.bumptech.glide.Glide;
import eu.siacs.conversations.R;
public class GifsAdapter extends BaseAdapter {
private Context ctx;
private final Context ctx;
private final String[] filesNames;
private final String[] filesPaths;