Merge pull request #4124 from vector-im/feature/bca/spaces_fix_3048

Change call to action in filter room when space selected
This commit is contained in:
Adam Brown 2021-10-04 09:12:19 +01:00 committed by GitHub
commit e0a6e82661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

1
changelog.d/3048.bugfix Normal file
View File

@ -0,0 +1 @@
Room filter no results bad CTA in space mode when a space selected

View File

@ -17,6 +17,7 @@
package im.vector.app.features.home.room.filtered
import android.widget.Button
import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
@ -33,11 +34,21 @@ abstract class FilteredRoomFooterItem : VectorEpoxyModel<FilteredRoomFooterItem.
@EpoxyAttribute
var currentFilter: String = ""
@EpoxyAttribute
var inSpace: Boolean = false
override fun bind(holder: Holder) {
super.bind(holder)
holder.createRoomButton.onClick { listener?.createRoom(currentFilter) }
holder.createDirectChat.onClick { listener?.createDirectChat() }
holder.openRoomDirectory.onClick { listener?.openRoomDirectory(currentFilter) }
holder.openRoomDirectory.setText(
if (inSpace) R.string.space_explore_activity_title else R.string.room_filtering_footer_open_room_directory
)
// The explore space screen will have a shortcut to create
holder.createRoomButton.isVisible = !inSpace
}
class Holder : VectorEpoxyHolder() {

View File

@ -24,6 +24,7 @@ import im.vector.app.core.resources.UserPreferencesProvider
import im.vector.app.features.home.RoomListDisplayMode
import im.vector.app.features.home.room.filtered.FilteredRoomFooterItem
import im.vector.app.features.home.room.filtered.filteredRoomFooterItem
import im.vector.app.space
import javax.inject.Inject
class RoomListFooterController @Inject constructor(
@ -41,6 +42,7 @@ class RoomListFooterController @Inject constructor(
id("filter_footer")
listener(host.listener)
currentFilter(data.roomFilter)
inSpace(data.currentRoomGrouping.invoke()?.space() != null)
}
}
else -> {

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:colorBackground"
@ -11,6 +12,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="56dp"
android:layout_marginBottom="@dimen/layout_vertical_margin"
android:text="@string/room_filtering_footer_title"
android:textColor="?vctr_content_secondary" />
@ -20,7 +22,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/layout_vertical_margin"
android:text="@string/room_filtering_footer_create_new_room" />
<Button
@ -31,6 +32,7 @@
android:layout_gravity="center"
android:text="@string/room_filtering_footer_create_new_direct_message" />
<!-- Note: can also be used to open the SpaceExploreActivity-->
<Button
android:id="@+id/roomFilterFooterOpenRoomDirectory"
style="@style/Widget.Vector.Button.Text"
@ -38,6 +40,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/layout_vertical_margin"
android:text="@string/room_filtering_footer_open_room_directory" />
tools:text="@string/room_filtering_footer_open_room_directory" />
</LinearLayout>