Change statusbar color on dark theme
This commit is contained in:
parent
3ce58c84ce
commit
f0d3b2b4f6
@ -62,13 +62,11 @@ router.on("pageInit", function (pagedata) {
|
||||
}
|
||||
});
|
||||
|
||||
if (localStorage.getItem("darktheme") == "true") {
|
||||
$("#app").addClass("theme-dark");
|
||||
}
|
||||
|
||||
// Run platform-specific setup code for Cordova or NW.js
|
||||
initPlatform();
|
||||
|
||||
// Switch to dark theme if requested by user setting
|
||||
setAppTheme();
|
||||
|
||||
if (localStorage.getItem("configured") == null) {
|
||||
// Open the setup page
|
||||
|
@ -22,6 +22,14 @@ var removeTrayMenu = function () {
|
||||
|
||||
}
|
||||
|
||||
var setAppTheme = function () {
|
||||
if (localStorage.getItem("darktheme") == "true") {
|
||||
$("#app").addClass("theme-dark");
|
||||
} else {
|
||||
$("#app").removeClass("theme-dark");
|
||||
}
|
||||
}
|
||||
|
||||
function initCordova() {
|
||||
platform_type = "cordova";
|
||||
|
||||
@ -46,6 +54,21 @@ function initCordova() {
|
||||
openBrowser = function (url) {
|
||||
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
||||
}
|
||||
|
||||
setAppTheme = function () {
|
||||
if (localStorage.getItem("darktheme") == "true") {
|
||||
$("#app").addClass("theme-dark");
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.styleDefault();
|
||||
}
|
||||
} else {
|
||||
$("#app").removeClass("theme-dark");
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#D32F2F");
|
||||
StatusBar.styleLightContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initNW() {
|
||||
|
@ -14,9 +14,5 @@ $('.item-content[data-setting=darktheme] .toggle input').on("change", function (
|
||||
var checked = $(this).prop('checked');
|
||||
localStorage.setItem("darktheme", checked);
|
||||
|
||||
if (localStorage.getItem("darktheme") == "true") {
|
||||
$("#app").addClass("theme-dark");
|
||||
} else {
|
||||
$("#app").removeClass("theme-dark");
|
||||
}
|
||||
setAppTheme();
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user