-
Notifications
You must be signed in to change notification settings - Fork 531
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
Fix #1957: Optimise code in profile_chooser_profile_view.xml #2008
Changes from 13 commits
a520170
5367b77
b83140c
a0a8ee9
0548713
18c6e70
92b7dd9
a55a249
294cb6f
432683d
dcc636c
4714f32
f94cf17
693bb8e
dd1627f
9066029
1111184
ceb8501
1d9d7eb
4b4376c
aa723ef
a7878d6
7f86822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,89 +20,88 @@ | |
type="org.oppia.android.app.model.ProfileChooserUiModel" /> | ||
</data> | ||
|
||
<LinearLayout | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/profile_chooser_item" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="@{hasProfileEverBeenAddedValue ? Gravity.TOP|Gravity.CENTER : Gravity.START}" | ||
android:gravity="center_horizontal" | ||
android:orientation="vertical" | ||
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}" | ||
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}"> | ||
|
||
<LinearLayout | ||
android:id="@+id/profile_chooser_item" | ||
android:layout_width="wrap_content" | ||
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:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_24dp}" | ||
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" | ||
profile:src="@{viewModel.profile.avatar}" /> | ||
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_298dp}" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
profile:ignore="RtlSymmetry"> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
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_32dp}"> | ||
<de.hdodenhof.circleimageview.CircleImageView | ||
android:id="@+id/profile_avatar_img" | ||
android:layout_width="108dp" | ||
android:layout_height="108dp" | ||
app:civ_border_color="@color/avatarBorder" | ||
app:civ_border_width="1dp" | ||
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_48dp : @dimen/space_0dp}" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
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="20sp" /> | ||
<TextView | ||
android:id="@+id/profile_name_text" | ||
style="@style/Heading2" | ||
android:layout_marginTop="@dimen/space_8dp" | ||
android:ellipsize="end" | ||
android:gravity="center" | ||
android:maxLines="2" | ||
android:singleLine="false" | ||
android:text="@{viewModel.profile.name}" | ||
android:textColor="@color/white" | ||
app:layoutMarginStart="@{hasProfileEverBeenAddedValue ? @dimen/space_0dp : @dimen/space_32dp}" | ||
app:layoutMarginTop="@{hasProfileEverBeenAddedValue ? @dimen/space_8dp : @dimen/space_0dp}" | ||
app:layout_constraintStart_toEndOf="@+id/profile_avatar_img" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/profile_last_visited" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, we used light before so @rt4914 looking at https://github.com/oppia/oppia-android/blob/a44791096a3e797653c3d463158db6e7662ab5cb/app/src/main/res/values/styles.xml we don't seem to have any styles with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Holding off on resolving this until @rt4914 can weigh in since this particular situation probably should have a new style given you found a bunch of places where the same properties are being used. |
||
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_last_visited" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/space_8dp" | ||
android:fontFamily="sans-serif-light" | ||
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/space_8dp : @dimen/space_0dp}" | ||
app:layout_constraintEnd_toEndOf="@+id/profile_name_text" | ||
app:layout_constraintHorizontal_bias="0.094" | ||
app:layout_constraintStart_toStartOf="@+id/profile_name_text" | ||
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="16sp" | ||
android:layout_marginTop="4dp" | ||
android:textStyle="italic" | ||
android:visibility="@{viewModel.profile.isAdmin && hasProfileEverBeenAddedValue ? View.VISIBLE : View.GONE}" /> | ||
</LinearLayout> | ||
</LinearLayout> | ||
<TextView | ||
android:id="@+id/profile_is_admin_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/space_16dp" | ||
android:layout_marginTop="@dimen/space_4dp" | ||
android:fontFamily="sans-serif-light" | ||
android:gravity="center" | ||
android:text="@string/profile_chooser_admin" | ||
android:textColor="@color/white" | ||
android:textSize="16sp" | ||
android:textStyle="italic" | ||
android:visibility="@{viewModel.profile.isAdmin && hasProfileEverBeenAddedValue ? View.VISIBLE : View.GONE}" | ||
app:layout_constraintStart_toEndOf="@+id/profile_avatar_img" | ||
app:layout_constraintTop_toBottomOf="@+id/profile_last_visited" /> | ||
|
||
<View | ||
android:id="@+id/add_profile_divider_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="0.5dp" | ||
android:layout_marginTop="40dp" | ||
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" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if its a valid comment but this (marginBottom) was missed or has been adjusted somwhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added android:layout_marginBottom="8dp" here