From 337adbbc70730afcf635e78dfcc3b2708b355584 Mon Sep 17 00:00:00 2001 From: peculiaruc Date: Sun, 8 Nov 2020 23:14:38 +0100 Subject: [PATCH 1/2] Last Update --- .../profile_chooser_profile_view.xml | 16 +-- .../profile_chooser_profile_view.xml | 98 +++++++++-------- .../profile_chooser_profile_view.xml | 103 +++++++++--------- .../layout/profile_chooser_profile_view.xml | 98 ++++++++--------- 4 files changed, 157 insertions(+), 158 deletions(-) diff --git a/app/src/main/res/layout-land/profile_chooser_profile_view.xml b/app/src/main/res/layout-land/profile_chooser_profile_view.xml index d65e4129432..e4966c2c59c 100644 --- a/app/src/main/res/layout-land/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout-land/profile_chooser_profile_view.xml @@ -19,7 +19,6 @@ name="viewModel" type="org.oppia.android.app.model.ProfileChooserUiModel" /> - @@ -32,11 +31,11 @@ android:layout_marginEnd="16dp" android:gravity="center_horizontal" android:orientation="vertical" + app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_28dp}" + app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_24dp}" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_28dp}" - app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_24dp}"> + app:layout_constraintTop_toTopOf="parent"> + android:textColor="@color/white" /> - - + + - - + android:textColor="@color/white" + android:textSize="16sp" + android:textStyle="italic" + android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}" + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}" + app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_description_parent_margin_top : @dimen/space_4dp}" + profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" /> - - - - + - + android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/profile_chooser_item" /> + diff --git a/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml b/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml index de83a75f6c8..8740f7c3918 100644 --- a/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml @@ -20,14 +20,13 @@ type="org.oppia.android.app.model.ProfileChooserUiModel" /> - + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_170dp}"> - + + - - + android:textColor="@color/white" + android:textSize="16sp" + android:textStyle="italic" + android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}" + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_28dp}" + profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" /> - - - - + - + android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/profile_chooser_item" /> + diff --git a/app/src/main/res/layout/profile_chooser_profile_view.xml b/app/src/main/res/layout/profile_chooser_profile_view.xml index c02137b17d7..1e44765c7c5 100644 --- a/app/src/main/res/layout/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout/profile_chooser_profile_view.xml @@ -19,11 +19,9 @@ name="viewModel" type="org.oppia.android.app.model.ProfileChooserUiModel" /> - - @@ -33,9 +31,12 @@ android:layout_height="wrap_content" android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}" android:orientation="@{hasProfileEverBeenAddedValue ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}" - app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_28dp}" - app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_28dp}" - app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"> + app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_24dp : @dimen/profile_view_not_added_margin}" + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/profile_view_not_added_margin}" + app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + android:maxLines="2" + android:singleLine="false" + android:text="@{viewModel.profile.name}" + android:textColor="@color/white" + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/profile_view_already_added_margin}" + app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_description_parent_margin_top : @dimen/space_0dp}" /> - - - + - - + - + android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/profile_chooser_item" /> + From 0d5840ea2c8eecd0450616e76fa4548cf10b0203 Mon Sep 17 00:00:00 2001 From: peculiaruc Date: Mon, 9 Nov 2020 20:23:33 +0100 Subject: [PATCH 2/2] Fix #1957: Optimise codes in profile_chooser_profile_view --- .../main/res/layout-land/profile_chooser_profile_view.xml | 4 ++-- .../layout-sw600dp-land/profile_chooser_profile_view.xml | 7 ++++--- .../layout-sw600dp-port/profile_chooser_profile_view.xml | 3 ++- app/src/main/res/layout/profile_chooser_profile_view.xml | 5 ++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/layout-land/profile_chooser_profile_view.xml b/app/src/main/res/layout-land/profile_chooser_profile_view.xml index e4966c2c59c..db30420f809 100644 --- a/app/src/main/res/layout-land/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout-land/profile_chooser_profile_view.xml @@ -27,8 +27,8 @@ android:id="@+id/profile_chooser_item" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginStart="@dimen/space_16dp" + android:layout_marginEnd="@dimen/space_16dp" android:gravity="center_horizontal" android:orientation="vertical" app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_28dp}" diff --git a/app/src/main/res/layout-sw600dp-land/profile_chooser_profile_view.xml b/app/src/main/res/layout-sw600dp-land/profile_chooser_profile_view.xml index c5ef6780a84..ff3f0325e84 100644 --- a/app/src/main/res/layout-sw600dp-land/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout-sw600dp-land/profile_chooser_profile_view.xml @@ -24,9 +24,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}" + android:layout_margin="@dimen/space_16dp" + android:padding="@dimen/space_4dp" + app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_0dp}" app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}" - app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_0dp}"> + app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}"> diff --git a/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml b/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml index 8740f7c3918..188ad4a9c0d 100644 --- a/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout-sw600dp-port/profile_chooser_profile_view.xml @@ -24,6 +24,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" + android:layout_margin="@dimen/space_16dp" + android:padding="@dimen/space_4dp" app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_0dp}" app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_170dp}" app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_170dp}"> @@ -37,7 +39,6 @@ app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/profile_view_not_added_margin}" app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/profile_view_not_added_margin}" app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}" - app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" profile:ignore="RtlSymmetry"> diff --git a/app/src/main/res/layout/profile_chooser_profile_view.xml b/app/src/main/res/layout/profile_chooser_profile_view.xml index 1e44765c7c5..69efeb0d110 100644 --- a/app/src/main/res/layout/profile_chooser_profile_view.xml +++ b/app/src/main/res/layout/profile_chooser_profile_view.xml @@ -62,12 +62,12 @@ android:id="@+id/profile_last_visited" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="4dp" android:fontFamily="sans-serif-light" - android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}" android:textColor="@color/white" + android:layout_marginTop="4dp" android:textSize="12sp" android:textStyle="italic" + android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}" android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}" app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_12dp}" profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" /> @@ -79,7 +79,6 @@ android:layout_marginTop="@dimen/space_4dp" android:fontFamily="sans-serif-light" android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}" - android:orientation="vertical" android:text="@string/profile_chooser_admin" android:textColor="@color/white" android:textSize="12sp"