diff --git a/library/ui-styles/src/main/res/values/colors.xml b/library/ui-styles/src/main/res/values/colors.xml index d887e7774e..3217622ed0 100644 --- a/library/ui-styles/src/main/res/values/colors.xml +++ b/library/ui-styles/src/main/res/values/colors.xml @@ -136,4 +136,9 @@ #17191C #FF4B55 + + + #FFFFFF + #21262C + diff --git a/library/ui-styles/src/main/res/values/theme_dark.xml b/library/ui-styles/src/main/res/values/theme_dark.xml index 7177687fdd..63237ae8f8 100644 --- a/library/ui-styles/src/main/res/values/theme_dark.xml +++ b/library/ui-styles/src/main/res/values/theme_dark.xml @@ -30,6 +30,7 @@ @color/element_system_dark @color/vctr_message_bubble_inbound_dark @color/vctr_message_bubble_outbound_dark + @color/vctr_badge_color_border_dark #61708B diff --git a/library/ui-styles/src/main/res/values/theme_light.xml b/library/ui-styles/src/main/res/values/theme_light.xml index c90c021591..5015c93ca9 100644 --- a/library/ui-styles/src/main/res/values/theme_light.xml +++ b/library/ui-styles/src/main/res/values/theme_light.xml @@ -30,6 +30,7 @@ @color/element_background_light @color/vctr_message_bubble_inbound_light @color/vctr_message_bubble_outbound_light + @color/vctr_badge_color_border_light #61708B diff --git a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt index 5fd0d65167..8e762fda96 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt @@ -19,6 +19,7 @@ package im.vector.app.features.home.room.threads.list.views import android.os.Bundle import android.view.LayoutInflater import android.view.Menu +import android.view.MenuInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup @@ -70,6 +71,16 @@ class ThreadListFragment @Inject constructor( analyticsScreenName = MobileScreen.ScreenName.ThreadList } + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + super.onCreateOptionsMenu(menu, inflater) + + menu.findItem(R.id.menu_thread_list_filter)?.let { menuItem -> + menuItem.actionView.setOnClickListener { + onOptionsItemSelected(menuItem) + } + } + } + override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.menu_thread_list_filter -> { @@ -82,6 +93,9 @@ class ThreadListFragment @Inject constructor( override fun onPrepareOptionsMenu(menu: Menu) { withState(threadListViewModel) { state -> + val filterIcon = menu.findItem(R.id.menu_thread_list_filter).actionView + val filterBadge = filterIcon.findViewById(R.id.threadListFilterBadge) + filterBadge.isVisible = state.shouldFilterThreads when (threadListViewModel.canHomeserverUseThreading()) { true -> menu.findItem(R.id.menu_thread_list_filter).isVisible = !state.threadSummaryList.invoke().isNullOrEmpty() false -> menu.findItem(R.id.menu_thread_list_filter).isVisible = !state.rootThreadEventList.invoke().isNullOrEmpty() @@ -112,7 +126,8 @@ class ThreadListFragment @Inject constructor( private fun initTextConstants() { views.threadListEmptyNoticeTextView.text = String.format( resources.getString(R.string.thread_list_empty_notice), - resources.getString(R.string.reply_in_thread)) + resources.getString(R.string.reply_in_thread) + ) } private fun initBetaFeedback() { @@ -149,7 +164,8 @@ class ThreadListFragment @Inject constructor( displayName = threadListArgs.displayName, avatarUrl = threadListArgs.avatarUrl, roomEncryptionTrustLevel = null, - rootThreadEventId = threadSummary.rootEventId) + rootThreadEventId = threadSummary.rootEventId + ) (activity as? ThreadsActivity)?.navigateToThreadTimeline(roomThreadDetailArgs) } @@ -159,7 +175,8 @@ class ThreadListFragment @Inject constructor( displayName = threadListArgs.displayName, avatarUrl = threadListArgs.avatarUrl, roomEncryptionTrustLevel = null, - rootThreadEventId = timelineEvent.eventId) + rootThreadEventId = timelineEvent.eventId + ) (activity as? ThreadsActivity)?.navigateToThreadTimeline(threadTimelineArgs) } diff --git a/vector/src/main/res/drawable/thread_filter_badge.xml b/vector/src/main/res/drawable/thread_filter_badge.xml new file mode 100644 index 0000000000..c9a01197c8 --- /dev/null +++ b/vector/src/main/res/drawable/thread_filter_badge.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/vector/src/main/res/layout/item_thread.xml b/vector/src/main/res/layout/item_thread.xml index 921f0663b1..9199a72628 100644 --- a/vector/src/main/res/layout/item_thread.xml +++ b/vector/src/main/res/layout/item_thread.xml @@ -92,7 +92,7 @@ android:maxWidth="496dp" android:minWidth="144dp" android:paddingTop="8dp" - android:paddingBottom="8dp" + android:paddingBottom="12dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@id/threadSummaryTitleTextView" app:layout_constraintTop_toBottomOf="@id/threadSummaryRootMessageTextView" @@ -108,4 +108,4 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@id/threadSummaryConstraintLayout" app:layout_constraintTop_toBottomOf="@id/threadSummaryConstraintLayout" /> - \ No newline at end of file + diff --git a/vector/src/main/res/layout/view_thread_list_filter.xml b/vector/src/main/res/layout/view_thread_list_filter.xml new file mode 100644 index 0000000000..7bdc994f43 --- /dev/null +++ b/vector/src/main/res/layout/view_thread_list_filter.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + diff --git a/vector/src/main/res/menu/menu_thread_list.xml b/vector/src/main/res/menu/menu_thread_list.xml index 6da0f80112..d9fb1e7997 100644 --- a/vector/src/main/res/menu/menu_thread_list.xml +++ b/vector/src/main/res/menu/menu_thread_list.xml @@ -5,9 +5,10 @@ + app:showAsAction="always" + tools:visible="true" /> - \ No newline at end of file +