mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-21 21:58:09 +00:00
Added entries to conversation popup menu + mute indicator below conversation title
This commit is contained in:
parent
570492cea9
commit
8b1ff7af2b
7 changed files with 151 additions and 27 deletions
|
|
@ -725,6 +725,9 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
|||
true
|
||||
)
|
||||
|
||||
popupView.conversationMuted = viewModel.isMuted.value == true
|
||||
popupView.ephemeralMessagesAvailable = viewModel.isEndToEndEncrypted.value == true || viewModel.isGroup.value == true
|
||||
|
||||
popupView.setGoToInfoClickListener {
|
||||
goToInfoFragment()
|
||||
popupWindow.dismiss()
|
||||
|
|
@ -736,6 +739,23 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
|||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
popupView.setMuteClickListener {
|
||||
Log.i("$TAG Muting conversation")
|
||||
viewModel.mute()
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
popupView.setUnmuteClickListener {
|
||||
Log.i("$TAG Un-muting conversation")
|
||||
viewModel.unmute()
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
popupView.setConfigureEphemeralMessagesClickListener {
|
||||
// TODO: go to configure ephemeral messages
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
// Elevation is for showing a shadow around the popup
|
||||
popupWindow.elevation = 20f
|
||||
popupWindow.showAsDropDown(view, 0, 0, Gravity.BOTTOM)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val events = MutableLiveData<ArrayList<EventLogModel>>()
|
||||
|
||||
var isEndToEndEncrypted = MutableLiveData<Boolean>()
|
||||
val isMuted = MutableLiveData<Boolean>()
|
||||
|
||||
val isEndToEndEncrypted = MutableLiveData<Boolean>()
|
||||
|
||||
val isGroup = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
@ -435,6 +437,22 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun mute() {
|
||||
coreContext.postOnCoreThread {
|
||||
chatRoom.muted = true
|
||||
isMuted.postValue(chatRoom.muted)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun unmute() {
|
||||
coreContext.postOnCoreThread {
|
||||
chatRoom.muted = false
|
||||
isMuted.postValue(chatRoom.muted)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateCurrentlyDisplayedConversation() {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
@ -458,6 +476,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
isEndToEndEncrypted.postValue(
|
||||
chatRoom.hasCapability(ChatRoom.Capabilities.Encrypted.toInt())
|
||||
)
|
||||
isMuted.postValue(chatRoom.muted)
|
||||
|
||||
computeConversationInfo()
|
||||
|
||||
|
|
|
|||
|
|
@ -64,16 +64,15 @@
|
|||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:padding="15dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{backClickListener}"
|
||||
android:visibility="@{viewModel.showBackButton && !viewModel.searchBarVisible ? View.VISIBLE : View.GONE}"
|
||||
android:src="@drawable/caret_left"
|
||||
app:tint="?attr/color_main1_500"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
|
|
@ -115,7 +114,7 @@
|
|||
android:id="@+id/title"
|
||||
android:onClick="@{goToInfoClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:maxLines="1"
|
||||
|
|
@ -126,7 +125,19 @@
|
|||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toStartOf="@id/start_call"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/back"
|
||||
app:layout_constraintBottom_toTopOf="@id/muted"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/muted"
|
||||
android:layout_width="@dimen/small_icon_size"
|
||||
android:layout_height="@dimen/small_icon_size"
|
||||
android:src="@drawable/bell_simple_slash"
|
||||
android:visibility="@{viewModel.isMuted ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:tint="@color/orange_main_400"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/show_menu"
|
||||
|
|
@ -136,8 +147,8 @@
|
|||
android:padding="15dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/dots_three_vertical"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toTopOf="@id/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:tint="?attr/color_main2_500"/>
|
||||
|
||||
|
|
@ -148,9 +159,9 @@
|
|||
android:layout_height="0dp"
|
||||
android:padding="15dp"
|
||||
android:src="@drawable/phone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toTopOf="@id/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:layout_constraintEnd_toStartOf="@id/show_menu"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:tint="?attr/color_main2_500" />
|
||||
|
||||
<ImageView
|
||||
|
|
|
|||
|
|
@ -6,28 +6,63 @@
|
|||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="android.graphics.Typeface" />
|
||||
<variable
|
||||
name="goToInfoClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="searchClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="goToInfoClickListener"
|
||||
name="muteClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="unmuteClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="configureEphemeralMessagesClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="conversationMuted"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="ephemeralMessagesAvailable"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@drawable/shape_round_popup_menu_background">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/info"
|
||||
android:onClick="@{goToInfoClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/conversation_menu_go_to_info"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/info"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/search"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/search"
|
||||
android:onClick="@{searchClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/conversation_menu_search_in_messages"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
|
|
@ -37,31 +72,67 @@
|
|||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/info"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/info"
|
||||
app:layout_constraintBottom_toTopOf="@id/mute"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/info"
|
||||
android:onClick="@{goToInfoClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/mute"
|
||||
android:onClick="@{muteClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="@string/conversation_menu_go_to_info"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/conversation_action_mute"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/info"
|
||||
android:drawableStart="@drawable/bell_simple_slash"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{conversationMuted ? View.GONE : View.VISIBLE}"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search"
|
||||
app:layout_constraintBottom_toTopOf="@id/unmute"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/unmute"
|
||||
android:onClick="@{unmuteClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/conversation_action_unmute"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/bell_simple"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{conversationMuted ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/mute"
|
||||
app:layout_constraintBottom_toTopOf="@id/ephemeral"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/ephemeral"
|
||||
android:onClick="@{configureEphemeralMessagesClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/conversation_menu_configure_ephemeral_messages"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/clock_countdown"
|
||||
android:drawablePadding="5dp"
|
||||
android:visibility="@{ephemeralMessagesAvailable ? View.VISIBLE : View.GONE}"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/unmute"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
|||
|
|
@ -377,6 +377,7 @@
|
|||
android:padding="5dp"
|
||||
android:drawableEnd="@{viewModel.expandDevicesTrust ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
|
||||
android:drawableTint="?attr/color_main2_600"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@id/trust_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/info_background"/>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<color name="orange_main_100">#FFEACB</color>
|
||||
<color name="orange_main_100_alpha_50">#80FFEACB</color>
|
||||
<color name="orange_main_300">#FFB266</color>
|
||||
<color name="orange_main_400">#FF923F</color>
|
||||
<color name="orange_main_500">#FF5E00</color>
|
||||
<color name="orange_main_700">#B72D00</color>
|
||||
<color name="orange_main_900">#662600</color>
|
||||
|
|
|
|||
|
|
@ -425,6 +425,7 @@
|
|||
<string name="conversation_reply_to_message_title">Replying to:</string>
|
||||
<string name="conversation_menu_search_in_messages">Search</string>
|
||||
<string name="conversation_menu_go_to_info">Conversation info</string>
|
||||
<string name="conversation_menu_configure_ephemeral_messages">Ephemeral messages</string>
|
||||
<string name="conversation_filter_no_matching_result">No matching result</string>
|
||||
|
||||
<string name="conversation_info_participants_list_title">Group members</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue