Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] AppCompat NavigationBar should handle Transluscent Flags #1287

Merged
merged 2 commits into from
Dec 13, 2017

Conversation

bentmar
Copy link
Contributor

@bentmar bentmar commented Nov 18, 2017

Description of Change

When using either TransluscentStatus or TransluscentNavigation flags on Android the content will be layed out under the statusbar (not below as it would without them). This PR adds padding and height to NavigationBar if any of those flags are set. The padding is calculated based on the statusbar height.
Now we can finally use the flags mentioned on android to create stunning looking UI.

To use any of the flags just set this in MainActivity OnCreate()

	Window.AddFlags(WindowManagerFlags.TranslucentNavigation);
	Window.AddFlags(WindowManagerFlags.TranslucentStatus);

Before we added a statusbarunderlay = we couldnt layout stuff under the statusbar even with those flags, but that got removed in 2.3.4 (i think). Now the only thing stopping us is the adjusting padding and height, thats what this PR solves for NavigationBar.

Here are som images:

BEFORE with transluscentNavigation
before_trans_nav

AFTER with transluscentNavigation
after_trans_nav

BEFORE with both transluscent statusbar and navigation
before_trans_both

After with both transluscent statusbar and navigation
after_trans_both

Drawer looks nice on MDP with trascuscentstatusbar!
after_drawer_trans_status

Drawer looks nice on MDP with trascuscent flags! (this is KitKat)
kitkat_drawer_open

Kitkat with no transluscentflags
kitkat_noflags

BEFORE Kitkat with both flags transluscentflags
kitkat_before_both

AFTER Kitkat with both flags transluscentflags
kitkat_after_both

PR Checklist

  • Has tests (if omitted, state reason in description)
  • [X ] Rebased on top of master at time of PR
  • [X ] Changes adhere to coding standard
  • [X ] Consolidate commits as makes sense

if the app uses any TransluscentFlags padding will be added to the Toolbar. When device is rotated a new height is calculated. This leads to the Toolbar being reset by ResetToolbar(). If the old toolbar was adjusted by toppadding the new toolbar should get the same padding to not be layout out under the statusbar
@bentmar
Copy link
Contributor Author

bentmar commented Nov 20, 2017

While debugging the code i see that ResetToolbar is called twice on device orientation. One from propertychanged and one from OnLayout().

OnLayout will call resetToolbar() since ActionBarHeight() returns a different height now that it is in a different orientation => triggering ResetToolbar().

As your comments say in code the call from PropertyChanged should be removed.

@dhaligas
Copy link

+1 to this .. would like to see this in there soon

@rmarinho
Copy link
Member

rmarinho commented Dec 5, 2017

@bentmar can you rebase to run uitest please.

Thanks

@bentmar
Copy link
Contributor Author

bentmar commented Dec 9, 2017

I did this PR "manually" by pasting code in the browser. How does one rebase that?
I can do a new PR (again..)

@rmarinho

@RsZoli
Copy link

RsZoli commented Dec 11, 2017

any word on this when will it be finally pulled? we are in desperate need of this, because we can not refresh our nugets thus it is broken since 2.4 :/

@rmarinho rmarinho merged commit 8ee768c into xamarin:master Dec 13, 2017
@HenKun
Copy link

HenKun commented Feb 27, 2018

Great and really required fix, thanks. In which release should this fix be included?

@samhouts samhouts added this to the 3.0.0 milestone May 5, 2018
@samhouts samhouts modified the milestones: 3.0.0, 2.5.0 Aug 23, 2019
@samhouts samhouts modified the milestones: 3.0.0, 2.5.0 Oct 29, 2019
mattleibow pushed a commit that referenced this pull request Jan 28, 2021
Return user's email as part of the properties.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants