|
|
@@ -1251,124 +1251,42 @@ 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;
|
|
|
+ JSONObject jitem = injectMenu.optJSONObject(item.getItemId());
|
|
|
|
|
|
+ if(jitem==null)
|
|
|
+ {
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
+ }
|
|
|
+ String type = jitem.optString("type");
|
|
|
+ if(type.toLowerCase().equals("quickview"))
|
|
|
+ {
|
|
|
+ String url = jitem.optString("url");
|
|
|
+ showQuickLook(url);
|
|
|
+ }
|
|
|
+ else if(type.toLowerCase().equals("editor"))
|
|
|
+ {
|
|
|
+ throw new AssertionError("Editor not impl");
|
|
|
|
|
|
-// 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;
|
|
|
+ }
|
|
|
+ void injectmenu()
|
|
|
+ {
|
|
|
if(injectMenu!=null&&FragmentMenu!=null)
|
|
|
{
|
|
|
+
|
|
|
+ FragmentMenu.removeGroup(-1);
|
|
|
+
|
|
|
for(int i=0;i<injectMenu.length();i++)
|
|
|
{
|
|
|
JSONObject item= injectMenu.optJSONObject(i);
|
|
|
@@ -1380,6 +1298,15 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
+ // TODO Add your menu entries here
|
|
|
+
|
|
|
+
|
|
|
+ FragmentMenu = menu;
|
|
|
+
|
|
|
+ injectmenu();
|
|
|
super.onCreateOptionsMenu(menu, inflater);
|
|
|
}
|
|
|
@Override
|
|
|
@@ -1425,16 +1352,18 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
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"));
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ injectmenu();
|
|
|
+//
|
|
|
+// 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();
|
|
|
@@ -1533,7 +1462,7 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
final Bundle param = new Bundle();
|
|
|
// 下载文件
|
|
|
- final File downloadFile = OnlineDataProvider.downloadFile(param,url,cacheDir);
|
|
|
+ final File downloadFile = RADataProvider.downloadFile(param,url,cacheDir);
|
|
|
|
|
|
getActivity().runOnUiThread(new Runnable() {
|
|
|
@Override
|