Leave icon update

This commit is contained in:
SessionHero01 2024-11-01 17:01:21 +11:00
parent 1b6f7bc3fa
commit dfc69420ba
No known key found for this signature in database
2 changed files with 26 additions and 19 deletions

View File

@ -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) }

View File

@ -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" />
<TextView
@ -47,7 +48,8 @@
style="@style/BottomSheetActionItem"
android:text="@string/pinUnpin"
android:visibility="gone"
app:drawableStartCompat="?attr/menu_unpin_icon"
app:drawableStartCompat="@drawable/ic_outline_pin_off_24"
app:drawableTint="?attr/colorControlNormal"
tools:visibility="visible" />
<TextView
@ -56,7 +58,8 @@
android:contentDescription="@string/AccessibilityId_block"
android:text="@string/block"
android:visibility="gone"
app:drawableStartCompat="?attr/menu_block_icon"
app:drawableStartCompat="@drawable/ic_baseline_block_24"
app:drawableTint="?attr/colorControlNormal"
tools:visibility="visible" />
<TextView
@ -64,7 +67,8 @@
style="@style/BottomSheetActionItem"
android:text="@string/blockUnblock"
android:visibility="gone"
app:drawableStartCompat="?attr/menu_accept_icon"
app:drawableStartCompat="@drawable/ic_baseline_done_24"
app:drawableTint="?attr/colorControlNormal"
tools:visibility="visible" />
<TextView
@ -73,6 +77,7 @@
android:contentDescription="@string/AccessibilityId_notificationsMute"
android:text="@string/notificationsMute"
app:drawableStartCompat="@drawable/ic_outline_notifications_off_24"
app:drawableTint="?attr/colorControlNormal"
tools:visibility="visible"
android:visibility="gone"
/>
@ -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" />
<TextView
android:id="@+id/deleteTextView"
style="@style/BottomSheetActionItem"
android:contentDescription="@string/AccessibilityId_delete"
android:text="@string/delete"
app:drawableStartCompat="?attr/menu_trash_icon" />
<TextView
android:id="@+id/leaveTextView"
style="@style/BottomSheetActionItem"
android:text="@string/leave"
app:drawableStartCompat="@drawable/ic_log_out"
app:drawableTint="?android:attr/textColorPrimary" />
app:drawableTint="?attr/colorControlNormal"
tools:drawableStartCompat="@drawable/ic_baseline_delete_24" />
</LinearLayout>