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

View File

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

View File

@ -30,11 +30,10 @@ class RoomMemberSummaryFilter @Inject constructor() : Predicate<RoomMemberSummar
return true
}
// if filter is "Jo Do", it should match "John Doe"
return filter.split(" ").fold(true) { acc, s ->
acc
&& (roomMemberSummary.displayName?.contains(s, ignoreCase = true).orFalse()
return filter.split(" ").all {
roomMemberSummary.displayName?.contains(it, ignoreCase = true).orFalse()
// 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
android:id="@+id/matrixItemTitle"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?riotx_text_primary"
@ -49,19 +48,17 @@
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@+id/matrixItemSubtitle"
app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginStart="0dp"
app:layout_goneMarginEnd="80dp"
tools:text="@sample/matrix.json/data/displayName" />
<TextView
android:id="@+id/matrixItemSubtitle"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:drawablePadding="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?riotx_text_secondary"
@ -69,13 +66,11 @@
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/matrixItemPowerLevelLabel"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
app:layout_goneMarginStart="0dp"
app:layout_goneMarginEnd="8dp"
tools:text="@sample/matrix.json/data/mxid" />
<TextView
android:id="@+id/matrixItemPowerLevelLabel"
android:layout_width="wrap_content"
@ -101,5 +96,4 @@
app:tint="?riotx_text_secondary"
tools:ignore="MissingPrefix" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

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