Room decoration - in room profile UI

This commit is contained in:
Benoit Marty 2020-01-31 20:12:02 +01:00
parent 7e34b2a672
commit 46dd17644f
3 changed files with 33 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import android.os.Bundle
import android.os.Parcelable
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.airbnb.mvrx.args
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
@ -34,6 +35,7 @@ import im.vector.riotx.core.extensions.configureWith
import im.vector.riotx.core.extensions.exhaustive
import im.vector.riotx.core.extensions.setTextOrHide
import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.features.crypto.util.toImageRes
import im.vector.riotx.features.home.AvatarRenderer
import im.vector.riotx.features.home.room.list.actions.RoomListActionsArgs
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsBottomSheet
@ -75,8 +77,12 @@ class RoomProfileFragment @Inject constructor(
}
setupToolbar(matrixProfileToolbar)
setupRecyclerView()
appBarStateChangeListener = MatrixItemAppBarStateChangeListener(headerView, listOf(matrixProfileToolbarAvatarImageView,
matrixProfileToolbarTitleView))
appBarStateChangeListener = MatrixItemAppBarStateChangeListener(
headerView,
listOf(matrixProfileToolbarAvatarImageView,
matrixProfileToolbarTitleView,
matrixProfileDecorationToolbarAvatarImageView)
)
matrixProfileAppBarLayout.addOnOffsetChangedListener(appBarStateChangeListener)
roomProfileViewModel.observeViewEvents {
when (it) {
@ -139,6 +145,10 @@ class RoomProfileFragment @Inject constructor(
val matrixItem = it.toMatrixItem()
avatarRenderer.render(matrixItem, roomProfileAvatarView)
avatarRenderer.render(matrixItem, matrixProfileToolbarAvatarImageView)
roomProfileDecorationImageView.isVisible = it.roomEncryptionTrustLevel != null
roomProfileDecorationImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
matrixProfileDecorationToolbarAvatarImageView.isVisible = it.roomEncryptionTrustLevel != null
matrixProfileDecorationToolbarAvatarImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
}
}
roomProfileController.setData(state)

View File

@ -20,8 +20,8 @@
android:layout_height="match_parent"
app:contentScrim="?riotx_background"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:scrimVisibleHeightTrigger="80dp"
app:scrimAnimationDuration="250"
app:scrimVisibleHeightTrigger="80dp"
app:titleEnabled="false"
app:toolbarId="@+id/matrixProfileToolbar">
@ -59,6 +59,16 @@
tools:alpha="1"
tools:src="@tools:sample/avatars" />
<ImageView
android:id="@+id/matrixProfileDecorationToolbarAvatarImageView"
android:layout_width="24dp"
android:layout_height="24dp"
app:layout_constraintCircle="@+id/matrixProfileToolbarAvatarImageView"
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="20dp"
tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" />
<TextView
android:id="@+id/matrixProfileToolbarTitleView"
android:layout_width="0dp"

View File

@ -18,6 +18,16 @@
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />
<ImageView
android:id="@+id/roomProfileDecorationImageView"
android:layout_width="48dp"
android:layout_height="48dp"
app:layout_constraintCircle="@+id/roomProfileAvatarView"
app:layout_constraintCircleAngle="135"
app:layout_constraintCircleRadius="64dp"
tools:ignore="MissingConstraints"
tools:src="@drawable/ic_shield_trusted" />
<TextView
android:id="@+id/roomProfileNameView"
android:layout_width="0dp"