mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Hidden some options of conversation long press menu if read only
This commit is contained in:
parent
e4a85985c2
commit
a50b74d042
4 changed files with 11 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ import org.linphone.databinding.ChatLongPressMenuBinding
|
|||
class ConversationDialogFragment(
|
||||
private val isMuted: Boolean,
|
||||
private val isGroup: Boolean,
|
||||
private val isReadOnly: Boolean,
|
||||
private val onDismiss: (() -> Unit)? = null,
|
||||
private val onMarkConversationAsRead: (() -> Unit)? = null,
|
||||
private val onToggleMute: (() -> Unit)? = null,
|
||||
|
|
@ -72,6 +73,7 @@ class ConversationDialogFragment(
|
|||
val view = ChatLongPressMenuBinding.inflate(layoutInflater)
|
||||
view.isMuted = isMuted
|
||||
view.isGroup = isGroup
|
||||
view.isReadOnly = isReadOnly
|
||||
|
||||
view.setMarkAsReadClickListener {
|
||||
onMarkConversationAsRead?.invoke()
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
|||
val modalBottomSheet = ConversationDialogFragment(
|
||||
model.isMuted.value == true,
|
||||
model.isGroup,
|
||||
model.isReadOnly,
|
||||
{ // onDismiss
|
||||
adapter.resetSelection()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
|||
Capabilities.Conference.toInt()
|
||||
)
|
||||
|
||||
val isReadOnly = chatRoom.isReadOnly
|
||||
|
||||
val subject = MutableLiveData<String>()
|
||||
|
||||
val lastUpdateTime = MutableLiveData<Long>()
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
<variable
|
||||
name="isGroup"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="isReadOnly"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -56,6 +59,7 @@
|
|||
android:background="@drawable/menu_item_background"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:drawableStart="@{isMuted ? @drawable/bell_simple : @drawable/bell_simple_slash, default=@drawable/bell_simple_slash}"
|
||||
android:visibility="@{isReadOnly ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintBottom_toTopOf="@id/call"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
@ -70,7 +74,7 @@
|
|||
android:background="@drawable/menu_item_background"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:drawableStart="@drawable/phone"
|
||||
android:visibility="@{isGroup ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{isGroup || isReadOnly ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintBottom_toTopOf="@id/delete_chat_room"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
@ -92,7 +96,7 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{leaveClickListener}"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:visibility="@{isGroup ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{isGroup && !isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
android:id="@+id/leave_group"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue