Light status and navigation bars

This commit is contained in:
Pierrot 2019-03-22 09:30:27 +01:00
parent 4a513c18c0
commit 7c8f723002
7 changed files with 48 additions and 0 deletions

View file

@ -1190,11 +1190,17 @@ public class Customize extends ResourceWrapperActivity implements
if (Build.VERSION.SDK_INT >= 19) {
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsStatusBarColor, R.string.sbc_t, 0, pc.statusBarColor, null, true));
if (Build.VERSION.SDK_INT >= 23) {
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarLight, R.string.sbl_t, 0, pc.statusBarLight, null));
}
mPreferencesPageSystemBars.add(mPGSystemBarsStatusBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsStatusBarOverlap, R.string.sbo_t, 0, pc.statusBarOverlap, null));
if (mSystemBarTintManager == null || (mSystemBarTintManager != null && mSystemBarTintManager.getConfig().hasNavigationBar())) {
mPreferencesPageSystemBars.add(new LLPreferenceCategory(this, R.string.nb_c));
mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarColor = new LLPreferenceColor(this, ID_mPGSystemBarsNavigationBarColor, R.string.nbc_t, 0, pc.navigationBarColor, null, true));
if (Build.VERSION.SDK_INT >= 26) {
mPreferencesPageSystemBars.add(mPGSystemBarsNavigationBarLight = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavigationBarLight, R.string.nbl_t, 0, pc.navigationBarLight, null));
}
mPreferencesPageSystemBars.add(mPGSystemBarsNavBarOverlap = new LLPreferenceCheckBox(this, ID_mPGSystemBarsNavBarOverlap, R.string.nbo_t, 0, pc.navigationBarOverlap, null));
}
}
@ -1637,7 +1643,9 @@ public class Customize extends ResourceWrapperActivity implements
if(mPGSystemBarsStatusBarOverlap != null) pc.statusBarOverlap = mPGSystemBarsStatusBarOverlap.isChecked();
if(mPGSystemBarsNavBarOverlap != null) pc.navigationBarOverlap = mPGSystemBarsNavBarOverlap.isChecked();
if(mPGSystemBarsStatusBarColor != null) pc.statusBarColor = mPGSystemBarsStatusBarColor.getColor();
if(mPGSystemBarsStatusBarLight != null) pc.statusBarLight = mPGSystemBarsStatusBarLight.isChecked();
if(mPGSystemBarsNavigationBarColor != null) pc.navigationBarColor = mPGSystemBarsNavigationBarColor.getColor();
if(mPGSystemBarsNavigationBarLight != null) pc.navigationBarLight = mPGSystemBarsNavigationBarLight.isChecked();
pc.statusBarHide = mPGSystemBarsHideStatusBar.isChecked();
if(is_app_drawer) {
pc.autoExit = mPGMiscAutoExit.isChecked();
@ -2100,7 +2108,9 @@ public class Customize extends ResourceWrapperActivity implements
private LLPreferenceCheckBox mPGSystemBarsStatusBarOverlap;
private LLPreferenceCheckBox mPGSystemBarsNavBarOverlap;
private LLPreferenceColor mPGSystemBarsStatusBarColor;
private LLPreferenceCheckBox mPGSystemBarsStatusBarLight;
private LLPreferenceColor mPGSystemBarsNavigationBarColor;
private LLPreferenceCheckBox mPGSystemBarsNavigationBarLight;
private LLPreferenceColor mPGAppDrawerABTextColor;
private LLPreference mPGAppDrawerABBackground;
@ -2277,7 +2287,9 @@ public class Customize extends ResourceWrapperActivity implements
private static final int ID_mPGSystemBarsNavBarOverlap = 164;
private static final int ID_mPGSystemBars = 165;
private static final int ID_mPGSystemBarsStatusBarColor = 166;
private static final int ID_mPGSystemBarsStatusBarLight = 513;
private static final int ID_mPGSystemBarsNavigationBarColor = 167;
private static final int ID_mPGSystemBarsNavigationBarLight = 514;
private static final int ID_mGCAppStyle = 168;
private static final int ID_mPGADCategories = 190;
private static final int ID_mPGBackgroundScaleType = 191;

View file

@ -95,6 +95,8 @@ public class PageConfig extends JsonLoader {
public boolean navigationBarOverlap =false;
public int statusBarColor=0;
public int navigationBarColor=0;
public boolean statusBarLight=false;
public boolean navigationBarLight=false;
public ScreenOrientation screenOrientation=ScreenOrientation.SYSTEM;
// public ScreenRotationWhat screenRotationWhat=ScreenRotationWhat.ROTATE_WORKSPACE;

View file

@ -1480,6 +1480,24 @@ public abstract class Screen implements ItemLayout.ItemLayoutListener, ItemView.
flags &= ~(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
mWindow.setFlags(flags, 0xffffffff);
if (Build.VERSION.SDK_INT >= 23) {
int f = mContentView.getSystemUiVisibility();
if(c.statusBarLight) {
f |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} else {
f &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
mContentView.setSystemUiVisibility(f);
}
if (Build.VERSION.SDK_INT >= 26) {
int f = mContentView.getSystemUiVisibility();
if(c.navigationBarLight) {
f |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
} else {
f &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
mContentView.setSystemUiVisibility(f);
}
try {
Method setStatusBarColor = mWindow.getClass().getMethod("setStatusBarColor", int.class);
setStatusBarColor.invoke(mWindow, 0);

View file

@ -29,7 +29,9 @@ public class Property {
public static final String PROP_PAGE_BG_COLOR = "bgColor";
public static final String PROP_PAGE_STATUS_BAR_COLOR = "statusBarColor";
public static final String PROP_PAGE_STATUS_BAR_LIGHT = "statusBarLight";
public static final String PROP_PAGE_NAV_BAR_COLOR = "navigationBarColor";
public static final String PROP_PAGE_NAV_BAR_LIGHT = "navigationBarLight";
public static final String PROP_PAGE_SCROLLING_DIRECTION = "scrollingDirection";
// public static final String PROP_PAGE_ICON_PACK = "iconPack";

View file

@ -158,11 +158,21 @@ public class PropertyEditor {
for (Screen screen : LLApp.get().getScreens()) {
screen.onPageSystemBarsColorChanged(page);
}
} else if (key.equals(Property.PROP_PAGE_STATUS_BAR_LIGHT)) {
page_config.statusBarLight = (boolean) value;
for (Screen screen : LLApp.get().getScreens()) {
screen.onPageSystemBarsColorChanged(page);
}
} else if (key.equals(Property.PROP_PAGE_NAV_BAR_COLOR)) {
page_config.navigationBarColor = (int) value;
for (Screen screen : LLApp.get().getScreens()) {
screen.onPageSystemBarsColorChanged(page);
}
} else if (key.equals(Property.PROP_PAGE_NAV_BAR_LIGHT)) {
page_config.navigationBarLight = (boolean) value;
for (Screen screen : LLApp.get().getScreens()) {
screen.onPageSystemBarsColorChanged(page);
}
} else if (key.equals(Property.PROP_PAGE_SCROLLING_DIRECTION)) {
try {
page_config.scrollingDirection = PageConfig.ScrollingDirection.valueOf((String) value);

View file

@ -64,7 +64,9 @@ import android.util.Pair;
* <tr><td><a href="/help/app/topic.php?id=57">bgColor</a></td><td>int</td><td>Read/Write</td><td>argb color</td></tr>
* <tr><td><a href="/help/app/topic.php?id=97">statusBarHide</a></td><td>boolean</td><td>Read/Write</td><td>true/false</td></tr>
* <tr><td><a href="/help/app/topic.php?id=109">statusBarColor</a></td><td>int</td><td>Read/Write</td><td>argb color</td></tr>
* <tr><td><a href="/help/app/topic.php?id=513">statusBarLight</a></td><td>boolean</td><td>Read/Write</td><td>true/false</td></tr>
* <tr><td><a href="/help/app/topic.php?id=138">navigationBarColor</a></td><td>int</td><td>Read/Write</td><td>argb color</td></tr>
* <tr><td><a href="/help/app/topic.php?id=514">navigationBarLight</a></td><td>boolean</td><td>Read/Write</td><td>true/false</td></tr>
* <tr><td><a href="/help/app/topic.php?id=138">statusBarOverlap</a></td><td>boolean</td><td>Read/Write</td><td>true/false</td></tr>
* <tr><td><a href="/help/app/topic.php?id=138">navigationBarOverlap</a></td><td>boolean</td><td>Read/Write</td><td>true/false</td></tr>
* <tr><td><a href="/help/app/topic.php?id=96">screenOrientation</a></td><td>string</td><td>Read/Write</td><td>AUTO|PORTRAIT|LANDSCAPE|SYSTEM</td></tr>

View file

@ -928,7 +928,9 @@
<string name="sb_t">System bars</string>
<string name="sb_s">Set status and navigation bars visibility, transparency, etc.</string>
<string name="sbc_t">Status bar tint color</string>
<string name="sbl_t">Light status bar</string>
<string name="nbc_t">Navigation bar tint color</string>
<string name="nbl_t">Light navigation bar</string>
<string name="sb_c">Status bar</string>
<string name="nb_c">Navigation bar</string>
<string name="mi_app_store">Play Store</string>