move emoji reaction buttons

This commit is contained in:
0xd9a 2022-08-01 17:35:54 +05:30
parent e6a0a7f46d
commit f936bc2c35
5 changed files with 71 additions and 47 deletions

View File

@ -109,11 +109,11 @@ public class AnnouncementAdapter extends RecyclerView.Adapter<AnnouncementAdapte
} else {
holder.binding.dates.setVisibility(View.GONE);
}
holder.binding.layoutReactions.statusEmoji.setOnClickListener(v -> {
holder.binding.statusEmoji.setOnClickListener(v -> {
EmojiManager.install(new EmojiOneProvider());
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(holder.binding.layoutReactions.statusEmoji).setOnEmojiPopupDismissListener(() -> {
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(holder.binding.statusEmoji).setOnEmojiPopupDismissListener(() -> {
InputMethodManager imm = (InputMethodManager) context.getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(holder.binding.layoutReactions.statusEmoji.getWindowToken(), 0);
imm.hideSoftInputFromWindow(holder.binding.statusEmoji.getWindowToken(), 0);
}).setOnEmojiClickListener((emoji, imageView) -> {
String emojiStr = imageView.getUnicode();
boolean alreadyAdded = false;
@ -146,7 +146,7 @@ public class AnnouncementAdapter extends RecyclerView.Adapter<AnnouncementAdapte
.build(holder.binding.layoutReactions.fakeEdittext);
emojiPopup.toggle();
});
holder.binding.layoutReactions.statusAddCustomEmoji.setOnClickListener(v -> {
holder.binding.statusAddCustomEmoji.setOnClickListener(v -> {
final AlertDialog.Builder builder = new AlertDialog.Builder(context, Helper.dialogStyle());
int paddingPixel = 15;
float density = context.getResources().getDisplayMetrics().density;

View File

@ -335,11 +335,11 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} else {
holder.binding.layoutReactions.reactionsView.setAdapter(null);
}
holder.binding.layoutReactions.statusEmoji.setOnClickListener(v -> {
holder.binding.statusEmoji.setOnClickListener(v -> {
EmojiManager.install(new EmojiOneProvider());
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(holder.binding.layoutReactions.statusEmoji).setOnEmojiPopupDismissListener(() -> {
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(holder.binding.statusEmoji).setOnEmojiPopupDismissListener(() -> {
InputMethodManager imm = (InputMethodManager) context.getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(holder.binding.layoutReactions.statusEmoji.getWindowToken(), 0);
imm.hideSoftInputFromWindow(holder.binding.statusEmoji.getWindowToken(), 0);
}).setOnEmojiClickListener((emoji, imageView) -> {
String emojiStr = imageView.getUnicode();
boolean alreadyAdded = false;
@ -375,7 +375,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
.build(holder.binding.layoutReactions.fakeEdittext);
emojiPopup.toggle();
});
holder.binding.layoutReactions.statusAddCustomEmoji.setOnClickListener(v -> {
holder.binding.statusAddCustomEmoji.setOnClickListener(v -> {
final AlertDialog.Builder builder = new AlertDialog.Builder(context, Helper.dialogStyle());
int paddingPixel = 15;

View File

@ -59,9 +59,38 @@
tools:maxLines="10"
tools:text="@tools:sample/lorem/random" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/content">
<include
android:id="@+id/layout_reactions"
layout="@layout/layout_reactions" />
layout="@layout/layout_reactions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_add_custom_emoji"
android:layout_width="28dp"
android:layout_height="28dp"
android:contentDescription="@string/add_reaction"
android:padding="3dp"
android:src="@drawable/ic_baseline_emoji_emotions_24"
app:tint="?attr/iconColor" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_emoji"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/add_reaction"
android:padding="3dp"
android:src="@drawable/ic_baseline_add_reaction_24"
app:tint="?attr/iconColor" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -27,13 +27,14 @@
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:id="@+id/main_container"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp" />
@ -591,6 +592,30 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_add_custom_emoji"
android:layout_width="28dp"
android:layout_height="28dp"
android:contentDescription="@string/add_reaction"
android:padding="3dp"
android:src="@drawable/ic_baseline_emoji_emotions_24"
app:tint="?attr/iconColor" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_emoji"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/add_reaction"
android:padding="3dp"
android:src="@drawable/ic_baseline_add_reaction_24"
app:tint="?attr/iconColor" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/action_button_more"
style="@style/Widget.AppCompat.Button.Borderless"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/status_reactions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -8,10 +7,7 @@
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
android:paddingBottom="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/content">
android:paddingBottom="10dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/reactions_view"
@ -19,32 +15,6 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_add_custom_emoji"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="5dp"
android:contentDescription="@string/add_reaction"
android:src="@drawable/ic_baseline_emoji_emotions_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/status_emoji"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="5dp"
android:contentDescription="@string/add_reaction"
android:src="@drawable/ic_baseline_add_reaction_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/iconColor" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"