Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

switch (style) {
case "SystemUiOverlayStyle.light":
window.setNavigationBarColor(0xffffffff);
flags |= 16;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what Android convention is, but personally bitwise operations read a lot clearer to me using hex literals.

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

window.setNavigationBarColor(0xffffffff);
flags |= 16;
if ((flags & 16) == 0) {
flags |= 16; //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
Copy link
Member

Choose a reason for hiding this comment

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

Is View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR not available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not until we update our target SDK

@jonahwilliams
Copy link
Contributor Author

I've updated this PR based on offline discussion with @Hixie and @HansMuller.

Instead of just extending the dark and light theme to Android, we should allow users to customize all of the different system chrome related APIs. This PR works in tandem with https://github.com/flutter/flutter/pull/17171/files to extend the systemOverlayStyle with multiple values for the different parts of each platforms system chrome.

Currently on Android, versions less than 26 are not allowed to customize these settings from flutter since there are no "light" settings for the status or nav bar icons.

As a part of a later process, we'll remove the SystemChrome api calls from the app bar widgets and instead specify a theme-like way to customize system chrome. This is only intended to be a low-level API

Copy link

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

switch (navigationIconTheme) {
case "SystemChromeTheme.dark":
//View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
if ((flags & 0x10) == 0) {

Choose a reason for hiding this comment

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

This test and the similar tests below don't seem necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bit-fu is weak, but I believe this is necessary because we currently can set the same system chrome flag multiple times. If it is already on/off we don't want to toggle it again.

Copy link

@HansMuller HansMuller May 2, 2018

Choose a reason for hiding this comment

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

But x |= 0x10 doesn't toggle the bit, it just ensures that it's set. 0x10 | 0x10 == 0 | 0x10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, fixed

@jonahwilliams
Copy link
Contributor Author

Since this will require an engine roll and and a separate framework PR i'm going to wait until tomorrow when the build is hopefully green

@jonahwilliams jonahwilliams changed the title Enables dart & light system chrome on Android O and greater Enables system chrome customization on Android O and greater May 3, 2018
@jonahwilliams jonahwilliams merged commit f2db5df into flutter:master May 3, 2018
@jonahwilliams jonahwilliams deleted the system_chrome branch May 3, 2018 20:10
flags |= 0x10;
break;
case "Brightness.light":
if ((flags & 0x10) == 0x10) {

Choose a reason for hiding this comment

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

Sorry for not bringing this up earlier. To unconditionally turn a bit off:

flags &= ~0x10;

jonahwilliams pushed a commit that referenced this pull request May 3, 2018
jonahwilliams pushed a commit that referenced this pull request May 3, 2018
…#5167)

* Revert "Roll dart sdk to e6d7d67. (#5165)"

This reverts commit 9e4c5d0.

* Revert "Enables system chrome customization on Android M/O and greater (#5112)"

This reverts commit f2db5df.
@jonahwilliams jonahwilliams restored the system_chrome branch May 4, 2018 00:22
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
…flutter#5167)

* Revert "Roll dart sdk to e6d7d67. (flutter#5165)"

This reverts commit 9e4c5d0.

* Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)"

This reverts commit f2db5df.
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
…flutter#5167)

* Revert "Roll dart sdk to e6d7d67. (flutter#5165)"

This reverts commit 9e4c5d0.

* Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)"

This reverts commit f2db5df.
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
sigurdm pushed a commit to sigurdm/engine that referenced this pull request May 4, 2018
…flutter#5167)

* Revert "Roll dart sdk to e6d7d67. (flutter#5165)"

This reverts commit 9e4c5d0.

* Revert "Enables system chrome customization on Android M/O and greater (flutter#5112)"

This reverts commit f2db5df.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants