Room decoration - in room profile UI
This commit is contained in:
parent
7e34b2a672
commit
46dd17644f
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
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.exhaustive
|
||||||
import im.vector.riotx.core.extensions.setTextOrHide
|
import im.vector.riotx.core.extensions.setTextOrHide
|
||||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
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.AvatarRenderer
|
||||||
import im.vector.riotx.features.home.room.list.actions.RoomListActionsArgs
|
import im.vector.riotx.features.home.room.list.actions.RoomListActionsArgs
|
||||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
||||||
|
@ -75,8 +77,12 @@ class RoomProfileFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
setupToolbar(matrixProfileToolbar)
|
setupToolbar(matrixProfileToolbar)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
appBarStateChangeListener = MatrixItemAppBarStateChangeListener(headerView, listOf(matrixProfileToolbarAvatarImageView,
|
appBarStateChangeListener = MatrixItemAppBarStateChangeListener(
|
||||||
matrixProfileToolbarTitleView))
|
headerView,
|
||||||
|
listOf(matrixProfileToolbarAvatarImageView,
|
||||||
|
matrixProfileToolbarTitleView,
|
||||||
|
matrixProfileDecorationToolbarAvatarImageView)
|
||||||
|
)
|
||||||
matrixProfileAppBarLayout.addOnOffsetChangedListener(appBarStateChangeListener)
|
matrixProfileAppBarLayout.addOnOffsetChangedListener(appBarStateChangeListener)
|
||||||
roomProfileViewModel.observeViewEvents {
|
roomProfileViewModel.observeViewEvents {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
@ -139,6 +145,10 @@ class RoomProfileFragment @Inject constructor(
|
||||||
val matrixItem = it.toMatrixItem()
|
val matrixItem = it.toMatrixItem()
|
||||||
avatarRenderer.render(matrixItem, roomProfileAvatarView)
|
avatarRenderer.render(matrixItem, roomProfileAvatarView)
|
||||||
avatarRenderer.render(matrixItem, matrixProfileToolbarAvatarImageView)
|
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)
|
roomProfileController.setData(state)
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:contentScrim="?riotx_background"
|
app:contentScrim="?riotx_background"
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||||
app:scrimVisibleHeightTrigger="80dp"
|
|
||||||
app:scrimAnimationDuration="250"
|
app:scrimAnimationDuration="250"
|
||||||
|
app:scrimVisibleHeightTrigger="80dp"
|
||||||
app:titleEnabled="false"
|
app:titleEnabled="false"
|
||||||
app:toolbarId="@+id/matrixProfileToolbar">
|
app:toolbarId="@+id/matrixProfileToolbar">
|
||||||
|
|
||||||
|
@ -59,6 +59,16 @@
|
||||||
tools:alpha="1"
|
tools:alpha="1"
|
||||||
tools:src="@tools:sample/avatars" />
|
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
|
<TextView
|
||||||
android:id="@+id/matrixProfileToolbarTitleView"
|
android:id="@+id/matrixProfileToolbarTitleView"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -18,6 +18,16 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:src="@tools:sample/avatars" />
|
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
|
<TextView
|
||||||
android:id="@+id/roomProfileNameView"
|
android:id="@+id/roomProfileNameView"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
Loading…
Reference in New Issue