@Override protected void onActivityResult(int requestCode, int resultCode, Intent detail) { log.d("onActivityResult req=%s res=%sdetail=%s", requestCode, resultCode, detail); switch (requestCode) { case MenuDialog.REQ_FILEPICKER: if (resultCode == RESULT_OK && detail != null) { add_item(MushroomHelper.uri_to_path(env, detail.getData())); } break; case MenuDialog.REQ_HISTORY: if (resultCode == RESULT_OK && detail != null) { MushroomHelper.finish_mush(env, true, detail.getStringExtra("url")); } break; case MenuDialog.REQ_PREF: upload_target_manager.reload(); break; case MenuDialog.REQ_ARRANGE: if (resultCode == RESULT_OK && detail != null) { String path = detail.getStringExtra(PrefKey.EXTRA_DST_PATH); replace_path(last_edit_index, path); } break; case MenuDialog.REQ_APPINFO: break; case MenuDialog.REQ_CAPTURE: if (resultCode == RESULT_OK) { Uri uri = (detail == null ? null : detail.getData()); if (uri == null) uri = capture_uri; if (uri == null) { log.e("cannot get capture uri"); } else { log.d("capture uri = %s", uri); add_item(MushroomHelper.uri_to_path(env, uri)); } } break; } super.onActivityResult(requestCode, resultCode, detail); }
// 画像選択画面を開く void open_file_picker() { try { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); // open chooser // startActivityForResult(Intent.createChooser(intent,"file picker"),REQ_FILEPICKER); startActivityForResult(intent, MenuDialog.REQ_FILEPICKER); return; } catch (ActivityNotFoundException ex) { env.show_toast(true, R.string.picker_missing); } log.d("open_file_picker :finish"); MushroomHelper.finish_mush(env, false, ""); }
void save_status() { log.d("save_status"); Intent intent = getIntent(); // リストアフラグ設定 intent.putExtra(PrefKey.EXTRA_IS_STATUS_SAVE, true); // 最後にカメラ画面を呼び出した際に生成したURL if (capture_uri != null) intent.putExtra(PrefKey.EXTRA_CAPTURE_URI, capture_uri.toString()); intent.putExtra(PrefKey.EXTRA_LAST_EDIT_INDEX, last_edit_index); // 選択中のファイルの一覧 ArrayList<Parcelable> list = new ArrayList<Parcelable>(); int n = upload_list_adapter.getCount(); for (int i = 0; i < n; ++i) { UploadItem item = (UploadItem) upload_list_adapter.getItem(i); if (item != null) list.add(Uri.fromFile(item.file)); } intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, list); intent.setAction(Intent.ACTION_SEND_MULTIPLE); setIntent(intent); }