package com.twin3.plugin;

import android.util.Log;
import android.view.View;

import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;

public class SystemBarDimmer extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
        
        if (action.equals("Dim")){

            View decorView = cordova.getActivity().getWindow().getDecorView();
            int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;
            decorView.setSystemUiVisibility(uiOptions);

            return true;

        } else if (action.equals("Reset")){
            
            View decorView = cordova.getActivity().getWindow().getDecorView();
            decorView.setSystemUiVisibility(0);

            return true;
            
        } else {
            
            return false;

        }
    }

}
@@ -285,16 +285,22 @@
 ay data,
+ final
  Callbac
@@ -393,16 +393,161 @@
 im%22))%7B%0A%0A
+            cordova.getActivity().runOnUiThread(new Runnable() %7B%0A        %0A                @Override%0A                public void run() %7B%0A%0A        
         
@@ -629,16 +629,24 @@
         
+  
+      
 int uiOp
@@ -690,32 +690,40 @@
 LE;%0A            
+        
 decorView.setSys
@@ -749,16 +749,99 @@
 ptions);
+%0A                    callbackContext.success();%0A%0A                %7D%0A%0A            %7D);
 %0A%0A      
@@ -909,32 +909,177 @@
 )%7B%0A            %0A
+            cordova.getActivity().runOnUiThread(new Runnable() %7B%0A        %0A                @Override%0A                public void run() %7B%0A%0A        
             View
@@ -1145,32 +1145,40 @@
 ();%0A            
+ 
+       
 decorView.setSys
@@ -1194,24 +1194,107 @@
 bility(0);%0A%0A
+                    callbackContext.success();%0A                %7D%0A%0A            %7D);%0A%0A
             
@@ -1394,8 +1394,9 @@
     %7D%0A%0A%7D
+%0A

Update SystemBarDimmer.java