From 10b0cfab9fb4efee4ffcfe8454bc9260aa9a1eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 29 Aug 2023 13:09:33 +0200 Subject: [PATCH] MOBILE-4331 app: Remove status bar color from local plugin --- .../src/android/SystemUI.java | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/cordova-plugin-moodleapp/src/android/SystemUI.java b/cordova-plugin-moodleapp/src/android/SystemUI.java index 217c72df9d3..ed20bd28aa5 100644 --- a/cordova-plugin-moodleapp/src/android/SystemUI.java +++ b/cordova-plugin-moodleapp/src/android/SystemUI.java @@ -32,11 +32,7 @@ public class SystemUI extends CordovaPlugin { public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { try { switch (action) { - case "setNavigationBarColor": - this.setNavigationBarColor(args.getString(0)); - callbackContext.success(); - - return true; + // No actions yet. } } catch (Throwable e) { Log.e(TAG, "Failed executing action: " + action, e); @@ -45,41 +41,5 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo return false; } - private void setNavigationBarColor(String color) { - if (Build.VERSION.SDK_INT < 21) { - return; - } - - if (color == null || color.isEmpty()) { - return; - } - - Log.d(TAG, "Setting navigation bar color to " + color); - - this.cordova.getActivity().runOnUiThread(new Runnable() { - @Override - public void run() { - final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000; - final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 0x00000010; - final Window window = cordova.getActivity().getWindow(); - int uiOptions = window.getDecorView().getSystemUiVisibility(); - - uiOptions = uiOptions | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - uiOptions = uiOptions & ~SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; - - window.getDecorView().setSystemUiVisibility(uiOptions); - - try { - // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21 - window.getClass().getDeclaredMethod("setNavigationBarColor", int.class).invoke(window, Color.parseColor(color)); - } catch (IllegalArgumentException ignore) { - Log.e(TAG, "Invalid hexString argument, use f.i. '#999999'"); - } catch (Exception ignore) { - // this should not happen, only in case Android removes this method in a version > 21 - Log.w(TAG, "Method window.setNavigationBarColor not found for SDK level " + Build.VERSION.SDK_INT); - } - } - }); - } }