Some cleanup

This commit is contained in:
Benoit Marty 2021-05-05 17:46:58 +02:00
parent 99d4471799
commit 2acfb29416
5 changed files with 23 additions and 35 deletions

View File

@ -17,6 +17,7 @@
package im.vector.app.core.epoxy.profiles package im.vector.app.core.epoxy.profiles
import android.view.View import android.view.View
import androidx.annotation.CallSuper
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import im.vector.app.core.epoxy.VectorEpoxyModel import im.vector.app.core.epoxy.VectorEpoxyModel
@ -34,6 +35,7 @@ abstract class BaseProfileMatrixItem<T : ProfileMatrixItem.Holder> : VectorEpoxy
var userEncryptionTrustLevel: RoomEncryptionTrustLevel? = null var userEncryptionTrustLevel: RoomEncryptionTrustLevel? = null
@EpoxyAttribute var clickListener: View.OnClickListener? = null @EpoxyAttribute var clickListener: View.OnClickListener? = null
@CallSuper
override fun bind(holder: T) { override fun bind(holder: T) {
super.bind(holder) super.bind(holder)
val bestName = matrixItem.getBestName() val bestName = matrixItem.getBestName()

View File

@ -284,21 +284,20 @@ class DefaultNavigator @Inject constructor(
} }
override fun openCreateDirectRoom(context: Context) { override fun openCreateDirectRoom(context: Context) {
when (val currentGroupingMethod = appStateHandler.getCurrentRoomGroupingMethod()) { val intent = when (val currentGroupingMethod = appStateHandler.getCurrentRoomGroupingMethod()) {
is RoomGroupingMethod.ByLegacyGroup -> { is RoomGroupingMethod.ByLegacyGroup -> {
val intent = CreateDirectRoomActivity.getIntent(context) CreateDirectRoomActivity.getIntent(context)
context.startActivity(intent)
} }
is RoomGroupingMethod.BySpace -> { is RoomGroupingMethod.BySpace -> {
if (currentGroupingMethod.spaceSummary != null) { if (currentGroupingMethod.spaceSummary != null) {
val intent = SpacePeopleActivity.newIntent(context, currentGroupingMethod.spaceSummary.roomId) SpacePeopleActivity.newIntent(context, currentGroupingMethod.spaceSummary.roomId)
context.startActivity(intent)
} else { } else {
val intent = CreateDirectRoomActivity.getIntent(context) CreateDirectRoomActivity.getIntent(context)
context.startActivity(intent)
} }
} }
} else -> null
} ?: return
context.startActivity(intent)
} }
override fun openInviteUsersToRoom(context: Context, roomId: String) { override fun openInviteUsersToRoom(context: Context, roomId: String) {

View File

@ -30,11 +30,10 @@ class RoomMemberSummaryFilter @Inject constructor() : Predicate<RoomMemberSummar
return true return true
} }
// if filter is "Jo Do", it should match "John Doe" // if filter is "Jo Do", it should match "John Doe"
return filter.split(" ").fold(true) { acc, s -> return filter.split(" ").all {
acc roomMemberSummary.displayName?.contains(it, ignoreCase = true).orFalse()
&& (roomMemberSummary.displayName?.contains(s, ignoreCase = true).orFalse()
// We should maybe exclude the domain from the userId // We should maybe exclude the domain from the userId
|| roomMemberSummary.userId.contains(s, ignoreCase = true)) || roomMemberSummary.userId.contains(it, ignoreCase = true)
} }
} }
} }

View File

@ -37,11 +37,10 @@
<TextView <TextView
android:id="@+id/matrixItemTitle" android:id="@+id/matrixItemTitle"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_primary" android:textColor="?riotx_text_primary"
@ -49,19 +48,17 @@
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/matrixItemSubtitle" app:layout_constraintBottom_toTopOf="@+id/matrixItemSubtitle"
app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel" app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar" app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="0dp" app:layout_goneMarginEnd="80dp"
tools:text="@sample/matrix.json/data/displayName" /> tools:text="@sample/matrix.json/data/displayName" />
<TextView <TextView
android:id="@+id/matrixItemSubtitle" android:id="@+id/matrixItemSubtitle"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_secondary" android:textColor="?riotx_text_secondary"
@ -69,13 +66,11 @@
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel" app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar" app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle" app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
app:layout_goneMarginStart="0dp" app:layout_goneMarginEnd="8dp"
tools:text="@sample/matrix.json/data/mxid" /> tools:text="@sample/matrix.json/data/mxid" />
<TextView <TextView
android:id="@+id/matrixItemPowerLevelLabel" android:id="@+id/matrixItemPowerLevelLabel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -101,5 +96,4 @@
app:tint="?riotx_text_secondary" app:tint="?riotx_text_secondary"
tools:ignore="MissingPrefix" /> tools:ignore="MissingPrefix" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -37,11 +37,10 @@
<TextView <TextView
android:id="@+id/matrixItemTitle" android:id="@+id/matrixItemTitle"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_primary" android:textColor="?riotx_text_primary"
@ -49,19 +48,17 @@
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/matrixItemSubtitle" app:layout_constraintBottom_toTopOf="@+id/matrixItemSubtitle"
app:layout_constraintEnd_toStartOf="@+id/matrixItemProgress" app:layout_constraintEnd_toStartOf="@+id/matrixItemProgress"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar" app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="0dp" app:layout_goneMarginEnd="80dp"
tools:text="@sample/matrix.json/data/displayName" /> tools:text="@sample/matrix.json/data/displayName" />
<TextView <TextView
android:id="@+id/matrixItemSubtitle" android:id="@+id/matrixItemSubtitle"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_secondary" android:textColor="?riotx_text_secondary"
@ -69,10 +66,9 @@
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/matrixItemProgress" app:layout_constraintEnd_toStartOf="@+id/matrixItemProgress"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar" app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle" app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
app:layout_goneMarginStart="0dp" app:layout_goneMarginEnd="8dp"
tools:text="@sample/matrix.json/data/mxid" /> tools:text="@sample/matrix.json/data/mxid" />
<ProgressBar <ProgressBar
@ -93,12 +89,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:src="@drawable/ic_arrow_right" android:src="@drawable/ic_arrow_right"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:tint="?riotx_text_secondary" app:tint="?riotx_text_secondary"
tools:ignore="MissingPrefix" tools:ignore="MissingPrefix" />
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>