|
@@ -2436,6 +2436,12 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ protected void multiAction( int groupIndex,int itemIndex,JSONObject item_json)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ throw new AssertionError("CommonEditor.multiAction not impl");
|
|
|
|
|
+ }
|
|
|
protected void commonAction(String value, int groupIndex,int itemIndex,JSONObject item_json)
|
|
protected void commonAction(String value, int groupIndex,int itemIndex,JSONObject item_json)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -3786,165 +3792,170 @@ protected void commonAction(String value, int groupIndex,int itemIndex,JSONObjec
|
|
|
int child = Integer.valueOf(arr[1]);
|
|
int child = Integer.valueOf(arr[1]);
|
|
|
int i = Integer.valueOf(arr[2]);
|
|
int i = Integer.valueOf(arr[2]);
|
|
|
|
|
|
|
|
- int refresh = 0;
|
|
|
|
|
- boolean discardDirty = false;
|
|
|
|
|
- JSONObject section_json = null;
|
|
|
|
|
- JSONObject item_json = content_data_control.optJSONArray(group).optJSONObject(child);
|
|
|
|
|
- String subid = item_json.optString("subid");
|
|
|
|
|
- String refresh_trigger = item_json.optString("name");
|
|
|
|
|
- JSONObject sub_action = item_json.optJSONObject("item_" + i);
|
|
|
|
|
- String type = sub_action.optString("type");
|
|
|
|
|
-
|
|
|
|
|
- if (type != null && type.equals("pull")) {
|
|
|
|
|
-
|
|
|
|
|
- // end edit
|
|
|
|
|
-
|
|
|
|
|
- refresh = sub_action.optInt("refresh");
|
|
|
|
|
- discardDirty = sub_action.optBoolean("discarddirty");
|
|
|
|
|
- JSONObject keymap = sub_action.optJSONObject("key_map");
|
|
|
|
|
- JSONObject value = create_value_map(keymap);
|
|
|
|
|
-
|
|
|
|
|
- if (subid == null || subid.isEmpty()) {
|
|
|
|
|
- JSONObject jsonmap = sub_action.optJSONObject("key_map");
|
|
|
|
|
- section_json = content_data_download.optJSONObject("section_" + group);
|
|
|
|
|
- int icount = section_json.optInt("count");
|
|
|
|
|
- for (int ic = 0; ic < icount; ic++) {
|
|
|
|
|
- JSONObject modity_item = section_json.optJSONObject("item_" + ic);
|
|
|
|
|
- String mapto = modity_item.optString("name");
|
|
|
|
|
-
|
|
|
|
|
- if (mapto.isEmpty()) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- String valuefrom = jsonmap.optString(modity_item.optString("name"));
|
|
|
|
|
- if (valuefrom == null) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- String valuestr = value.optString(valuefrom);
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- if (valuestr.isEmpty()) {
|
|
|
|
|
- modity_item.put("value","");
|
|
|
|
|
- } else {
|
|
|
|
|
- modity_item.put("value",valuestr);
|
|
|
|
|
- }
|
|
|
|
|
- modity_item.put("dirty","true");
|
|
|
|
|
- section_json.put("item_" + ic,modity_item);
|
|
|
|
|
-
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- String[] idarr = subid.split("_");
|
|
|
|
|
- int section = Integer.valueOf(idarr[0]);
|
|
|
|
|
- int item = Integer.valueOf(idarr[1]);
|
|
|
|
|
-
|
|
|
|
|
- JSONObject jsonmap = sub_action.optJSONObject("key_map");
|
|
|
|
|
- section_json = content_data_download.optJSONObject("section_" + section);
|
|
|
|
|
- JSONObject olditem = section_json.optJSONObject("item_" + item);
|
|
|
|
|
-
|
|
|
|
|
- String control_type = olditem.optString("control");
|
|
|
|
|
- if (control_type.equals("switch")) {
|
|
|
|
|
- olditem = fill_switch_subitem_subid_mapping(olditem,null,value,jsonmap);
|
|
|
|
|
- } else if (control_type.equals("enum")) {
|
|
|
|
|
- olditem = fill_enum_subitem_subid_mapping(olditem,null,value,jsonmap);
|
|
|
|
|
- } else {
|
|
|
|
|
- new AlertDialog.Builder(mCtx)
|
|
|
|
|
- .setMessage("not impl")
|
|
|
|
|
- .setPositiveButton("OK",null)
|
|
|
|
|
- .show();
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- olditem.put("dirty","true");
|
|
|
|
|
- section_json.put("item_" + item,olditem);
|
|
|
|
|
-
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
-
|
|
|
|
|
- content_data_download.put("section_" + group,section_json);
|
|
|
|
|
- content_data_control = translateChange(content_data_download,changed_data);
|
|
|
|
|
-
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (refresh == 1) {
|
|
|
|
|
- refresh(refresh_trigger,discardDirty);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- JSONObject itemjson = sub_action;
|
|
|
|
|
- String value = itemjson.optString("value");
|
|
|
|
|
- Intent intent = null;
|
|
|
|
|
- String requesturl = null;
|
|
|
|
|
- int request_code = -1;
|
|
|
|
|
- if (value.equals("new_addr")) {
|
|
|
|
|
-
|
|
|
|
|
- AddressEditorActivity.Builder builder = new AddressEditorActivity.Builder(); // 创建内部类实例需要外部类的实例,或者声明内部类为static
|
|
|
|
|
- intent = builder.build(mCtx,URL_REMOTE,requesturl,"true",String.format("%d",i),group,child);
|
|
|
|
|
- request_code = 2;
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("credit_card")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 3;
|
|
|
|
|
- JSONObject data = item_json.optJSONObject("data");
|
|
|
|
|
- int url_type;
|
|
|
|
|
- JSONObject download_data;
|
|
|
|
|
- if (data != null) {
|
|
|
|
|
- download_data = data;
|
|
|
|
|
- url_type = URL_NONE;
|
|
|
|
|
- requesturl = null;
|
|
|
|
|
- } else {
|
|
|
|
|
- download_data = null;
|
|
|
|
|
- url_type = URL_REMOTE;
|
|
|
|
|
- requesturl = "";
|
|
|
|
|
- }
|
|
|
|
|
- intent = new CreditCardEditorActivity.Builder().build(mCtx,url_type,requesturl,Application.order_code,"true",String.format("%d",i),download_data,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Sales_Order_Freight_Bill_To")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 4;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Sales_Order_Ship_From")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 5;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Sales_Order_Customer")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 6;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Sales_Order_Merchandise_Bill_To")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 7;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Contact_Return_To")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 8;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
-
|
|
|
|
|
- } else if (value.equals("Sales_Order_Ship_To")) {
|
|
|
|
|
-
|
|
|
|
|
- request_code = 9;
|
|
|
|
|
- intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// int refresh = 0;
|
|
|
|
|
+// boolean discardDirty = false;
|
|
|
|
|
+// JSONObject section_json = null;
|
|
|
|
|
+// JSONObject item_json = content_data_control.optJSONArray(group).optJSONObject(child);
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// String subid = item_json.optString("subid");
|
|
|
|
|
+// String refresh_trigger = item_json.optString("name");
|
|
|
|
|
+// JSONObject sub_action = item_json.optJSONObject("item_" + i);
|
|
|
|
|
+// String type = sub_action.optString("type");
|
|
|
|
|
|
|
|
- if (intent != null) {
|
|
|
|
|
- startActivityForResult(intent,request_code);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ multiAction(group,child,item_json);
|
|
|
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// if (type != null && type.equals("pull")) {
|
|
|
|
|
+//
|
|
|
|
|
+// // end edit
|
|
|
|
|
+//
|
|
|
|
|
+// refresh = sub_action.optInt("refresh");
|
|
|
|
|
+// discardDirty = sub_action.optBoolean("discarddirty");
|
|
|
|
|
+// JSONObject keymap = sub_action.optJSONObject("key_map");
|
|
|
|
|
+// JSONObject value = create_value_map(keymap);
|
|
|
|
|
+//
|
|
|
|
|
+// if (subid == null || subid.isEmpty()) {
|
|
|
|
|
+// JSONObject jsonmap = sub_action.optJSONObject("key_map");
|
|
|
|
|
+// section_json = content_data_download.optJSONObject("section_" + group);
|
|
|
|
|
+// int icount = section_json.optInt("count");
|
|
|
|
|
+// for (int ic = 0; ic < icount; ic++) {
|
|
|
|
|
+// JSONObject modity_item = section_json.optJSONObject("item_" + ic);
|
|
|
|
|
+// String mapto = modity_item.optString("name");
|
|
|
|
|
+//
|
|
|
|
|
+// if (mapto.isEmpty()) {
|
|
|
|
|
+// continue;
|
|
|
|
|
+// }
|
|
|
|
|
+// String valuefrom = jsonmap.optString(modity_item.optString("name"));
|
|
|
|
|
+// if (valuefrom == null) {
|
|
|
|
|
+// continue;
|
|
|
|
|
+// }
|
|
|
|
|
+// String valuestr = value.optString(valuefrom);
|
|
|
|
|
+//
|
|
|
|
|
+// try {
|
|
|
|
|
+// if (valuestr.isEmpty()) {
|
|
|
|
|
+// modity_item.put("value","");
|
|
|
|
|
+// } else {
|
|
|
|
|
+// modity_item.put("value",valuestr);
|
|
|
|
|
+// }
|
|
|
|
|
+// modity_item.put("dirty","true");
|
|
|
|
|
+// section_json.put("item_" + ic,modity_item);
|
|
|
|
|
+//
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// } else {
|
|
|
|
|
+// String[] idarr = subid.split("_");
|
|
|
|
|
+// int section = Integer.valueOf(idarr[0]);
|
|
|
|
|
+// int item = Integer.valueOf(idarr[1]);
|
|
|
|
|
+//
|
|
|
|
|
+// JSONObject jsonmap = sub_action.optJSONObject("key_map");
|
|
|
|
|
+// section_json = content_data_download.optJSONObject("section_" + section);
|
|
|
|
|
+// JSONObject olditem = section_json.optJSONObject("item_" + item);
|
|
|
|
|
+//
|
|
|
|
|
+// String control_type = olditem.optString("control");
|
|
|
|
|
+// if (control_type.equals("switch")) {
|
|
|
|
|
+// olditem = fill_switch_subitem_subid_mapping(olditem,null,value,jsonmap);
|
|
|
|
|
+// } else if (control_type.equals("enum")) {
|
|
|
|
|
+// olditem = fill_enum_subitem_subid_mapping(olditem,null,value,jsonmap);
|
|
|
|
|
+// } else {
|
|
|
|
|
+// new AlertDialog.Builder(mCtx)
|
|
|
|
|
+// .setMessage("not impl")
|
|
|
|
|
+// .setPositiveButton("OK",null)
|
|
|
|
|
+// .show();
|
|
|
|
|
+// }
|
|
|
|
|
+// try {
|
|
|
|
|
+// olditem.put("dirty","true");
|
|
|
|
|
+// section_json.put("item_" + item,olditem);
|
|
|
|
|
+//
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// try {
|
|
|
|
|
+//
|
|
|
|
|
+// content_data_download.put("section_" + group,section_json);
|
|
|
|
|
+// content_data_control = translateChange(content_data_download,changed_data);
|
|
|
|
|
+//
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if (refresh == 1) {
|
|
|
|
|
+// refresh(refresh_trigger,discardDirty);
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
|
|
+// adapter.notifyDataSetChanged();
|
|
|
|
|
+//
|
|
|
|
|
+// } else {
|
|
|
|
|
+// JSONObject itemjson = sub_action;
|
|
|
|
|
+// String value = itemjson.optString("value");
|
|
|
|
|
+// Intent intent = null;
|
|
|
|
|
+// String requesturl = null;
|
|
|
|
|
+// int request_code = -1;
|
|
|
|
|
+// if (value.equals("new_addr")) {
|
|
|
|
|
+//
|
|
|
|
|
+// AddressEditorActivity.Builder builder = new AddressEditorActivity.Builder(); // 创建内部类实例需要外部类的实例,或者声明内部类为static
|
|
|
|
|
+// intent = builder.build(mCtx,URL_REMOTE,requesturl,"true",String.format("%d",i),group,child);
|
|
|
|
|
+// request_code = 2;
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("credit_card")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 3;
|
|
|
|
|
+// JSONObject data = item_json.optJSONObject("data");
|
|
|
|
|
+// int url_type;
|
|
|
|
|
+// JSONObject download_data;
|
|
|
|
|
+// if (data != null) {
|
|
|
|
|
+// download_data = data;
|
|
|
|
|
+// url_type = URL_NONE;
|
|
|
|
|
+// requesturl = null;
|
|
|
|
|
+// } else {
|
|
|
|
|
+// download_data = null;
|
|
|
|
|
+// url_type = URL_REMOTE;
|
|
|
|
|
+// requesturl = "";
|
|
|
|
|
+// }
|
|
|
|
|
+// intent = new CreditCardEditorActivity.Builder().build(mCtx,url_type,requesturl,Application.order_code,"true",String.format("%d",i),download_data,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Sales_Order_Freight_Bill_To")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 4;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Sales_Order_Ship_From")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 5;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Sales_Order_Customer")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 6;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Sales_Order_Merchandise_Bill_To")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 7;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Contact_Return_To")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 8;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+//
|
|
|
|
|
+// } else if (value.equals("Sales_Order_Ship_To")) {
|
|
|
|
|
+//
|
|
|
|
|
+// request_code = 9;
|
|
|
|
|
+// intent = new ContactListActivity.Builder().build(mCtx,"true",String.format("%d",i),value,true,group,child);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// if (intent != null) {
|
|
|
|
|
+// startActivityForResult(intent,request_code);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|