mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Merge pull request #4624 from nextcloud/issue-4607-4608-archive-conversations-follow-up
Follow up fixes for 'Archive Conversations
This commit is contained in:
commit
b3f32a0761
@ -820,6 +820,7 @@ class ConversationInfoActivity :
|
||||
binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint)
|
||||
}
|
||||
}
|
||||
viewModel.getRoom(conversationUser, conversationToken)
|
||||
}
|
||||
|
||||
if (conversation!!.hasArchived) {
|
||||
|
@ -455,8 +455,20 @@ class ConversationsListActivity :
|
||||
newItems.add(i)
|
||||
}
|
||||
}
|
||||
|
||||
val archiveFilterOn = filterState[FilterConversationFragment.ARCHIVE] ?: false
|
||||
if (archiveFilterOn && newItems.isEmpty()) {
|
||||
binding.noArchivedConversationLayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.noArchivedConversationLayout.visibility = View.GONE
|
||||
}
|
||||
|
||||
adapter!!.updateDataSet(newItems, true)
|
||||
setFilterableItems(newItems)
|
||||
if (archiveFilterOn) {
|
||||
// Never a notification from archived conversations
|
||||
binding.newMentionPopupBubble.visibility = View.GONE
|
||||
}
|
||||
|
||||
updateFilterConversationButtonColor()
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import com.nextcloud.talk.api.NcApi
|
||||
import com.nextcloud.talk.api.NcApiCoroutines
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.conversation.RenameConversationDialogFragment
|
||||
import com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel
|
||||
import com.nextcloud.talk.conversationlist.ConversationsListActivity
|
||||
import com.nextcloud.talk.data.user.model.User
|
||||
import com.nextcloud.talk.databinding.DialogConversationOperationsBinding
|
||||
@ -68,6 +69,9 @@ class ConversationsListBottomDialog(
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
@Inject
|
||||
lateinit var conversationInfoViewModel: ConversationInfoViewModel
|
||||
|
||||
@Inject
|
||||
lateinit var userManager: UserManager
|
||||
|
||||
@ -189,6 +193,16 @@ class ConversationsListBottomDialog(
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.conversationArchiveText.text = if (conversation.hasArchived) {
|
||||
this.activity.resources.getString(R.string.unarchive_conversation)
|
||||
} else {
|
||||
this.activity.resources.getString(R.string.archive_conversation)
|
||||
}
|
||||
|
||||
binding.conversationArchive.setOnClickListener {
|
||||
handleArchiving()
|
||||
}
|
||||
|
||||
binding.conversationOperationRename.setOnClickListener {
|
||||
renameConversation()
|
||||
}
|
||||
@ -202,6 +216,33 @@ class ConversationsListBottomDialog(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleArchiving() {
|
||||
val currentUser = userManager.currentUser.blockingGet()
|
||||
val token = conversation.token
|
||||
lifecycleScope.launch {
|
||||
if (conversation.hasArchived) {
|
||||
conversationInfoViewModel.unarchiveConversation(currentUser, token)
|
||||
activity.showSnackbar(
|
||||
String.format(
|
||||
context.resources.getString(R.string.unarchived_conversation),
|
||||
conversation.displayName
|
||||
)
|
||||
)
|
||||
dismiss()
|
||||
} else {
|
||||
conversationInfoViewModel.archiveConversation(currentUser, token)
|
||||
activity.showSnackbar(
|
||||
String.format(
|
||||
context.resources.getString(R.string.archived_conversation),
|
||||
conversation.displayName
|
||||
)
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
activity.fetchRooms()
|
||||
}
|
||||
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
@SuppressLint("StringFormatInvalid", "TooGenericExceptionCaught")
|
||||
private fun addConversationToFavorites() {
|
||||
|
@ -410,7 +410,6 @@
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="40dp"
|
||||
@ -425,47 +424,8 @@
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/show_banned_participants"
|
||||
android:textSize="@dimen/headline_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/archive_conversation_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/standard_margin"
|
||||
android:paddingTop="@dimen/standard_half_margin"
|
||||
android:paddingEnd="@dimen/standard_margin"
|
||||
android:paddingBottom="@dimen/standard_half_margin"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archive_conversation_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="@dimen/standard_margin"
|
||||
android:contentDescription="@null"
|
||||
tools:src="@drawable/outline_archive_24"
|
||||
app:tint="@color/grey_600" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/archive_conversation_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
tools:text="@string/unarchive_conversation"
|
||||
android:textSize="@dimen/headline_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/archive_conversation_text_hint"
|
||||
android:layout_marginHorizontal="@dimen/standard_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/archive_hint" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/danger_zone_options"
|
||||
android:layout_width="match_parent"
|
||||
@ -482,6 +442,41 @@
|
||||
android:textSize="@dimen/headline_text_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/archive_conversation_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/standard_margin"
|
||||
android:paddingEnd="@dimen/standard_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/archive_conversation_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="@dimen/standard_margin"
|
||||
android:contentDescription="@null"
|
||||
app:tint="@color/grey_600"
|
||||
tools:src="@drawable/outline_archive_24" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/archive_conversation_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/headline_text_size"
|
||||
tools:text="@string/unarchive_conversation" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/archive_conversation_text_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/standard_margin"
|
||||
android:text="@string/archive_hint"
|
||||
android:textColor="@color/disabled_text" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/leaveConversationAction"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -168,7 +168,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
tools:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/empty_list_icon"
|
||||
@ -210,6 +210,38 @@
|
||||
android:textSize="16sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/no_archived_conversation_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_archived_conversation_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:contentDescription="@string/nc_app_product_name"
|
||||
android:src="@drawable/outline_archive_24"
|
||||
app:tint="@color/grey_600" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/no_archived_conversation_icon"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:paddingTop="@dimen/standard_padding"
|
||||
android:paddingBottom="@dimen/standard_half_padding"
|
||||
android:text="@string/no_conversations_archived"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="22sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayoutView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -195,6 +195,37 @@
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/conversation_archive"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/standard_padding"
|
||||
android:paddingEnd="@dimen/standard_padding"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/outline_archive_24"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/conversation_archive_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="40dp"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/archive_conversation"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/conversation_operation_rename"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -847,4 +847,7 @@ How to translate with transifex:
|
||||
<string name="user_absence_for_one_day">%1$s is out of office today</string>
|
||||
<string name="user_absence_replacement">Replacement: </string>
|
||||
<string name="resend_message">Resend</string>
|
||||
<string name="no_conversations_archived">No conversations archived</string>
|
||||
<string name="archived_conversation">Archived %1$s</string>
|
||||
<string name="unarchived_conversation">Unarchived %1$s</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user