b71fd4c9fde45e2e8d7cca10e9b3687a62cbed2b
[wl-mobile.git] / src / pl / org / nowoczesnapolska / wlmobi / MenuInterface.java
1 package pl.org.nowoczesnapolska.wlmobi;
2
3 /*
4  @author Radek Czajka
5  */
6
7 import org.json.JSONArray;
8 import org.json.JSONException;
9
10 import android.util.Log;
11
12 import com.phonegap.api.Plugin;
13 import com.phonegap.api.PluginResult;
14
15 public class MenuInterface extends Plugin{
16
17         public static String infoLabel = "Proszę czekać...";
18         public static Boolean infoEnabled = false;
19
20         @Override
21         public PluginResult execute(String action, JSONArray args, String callbackId) {
22                 if (action.equals("setInfoButton")) {
23                         try {
24                                 return this.setInfoButton(args.getString(0), args.getString(1));
25                         } catch (JSONException e) {
26                                 return new PluginResult(PluginResult.Status.ERROR, "Param errrors");
27                         }
28                 }
29                 else {
30                         return new PluginResult(PluginResult.Status.INVALID_ACTION);
31                 }
32         }
33
34         private PluginResult setInfoButton(String label, String enabled) {
35         infoLabel = label;
36         infoEnabled = enabled.equals("true");
37
38                 return new PluginResult(PluginResult.Status.OK);
39         }
40 }