-
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
Fix #1957: Optimise code in profile_chooser_profile_view.xml #2008
Conversation
@rt4914 PTAL |
I'll take this. |
Please how do you mean?
…On Wed, 14 Oct 2020 at 00:39, Ben Henning ***@***.***> wrote:
I'll take this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2008 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIOVAVZHN5ZKW3DF5FISSJ3SKTQK3ANCNFSM4SPJXAKA>
.
|
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.
Thanks @peculiaruc! Took a first pass on the PR. I think it's on the right track, I just had a few nits & one more major suggestion in profile_chooser_profile_view.xml
.
Beyond that, as a small nit please remove the space before :
in your PR title for consistency with other PR titles. Also, please update your PR title & description to more accurately describe what this PR is doing. It's clearly optimizing more than just profile_chooser_profile_view.xml
given the other style updates happening here.
.idea/codeStyles/Project.xml
Outdated
@@ -161,4 +162,4 @@ | |||
</indentOptions> | |||
</codeStyleSettings> | |||
</code_scheme> | |||
</component> | |||
</component> |
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.
Please add EOF newline here & in other files (in general, we always want all files to end with a newline).
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.
Ok But this sort of error.
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.
Sorry @peculiaruc I'm not sure I follow. What error are you referring to? In general, please try to include all the context in your comment since reviews can often take multiple hours or even a day to go back-and-forth on, and it's more efficient to over-communicate than under in these cases.
Also, I'm still seeing an EOF newline missing here.
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.
Done
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.
EOF is missing, add one blank line at the end.
.idea/codeStyles/Project.xml
Outdated
@@ -1,5 +1,6 @@ | |||
<component name="ProjectCodeStyleConfiguration"> | |||
<code_scheme name="Project" version="173"> | |||
<option name="FORMATTER_TAGS_ACCEPT_REGEXP" value="true" /> |
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.
For this & the next file: please don't check in changes to the .idea project files in unrelated PRs (if you specifically want to change them, please submit a separate PR).
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.
Noted. Thanks.
@@ -45,42 +45,33 @@ | |||
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}"/> |
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.
Prefer readding this space (ditto elsewhere) for consistency.
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.
Done
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
style="@style/TextFieldLabel" |
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.
This doesn't seem like the correct replacement--the previous version was using sans-serif-light
and TextFieldLabel
uses standard sans-serif
.
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.
Done
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
style="@style/TextFieldLabel" |
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.
Ditto here.
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.
Done
|
||
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, we used light before so Subtitle1
doesn't seem like the correct fit.
@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 sans-serif-light
. Are the current layouts wrong, or are we missing some styles?
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.
Done
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.
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:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
style="@style/Subtitle1" |
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.
Ditto for this one (the font family is unexpectedly changing).
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.
Done
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
style="@style/Subtitle1" |
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.
Ditto here.
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.
Done
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="sans-serif-light" | ||
style="@style/Subtitle1" |
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.
And here.
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.
Done
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.
@BenHenning Please has this been resolved?
@@ -20,7 +20,7 @@ | |||
type="org.oppia.android.app.model.ProfileChooserUiModel" /> | |||
</data> | |||
|
|||
<LinearLayout | |||
<androidx.constraintlayout.widget.ConstraintLayout |
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.
We should either stay with LinearLayout in this case, or remove the inner LinearLayouts by leveraging a single outer ConstraintLayout.
In this case, I suggest the latter: we should flatten the view hierarchy here into a single ConstraintLayout.
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.
Thanks
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.
@peculiaruc I don't think you addressed this comment. To be clear: we should be optimizing this layout by flattening the hierarchy. That involves removing the nested LinearLayouts here & bringing up their elements to the new top-level ConstraintLayout, using constraints to make sure they're still presented correctly.
Note that there are also 2 other versions of this layout that need to be updated under layout-land and the sw600dp layout folders.
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.
Done
@BenHenning PTAL |
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.
Thanks @peculiaruc. There's still some work left to do on this PR. Please make sure to fully address all comments before requesting another follow-up review. If there's something that you don't understand, please mention in a reply comment:
- What you tried
- What didn't work
- Where you're stuck/confused
- What you think are the next steps
This will help reviewers specifically understand where the issue started, and give them a foundation to provide specific feedback for you to get unstuck and make progress.
Please let me know if you have any questions!
.idea/codeStyles/Project.xml
Outdated
@@ -161,4 +162,4 @@ | |||
</indentOptions> | |||
</codeStyleSettings> | |||
</code_scheme> | |||
</component> | |||
</component> |
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.
Sorry @peculiaruc I'm not sure I follow. What error are you referring to? In general, please try to include all the context in your comment since reviews can often take multiple hours or even a day to go back-and-forth on, and it's more efficient to over-communicate than under in these cases.
Also, I'm still seeing an EOF newline missing here.
|
||
<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 comment
The 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.
@@ -20,7 +20,7 @@ | |||
type="org.oppia.android.app.model.ProfileChooserUiModel" /> | |||
</data> | |||
|
|||
<LinearLayout | |||
<androidx.constraintlayout.widget.ConstraintLayout |
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.
@peculiaruc I don't think you addressed this comment. To be clear: we should be optimizing this layout by flattening the hierarchy. That involves removing the nested LinearLayouts here & bringing up their elements to the new top-level ConstraintLayout, using constraints to make sure they're still presented correctly.
Note that there are also 2 other versions of this layout that need to be updated under layout-land and the sw600dp layout folders.
@BenHenning PTAL |
I'm a bit braindead today. :) @MohamedMedhat1998 or @aggarwalpulkit596 could one of you do a pass on the ConstraintLayout bit to see if it looks good to you? |
.idea/codeStyles/codeStyleConfig.xml
Outdated
@@ -3,4 +3,4 @@ | |||
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> | |||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Project copy" /> | |||
</state> | |||
</component> | |||
</component> |
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.
EOF is missing, add one blank line at the end.
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.
Done
Yes @rt4914 It does help thanks a lot |
@MohamedMedhat1998 Please confirm if the screens are good now. @BenHenning PTAL |
Nice work @peculiaruc! |
@peculiaruc Please update this PR and also fix the issues mentioned by @MohamedMedhat1998 Thanks. |
I have done that but couldn't test the app before my final push as a result
of an error for @dimen/space_8dp. which is used to bind profile_name_text
in the ProfileChooserProfileViewBindingImpl.
I tried changing the margin of the textView to the recent change @dimens
but it didn't work, i have also asked for help in Glitter, waiting for a
possible reply. Thanks
…On Wed, 28 Oct 2020 at 21:18, Rajat Talesra ***@***.***> wrote:
@peculiaruc <https://github.com/peculiaruc> Please update this PR and
also fix the issues mentioned by @MohamedMedhat1998
<https://github.com/MohamedMedhat1998>
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2008 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIOVAV2A66QP4ACXOQKAFXLSNB373ANCNFSM4SPJXAKA>
.
|
@peculiaruc You are facing this issue because you are getting merge-conflicts while pulling the latest changes. You will need to resolve those merge conflicts manually to fix this. Reference PR because of which you are getting that error: #2034 |
This is part of my challenge here, I try to update my branch but is demanding me to commit files I did not work on. |
That's how merge conflicts work. You will need to commit those changes and at the same time also make sure that you have done correct changes. |
@peculiaruc You might need to rebuild the project after doing the merge. |
Yes, I know but in this case, is not working for me locally. I am checking
to find a way around it. Thanks
…On Thu, 29 Oct 2020 at 14:55, Rajat Talesra ***@***.***> wrote:
@rt4914 <https://github.com/rt4914> PTAL.
[image: image]
<https://user-images.githubusercontent.com/35475543/97575789-8db00a00-19ed-11eb-86f3-0f196029c424.png>
This @dimen/space_8dp is the cause of this fail. The
ProfileChooserProfileViewBindingImpl, kept throwing an error because of the
modification done by #2034
<#2034>. Please can this
change be made in the ProfileChooserProfileViewBindingImpl, so that this
issue will be resolve
Thank
@peculiaruc <https://github.com/peculiaruc> You might need to rebuild the
project after doing the merge. ProfileChooserProfileViewBindingImpl is
auto-generated and therefore we cannot make any change to this file.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2008 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIOVAV4KHVDGJ7E6U35QGCLSNFX3JANCNFSM4SPJXAKA>
.
|
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.
@peculiaruc Great. There are few issues but its nice to see that you solved the issue that you were facing.
<component name="RenderSettings"> | ||
<option name="showDecorations" value="true" /> | ||
</component> | ||
</project> |
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.
Please remove this file.
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.
Done
@@ -87,4 +88,10 @@ object InteractionObjectTestBuilder { | |||
fun createInt(value: Int): InteractionObject { | |||
return InteractionObject.newBuilder().setReal(value.toDouble()).build() | |||
} | |||
|
|||
fun createRatio(value: List<Int>): InteractionObject { |
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.
There are changes in these non xml files too. Thats because your branch is still 3 commits behind current develop.
If you can just merge with latest develop this should work and make these changes not visible.
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.
Done, It is still yet to be fix
@peculiaruc As per our 1:1 discussion we should remove un-intentionally commits to PR and also keep on eye on |
@peculiaruc Please close this PR, if not needed. |
This error persisted so i created a new branch and worked on it |
Alight, done
…On Fri, 30 Oct 2020 at 20:52, Rajat Talesra ***@***.***> wrote:
@peculiaruc <https://github.com/peculiaruc> Please close this PR, if not
needed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2008 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIOVAV35VTJW2OGYCQ5R6FDSNMKPNANCNFSM4SPJXAKA>
.
|
Explanation
Fix Optimise code in profile_chooser_profile_view.xml #1957: Optimized code in profile_chooser_profile_view.xml by adding style to TextViews using defined styles in the style.xml file and removed redundant attributes.
Also, flatten the view hierarchy here into a single ConstraintLayout.
Reviewer: @BenHenning @MohamedMedhat1998 @rt4914
Checklist