-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] make NavigationBar support Transluscent status #1116
Conversation
If the app has flag Transluscentstatus then we should support that when creating the navbar. Now that we dont draw a statusbarunderlay anymore this opens up to many interesting UI possibilities
I think that if you are adding a padding, you need to account for how some pages (like MDP) are positioned during layout. Also, what happens if the user removes this Window flag through a DependencyService call? Will it get rid of the padding? |
Thx for your input adrian!
https://forums.xamarin.com/discussion/comment/293695/#Comment_293695 If you remove the Transluscent, it wouldn be transluscent anymore (thats all I can see) and the next time a navbar is layed out, it doesnt add padding. This is what ive seen from testing on 5 different devices. Note that if you use transluscent today your navbar and its content gets hidden under the statusbar = you cant even use it (well you can but...) |
I guess this is what I was getting at. To remove the padding, do you need to wait until the navbar is laid out next time or can you force it to layout once the translucent status is removed? I haven't tested these changes, so I'm only speculating. Maybe it's better to detect translucent changes and force navbar layout? |
I see the transluscent status as a "either you have it, or you dont" I have never seen apps that toggles in and out of transluscent during runtime. And if a user were to toggle it on and off, then wouldnt it be possible to handle that forceLayout in a customrenderer? Update: To remove the padding when removing transluscent would make it look wrong. The height doesnt change when your remove it. it changes the next layout, and in that same layout it doesnt add the padding = looks like it should |
This will need to be fixed in ContentPage and TabbedPage as well. MasterDetailPage should be fine once the other ones are fixed, but it'll have to be tested with the different combination of Detail/Master pages just to be sure. I opened up a bug report with a repro project to track this. |
one thing I haven't tested with this is TabbedPage with no navigation bar. If the tabbed page has no navbar then the tabbar needs to get the same adjustments as I give the navbar UPDATE (Tested, and solved) : This is easily handled in a custom TabbedPageRenderer
Id prefer this solution to anyone who has this specific layout instead of adding numerous checks in XF code to slow down android even more |
About your bug. TransluscentStatus behaviour is expected to layout content behind status bar if I'm not wrong here. this is exactly what I'm trying to achieve :) Contentpages with no navbars are supposed to go under the statusbar, check the link https://us.v-cdn.net/5019960/uploads/editor/sc/o4mdus3r0wsv.gif (the gif is huge, so it might take a few seconds to load) too see what I mean |
@davidortinau is this going to be merged anytime soon? It's blocking us from upgrading XF. See here. |
@bentmar can you rebase to run some tests please ? Also can you please post some screenshots so we can better understand the changes? thanks |
@rmarinho yes, if not today il do it this weekend! |
#1287 made a new PR that also covers TransluscentNavigation flag, and has some images. (im not a github pro hence a new pr) |
Closing since #1287 replaces this |
…) (#1116) * the compile-time check is not enough * it crashed on old Android versions (<8.0)
* Implement vertical accuracy in GeoLocation API (#1103) * Location: add property 'VerticalAccuracy' (#1099) * vertical accuracy is only available in Android API level 26 and above (#1099) * update Samples app to show vertical accuracy on GeolocationPage * add missing documentation bits for Location.VerticalAccuracy * .gitattributes: get better diff context for C# code (#1115) * Location.VerticalAccuracy: add runtime check for Android version (#1099) (#1116) * the compile-time check is not enough * it crashed on old Android versions (<8.0) * GH-1102 Fix launcher on older devices (#1120) * Update Launcher.ios.tvos.cs * OpenUrlAsync was introduced in iOS 10 not 12 https://docs.microsoft.com/en-us/dotnet/api/uikit.uiapplication.openurlasync?view=xamarin-ios-sdk-12 * Fix trailing whitespace * Really? fix whitespace * Really! Fix whitespace Co-authored-by: Janus Weil <janus@gcc.gnu.org> Co-authored-by: James Montemagno <james.montemagno@gmail.com>
* Implement vertical accuracy in GeoLocation API (#1103) * Location: add property 'VerticalAccuracy' (#1099) * vertical accuracy is only available in Android API level 26 and above (#1099) * update Samples app to show vertical accuracy on GeolocationPage * add missing documentation bits for Location.VerticalAccuracy * .gitattributes: get better diff context for C# code (#1115) * Location.VerticalAccuracy: add runtime check for Android version (#1099) (#1116) * the compile-time check is not enough * it crashed on old Android versions (<8.0) * GH-1102 Fix launcher on older devices (#1120) * Update Launcher.ios.tvos.cs * OpenUrlAsync was introduced in iOS 10 not 12 https://docs.microsoft.com/en-us/dotnet/api/uikit.uiapplication.openurlasync?view=xamarin-ios-sdk-12 * Fix trailing whitespace * Really? fix whitespace * Really! Fix whitespace * Fixes #1129 - set empty required declarations on UWP (#1133) * Fixes #1129 - set empty required declarations on UWP * Update Permissions.uwp.cs * Update Xamarin.Essentials.csproj (#1136) * GH-1142 AccessBackgroundLocation only when compile & running Q (#1143) * AccessBackgroundLocation only when compile & running Q * put if compile check around permission * GH-1121 If VC is null use TraitCollection (#1144) * Fixes #1123 (#1126) * Update PlacemarkExtensions.xml (#1132) Co-authored-by: Janus Weil <janus@gcc.gnu.org> Co-authored-by: James Montemagno <james.montemagno@gmail.com> Co-authored-by: Michael <Michael@ZPF.fr>
* Implement vertical accuracy in GeoLocation API (#1103) * Location: add property 'VerticalAccuracy' (#1099) * vertical accuracy is only available in Android API level 26 and above (#1099) * update Samples app to show vertical accuracy on GeolocationPage * add missing documentation bits for Location.VerticalAccuracy * .gitattributes: get better diff context for C# code (#1115) * Location.VerticalAccuracy: add runtime check for Android version (#1099) (#1116) * the compile-time check is not enough * it crashed on old Android versions (<8.0) * GH-1102 Fix launcher on older devices (#1120) * Update Launcher.ios.tvos.cs * OpenUrlAsync was introduced in iOS 10 not 12 https://docs.microsoft.com/en-us/dotnet/api/uikit.uiapplication.openurlasync?view=xamarin-ios-sdk-12 * Fix trailing whitespace * Really? fix whitespace * Really! Fix whitespace * Fixes #1129 - set empty required declarations on UWP (#1133) * Fixes #1129 - set empty required declarations on UWP * Update Permissions.uwp.cs * Update Xamarin.Essentials.csproj (#1136) * GH-1142 AccessBackgroundLocation only when compile & running Q (#1143) * AccessBackgroundLocation only when compile & running Q * put if compile check around permission * GH-1121 If VC is null use TraitCollection (#1144) * Fixes #1123 (#1126) * Update PlacemarkExtensions.xml (#1132) Co-authored-by: Janus Weil <janus@gcc.gnu.org> Co-authored-by: James Montemagno <james.montemagno@gmail.com> Co-authored-by: Michael <Michael@ZPF.fr> Co-authored-by: Jonathan Dick <jodick@microsoft.com> Co-authored-by: Janus Weil <janus@gcc.gnu.org> Co-authored-by: Michael <Michael@ZPF.fr>
If the app has flag Transluscentstatus then we should support that when creating the navbar. Now that we dont draw a statusbarunderlay anymore this opens up to many interesting UI possibilities
Description of Change
Adds a padding and adjusts the height of the Navigationbar if Transluscentstatus flag is set to true.
Bugs Fixed
API Changes
none
Changed:
The way we calculate the height for the navigationbar.
Adds padding to the navigationbar
Changes are only made if TransluscentStatus = true
Behavioral Changes
Now this is possible
https://forums.xamarin.com/discussion/comment/293844/#Comment_293844
by adding this is MainActivity
PR Checklist