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 Navigation Bar Buttons Not Visible with Signup Sheet #11051

Merged

Conversation

ashiagr
Copy link
Contributor

@ashiagr ashiagr commented Jan 7, 2020

This PR tries to fix #10908

It is an existing Android issue which has become obsolete because of lower priority. Seems like we need to go for a hack to fix it. Tried different solutions, this one seems to be working well in both portrait and landscape mode.

To test:

  1. Clear app data.
  2. Launch app.
  3. Tap Sign Up for WordPress.com button.
  4. Notice navigation buttons are visible.
API Orientation Before After
27 Portrait API27Before API27After
27 Landscape API27BeforeLandscape API27AfterLandscape
29 Portrait Android10BeforePortrait Android10AfterPortrait
29 Landscape Android10BeforeLandscape Android10AfterLandscape

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 7, 2020

Messages
📖

This PR contains changes in the subtree libs/login/. It is your responsibility to ensure these changes are merged back into wordpress-mobile/WordPress-Login-Flow-Android. Follow these handy steps!
WARNING: Make sure your git version is 2.19.x or lower - there is currently a bug in later versions that will corrupt the subtree history!

  1. cd WordPress-Android
  2. git checkout issue/10908-navigation-bar-buttons-not-visible-with-signup-sheet
  3. git subtree push --prefix=libs/login/ https://github.com/wordpress-mobile/WordPress-Login-Flow-Android.git merge/WordPress-Android/11051
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/WordPress-Android/11051 and open a new PR.

Generated by 🚫 dangerJS

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 7, 2020

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Contributor

@theck13 theck13 left a comment

Choose a reason for hiding this comment

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

The navigation bar looks good in the screenshots for this pull request in portrait orientation, but the landscape orientation looks odd since only part of the navigation bar background is unshadowed.

We should be able to fix this without hacks. We updated the navigation bar background color including bottom sheets in Simplenote in Automattic/simplenote-android#792. The changes included updating the base class from BottomSheetDialog to BottomSheetDialogFragment as well as updating styles.xml files. See the screenshots in the pull request for illustration.

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 8, 2020

The changes included updating the base class from BottomSheetDialog to BottomSheetDialogFragment as well as updating styles.xml files.

Thank you for the directions @theck13 🙇‍♀️. I'll take a look and update it.

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 13, 2020

Updated screenshots after applying changes requested.

API Portrait Landscape
26 api26_portrait api26_land
27 api27_portrait api27_land
29 api29_portrait api29_land

Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Note: @theck13 I hope you don't mind me jumping in. Riccardo would like to merge a feature which is blocked by this bug into the next release so I wanted to speed thing up. Since the changes are touching the Login flow I think it's good to have it reviewed by at least two developers anyway.

Thanks @ashiagr! I've reviewed most of the code and tested the changes. I've left some in-code comments and I found a bug during the tests. Let me know what you think ;)

Emulator, Nexus 9, API 28

  • the buttons are white on light background
  • the width of the view seems a bit weird
  • I'm not sure we want to change the width of the bottom navigation bar
    Screenshot_1578903128

Don't worry if we don't merge the changes before the code freeze - we can create a hotfix if it's necessary to include the fix in the next release.

dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mSignupSheetListener.onSignupSheetCanceled();
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this call is duplicated - we invoke the same callback in public void onDismiss(DialogInterface dialog). Is this intentional?

Copy link
Contributor Author

@ashiagr ashiagr Jan 13, 2020

Choose a reason for hiding this comment

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

dialog.setOnDismissListener was initially added referring to SimpleNote dialog code. It didn't seem to cover a scenario when dialog fragment was dismissed by touching on the screen and screen was rotated (dialog fragment reappeared even though it was dismissed) which is why I added public void onDismiss(DialogInterface dialog) callback. I'll test it further and see if we can eliminate one of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here d15dd92

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 14, 2020

Thank you for reviewing the changes @malinajirka 🙏! Fixed issues related to dialog to fragment conversion.

However this design issue still remains,

Emulator, Nexus 9, API 28
the buttons are white on light background

Noticed it appears in SimpleNote android app as well

Screenshot 2020-01-14 at 5 42 44 PM

As we're using a light themed bottom sheet style, ideally navigation bar icons should have been darker in color. But it isn't the case here, Android platform provides little support in customising navigation bar icons color. @theck13 are you aware of the issue in SimpleNote app? Do you have any suggestions?

@theck13
Copy link
Contributor

theck13 commented Jan 14, 2020

No, I wasn't aware of it. No, I don't have any suggestions.

@ashiagr ashiagr added this to the 14.1 milestone Jan 15, 2020
@malinajirka
Copy link
Contributor

malinajirka commented Jan 15, 2020

Thanks @ashiagr! I've looked into this and I found what is causing the issue. It's the hack we use in WPBottomSheetDialogFragment to adjust the width of the view/window. Tbh I'd personally discuss this with a designer as I believe it's ok too keep the sheet fullwidth - it's the default OS behavior, right? If they think it's better to use a maxWidth, we'll need to come up with another solution - eg. different layout/dimens for tablets. Wdyt?
P.S. Besides I don't understand why we change the layout parameters of the window and not just parameters of the view. 🤷‍♂

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 15, 2020

Good catch @malinajirka ! Thanks for looking into it.

I believe it's ok too keep the sheet fullwidth - it's the default OS behavior, right

Right, it is the default OS behavior. I agree we should keep it fullwidth.

Screenshots for the fullwidth layout (for design review):

Landscape Portrait
device-2020-01-15-144701 device-2020-01-15-144715

Besides I don't understand why we change the layout parameters of the window and not just parameters of the view.

Tried setting it on the fragment's view, it doesn't seem to be covering full width

view

It could be because full width setting for dialog window window.setLayout(-1, -1); inside BottomSheetDialog. But we can investigate it more.

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = this.getWindow();
        if (window != null) {
            if (VERSION.SDK_INT >= 21) {
                window.clearFlags(67108864);
                window.addFlags(-2147483648);
            }
            window.setLayout(-1, -1);
        }
    }

@ashiagr ashiagr added the [Status] Needs Design Review A designer needs to sign off on the implemented design. label Jan 15, 2020
@maxme maxme added this to the 14.2 milestone Jan 27, 2020
Copy link

@osullivanchris osullivanchris left a comment

Choose a reason for hiding this comment

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

@ashiagr Hey this looks like a great starting point, good job!

If we find a scenario where this isn't working for us later I think we can add more breakpoints or definitions at that point. Would you agree?

Also do you think we should extend this to landscape on phones in any cases or keep it just for tablet? cc @theck13 as well on that point.

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 28, 2020

If we find a scenario where this isn't working for us later I think we can add more breakpoints or definitions at that point. Would you agree?

I agree.

do you think we should extend this to landscape on phones in any cases or keep it just for tablet?

I would want it to be consistent with our other apps like SimpleNote, and like to know @theck13's inputs.

@theck13
Copy link
Contributor

theck13 commented Jan 28, 2020

Simplenote is different since it uses the large and large-land modifiers.

Personally, I think the bottom sheet looks a little stretched on phones in landscape orientation. To adjust that and since the horizontal button layout only occurs in landscape orientation, we could add bottom_sheet_dialog_width with a value around 512dp and the w600dp-land qualifier. I haven't tried that out though so we'll want to test it to make sure it looks good. Otherwise, it looks good to me.

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 29, 2020

Thanks @theck13 !

I tested 512dp for w600dp-land on few phone emulators. @osullivanchris, can you review these screenshots?

Device/ Resolution/ ViewPort/ Density Landscape
Nexus6p/ 1440x2560/ 412x738/ xxhdpi nexus6p
Pixel 3/ 1080x2160/ 411x823/ xxhdpi pixel-3
Pixel 3 XL/ 1440x2960/ 411x846/ xxxhdpi pixel-3xl
Samsung S10/ 1440x3040/ 360x760/ xxxhdpi samasung-s10
Galaxy Fold/ 840x1960/ /xhdpi samsung_galaxy_fold-7 3_inch

Copy link

@osullivanchris osullivanchris left a comment

Choose a reason for hiding this comment

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

LGTM @ashiagr !

cc @develric as we are trying to solve some landscape issues with sheets that are related.

@develric and I are also making some stylistic changes to bottom sheets for the iA project - I think the style changes should probably apply across the board as part of a bottom sheet component. But not sure which task that would be a part of - its probably separate to this.

…sible-with-signup-sheet

# Conflicts:
#	libs/login/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupBottomSheetDialog.java
@theck13
Copy link
Contributor

theck13 commented Jan 30, 2020

Now that we have bottom_sheet_dialog_width with 512dp for sw600dp-land and w600dp-land, I think we can delete the sw600dp-land instance since it's redundant. @ashiagr and @malinajirka, correct me if I'm wrong or I'm forgetting a scenario for which we need to keep sw600dp-land.

@ashiagr
Copy link
Contributor Author

ashiagr commented Jan 31, 2020

Thanks for the suggestion @theck13 . I removed the value from sw600dp-land and tested it on a Nexus 10 tablet emulator, buttons looked squished again.

nexus_10_landscape

According to Android's best-matching resource guide , it seems we have this order of precedence:

values-sw600dp-land
values-sw600dp
values-w600dp-land

If we remove values-sw600dp-land, it picks up next precedence which is values-sw600dp - 300dp for the tablet. Based on the test, I suggest we keep sw600dp-land as well.

@ashiagr
Copy link
Contributor Author

ashiagr commented Feb 6, 2020

@theck13 do you find the solution good enough to be merged? If yes, can you approve these changes?

@ashiagr ashiagr requested a review from theck13 February 6, 2020 09:22
@theck13
Copy link
Contributor

theck13 commented Feb 6, 2020

I haven't found a better solution, but I haven't been researching this either. Therefore, we're going to use this is Simplenote (Automattic/simplenote-android#933). I haven't reviewed the code as extensively as @malinajirka and he had requested changes in his review. So I'll leave the final approval to him.

@ashiagr ashiagr requested a review from malinajirka February 7, 2020 04:47
@malinajirka
Copy link
Contributor

Thanks @ashiagr for all the improvements!! ;) The final solution is great.

I've been testing the sign-up flow and I noticed two bugs.

  1. The first issue is already being tracked so it apparently isn't related your changes. I'm just mentioning it here to keep thinks linked. Bottom sheet animation glitch when app comes from background. #11242

  2. The bottom sheet doesn't disappear after rotation.

  • Click on "SIGN UP FOR WORDPRESS.COM"
  • Rotate your device
  • Click on "SIGN UP WITH EMAIL"
  • notice the bottom sheet doesn't disappear (Do we perhaps show two dialogs on top of one another?)

@jkmassel
Copy link
Contributor

We're freezing 14.2 today, so this PR is being bumped to 14.3. If you'd like it to ship with 14.2, please merge it into release/14.2 and ping me – I'll be happy to cut a new beta release.

@jkmassel jkmassel modified the milestones: 14.2, 14.3 Feb 10, 2020
@ashiagr
Copy link
Contributor Author

ashiagr commented Feb 11, 2020

  1. The bottom sheet doesn't disappear after rotation.

Thanks for catching the bug @malinajirka ! Fixed here f963bc2

Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Thanks @ashiagr! It all looks good now.

I think we might want to keep an eye on Sign-Up/Login tracks after 14.3 gets released. Just to make sure we didn't introduce any crashes. Could you please add a reminder and check it when the time comes. Thanks!

P.S. We should also push the changes to the login lib repo.

@malinajirka
Copy link
Contributor

@theck13 It seems, I can't merge the PR, since you requested some changes. Could you please either dismiss the review or approve it and merge the PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Signup [Status] Needs Design Review A designer needs to sign off on the implemented design. [Type] Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigation Bar Buttons Not Visible with Signup Sheet
7 participants