Improve layout and add a fake date

This commit is contained in:
Benoit Marty 2021-04-14 20:05:40 +02:00 committed by Benoit Marty
parent 2d7bface27
commit d812ed72d0
2 changed files with 35 additions and 10 deletions

View file

@ -26,6 +26,8 @@ import androidx.core.view.isVisible
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.app.R
import im.vector.app.core.date.DateFormatKind
import im.vector.app.core.date.VectorDateFormatter
import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper
import im.vector.app.core.intent.getFilenameFromUri
import im.vector.app.core.resources.ColorProvider
@ -48,6 +50,7 @@ import javax.inject.Inject
class AccountCreatedFragment @Inject constructor(
val accountCreatedViewModelFactory: AccountCreatedViewModel.Factory,
private val avatarRenderer: AvatarRenderer,
private val dateFormatter: VectorDateFormatter,
private val matrixItemColorProvider: MatrixItemColorProvider,
colorProvider: ColorProvider
) : AbstractLoginFragment2<FragmentLoginAccountCreatedBinding>(),
@ -69,6 +72,8 @@ class AccountCreatedFragment @Inject constructor(
observeViewEvents()
viewModel.subscribe { invalidateState(it) }
views.loginAccountCreatedTime.text = dateFormatter.format(System.currentTimeMillis(), DateFormatKind.MESSAGE_SIMPLE)
}
private fun observeViewEvents() {

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/login_fragment"
android:layout_width="match_parent"
@ -43,45 +44,64 @@
android:text="@string/login_account_created_notice_2"
android:textAppearance="@style/TextAppearance.Vector.Login.Text" />
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/loginAccountCreatedMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_vertical_margin">
android:layout_marginTop="@dimen/layout_vertical_margin"
android:background="@drawable/bg_login_server_selector"
android:padding="4dp">
<ImageView
android:id="@+id/loginAccountCreatedAvatar"
android:layout_width="44dp"
android:layout_height="44dp"
android:contentDescription="@string/avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />
<TextView
android:id="@+id/loginAccountCreatedMemberName"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
android:layout_toEndOf="@+id/loginAccountCreatedAvatar"
android:layout_marginEnd="4dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?riotx_text_primary"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/loginAccountCreatedTime"
app:layout_constraintStart_toEndOf="@+id/loginAccountCreatedAvatar"
app:layout_constraintTop_toTopOf="parent"
tools:text="\@user:domain.org" />
<TextView
android:layout_width="match_parent"
android:id="@+id/loginAccountCreatedTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/loginAccountCreatedMemberName"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:layout_toEndOf="@+id/loginAccountCreatedAvatar"
android:layout_marginEnd="8dp"
android:textColor="?riotx_text_secondary"
android:textSize="12sp"
app:layout_constraintBaseline_toBaselineOf="@+id/loginAccountCreatedMemberName"
app:layout_constraintEnd_toEndOf="parent"
tools:text="@tools:sample/date/hhmm" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/login_account_created_message"
android:textColor="?riotx_text_primary"
android:textSize="14sp" />
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/loginAccountCreatedMemberName"
app:layout_constraintTop_toBottomOf="@+id/loginAccountCreatedMemberName" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="wrap_content"