// アップロードを開始する void upload_start() { // アップロードするアカウントとアルバム ImgurAlbum album = upload_target_manager.getSelectedAlbum(); ImgurAccount account = upload_target_manager.getSelectedAccount(); // アップロードジョブを登録してアップロード開始 UploadJob job = new UploadJob(account, album); for (int i = 0, ie = upload_list_adapter.getCount(); i < ie; ++i) { UploadItem item = (UploadItem) upload_list_adapter.getItem(i); if (item != null) job.addFile(item.file.getAbsolutePath()); } if (job.file_list.size() == 0) return; uploader.upload(job); }
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); }
void initPage() { Intent intent = getIntent(); if (intent != null) { // カメラ画面を呼び出した際のURIを復旧 String v = intent.getStringExtra(PrefKey.EXTRA_CAPTURE_URI); if (v != null) this.capture_uri = Uri.parse(v); String action = intent.getAction(); if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { try { ArrayList<UploadItem> tmp = new ArrayList<UploadItem>(); for (Parcelable p : intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)) { String path = MushroomHelper.uri_to_path(env, (Uri) p); if (path != null) tmp.add(new UploadItem(env, path)); } upload_list_adapter.replace(tmp); } catch (Throwable ex) { env.report_ex(ex); } } } updateUploadButtonStatus(); }
void updateUploadButtonStatus() { boolean b = (upload_list_adapter.getCount() > 0 && !uploader.isBusy()); btnUpload.setEnabled(b); }
private void replace_path(int idx, String path) { upload_list_adapter.replace_item(idx, new UploadItem(env, path)); }
private void add_item(String path) { if (path != null) upload_list_adapter.add(new UploadItem(env, path)); updateUploadButtonStatus(); }