|
@ -6,7 +6,6 @@ import java.text.SimpleDateFormat;
|
6
|
6
|
import java.util.Calendar;
|
7
|
7
|
import java.util.Date;
|
8
|
8
|
import java.util.Map;
|
9
|
|
import java.util.Stack;
|
10
|
9
|
|
11
|
10
|
import org.json.JSONArray;
|
12
|
11
|
|
|
@ -64,7 +63,6 @@ public class MobileUI extends Plugin {
|
64
|
63
|
private final int REQUEST_CODE_SLIDING_MENU = 300;
|
65
|
64
|
private final int REQUEST_CODE_CONTACTS_VIEW = 400;
|
66
|
65
|
private final String DATA_REQUEST_ERROR = "dataRequestError";
|
67
|
|
private Stack<String> stackForCallback = new Stack<String>();
|
68
|
66
|
|
69
|
67
|
public MobileUI(IWadeMobile wademobile) {
|
70
|
68
|
super(wademobile);
|
|
@ -865,48 +863,31 @@ public class MobileUI extends Plugin {
|
865
|
863
|
* 打开窗口
|
866
|
864
|
*/
|
867
|
865
|
public void openWindow(JSONArray param) throws Exception {
|
868
|
|
final String pageAction = param.getString(0);
|
869
|
|
final String data = param.getString(1);
|
|
866
|
String pageAction = param.getString(0);
|
|
867
|
String data = param.getString(1);
|
870
|
868
|
|
871
|
|
openTemplate(pageAction, isNull(data) ? null : new DataMap(data), true);
|
|
869
|
Intent intent = new Intent(context, CustomWindowActivity.class);
|
|
870
|
intent.putExtra(CustomWindowActivity.KEY_PAGE_ACTION, pageAction);
|
|
871
|
intent.putExtra(CustomWindowActivity.KEY_DATA, data);
|
|
872
|
startActivityForResult(intent, REQUEST_CODE_CUSTOM_WINDOW);
|
872
|
873
|
}
|
873
|
874
|
|
874
|
875
|
/**
|
875
|
876
|
* 关闭窗口
|
876
|
877
|
*/
|
877
|
878
|
public void closeWindow(JSONArray param) throws Exception {
|
878
|
|
final String resultData = isNull(param.getString(0)) ? null : param.getString(0);
|
879
|
|
final Plugin plugin = this;
|
880
|
|
context.runOnUiThread(new Runnable() {
|
881
|
|
|
882
|
|
@Override
|
883
|
|
public void run() {
|
884
|
|
wademobile.getFlipperLayout().back();
|
885
|
|
plugin.callback(resultData);
|
886
|
|
}
|
887
|
|
});
|
|
879
|
String resultData = param.getString(0);
|
|
880
|
resultData = isNull(resultData) ? null : resultData;
|
|
881
|
int resultState = isNull(param.getString(1)) ? CustomWindowActivity.SUCCESS_CODE
|
|
882
|
: param.getInt(1);
|
|
883
|
if (context instanceof CustomWindowActivity) {
|
|
884
|
((CustomWindowActivity) context).closeWindow(resultData,
|
|
885
|
resultState);
|
|
886
|
} else {
|
|
887
|
HintUtil.alert(context, "无窗口可以关闭!");
|
|
888
|
}
|
888
|
889
|
}
|
889
|
890
|
|
890
|
|
@Override
|
891
|
|
public void setCallback(String callback) {
|
892
|
|
if (callback !=null && callback.contains("openWindow")) {
|
893
|
|
stackForCallback.push(callback);
|
894
|
|
}else{
|
895
|
|
super.setCallback(callback);
|
896
|
|
}
|
897
|
|
}
|
898
|
|
|
899
|
|
@Override
|
900
|
|
public String getCallback() {
|
901
|
|
String result = super.getCallback();
|
902
|
|
if (result != null && result.contains("closeWindow") && !stackForCallback.empty()) {
|
903
|
|
result = stackForCallback.pop();
|
904
|
|
}else{
|
905
|
|
result = super.getCallback();
|
906
|
|
}
|
907
|
|
return result;
|
908
|
|
}
|
909
|
|
|
910
|
891
|
/**
|
911
|
892
|
* 打开侧滑菜单
|
912
|
893
|
*/
|