From dfc69420baac0b9e91d6d438a14b8f434d00e728 Mon Sep 17 00:00:00 2001 From: SessionHero01 <180888785+SessionHero01@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:01:21 +1100 Subject: [PATCH] Leave icon update --- .../home/ConversationOptionsBottomSheet.kt | 16 ++++++---- .../fragment_conversation_bottom_sheet.xml | 29 ++++++++++--------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt index 241ce4d373..2f53e84546 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt @@ -6,6 +6,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.view.isVisible +import androidx.core.widget.TextViewCompat import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint import network.loki.messenger.R @@ -55,7 +56,6 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto binding.blockTextView -> onBlockTapped?.invoke() binding.unblockTextView -> onUnblockTapped?.invoke() binding.deleteTextView -> onDeleteTapped?.invoke() - binding.leaveTextView -> onDeleteTapped?.invoke() binding.markAllAsReadTextView -> onMarkAllAsReadTapped?.invoke() binding.notificationsTextView -> onNotificationTapped?.invoke() binding.unMuteNotificationsTextView -> onSetMuteTapped?.invoke(false) @@ -91,32 +91,36 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto // delete binding.deleteTextView.apply { - isVisible = recipient.isContactRecipient || (recipient.isGroupOrCommunityRecipient && !isCurrentUserInGroup) setOnClickListener(this@ConversationOptionsBottomSheet) - // the text and content description will change depending on the type - when{ + val drawableStartRes: Int + + // the text, content description and icon will change depending on the type + when { // groups and communities recipient.isGroupOrCommunityRecipient -> { text = context.getString(R.string.leave) contentDescription = context.getString(R.string.AccessibilityId_leave) + drawableStartRes = R.drawable.ic_log_out } // note to self recipient.isLocalNumber -> { text = context.getString(R.string.clear) contentDescription = context.getString(R.string.AccessibilityId_clear) + drawableStartRes = R.drawable.ic_delete_24 } // 1on1 else -> { text = context.getString(R.string.delete) contentDescription = context.getString(R.string.AccessibilityId_delete) + drawableStartRes = R.drawable.ic_delete_24 } } + + TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this, drawableStartRes, 0, 0, 0) } - binding.leaveTextView.isVisible = recipient.isGroupOrCommunityRecipient && isCurrentUserInGroup - binding.leaveTextView.setOnClickListener(this) binding.markAllAsReadTextView.isVisible = thread.unreadCount > 0 || configFactory.withUserConfigs { it.convoInfoVolatile.getConversationUnread(thread) } diff --git a/app/src/main/res/layout/fragment_conversation_bottom_sheet.xml b/app/src/main/res/layout/fragment_conversation_bottom_sheet.xml index 442f0d4bcc..379e655f49 100644 --- a/app/src/main/res/layout/fragment_conversation_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_conversation_bottom_sheet.xml @@ -39,7 +39,8 @@ android:contentDescription="@string/AccessibilityId_pin" android:text="@string/pin" android:visibility="gone" - app:drawableStartCompat="?attr/menu_pin_icon" + app:drawableStartCompat="@drawable/ic_outline_pin_24" + app:drawableTint="?attr/colorControlNormal" tools:visibility="visible" /> @@ -82,6 +87,7 @@ style="@style/BottomSheetActionItem" android:text="@string/notificationsMuteUnmute" app:drawableStartCompat="@drawable/ic_outline_notifications_active_24" + app:drawableTint="?attr/colorControlNormal" tools:visibility="visible" android:visibility="gone" /> @@ -90,6 +96,7 @@ android:id="@+id/notificationsTextView" style="@style/BottomSheetActionItem" android:text="@string/sessionNotifications" + app:drawableTint="?attr/colorControlNormal" app:drawableStartCompat="@drawable/ic_outline_notification_important_24" tools:visibility="visible" android:visibility="gone" @@ -100,20 +107,16 @@ style="@style/BottomSheetActionItem" android:text="@string/messageMarkRead" android:visibility="gone" - app:drawableStartCompat="?attr/menu_mark_all_as_read" /> + tools:visibility="visible" + app:drawableTint="?attr/colorControlNormal" + app:drawableStartCompat="@drawable/ic_outline_mark_chat_read_24" /> - - + app:drawableTint="?attr/colorControlNormal" + tools:drawableStartCompat="@drawable/ic_baseline_delete_24" />