X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/ece057f255f997085854b36d6f858b97dad44546..6e087a91530a9731db6dd4b41bf69eda3409c0e9:/src/pl/org/nowoczesnapolska/wlmobi/MenuInterface.java diff --git a/src/pl/org/nowoczesnapolska/wlmobi/MenuInterface.java b/src/pl/org/nowoczesnapolska/wlmobi/MenuInterface.java index 28f3f2e..064d4de 100644 --- a/src/pl/org/nowoczesnapolska/wlmobi/MenuInterface.java +++ b/src/pl/org/nowoczesnapolska/wlmobi/MenuInterface.java @@ -8,6 +8,9 @@ package pl.org.nowoczesnapolska.wlmobi; import org.json.JSONArray; import org.json.JSONException; +import android.graphics.Color; +import android.webkit.WebView; + import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; @@ -15,6 +18,8 @@ public class MenuInterface extends Plugin{ public static String infoLabel = "Proszę czekać..."; public static Boolean infoEnabled = false; + public static Boolean nightEnabled = false; + public static WebView view; @Override public PluginResult execute(String action, JSONArray args, String callbackId) { @@ -25,6 +30,13 @@ public class MenuInterface extends Plugin{ return new PluginResult(PluginResult.Status.ERROR, "Param errrors"); } } + else if (action.equals("setNightMode")) { + try { + return this.setNightMode(args.getString(0)); + } catch (JSONException e) { + return new PluginResult(PluginResult.Status.ERROR, "Param errrors"); + } + } else { return new PluginResult(PluginResult.Status.INVALID_ACTION); } @@ -36,4 +48,16 @@ public class MenuInterface extends Plugin{ return new PluginResult(PluginResult.Status.OK); } + + private PluginResult setNightMode(String enabled) { + nightEnabled = enabled.equals("true"); + if (nightEnabled) { + view.setBackgroundColor(0x222222ff); + } + else { + view.setBackgroundColor(Color.WHITE); + } + + return new PluginResult(PluginResult.Status.OK); + } }