|
@@ -15,6 +15,7 @@ import android.view.View;
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
|
|
|
|
|
|
|
+import com.usai.commoneditorlib.AddressEditorActivity;
|
|
|
import com.usai.commoneditorlib.CommonEditorActivity;
|
|
import com.usai.commoneditorlib.CommonEditorActivity;
|
|
|
import com.usai.commoneditorlib.EnumSlectOnlineActivity;
|
|
import com.usai.commoneditorlib.EnumSlectOnlineActivity;
|
|
|
import com.usai.ratradefiling.R;
|
|
import com.usai.ratradefiling.R;
|
|
@@ -27,7 +28,7 @@ import com.usai.redant.rautils.utils.RAUtil;
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
-import java.lang.reflect.ParameterizedType;
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
import static com.usai.ratradefiling.dataprovider.OnlineDataProvider.URL_CADEDATE;
|
|
import static com.usai.ratradefiling.dataprovider.OnlineDataProvider.URL_CADEDATE;
|
|
|
import static com.usai.ratradefiling.dataprovider.OnlineDataProvider.URL_EDIT;
|
|
import static com.usai.ratradefiling.dataprovider.OnlineDataProvider.URL_EDIT;
|
|
@@ -38,6 +39,57 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
private Context mContext;
|
|
private Context mContext;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ static String URL_TYPE = "url_type";
|
|
|
|
|
+ static String REQUEST_URL = "request_url";
|
|
|
|
|
+
|
|
|
|
|
+ private int mGroup;
|
|
|
|
|
+ private int subtag;
|
|
|
|
|
+ private int mChild;
|
|
|
|
|
+ private String mTitle;
|
|
|
|
|
+ private boolean m_issub;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// intent.putExtra(CADEDATE,online_cadedate.toString());
|
|
|
|
|
+// intent.putExtra(GROUP_POSITION, mGroup);
|
|
|
|
|
+// intent.putExtra(CHILD_POSITION, mChild);
|
|
|
|
|
+// intent.putExtra(SUB_ID,subid);
|
|
|
|
|
+
|
|
|
|
|
+ public static class Builder {
|
|
|
|
|
+
|
|
|
|
|
+ public Intent build(Context context,String title,int URLType,String requestURL,Bundle params,boolean is_subaction,int subaction_tag,int group,int child) {
|
|
|
|
|
+ if (context == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ Intent intent = new Intent(context,TFEditorActivity.class);
|
|
|
|
|
+
|
|
|
|
|
+ intent.putExtra(URL_TYPE ,URLType);
|
|
|
|
|
+
|
|
|
|
|
+ if (requestURL != null) {
|
|
|
|
|
+ intent.putExtra(REQUEST_URL,requestURL);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (is_subaction ) {
|
|
|
|
|
+ intent.putExtra(IS_SUBACTION,is_subaction);
|
|
|
|
|
+
|
|
|
|
|
+ intent.putExtra(SUBACTION_TAG,subaction_tag);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ intent.putExtra(GROUP,group);
|
|
|
|
|
+ intent.putExtra(CHILD,child);
|
|
|
|
|
+ if (params != null) {
|
|
|
|
|
+ intent.putExtra("params",params);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (title != null) {
|
|
|
|
|
+ intent.putExtra("title",title);
|
|
|
|
|
+ }
|
|
|
|
|
+ return intent;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
|
@@ -47,6 +99,14 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
hasChildView = false;
|
|
hasChildView = false;
|
|
|
|
|
|
|
|
ONLINE_ENUM_URL=URL_CADEDATE;
|
|
ONLINE_ENUM_URL=URL_CADEDATE;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Intent intent = getIntent();
|
|
|
|
|
+ mGroup = intent.getIntExtra(GROUP, 0);
|
|
|
|
|
+ subtag = intent.getIntExtra(SUBACTION_TAG, -1);
|
|
|
|
|
+ mChild = intent.getIntExtra(CHILD, 0);
|
|
|
|
|
+ mTitle = intent.getStringExtra("title");
|
|
|
|
|
+ m_issub = intent.getBooleanExtra(IS_SUBACTION,false);
|
|
|
// setContentView(R.layout.activity_tfeditor);
|
|
// setContentView(R.layout.activity_tfeditor);
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
@@ -147,7 +207,26 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
if (result == 2)
|
|
if (result == 2)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- RAUtil.alertMessage(mCtx, "Message", "Save successful");
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(mCtx);
|
|
|
|
|
+
|
|
|
|
|
+ builder.setTitle("Message");
|
|
|
|
|
+
|
|
|
|
|
+ builder.setMessage( "Save successful");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ builder.setPositiveButton(mCtx.getString(com.usai.redant.rautils.R.string.ra_btn_ok), new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+ prepareReturn();
|
|
|
|
|
+// finish();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ builder.show();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -303,12 +382,47 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
return ;
|
|
return ;
|
|
|
|
|
|
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
|
- Intent intent = TFEditorActivity.build(mContext,TFEditorActivity.class,null,URL_REMOTE,URL_EDIT,b);
|
|
|
|
|
|
|
+// Intent intent = TFEditorActivity.build(mContext,TFEditorActivity.class,null,URL_REMOTE,URL_EDIT,b);
|
|
|
|
|
+ boolean is_subaction = item_json.optBoolean("is_subaction");
|
|
|
|
|
+ int subaction_tag = item_json.optInt("subaction_tag");
|
|
|
|
|
+
|
|
|
|
|
+ TFEditorActivity.Builder builder = new TFEditorActivity.Builder(); // 创建内部类实例需要外部类的实例,或者声明内部类为static
|
|
|
|
|
+ Intent intent = builder.build(mContext,null,URL_REMOTE,URL_EDIT,b,is_subaction,subaction_tag,groupIndex,itemIndex);
|
|
|
|
|
|
|
|
- startActivity(intent);
|
|
|
|
|
|
|
+ int request_code = 20;
|
|
|
|
|
+
|
|
|
|
|
+ startActivityForResult(intent,20);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void prepareReturn()
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+// if (mDirty != false)
|
|
|
|
|
+// {
|
|
|
|
|
+ Intent intent = new Intent();
|
|
|
|
|
+// intent.putExtra(CADEDATE,online_cadedate.toString());
|
|
|
|
|
+ intent.putExtra(GROUP, mGroup);
|
|
|
|
|
+ intent.putExtra(CHILD, mChild);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject value = new JSONObject();
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ value.put("is_subaction", m_issub);
|
|
|
|
|
+ value.put("subaction_tag",subtag);
|
|
|
|
|
+ } catch (JSONException e)
|
|
|
|
|
+ {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ intent.putExtra(RETURN_VALUE,value.toString());
|
|
|
|
|
+
|
|
|
|
|
+ setResult(RESULT_OK, intent);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ super.finish();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void multiAction( int groupIndex, int itemIndex, JSONObject item_json,int subid)
|
|
protected void multiAction( int groupIndex, int itemIndex, JSONObject item_json,int subid)
|
|
@@ -337,10 +451,15 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
if(disable==1||readonly)
|
|
if(disable==1||readonly)
|
|
|
return ;
|
|
return ;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ boolean is_subaction = subid >= 0;
|
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
|
- Intent intent = TFEditorActivity.build(mContext,TFEditorActivity.class,null,URL_REMOTE,URL_EDIT,b);
|
|
|
|
|
|
|
+ TFEditorActivity.Builder builder = new TFEditorActivity.Builder(); // 创建内部类实例需要外部类的实例,或者声明内部类为static
|
|
|
|
|
+ Intent intent = builder.build(mContext,null,URL_REMOTE,URL_EDIT,b,is_subaction,subid,groupIndex,itemIndex);
|
|
|
|
|
|
|
|
- startActivity(intent);
|
|
|
|
|
|
|
+ int request_code = 20;
|
|
|
|
|
+
|
|
|
|
|
+ startActivityForResult(intent,20);
|
|
|
|
|
|
|
|
// TFEditorViewController *vc = [[UIStoryboard storyboardWithName:@"TFEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"TFEditorViewController"];
|
|
// TFEditorViewController *vc = [[UIStoryboard storyboardWithName:@"TFEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"TFEditorViewController"];
|
|
|
//
|
|
//
|
|
@@ -428,11 +547,15 @@ public class TFEditorActivity extends CommonEditorActivity
|
|
|
|
|
|
|
|
if(disable==1||readonly)
|
|
if(disable==1||readonly)
|
|
|
return ;
|
|
return ;
|
|
|
-
|
|
|
|
|
|
|
+ boolean is_subaction = item_json.optBoolean("is_subaction");
|
|
|
|
|
+ int subaction_tag = item_json.optInt("subaction_tag");
|
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
Bundle b= RAUtil.Json2Bundle(item_json.optJSONObject("params"));
|
|
|
- Intent intent = TFEditorActivity.build(mContext,TFEditorActivity.class,null,URL_REMOTE,URL_EDIT,b);
|
|
|
|
|
|
|
+ TFEditorActivity.Builder builder = new TFEditorActivity.Builder(); // 创建内部类实例需要外部类的实例,或者声明内部类为static
|
|
|
|
|
+ Intent intent = builder.build(mContext,null,URL_REMOTE,URL_EDIT,b,is_subaction,subaction_tag,groupIndex,itemIndex);
|
|
|
|
|
+
|
|
|
|
|
+ int request_code = 20;
|
|
|
|
|
|
|
|
- startActivity(intent);
|
|
|
|
|
|
|
+ startActivityForResult(intent,20);
|
|
|
|
|
|
|
|
// TFEditorViewController *vc = [[UIStoryboard storyboardWithName:@"TFEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"TFEditorViewController"];
|
|
// TFEditorViewController *vc = [[UIStoryboard storyboardWithName:@"TFEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"TFEditorViewController"];
|
|
|
//
|
|
//
|