Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2008: Optimise code in profile_chooser_profile_view.xml #2065

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a520170
{{Fixes #1997:Optimise code in profile chooser fragment xml}}
Oct 13, 2020
5367b77
{{Fix #1997:Optimise code in profile_chooser_profile_view.xml}}
Oct 13, 2020
b83140c
{{Fix #1957:Optimise code in profile_chooser_profile_view.xml}}
Oct 13, 2020
a0a8ee9
{{Fixes #2008: Optimise code in profile_chooser_profile_view.xml }}
Oct 14, 2020
0548713
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 16, 2020
18c6e70
{{Fixes #2008: Optimise code in profile_choose_profile
Oct 16, 2020
92b7dd9
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 16, 2020
a55a249
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 16, 2020
294cb6f
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 17, 2020
432683d
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 17, 2020
dcc636c
{{Fixes #2008: Optimise code in profile_chooser_profile_view}}
Oct 17, 2020
15d1173
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 19, 2020
691d393
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 20, 2020
f20f553
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 20, 2020
3d58841
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 20, 2020
005e9a2
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 20, 2020
a345466
{{Fix #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier}}
Oct 20, 2020
4714f32
{{Fixes #1957: Optimise code in profile_chooser_profile_view}}
Oct 21, 2020
f94cf17
Merge updates
Oct 21, 2020
7773e50
{{Fixes #1892: Thoroughly test FractionInputIsEquivalentToRuleClassifier
Oct 21, 2020
08d3520
{{Fixes #1892: Thoroughly test FractionInputIsEquivalentToRuleClassif…
Oct 21, 2020
a1fa52e
{{Fixes #1892: Thoroughly test FractionInputIsEquivalentToRuleClassif…
Oct 21, 2020
c827e1b
{{Fixes #1892: Thoroughly test FractionInputIsEquivalentToRuleClassif…
Oct 21, 2020
827c541
{{Fixes #1892: Thoroughly test FractionInputIsEquivalentToRuleClassif…
Oct 21, 2020
a411523
{{Fix #1899: Thoroughly test ItemsSelectionInputEqualsRuleClassifier}}
Oct 23, 2020
693bb8e
{{Fix #1957: Optimise code in profile_chooser_profile_view.xml}}
Oct 23, 2020
f4ef172
{{Fix #1899: Thoroughly test ItemsSelectionInputEqualsRuleClassifier}}
Oct 24, 2020
54c5a51
{{Fixes #1899: Thoroughly test ItemsSelectionInputEqualsRuleClassifier}}
Oct 24, 2020
3b484f5
Merge remote-tracking branch 'remotes/origin/itemsSelection_InputEqua…
Oct 25, 2020
f6b5aa9
{{Fixes #1899: Format ItemsSelectionInputEqualsRuleClassifieProviderT…
Oct 25, 2020
fbe287a
Merge remote-tracking branch 'remotes/origin/fractionInputIs_Equivale…
Oct 25, 2020
7a598ad
{{Fixes #1892: Format FractionInputIsEquivalentToRuleClassifier}}
Oct 25, 2020
2d17f1d
{{Fixes #1892: Format FractionInputIsEquivalentToRuleClassifier}}
Oct 25, 2020
544a5b3
Merge branch 'itemsSelection_InputEquals_RuleClassifier' into develop
Oct 26, 2020
d097556
Merge branch 'fractionInputIs_EquivalentTo_RuleClassifier' into develop
Oct 26, 2020
8c93309
Fixes #2008: Optimise code in profile_chooser_profile_view.xml
peculiaruc Oct 30, 2020
cdf7735
Merge remote-tracking branch 'upstream/develop' into profile_chooser_…
Oct 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 62 additions & 57 deletions app/src/main/res/layout-land/profile_chooser_profile_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,81 +21,86 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/profile_chooser_item"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_margin : @dimen/space_28dp}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_16dp : @dimen/space_24dp}"
app:layout_constraintTop_toTopOf="parent">

<LinearLayout
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:gravity="center_horizontal"
android:orientation="vertical"
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_avatar_img"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginBottom="@dimen/previous_button_exploration_view_margin_bottom"
app:civ_border_color="@color/avatarBorder"
app:civ_border_width="1dp"
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}">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_avatar_img"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginBottom="8dp"
app:civ_border_color="@color/avatarBorder"
app:civ_border_width="1dp"
profile:src="@{viewModel.profile.avatar}" />
profile:src="@{viewModel.profile.avatar}" />

<TextView
android:id="@+id/profile_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:maxLines="2"
android:singleLine="false"
android:text="@{viewModel.profile.name}"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/profile_name_text"
style="@style/Caption"
android:layout_marginTop="@dimen/profile_view_already_added_description_parent_margin_top"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:singleLine="false"
android:text="@{viewModel.profile.name}"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="@+id/profile_avatar_img"
app:layout_constraintStart_toStartOf="@+id/profile_avatar_img"
app:layout_constraintTop_toBottomOf="@+id/profile_avatar_img" />

<TextView
android:id="@+id/profile_last_visited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}"
profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" />
<TextView
android:id="@+id/profile_last_visited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/profile_name_text"
profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" />

<TextView
android:id="@+id/profile_is_admin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/profile_chooser_admin"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.isAdmin ? View.VISIBLE : View.GONE}" />
</LinearLayout>
<TextView
android:id="@+id/profile_is_admin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space_0dp"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/profile_chooser_admin"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.isAdmin ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="@+id/profile_name_text"
app:layout_constraintStart_toStartOf="@+id/profile_name_text"
app:layout_constraintTop_toBottomOf="@+id/profile_name_text" />

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginEnd="@dimen/walkthrough_final_no_button_margin_end"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="@+id/profile_chooser_item"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/profile_chooser_item"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
type="org.oppia.android.app.model.ProfileChooserUiModel" />
</data>

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.TOP|Gravity.CENTER : Gravity.START}"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}"
app:layoutMarginEnd="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}"
app:layoutMarginBottom="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_0dp}">
Expand All @@ -35,74 +36,72 @@
android:layout_height="wrap_content"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER}"
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: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_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
profile:ignore="RtlSymmetry">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_avatar_img"
android:layout_width="108dp"
android:layout_height="108dp"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_48dp : @dimen/space_0dp}"
app:civ_border_color="@color/avatarBorder"
app:civ_border_width="1dp"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_48dp : @dimen/space_0dp}"
profile:src="@{viewModel.profile.avatar}" />

<LinearLayout
<TextView
android:id="@+id/profile_name_text"
style="@style/Heading2"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}"
android:text="@{viewModel.profile.name}"
android:textColor="@color/white"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_description_parent_margin_top : @dimen/space_0dp}" />

<TextView
android:id="@+id/profile_last_visited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space_4dp"
android:fontFamily="sans-serif-light"
android:textColor="@color/white"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}"
android:orientation="vertical"
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/profile_view_already_added_description_parent_margin_top : @dimen/space_0dp}"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}">

<TextView
android:id="@+id/profile_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:maxLines="2"
android:singleLine="false"
android:text="@{viewModel.profile.name}"
android:textColor="@color/white"
android:textSize="20sp" />
android:textSize="16sp"
android:textStyle="italic"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}"
android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}"
profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" />

<TextView
android:id="@+id/profile_last_visited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:textColor="@color/white"
android:textSize="16sp"
android:layout_marginTop="4dp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.lastLoggedInTimestampMs > 0 ? View.VISIBLE : View.GONE}"
profile:lastVisited="@{viewModel.profile.lastLoggedInTimestampMs}" />

<TextView
android:id="@+id/profile_is_admin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/profile_chooser_admin"
android:textColor="@color/white"
android:textSize="16sp"
android:layout_marginTop="4dp"
android:textStyle="italic"
android:visibility="@{viewModel.profile.isAdmin &amp;&amp; hasProfileEverBeenAddedValue ? View.VISIBLE : View.GONE}" />
</LinearLayout>
<TextView
android:id="@+id/profile_is_admin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:text="@string/profile_chooser_admin"
android:textColor="@color/white"
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.CENTER_HORIZONTAL : Gravity.CENTER_VERTICAL}"
android:textSize="16sp"
android:textStyle="italic"
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}"
android:visibility="@{viewModel.profile.isAdmin &amp;&amp; hasProfileEverBeenAddedValue ? View.VISIBLE : View.GONE}" />
</LinearLayout>

<View
android:id="@+id/add_profile_divider_view"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="40dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/space_40dp"
android:background="@color/oppiaProfileChooserDivider"
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}" />
</LinearLayout>
android:visibility="@{hasProfileEverBeenAddedValue ? View.GONE : View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/profile_chooser_item" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading