More fixes

- Now possible to archive/unarchive conversations from dialog
- Now possible to archive and unarchive conversations in settings without leaving the screen
- Better UX

Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
rapterjet2004 2025-01-17 11:43:15 -06:00
parent 6104116ba9
commit bbb2dc28f2
No known key found for this signature in database
GPG Key ID: A6A69CFF84968EA1
6 changed files with 98 additions and 1 deletions

View File

@ -820,6 +820,7 @@ class ConversationInfoActivity :
binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint) binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint)
} }
} }
viewModel.getRoom(conversationUser, conversationToken)
} }
if (conversation!!.hasArchived) { if (conversation!!.hasArchived) {

View File

@ -455,6 +455,14 @@ class ConversationsListActivity :
newItems.add(i) 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) adapter!!.updateDataSet(newItems, true)
setFilterableItems(newItems) setFilterableItems(newItems)

View File

@ -26,6 +26,7 @@ import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.api.NcApiCoroutines import com.nextcloud.talk.api.NcApiCoroutines
import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.conversation.RenameConversationDialogFragment import com.nextcloud.talk.conversation.RenameConversationDialogFragment
import com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel
import com.nextcloud.talk.conversationlist.ConversationsListActivity import com.nextcloud.talk.conversationlist.ConversationsListActivity
import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.databinding.DialogConversationOperationsBinding import com.nextcloud.talk.databinding.DialogConversationOperationsBinding
@ -68,6 +69,9 @@ class ConversationsListBottomDialog(
@Inject @Inject
lateinit var viewThemeUtils: ViewThemeUtils lateinit var viewThemeUtils: ViewThemeUtils
@Inject
lateinit var conversationInfoViewModel: ConversationInfoViewModel
@Inject @Inject
lateinit var userManager: UserManager lateinit var userManager: UserManager
@ -189,6 +193,26 @@ class ConversationsListBottomDialog(
dismiss() 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 {
val currentUser = userManager.currentUser.blockingGet()
val token = conversation.token
lifecycleScope.launch {
if (conversation.hasArchived) {
conversationInfoViewModel.unarchiveConversation(currentUser, token)
} else {
conversationInfoViewModel.archiveConversation(currentUser, token)
}
}
activity.fetchRooms()
dismiss()
}
binding.conversationOperationRename.setOnClickListener { binding.conversationOperationRename.setOnClickListener {
renameConversation() renameConversation()
} }

View File

@ -168,7 +168,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="gone">
<ImageView <ImageView
android:id="@+id/empty_list_icon" android:id="@+id/empty_list_icon"
@ -210,6 +210,38 @@
android:textSize="16sp" /> android:textSize="16sp" />
</RelativeLayout> </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/ic_list_empty_error"
app:tint="@color/hwSecurityRed" />
<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/conversation_item_header"
android:textSize="22sp" />
</RelativeLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayoutView" android:id="@+id/swipeRefreshLayoutView"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -195,6 +195,37 @@
android:textSize="@dimen/bottom_sheet_text_size" /> android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout> </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 <LinearLayout
android:id="@+id/conversation_operation_rename" android:id="@+id/conversation_operation_rename"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -847,4 +847,5 @@ How to translate with transifex:
<string name="user_absence_for_one_day">%1$s is out of office today</string> <string name="user_absence_for_one_day">%1$s is out of office today</string>
<string name="user_absence_replacement">Replacement: </string> <string name="user_absence_replacement">Replacement: </string>
<string name="resend_message">Resend</string> <string name="resend_message">Resend</string>
<string name="no_conversations_archived">No conversations archived</string>
</resources> </resources>