Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/plugins/system/android/com/foxdebug/system/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1691,9 +1691,11 @@ private void setUiTheme(
final CallbackContext callback
) {
this.systemBarColor = Color.parseColor(systemBarColor);
preferences.set("BackgroundColor", String.format("0x%08X", this.systemBarColor));
Comment thread
RohitKushvaha01 marked this conversation as resolved.
Outdated
this.theme = new Theme(scheme);

final Window window = activity.getWindow();

// Method and constants not available on all SDKs but we want to be able to compile this code with any SDK
window.clearFlags(0x04000000); // SDK 19: WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(0x80000000); // SDK 21: WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
Expand Down Expand Up @@ -1728,6 +1730,7 @@ private void setUiTheme(
controller.setSystemBarsAppearance(0, appearance);
}
}

callback.success("OK");
} catch (IllegalArgumentException error) {
callback.error(error.toString());
Expand Down
84 changes: 44 additions & 40 deletions src/plugins/system/www/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ module.exports = {
cordova.exec(success, error, 'System', 'getNativeLibraryPath', []);
},

getFilesDir: function (success, error) {
cordova.exec(success, error, 'System', 'getFilesDir', []);
},
getRewardStatus: function (success, error) {
cordova.exec(success, error, 'System', 'getRewardStatus', []);
},
redeemReward: function (offerId, success, error) {
cordova.exec(success, error, 'System', 'redeemReward', [offerId]);
},

getParentPath: function (path, success, error) {
cordova.exec(success, error, 'System', 'getParentPath', [path]);
},
getFilesDir: function (success, error) {
cordova.exec(success, error, 'System', 'getFilesDir', []);
},
getRewardStatus: function (success, error) {
cordova.exec(success, error, 'System', 'getRewardStatus', []);
},
redeemReward: function (offerId, success, error) {
cordova.exec(success, error, 'System', 'redeemReward', [offerId]);
},
getParentPath: function (path, success, error) {
cordova.exec(success, error, 'System', 'getParentPath', [path]);
},

listChildren: function (path, success, error) {
cordova.exec(success, error, 'System', 'listChildren', [path]);
Expand Down Expand Up @@ -135,36 +135,40 @@ module.exports = {
onError: null,
};

cordova.exec(function (data) {
if (typeof data !== 'string') {
console.warn('System.inAppBrowser: invalid callback payload', data);
return;
}
var separatorIndex = data.indexOf(':');
if (separatorIndex < 0) {
console.warn('System.inAppBrowser: malformed callback payload', data);
return;
}
var dataTag = data.slice(0, separatorIndex);
var dataUrl = data.slice(separatorIndex + 1);
if (dataTag === 'onOpenExternalBrowser') {
if (typeof myInAppBrowser.onOpenExternalBrowser === 'function') {
myInAppBrowser.onOpenExternalBrowser(dataUrl);
} else {
console.warn('System.inAppBrowser: onOpenExternalBrowser handler is not set');
}
}
}, function (err) {
if (typeof myInAppBrowser.onError === 'function') {
myInAppBrowser.onError(err);
return;
}
console.warn('System.inAppBrowser error callback not handled', err);
}, 'System', 'in-app-browser', [url, title, !!showButtons, disableCache]);
cordova.exec(function (data) {
if (typeof data !== 'string') {
console.warn('System.inAppBrowser: invalid callback payload', data);
return;
}
var separatorIndex = data.indexOf(':');
if (separatorIndex < 0) {
console.warn('System.inAppBrowser: malformed callback payload', data);
return;
}
var dataTag = data.slice(0, separatorIndex);
var dataUrl = data.slice(separatorIndex + 1);
if (dataTag === 'onOpenExternalBrowser') {
if (typeof myInAppBrowser.onOpenExternalBrowser === 'function') {
myInAppBrowser.onOpenExternalBrowser(dataUrl);
} else {
console.warn('System.inAppBrowser: onOpenExternalBrowser handler is not set');
}
}
}, function (err) {
if (typeof myInAppBrowser.onError === 'function') {
myInAppBrowser.onError(err);
return;
}
console.warn('System.inAppBrowser error callback not handled', err);
}, 'System', 'in-app-browser', [url, title, !!showButtons, disableCache]);
return myInAppBrowser;
},
setUiTheme: function (systemBarColor, theme, onSuccess, onFail) {
cordova.exec(onSuccess, onFail, 'System', 'set-ui-theme', [systemBarColor, theme]);
cordova.exec((out)=>{
cordova.exec(null, null, "SystemBarPlugin", "updateSystemBars", []);
Comment thread
RohitKushvaha01 marked this conversation as resolved.
Outdated
window.statusbar.setBackgroundColor(systemBarColor);
Comment thread
RohitKushvaha01 marked this conversation as resolved.
onSuccess(out)
}, onFail, 'System', 'set-ui-theme', [systemBarColor, theme]);
},
setIntentHandler: function (handler, onerror) {
cordova.exec(handler, onerror, 'System', 'set-intent-handler', []);
Expand Down