mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 18:45:19 +00:00
Leave icon update
This commit is contained in:
parent
1b6f7bc3fa
commit
dfc69420ba
@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.core.widget.TextViewCompat
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
@ -55,7 +56,6 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto
|
|||||||
binding.blockTextView -> onBlockTapped?.invoke()
|
binding.blockTextView -> onBlockTapped?.invoke()
|
||||||
binding.unblockTextView -> onUnblockTapped?.invoke()
|
binding.unblockTextView -> onUnblockTapped?.invoke()
|
||||||
binding.deleteTextView -> onDeleteTapped?.invoke()
|
binding.deleteTextView -> onDeleteTapped?.invoke()
|
||||||
binding.leaveTextView -> onDeleteTapped?.invoke()
|
|
||||||
binding.markAllAsReadTextView -> onMarkAllAsReadTapped?.invoke()
|
binding.markAllAsReadTextView -> onMarkAllAsReadTapped?.invoke()
|
||||||
binding.notificationsTextView -> onNotificationTapped?.invoke()
|
binding.notificationsTextView -> onNotificationTapped?.invoke()
|
||||||
binding.unMuteNotificationsTextView -> onSetMuteTapped?.invoke(false)
|
binding.unMuteNotificationsTextView -> onSetMuteTapped?.invoke(false)
|
||||||
@ -91,32 +91,36 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
binding.deleteTextView.apply {
|
binding.deleteTextView.apply {
|
||||||
isVisible = recipient.isContactRecipient || (recipient.isGroupOrCommunityRecipient && !isCurrentUserInGroup)
|
|
||||||
setOnClickListener(this@ConversationOptionsBottomSheet)
|
setOnClickListener(this@ConversationOptionsBottomSheet)
|
||||||
|
|
||||||
// the text and content description will change depending on the type
|
val drawableStartRes: Int
|
||||||
when{
|
|
||||||
|
// the text, content description and icon will change depending on the type
|
||||||
|
when {
|
||||||
// groups and communities
|
// groups and communities
|
||||||
recipient.isGroupOrCommunityRecipient -> {
|
recipient.isGroupOrCommunityRecipient -> {
|
||||||
text = context.getString(R.string.leave)
|
text = context.getString(R.string.leave)
|
||||||
contentDescription = context.getString(R.string.AccessibilityId_leave)
|
contentDescription = context.getString(R.string.AccessibilityId_leave)
|
||||||
|
drawableStartRes = R.drawable.ic_log_out
|
||||||
}
|
}
|
||||||
|
|
||||||
// note to self
|
// note to self
|
||||||
recipient.isLocalNumber -> {
|
recipient.isLocalNumber -> {
|
||||||
text = context.getString(R.string.clear)
|
text = context.getString(R.string.clear)
|
||||||
contentDescription = context.getString(R.string.AccessibilityId_clear)
|
contentDescription = context.getString(R.string.AccessibilityId_clear)
|
||||||
|
drawableStartRes = R.drawable.ic_delete_24
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1on1
|
// 1on1
|
||||||
else -> {
|
else -> {
|
||||||
text = context.getString(R.string.delete)
|
text = context.getString(R.string.delete)
|
||||||
contentDescription = context.getString(R.string.AccessibilityId_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 ||
|
binding.markAllAsReadTextView.isVisible = thread.unreadCount > 0 ||
|
||||||
configFactory.withUserConfigs { it.convoInfoVolatile.getConversationUnread(thread) }
|
configFactory.withUserConfigs { it.convoInfoVolatile.getConversationUnread(thread) }
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
android:contentDescription="@string/AccessibilityId_pin"
|
android:contentDescription="@string/AccessibilityId_pin"
|
||||||
android:text="@string/pin"
|
android:text="@string/pin"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="?attr/menu_pin_icon"
|
app:drawableStartCompat="@drawable/ic_outline_pin_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -47,7 +48,8 @@
|
|||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/pinUnpin"
|
android:text="@string/pinUnpin"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="?attr/menu_unpin_icon"
|
app:drawableStartCompat="@drawable/ic_outline_pin_off_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -56,7 +58,8 @@
|
|||||||
android:contentDescription="@string/AccessibilityId_block"
|
android:contentDescription="@string/AccessibilityId_block"
|
||||||
android:text="@string/block"
|
android:text="@string/block"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="?attr/menu_block_icon"
|
app:drawableStartCompat="@drawable/ic_baseline_block_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -64,7 +67,8 @@
|
|||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/blockUnblock"
|
android:text="@string/blockUnblock"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="?attr/menu_accept_icon"
|
app:drawableStartCompat="@drawable/ic_baseline_done_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -73,6 +77,7 @@
|
|||||||
android:contentDescription="@string/AccessibilityId_notificationsMute"
|
android:contentDescription="@string/AccessibilityId_notificationsMute"
|
||||||
android:text="@string/notificationsMute"
|
android:text="@string/notificationsMute"
|
||||||
app:drawableStartCompat="@drawable/ic_outline_notifications_off_24"
|
app:drawableStartCompat="@drawable/ic_outline_notifications_off_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
@ -82,6 +87,7 @@
|
|||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/notificationsMuteUnmute"
|
android:text="@string/notificationsMuteUnmute"
|
||||||
app:drawableStartCompat="@drawable/ic_outline_notifications_active_24"
|
app:drawableStartCompat="@drawable/ic_outline_notifications_active_24"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
@ -90,6 +96,7 @@
|
|||||||
android:id="@+id/notificationsTextView"
|
android:id="@+id/notificationsTextView"
|
||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/sessionNotifications"
|
android:text="@string/sessionNotifications"
|
||||||
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
app:drawableStartCompat="@drawable/ic_outline_notification_important_24"
|
app:drawableStartCompat="@drawable/ic_outline_notification_important_24"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
@ -100,20 +107,16 @@
|
|||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/messageMarkRead"
|
android:text="@string/messageMarkRead"
|
||||||
android:visibility="gone"
|
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
|
<TextView
|
||||||
android:id="@+id/deleteTextView"
|
android:id="@+id/deleteTextView"
|
||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:contentDescription="@string/AccessibilityId_delete"
|
android:contentDescription="@string/AccessibilityId_delete"
|
||||||
android:text="@string/delete"
|
android:text="@string/delete"
|
||||||
app:drawableStartCompat="?attr/menu_trash_icon" />
|
app:drawableTint="?attr/colorControlNormal"
|
||||||
|
tools:drawableStartCompat="@drawable/ic_baseline_delete_24" />
|
||||||
<TextView
|
|
||||||
android:id="@+id/leaveTextView"
|
|
||||||
style="@style/BottomSheetActionItem"
|
|
||||||
android:text="@string/leave"
|
|
||||||
app:drawableStartCompat="@drawable/ic_log_out"
|
|
||||||
app:drawableTint="?android:attr/textColorPrimary" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user