Change call to action in filter room when space selected

This commit is contained in:
Valere 2021-09-30 11:56:07 +02:00
parent 701b0fbeef
commit 4880df3555
4 changed files with 15 additions and 1 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

@ -12,6 +12,7 @@
android:layout_gravity="center"
android:layout_marginTop="56dp"
android:text="@string/room_filtering_footer_title"
android:layout_marginBottom="@dimen/layout_vertical_margin"
android:textColor="?vctr_content_secondary" />
<Button
@ -20,7 +21,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