|
@ -88,31 +88,34 @@ public class MobileUI extends Plugin {
|
88
|
88
|
|
89
|
89
|
public void openUrl(JSONArray param) throws Exception{
|
90
|
90
|
String url = param.getString(0);
|
91
|
|
String title = param.getString(1);
|
92
|
|
JSONArray buttons = param.getJSONArray(2);
|
93
|
|
JSONArray arrayStyles = param.getJSONArray(3);
|
|
91
|
String title = param.optString(1);
|
|
92
|
JSONArray buttons = param.optJSONArray(2);
|
|
93
|
JSONArray arrayStyles = param.optJSONArray(3);
|
94
|
94
|
openUrl(url, title, buttons, arrayStyles);
|
95
|
95
|
|
96
|
96
|
}
|
97
|
97
|
|
98
|
98
|
private void openUrl(String url, String title, JSONArray buttons, JSONArray arrayStyles) throws Exception {
|
99
|
99
|
String[] styleNames = {"topbarbg", "iconcolor", "textcolor"};
|
100
|
|
String[] buttonNames = {"share", "search", "copyLink"};
|
101
|
100
|
url = URLDecoder.decode(url);
|
102
|
101
|
Intent intent = new Intent();
|
103
|
102
|
intent.putExtra("url", url);
|
104
|
|
intent.putExtra("title", title);
|
105
|
|
|
106
|
|
for(int i=0;i< arrayStyles.length();i++){
|
107
|
|
if (i < styleNames.length) {
|
108
|
|
intent.putExtra(styleNames[i], isNull(arrayStyles.getString(i)) ? "" : arrayStyles.getString(i));
|
109
|
|
}
|
|
103
|
if (title != null) {
|
|
104
|
intent.putExtra("title", title);
|
110
|
105
|
}
|
111
|
|
for(int i=0; i<buttons.length(); i++) {
|
112
|
|
if(i < buttonNames.length) {
|
113
|
|
intent.putExtra(buttonNames[i], buttons.getBoolean(i));
|
|
106
|
|
|
107
|
if(arrayStyles != null) {
|
|
108
|
for(int i=0;i< arrayStyles.length();i++){
|
|
109
|
if (i < styleNames.length) {
|
|
110
|
intent.putExtra(styleNames[i], isNull(arrayStyles.getString(i)) ? "" : arrayStyles.getString(i));
|
|
111
|
}
|
114
|
112
|
}
|
115
|
113
|
}
|
|
114
|
|
|
115
|
if(buttons != null) {
|
|
116
|
intent.putExtra("buttons", buttons.toString());
|
|
117
|
}
|
|
118
|
|
116
|
119
|
intent.setClassName(context, "com.ai.ipu.mobile.ui.activity.IpuUrlActivity");
|
117
|
120
|
startActivityForResult(intent, REQUEST_CODE_OPEN_URL);
|
118
|
121
|
}
|
|
@ -444,7 +447,7 @@ public class MobileUI extends Plugin {
|
444
|
447
|
if(!isNull(tag)){
|
445
|
448
|
context.runOnUiThread(new Runnable() { public void run() {
|
446
|
449
|
mainFlipper.back(tag); } });
|
447
|
|
}else {
|
|
450
|
}else {
|
448
|
451
|
context.runOnUiThread(new Runnable() { public void run() {
|
449
|
452
|
mainFlipper.back(); } });
|
450
|
453
|
}
|
|
@ -1066,6 +1069,8 @@ public class MobileUI extends Plugin {
|
1066
|
1069
|
data.put("VALUE", record.getValue());
|
1067
|
1070
|
data.put("COLOR", record.getColor());
|
1068
|
1071
|
callback(data.toString());
|
|
1072
|
} else if (requestCode == REQUEST_CODE_OPEN_URL) {
|
|
1073
|
callback("");
|
1069
|
1074
|
}
|
1070
|
1075
|
}
|
1071
|
1076
|
|