Fix issue with Avatar renderer in invitation screen

This commit is contained in:
Benoit Marty 2019-05-29 15:07:08 +02:00
parent e959fe2e9d
commit 241ee1cb9d
3 changed files with 22 additions and 19 deletions

View File

@ -67,10 +67,12 @@ object AvatarRenderer {
identifier: String,
name: String?,
target: Target<Drawable>) {
if (name.isNullOrEmpty()) {
return
val displayName = if (name.isNullOrBlank()) {
identifier
} else {
name
}
val placeholder = getPlaceholderDrawable(context, identifier, name)
val placeholder = getPlaceholderDrawable(context, identifier, displayName)
buildGlideRequest(glideRequest, avatarUrl)
.placeholder(placeholder)
.into(target)

View File

@ -95,17 +95,7 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback {
createGroupRoomButton.setOnClickListener {
navigator.openRoomDirectory()
}
}

private fun setupRecyclerView() {
val layoutManager = LinearLayoutManager(context)
val stateRestorer = LayoutManagerStateRestorer(layoutManager).register()
epoxyRecyclerView.layoutManager = layoutManager
epoxyRecyclerView.itemAnimator = RoomListAnimator()
roomController.callback = this
roomController.addModelBuildListener { it.dispatchTo(stateRestorer) }
stateView.contentView = epoxyRecyclerView
epoxyRecyclerView.setController(roomController)
// Hide FAB when list is scrolling
epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
@ -124,6 +114,17 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback {
})
}

private fun setupRecyclerView() {
val layoutManager = LinearLayoutManager(context)
val stateRestorer = LayoutManagerStateRestorer(layoutManager).register()
epoxyRecyclerView.layoutManager = layoutManager
epoxyRecyclerView.itemAnimator = RoomListAnimator()
roomController.callback = this
roomController.addModelBuildListener { it.dispatchTo(stateRestorer) }
stateView.contentView = epoxyRecyclerView
epoxyRecyclerView.setController(roomController)
}

private val showFabRunnable = Runnable {
fabButton.show()
}

View File

@ -22,11 +22,11 @@

<TextView
android:id="@+id/inviteNameView"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginTop="40dp"
android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:textAppearance="@style/TextAppearance.Vector.Title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -35,11 +35,11 @@

<TextView
android:id="@+id/inviteIdentifierView"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:paddingStart="@dimen/layout_horizontal_margin"
android:paddingEnd="@dimen/layout_horizontal_margin"
android:textAppearance="@style/TextAppearance.Vector.Subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"