Skip to content

Commit

Permalink
Fixes oppia#1956 :Optimise profile_chooser_add_view.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjupta committed Oct 12, 2020
1 parent cb27a1c commit 9ab4579
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 60 deletions.
29 changes: 14 additions & 15 deletions app/src/main/res/layout-land/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,34 @@
type="androidx.databinding.ObservableField<Boolean>" />
</data>

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
app:layout_constraintHorizontal_chainStyle="packed">

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintEnd_toStartOf="@+id/add_profile_item"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:id="@+id/add_profile_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="24dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_20dp : @dimen/space_28dp}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_24dp}">
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_24dp}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/add_profile_divider_view"
app:layout_constraintTop_toTopOf="parent">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_add_button"
Expand All @@ -46,26 +51,20 @@

<TextView
android:id="@+id/add_profile_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Caption"
android:layout_gravity="center"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="@{hasProfileEverBeenAddedValue ? @string/profile_chooser_add : @string/set_up_multiple_profiles}"
android:textColor="@color/white"
android:textSize="14sp" />
android:textColor="@color/white" />

<TextView
android:id="@+id/add_profile_description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextFieldLabel"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/set_up_multiple_profiles_description"
android:textColor="@color/white"
android:textSize="12sp"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
29 changes: 15 additions & 14 deletions app/src/main/res/layout-sw600dp-land/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@
type="androidx.databinding.ObservableField&lt;Boolean&gt;" />
</data>

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}"
android:orientation="vertical">
app:layout_constraintVertical_chainStyle="packed">

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="40dp"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/add_profile_item"/>

<LinearLayout
android:id="@+id/add_profile_item"
Expand All @@ -41,6 +44,10 @@
android:orientation="@{hasProfileEverBeenAddedValue ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"
app:layout_constraintTop_toBottomOf="@+id/add_profile_divider_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
Expand All @@ -62,27 +69,21 @@

<TextView
android:id="@+id/add_profile_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
style="@style/Heading2"
android:text="@{hasProfileEverBeenAddedValue ? @string/profile_chooser_add : @string/set_up_multiple_profiles}"
android:textColor="@color/white"
android:textSize="20sp" />
android:textColor="@color/white"/>

<TextView
android:id="@+id/add_profile_description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Subtitle1"
android:maxWidth="280dp"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:fontFamily="sans-serif"
android:text="@string/set_up_multiple_profiles_description"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
tools:ignore="RtlHardcoded" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
29 changes: 15 additions & 14 deletions app/src/main/res/layout-sw600dp-port/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@
type="androidx.databinding.ObservableField&lt;Boolean&gt;" />
</data>

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_170dp}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_170dp}"
android:orientation="vertical">
app:layout_constraintVertical_chainStyle="packed">

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="72dp"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/add_profile_item"/>

<LinearLayout
android:id="@+id/add_profile_item"
Expand All @@ -41,6 +44,10 @@
android:orientation="@{hasProfileEverBeenAddedValue ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"
app:layout_constraintTop_toBottomOf="@+id/add_profile_divider_view"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
Expand All @@ -62,27 +69,21 @@

<TextView
android:id="@+id/add_profile_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
style="@style/Heading2"
android:text="@{hasProfileEverBeenAddedValue ? @string/profile_chooser_add : @string/set_up_multiple_profiles}"
android:textColor="@color/white"
android:textSize="20sp" />
android:textColor="@color/white" />

<TextView
android:id="@+id/add_profile_description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Subtitle1"
android:maxWidth="280dp"
android:layout_gravity="left"
android:layout_marginTop="4dp"
android:fontFamily="sans-serif"
android:text="@string/set_up_multiple_profiles_description"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
tools:ignore="RtlHardcoded" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
35 changes: 18 additions & 17 deletions app/src/main/res/layout/profile_chooser_add_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
type="androidx.databinding.ObservableField&lt;Boolean&gt;" />
</data>

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
app:layout_constraintVertical_chainStyle="packed">

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="60dp"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintBottom_toTopOf="@+id/add_profile_item"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:id="@+id/add_profile_item"
Expand All @@ -37,7 +40,11 @@
android:orientation="@{hasProfileEverBeenAddedValue ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_20dp}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_20dp}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}">
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? + @dimen/space_0dp : @dimen/space_24dp}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/add_profile_divider_view"
app:layout_constraintBottom_toBottomOf="parent">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_add_button"
Expand All @@ -52,30 +59,24 @@
android:layout_height="wrap_content"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}"
android:orientation="vertical"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_8dp : @dimen/space_0dp}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}">
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_8dp : @dimen/space_0dp}">

<TextView
android:id="@+id/add_profile_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
style="@style/Caption"
android:text="@{hasProfileEverBeenAddedValue ? @string/profile_chooser_add : @string/set_up_multiple_profiles}"
android:textColor="@color/white"
android:textSize="14sp" />
android:textColor="@color/white" />

<TextView
android:id="@+id/add_profile_description_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextFieldLabel"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:fontFamily="sans-serif"
android:text="@string/set_up_multiple_profiles_description"
android:textColor="@color/white"
android:textSize="12sp"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit 9ab4579

Please sign in to comment.