Fix Splash screen layout, especially on small screens

This commit is contained in:
Benoit Marty 2020-09-26 11:30:08 +02:00
parent 6958d114a9
commit 21f1848499
3 changed files with 165 additions and 129 deletions

View File

@ -8,7 +8,7 @@ Improvements 🙌:
- -
Bugfix 🐛: Bugfix 🐛:
- - Fix Splash layout on small screens
Translations 🗣: Translations 🗣:
- -

View File

@ -3,144 +3,187 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?riotx_background"> android:background="?riotx_background"
android:paddingStart="36dp"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="36dp"
android:paddingBottom="@dimen/layout_vertical_margin">
<androidx.core.widget.NestedScrollView <!-- Strategy: 5 Spaces are used to spread the remaining space, using weight -->
<Space
android:id="@+id/loginSplashSpace1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/loginSplashLogoContainer"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside"
app:layout_constraintVertical_weight="4" />
<LinearLayout
android:id="@+id/loginSplashLogoContainer"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/loginSplashSpace2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toBottomOf="@+id/loginSplashSpace1">
<androidx.constraintlayout.widget.ConstraintLayout <ImageView
style="@style/LoginContainer" android:id="@+id/loginSplashLogo"
android:layout_width="match_parent" android:layout_width="64dp"
android:layout_height="match_parent"> android:layout_height="64dp"
android:src="@drawable/element_logo_green"
android:transitionName="loginLogoTransition" />
<ImageView <ImageView
android:id="@+id/loginSplashLogo" android:id="@+id/logoType"
android:layout_width="64dp" android:layout_width="wrap_content"
android:layout_height="64dp" android:layout_height="44dp"
android:src="@drawable/element_logo_green" android:layout_marginTop="8dp"
android:transitionName="loginLogoTransition" android:src="@drawable/element_logotype"
app:layout_constraintBottom_toTopOf="@+id/logoType" android:tint="?colorAccent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<ImageView </LinearLayout>
android:id="@+id/logoType"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_marginTop="8dp"
android:src="@drawable/element_logotype"
android:tint="?colorAccent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/loginSplashLogo" />
<TextView <Space
android:id="@+id/loginSplashTitle" android:id="@+id/loginSplashSpace2"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="32dp" app:layout_constraintBottom_toTopOf="@+id/loginSplashTitle"
android:gravity="center" app:layout_constraintTop_toBottomOf="@+id/loginSplashLogoContainer"
android:text="@string/login_splash_title" app:layout_constraintVertical_weight="1" />
android:textAppearance="@style/TextAppearance.Vector.Login.Title"
android:transitionName="loginTitleTransition"
app:layout_constraintBottom_toTopOf="@+id/loginSplashText1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logoType" />
<ImageView <TextView
android:id="@+id/loginSplashPicto1" android:id="@+id/loginSplashTitle"
android:layout_width="32dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="2dp" android:gravity="center"
android:importantForAccessibility="no" android:text="@string/login_splash_title"
android:src="@drawable/ic_login_splash_message_circle" android:textAppearance="@style/TextAppearance.Vector.Login.Title"
android:tint="?riotx_text_secondary" android:transitionName="loginTitleTransition"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toTopOf="@+id/loginSplashSpace3"
app:layout_constraintTop_toTopOf="@+id/loginSplashText1" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loginSplashSpace2" />
<TextView <Space
android:id="@+id/loginSplashText1" android:id="@+id/loginSplashSpace3"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginStart="8dp" app:layout_constraintBottom_toTopOf="@+id/loginSplashContent"
android:layout_marginTop="96dp" app:layout_constraintTop_toBottomOf="@+id/loginSplashTitle"
android:gravity="start" app:layout_constraintVertical_weight="2" />
android:text="@string/login_splash_text1"
android:textAppearance="@style/TextAppearance.Vector.Login.Text"
app:layout_constraintBottom_toTopOf="@+id/loginSplashText2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/loginSplashPicto1"
app:layout_constraintTop_toBottomOf="@+id/loginSplashTitle" />
<ImageView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/loginSplashPicto2" android:id="@+id/loginSplashContent"
android:layout_width="32dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:importantForAccessibility="no" app:layout_constraintBottom_toTopOf="@+id/loginSplashSpace4"
android:src="@drawable/ic_login_splash_lock" app:layout_constraintEnd_toEndOf="parent"
android:tint="?riotx_text_secondary" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toStartOf="@id/loginSplashPicto1" app:layout_constraintTop_toBottomOf="@+id/loginSplashSpace3">
app:layout_constraintTop_toTopOf="@+id/loginSplashText2" />
<TextView <ImageView
android:id="@+id/loginSplashText2" android:id="@+id/loginSplashPicto1"
android:layout_width="0dp" android:layout_width="32dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginStart="2dp"
android:gravity="start" android:importantForAccessibility="no"
android:text="@string/login_splash_text2" android:src="@drawable/ic_login_splash_message_circle"
android:textAppearance="@style/TextAppearance.Vector.Login.Text" android:tint="?riotx_text_secondary"
app:layout_constraintBottom_toTopOf="@id/loginSplashText3" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/loginSplashText1" />
app:layout_constraintStart_toStartOf="@id/loginSplashText1"
app:layout_constraintTop_toBottomOf="@+id/loginSplashText1" />
<ImageView <TextView
android:id="@+id/loginSplashPicto3" android:id="@+id/loginSplashText1"
android:layout_width="32dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:importantForAccessibility="no" android:layout_marginStart="8dp"
android:src="@drawable/ic_login_splash_sliders" android:gravity="start"
android:tint="?riotx_text_secondary" android:text="@string/login_splash_text1"
app:layout_constraintStart_toStartOf="@+id/loginSplashPicto1" android:textAppearance="@style/TextAppearance.Vector.Login.Text"
app:layout_constraintTop_toTopOf="@+id/loginSplashText3" /> app:layout_constraintBottom_toTopOf="@+id/loginSplashText2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/loginSplashPicto1"
app:layout_constraintTop_toTopOf="parent" />
<TextView <ImageView
android:id="@+id/loginSplashText3" android:id="@+id/loginSplashPicto2"
android:layout_width="0dp" android:layout_width="32dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:importantForAccessibility="no"
android:gravity="start" android:src="@drawable/ic_login_splash_lock"
android:text="@string/login_splash_text3" android:tint="?riotx_text_secondary"
android:textAppearance="@style/TextAppearance.Vector.Login.Text" app:layout_constraintStart_toStartOf="@id/loginSplashPicto1"
app:layout_constraintBottom_toTopOf="@+id/loginSplashSubmit" app:layout_constraintTop_toTopOf="@+id/loginSplashText2" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/loginSplashText1"
app:layout_constraintTop_toBottomOf="@+id/loginSplashText2" />
<com.google.android.material.button.MaterialButton <TextView
android:id="@+id/loginSplashSubmit" android:id="@+id/loginSplashText2"
style="@style/Style.Vector.Login.Button" android:layout_width="0dp"
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginTop="16dp"
android:layout_marginTop="48dp" android:gravity="start"
android:text="@string/login_splash_submit" android:text="@string/login_splash_text2"
android:transitionName="loginSubmitTransition" android:textAppearance="@style/TextAppearance.Vector.Login.Text"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toTopOf="@id/loginSplashText3"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="@id/loginSplashText1"
app:layout_constraintTop_toBottomOf="@+id/loginSplashText3" /> app:layout_constraintTop_toBottomOf="@+id/loginSplashText1" />
</androidx.constraintlayout.widget.ConstraintLayout> <ImageView
android:id="@+id/loginSplashPicto3"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:src="@drawable/ic_login_splash_sliders"
android:tint="?riotx_text_secondary"
app:layout_constraintStart_toStartOf="@+id/loginSplashPicto1"
app:layout_constraintTop_toTopOf="@+id/loginSplashText3" />
</androidx.core.widget.NestedScrollView> <TextView
android:id="@+id/loginSplashText3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="start"
android:text="@string/login_splash_text3"
android:textAppearance="@style/TextAppearance.Vector.Login.Text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/loginSplashText1"
app:layout_constraintTop_toBottomOf="@+id/loginSplashText2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Space
android:id="@+id/loginSplashSpace4"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/loginSplashSubmit"
app:layout_constraintTop_toBottomOf="@+id/loginSplashContent"
app:layout_constraintVertical_weight="2" />
<com.google.android.material.button.MaterialButton
android:id="@+id/loginSplashSubmit"
style="@style/Style.Vector.Login.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/login_splash_submit"
android:transitionName="loginSubmitTransition"
app:layout_constraintBottom_toTopOf="@+id/loginSplashSpace5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loginSplashSpace4" />
<Space
android:id="@+id/loginSplashSpace5"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loginSplashSubmit"
app:layout_constraintVertical_weight="4" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,13 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="LoginContainer">
<item name="android:paddingTop">32dp</item>
<item name="android:paddingBottom">32dp</item>
<item name="android:paddingStart">36dp</item>
<item name="android:paddingEnd">36dp</item>
</style>
<item name="loginLogo" type="id" /> <item name="loginLogo" type="id" />
<item name="loginFormScrollView" type="id" /> <item name="loginFormScrollView" type="id" />
<item name="loginFormContainer" type="id" /> <item name="loginFormContainer" type="id" />