mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Display in_progress drawable + text on chat rooms list cell to show removal is in progress
This commit is contained in:
parent
d30f7ba5ba
commit
bd9947a705
5 changed files with 23 additions and 3 deletions
|
|
@ -78,6 +78,8 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
|||
|
||||
val avatarModel = MutableLiveData<ContactAvatarModel>()
|
||||
|
||||
val isBeingDeleted = MutableLiveData<Boolean>()
|
||||
|
||||
private var lastMessage: ChatMessage? = null
|
||||
|
||||
private val chatRoomListener = object : ChatRoomListenerStub() {
|
||||
|
|
@ -232,9 +234,12 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
|||
@UiThread
|
||||
fun delete() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
Log.i("$TAG Deleting conversation [$id]")
|
||||
isBeingDeleted.postValue(true)
|
||||
ShortcutUtils.removeShortcutToChatRoom(chatRoom)
|
||||
core.deleteChatRoom(chatRoom)
|
||||
Log.i("$TAG Conversation [$id] has been deleted")
|
||||
isBeingDeleted.postValue(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod
|
|||
when (state) {
|
||||
ChatRoom.State.Created, ChatRoom.State.Instantiated, ChatRoom.State.Deleted -> {
|
||||
computeChatRoomsList(currentFilter)
|
||||
// TODO: display toast
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ private fun loadImageForChatBubble(imageView: ImageView, file: String?, grid: Bo
|
|||
}
|
||||
|
||||
@UiThread
|
||||
fun ImageView.startAnimatedDrawable() {
|
||||
@BindingAdapter("animatedDrawable")
|
||||
fun ImageView.startAnimatedDrawable(start: Boolean = true) {
|
||||
drawable.apply {
|
||||
when (this) {
|
||||
is AnimatedVectorDrawableCompat -> start()
|
||||
|
|
|
|||
|
|
@ -62,6 +62,18 @@
|
|||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/removal_in_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/animated_in_progress"
|
||||
android:visibility="@{model.isBeingDeleted ? View.VISIBLE : View.GONE, default=gone}"
|
||||
animatedDrawable="@{true}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar"
|
||||
app:layout_constraintEnd_toEndOf="@id/avatar"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/unread_count_right_border"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -105,10 +117,10 @@
|
|||
android:gravity="center_vertical|start"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:text="@{model.isComposing ? model.composingLabel : model.lastMessageText, default=`Hello there!`}"
|
||||
android:text="@{model.isBeingDeleted ? @string/conversations_list_is_being_removed_label : model.isComposing ? model.composingLabel : model.lastMessageText, default=`Hello there!`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_main2_400"
|
||||
android:textStyle="@{model.unreadMessageCount > 0 ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
android:textStyle="@{model.isBeingDeleted || model.unreadMessageCount > 0 ? Typeface.BOLD : Typeface.NORMAL}"
|
||||
app:layout_constraintStart_toStartOf="@id/name"
|
||||
app:layout_constraintEnd_toStartOf="@id/right_border"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
|
|
|
|||
|
|
@ -346,6 +346,7 @@
|
|||
<string name="call_incoming_for_account">Incoming call for %s</string>
|
||||
|
||||
<string name="conversations_list_empty">No conversation for the moment…</string>
|
||||
<string name="conversations_list_is_being_removed_label">Removal in progress</string>
|
||||
<string name="conversations_last_message_format">%s:</string>
|
||||
<string name="conversation_action_mark_as_read">Mark as read</string>
|
||||
<string name="conversation_action_mute">Mute</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue