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

Fix #1957: Optimise code in profile_chooser_profile_view.xml #2008

Closed
wants to merge 23 commits into from
Closed

Fix #1957: Optimise code in profile_chooser_profile_view.xml #2008

wants to merge 23 commits into from

Conversation

peculiaruc
Copy link
Contributor

@peculiaruc peculiaruc commented Oct 13, 2020

Explanation

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@peculiaruc
Copy link
Contributor Author

@rt4914 PTAL

@BenHenning BenHenning self-requested a review October 13, 2020 23:39
@BenHenning BenHenning self-assigned this Oct 13, 2020
@BenHenning
Copy link
Member

I'll take this.

@peculiaruc
Copy link
Contributor Author

peculiaruc commented Oct 13, 2020 via email

Copy link
Member

@BenHenning BenHenning left a 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.

@@ -161,4 +162,4 @@
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
</component>
Copy link
Member

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).

Copy link
Contributor Author

@peculiaruc peculiaruc Oct 14, 2020

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peculiaruc

EOF is missing, add one blank line at the end.

@@ -1,5 +1,6 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="FORMATTER_TAGS_ACCEPT_REGEXP" value="true" />
Copy link
Member

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).

Copy link
Contributor Author

@peculiaruc peculiaruc Oct 14, 2020

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}"/>
Copy link
Member

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.

Copy link
Contributor Author

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"
Copy link
Member

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.

Copy link
Contributor Author

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here.

Copy link
Contributor Author

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"
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

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"
Copy link
Member

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).

Copy link
Contributor Author

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here.

Copy link
Contributor Author

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

@peculiaruc peculiaruc Oct 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@BenHenning BenHenning assigned peculiaruc and unassigned BenHenning Oct 14, 2020
@peculiaruc peculiaruc changed the title Fix #1957 : Optimise code in profile_chooser_profile_view.xml Fix #1957: Optimise code in profile_chooser_profile_view.xml Oct 14, 2020
@peculiaruc
Copy link
Contributor Author

@BenHenning PTAL

@rt4914 rt4914 assigned BenHenning and unassigned peculiaruc Oct 14, 2020
Copy link
Member

@BenHenning BenHenning left a 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:

  1. What you tried
  2. What didn't work
  3. Where you're stuck/confused
  4. 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!

@@ -161,4 +162,4 @@
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
</component>
Copy link
Member

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"
Copy link
Member

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
Copy link
Member

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 BenHenning assigned peculiaruc and unassigned BenHenning Oct 15, 2020
@peculiaruc
Copy link
Contributor Author

@BenHenning PTAL

@BenHenning BenHenning assigned BenHenning and unassigned peculiaruc Oct 16, 2020
@BenHenning
Copy link
Member

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?

@@ -3,4 +3,4 @@
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Project copy" />
</state>
</component>
</component>
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@peculiaruc
Copy link
Contributor Author

peculiaruc commented Oct 23, 2020

Yes @rt4914 It does help thanks a lot

@peculiaruc
Copy link
Contributor Author

@MohamedMedhat1998 Please confirm if the screens are good now. @BenHenning PTAL

@MohamedMedhat1998
Copy link
Contributor

@MohamedMedhat1998 Please confirm if the screens are good now. @BenHenning PTAL

Nice work @peculiaruc!
There are only few changes that need to be done, please refer to the following table.

Original After PR Regression
screenshot-2020-10-26_16 20 45 569 screenshot-2020-10-26_16 00 34 363
  • The profiles aren't centered
  • The margin between Admin and Administrator text views were increased
screenshot-2020-10-26_16 20 56 001 screenshot-2020-10-26_16 00 42 532
  • The profiles aren't centered
  • The margin between Admin and Administrator text views were increased
Screenshot_2020-10-26-14-22-07 Screenshot_2020-10-26-14-04-04
  • The profiles top margin is decreased
  • The margin between Admin and Administrator text views were increased
Screenshot_2020-10-26-14-22-24 Screenshot_2020-10-26-14-02-27 The margin between Admin and Administrator text views were increased
Screenshot_2020-10-26-14-22-30 Screenshot_2020-10-26-14-02-44 The margin between Admin and Administrator text views were increased

@MohamedMedhat1998 MohamedMedhat1998 removed their assignment Oct 26, 2020
@rt4914
Copy link
Contributor

rt4914 commented Oct 28, 2020

@peculiaruc Please update this PR and also fix the issues mentioned by @MohamedMedhat1998

Thanks.

@peculiaruc
Copy link
Contributor Author

peculiaruc commented Oct 28, 2020 via email

@rt4914
Copy link
Contributor

rt4914 commented Oct 29, 2020

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

@peculiaruc
Copy link
Contributor Author

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.

@peculiaruc
Copy link
Contributor Author

image

@rt4914
Copy link
Contributor

rt4914 commented Oct 29, 2020

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
Copy link
Contributor Author

peculiaruc commented Oct 29, 2020

@rt4914 PTAL.
image

This @dimen/space_8dp is the cause of this fail. The ProfileChooserProfileViewBindingImpl, kept throwing an error because of the modification done by #2034. Please can this change be made in the ProfileChooserProfileViewBindingImpl, so that this issue will be resolve
Thank

@rt4914
Copy link
Contributor

rt4914 commented Oct 29, 2020

@rt4914 PTAL.
image

This @dimen/space_8dp is the cause of this fail. The ProfileChooserProfileViewBindingImpl, kept throwing an error because of the modification done by #2034. Please can this change be made in the ProfileChooserProfileViewBindingImpl, so that this issue will be resolve
Thank

@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.

@peculiaruc
Copy link
Contributor Author

peculiaruc commented Oct 29, 2020 via email

Copy link
Contributor

@rt4914 rt4914 left a 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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file.

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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

@rt4914
Copy link
Contributor

rt4914 commented Oct 30, 2020

@peculiaruc As per our 1:1 discussion we should remove un-intentionally commits to PR and also keep on eye on Files Changed tabs in PR to make sure that you have only those files which you have changed intentionally. Thanks.

@rt4914
Copy link
Contributor

rt4914 commented Oct 30, 2020

@peculiaruc Please close this PR, if not needed.

@peculiaruc
Copy link
Contributor Author

This error persisted so i created a new branch and worked on it

@peculiaruc
Copy link
Contributor Author

peculiaruc commented Oct 31, 2020 via email

@peculiaruc peculiaruc closed this Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimise code in profile_chooser_profile_view.xml
5 participants