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

Bugfix/status bar color #3241

Merged
merged 4 commits into from
Apr 23, 2022

Conversation

DoozyDoz
Copy link
Contributor

Description

In response to the issue reported in #3234:

  • upon unticking Colorize Navigation Bar in settings -> Apperance the navigation bar turns black no matter the current theme.
  • upon returning to the main activity it turns white no matter the current theme.
  • upon opening the about page the navigation bar is always inconsistent with the selected theme.

Issue tracker

Addresses issue at #3234

  • if Colorize Navigation Bar is ticked in settings, navigation bar color is consistent with primary color(blue) in all activities.
  • if Colorize Navigation Bar is unticked in settings, navigation bar color always follows the current theme.

Automatic tests

  • Added test cases

Manual tests

  • Done

  • Device: Huawei p30 lite

  • OS: Android 10

  • Device: Sharp Aquos 803SH

  • OS: Android 10

  • Device: Redmi Note 7

  • OS: Android 10

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@VishalNehra
Copy link
Member

please work on the code analysis failure, you can run. ./gradlew spotlessapply in your local to fix some of them.

@@ -112,6 +113,14 @@ public void initStatusBarResources(View parentView) {

if (getBoolean(PREFERENCE_COLORED_NAVIGATION) && SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Copy link
Member

Choose a reason for hiding this comment

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

This should be:

  if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    if (getBoolean(PREFERENCE_COLORED_NAVIGATION)) {
      window.setNavigationBarColor(PreferenceUtils.getStatusColor(getPrimary()));
    } else {
      if (getAppTheme().equals(AppTheme.LIGHT)) {
        window.setNavigationBarColor(Utils.getColor(this, android.R.color.white));
      } else if (getAppTheme().equals(AppTheme.BLACK)) {
        window.setNavigationBarColor(Utils.getColor(this, android.R.color.black));
      } else {
        window.setNavigationBarColor(Utils.getColor(this, R.color.holo_dark_background));
      }
    }
  }

setTheme(R.style.aboutBlack);
} else {
setTheme(R.style.aboutLight);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Copy link
Member

Choose a reason for hiding this comment

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

And for versions older that lollipop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have checked the official documentation and found that the color of the navigation bar cannot be manipulated for sdk versions before Lollipop, the closest you can get is making the bar translucent

@@ -105,23 +105,22 @@ public void initStatusBarResources(View parentView) {
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
if (getBoolean(PREFERENCE_COLORED_NAVIGATION)) {
Copy link
Contributor Author

@DoozyDoz DoozyDoz Apr 4, 2022

Choose a reason for hiding this comment

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

@EmmanuelMess I have transfered the code to the right block as requested hope its fine now

@VishalNehra
Copy link
Member

Thanks for contribution. Sorry that it took some time to review. Changeset looks fine now.

@VishalNehra VishalNehra merged commit 3e2c80b into TeamAmaze:release/3.7 Apr 23, 2022
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.

3 participants