Fixed black navigation bar for OxygenOS devices #408

This commit is contained in:
Ullas-Aithal 2019-10-28 19:58:25 -05:00
parent 0f54078ddf
commit 17befc6ffe
3 changed files with 13 additions and 3 deletions

View file

@ -24,10 +24,13 @@ package org.shadowice.flocke.andotp.Activities;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.shadowice.flocke.andotp.R;
import org.shadowice.flocke.andotp.Utilities.Settings;
import org.shadowice.flocke.andotp.Utilities.Tools;
import java.util.Locale;
@ -41,6 +44,11 @@ public abstract class ThemedActivity extends AppCompatActivity {
setTheme(settings.getTheme());
setLocale();
//Set navigation bar color
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setNavigationBarColor(Tools.getThemeColor(this,R.attr.navigationBarColor));
}
super.onCreate(savedInstanceState);
}

View file

@ -1,17 +1,14 @@
<resources>
<!-- Light application theme -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:navigationBarColor">?android:attr/colorBackground</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
<style name="AppTheme.Dark" parent="AppBaseTheme.Dark">
<item name="android:navigationBarColor">?android:attr/colorBackground</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
<style name="AppTheme.Black" parent="AppBaseTheme.Black">
<item name="android:navigationBarColor">@color/black</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
</resources>

View file

@ -7,6 +7,8 @@
<attr name="colorGithub" format="reference" />
<attr name="thumbnailBackground" format="reference" />
<attr name="navigationBarColor" format="reference" />
<!-- General styles -->
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
@ -21,6 +23,7 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="windowBackground">?android:attr/colorBackground</item>
<item name="navigationBarColor">?android:attr/colorBackground</item>
<item name="colorGithub">@color/github_dark</item>
<item name="thumbnailBackground">@android:color/transparent</item>
@ -57,6 +60,7 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="windowBackground">?android:attr/colorBackground</item>
<item name="navigationBarColor">?android:attr/colorBackground</item>
<item name="thumbnailBackground">@color/dark_thumbnail_background</item>
<item name="colorGithub">@color/github_light</item>
@ -89,6 +93,7 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="windowBackground">@color/black</item>
<item name="navigationBarColor">@color/black</item>
<item name="thumbnailBackground">@color/dark_thumbnail_background</item>
<item name="colorGithub">@color/github_light</item>