|
|
@@ -18,12 +18,16 @@ import android.os.Bundle;
|
|
|
import android.provider.ContactsContract;
|
|
|
import android.text.Editable;
|
|
|
import android.text.Html;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.text.TextWatcher;
|
|
|
import android.util.Log;
|
|
|
import android.util.SparseIntArray;
|
|
|
import android.view.GestureDetector;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
+import android.view.Menu;
|
|
|
+import android.view.MenuInflater;
|
|
|
+import android.view.MenuItem;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
import android.view.View.OnClickListener;
|
|
|
@@ -68,6 +72,8 @@ import java.io.ByteArrayInputStream;
|
|
|
import java.io.File;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
+import static com.usai.redant.rautils.utils.Network.RESULT_TRUE;
|
|
|
+
|
|
|
public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
* ,
|
|
|
* OnGestureListener
|
|
|
@@ -182,7 +188,7 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
{
|
|
|
// TODO Auto-generated method stub
|
|
|
super.onCreate(savedInstanceState);
|
|
|
-
|
|
|
+ setHasOptionsMenu(true);
|
|
|
if (progressDialog == null) {
|
|
|
progressDialog = new ProgressDialog(mContext);
|
|
|
progressDialog.setCancelable(false);
|
|
|
@@ -1242,6 +1248,140 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
}
|
|
|
|
|
|
+ JSONArray injectMenu;
|
|
|
+ Menu FragmentMenu;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
+ if(item.getGroupId()!=-1)
|
|
|
+ {
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
+ }
|
|
|
+ switch (item.getItemId())
|
|
|
+ {
|
|
|
+
|
|
|
+// case android.R.id.home:
|
|
|
+// finish();
|
|
|
+// break;
|
|
|
+// case R.id.action_addto_favorite:
|
|
|
+//// LayoutInflater factory = LayoutInflater.from(this);
|
|
|
+//// final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
|
|
|
+// final View edit = new EditText(this);
|
|
|
+// new AlertDialog.Builder(this)
|
|
|
+// .setIconAttribute(android.R.attr.alertDialogIcon)
|
|
|
+// .setTitle(R.string.str_createname)
|
|
|
+// .setView(edit)
|
|
|
+// .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
+// public void onClick(DialogInterface dialog, int whichButton) {
|
|
|
+// String name = ((EditText)edit).getText().toString();
|
|
|
+// if(TextUtils.isEmpty(name))
|
|
|
+// {
|
|
|
+// new AlertDialog.Builder(NewDetailActivity.this)
|
|
|
+// .setTitle("Warning")
|
|
|
+// .setMessage("Name can not be empty.")
|
|
|
+//
|
|
|
+// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
+//
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .show();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// JSONObject json = new JSONObject();
|
|
|
+//
|
|
|
+// JSONArray actions = new JSONArray();
|
|
|
+// int count = getIntent().getIntExtra("actions_count", 0);
|
|
|
+// for (int i = 0; i < count; i++)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+// String title = getIntent().getStringExtra("action" + i);
|
|
|
+//
|
|
|
+// actions.put(title);
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// try
|
|
|
+// {
|
|
|
+// json.put("actions",actions);
|
|
|
+// json.put("bundle_params",RAUtil.Bundle2Json(paramsB)) ;
|
|
|
+// } catch (JSONException e)
|
|
|
+// {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+//
|
|
|
+// boolean bsuccessful= RADataProvider.saveDetailParametersForModuleWithName(json, sub_type, name);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
|
|
+// public void onClick(DialogInterface dialog, int whichButton) {
|
|
|
+//
|
|
|
+// /* User clicked cancel so do some stuff */
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .create().show();
|
|
|
+// return true;
|
|
|
+
|
|
|
+
|
|
|
+// case R.id.action_share_detail: {
|
|
|
+//
|
|
|
+//// Intent share = new Intent();
|
|
|
+//// share.setAction(Intent.ACTION_SEND);
|
|
|
+////// share.putExtra(Intent.EXTRA_STREAM, uri);
|
|
|
+//// share.setType("text/plain");
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+////
|
|
|
+//// if (email_content != null) {
|
|
|
+//// share.putExtra(Intent.EXTRA_TEXT, email_content); //附带的说明信息
|
|
|
+//// }
|
|
|
+//// if (email_subject != null) {
|
|
|
+//// share.putExtra(Intent.EXTRA_SUBJECT, email_subject);
|
|
|
+//// }
|
|
|
+//// if (email_to != null) {
|
|
|
+//// share.putExtra(Intent.EXTRA_EMAIL, email_to.split(","));
|
|
|
+//// }
|
|
|
+////
|
|
|
+////// share.putExtra(Intent.EXTRA_CC, new String[]{"ray.zhang@united-cn.net"});
|
|
|
+////// startActivity(Intent.createChooser(share,getString(R.string.str_sendto)));
|
|
|
+//// startActivity(Intent.createChooser(share, "Share"));
|
|
|
+// }
|
|
|
+// break;
|
|
|
+ }
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
+ // TODO Add your menu entries here
|
|
|
+
|
|
|
+
|
|
|
+ FragmentMenu = menu;
|
|
|
+ if(injectMenu!=null&&FragmentMenu!=null)
|
|
|
+ {
|
|
|
+ for(int i=0;i<injectMenu.length();i++)
|
|
|
+ {
|
|
|
+ JSONObject item= injectMenu.optJSONObject(i);
|
|
|
+
|
|
|
+
|
|
|
+// public MenuItem add(int groupId, int itemId, int order, CharSequence title);
|
|
|
+ FragmentMenu.add(-1,i,i,item.optString("title"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ super.onCreateOptionsMenu(menu, inflater);
|
|
|
+ }
|
|
|
@Override
|
|
|
public void onDetach()
|
|
|
{
|
|
|
@@ -1276,12 +1416,33 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ errorcode = jsonResult.optInt("result");
|
|
|
+ if(errorcode!=RESULT_TRUE)
|
|
|
+ return false;
|
|
|
// mdataFragment.put_result(jstr);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ injectMenu= jsonResult.optJSONArray("page_menu");
|
|
|
+
|
|
|
+ if(injectMenu!=null&&FragmentMenu!=null)
|
|
|
+ {
|
|
|
+ for(int i=0;i<injectMenu.length();i++)
|
|
|
+ {
|
|
|
+ JSONObject item= injectMenu.optJSONObject(i);
|
|
|
+ FragmentMenu.addSubMenu(item.optString("title"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
fragment_content = jstr;
|
|
|
NewDetailActivity activity = (NewDetailActivity) getActivity();
|
|
|
- activity.save_content(getArguments().getString("action_type"), jstr);
|
|
|
|
|
|
- errorcode = OnlineDataProvider.RESULT_TRUE;
|
|
|
+
|
|
|
+// activity.save_content(getArguments().getString("action_type"), jstr);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return true;
|
|
|
}
|