use of fr.free.nrw.commons.category.CategorizationFragment in project apps-android-commons by commons-app.
the class MultipleShareActivity method multipleUploadBegins.
private void multipleUploadBegins() {
Timber.d("Multiple upload begins");
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setIndeterminate(false);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(photosList.size());
dialog.setTitle(getResources().getQuantityString(R.plurals.starting_multiple_uploads, photosList.size(), photosList.size()));
dialog.show();
for (int i = 0; i < photosList.size(); i++) {
Contribution up = photosList.get(i);
// Goddamn Java
final int uploadCount = i + 1;
uploadController.startUpload(up, new UploadController.ContributionUploadProgress() {
@Override
public void onUploadStarted(Contribution contribution) {
dialog.setProgress(uploadCount);
if (uploadCount == photosList.size()) {
dialog.dismiss();
Toast startingToast = Toast.makeText(CommonsApplication.getInstance(), R.string.uploading_started, Toast.LENGTH_LONG);
startingToast.show();
}
}
});
}
uploadsList.setImageOnlyMode(true);
categorizationFragment = (CategorizationFragment) getSupportFragmentManager().findFragmentByTag("categorization");
if (categorizationFragment == null) {
categorizationFragment = new CategorizationFragment();
}
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
View target = getCurrentFocus();
if (target != null) {
InputMethodManager imm = (InputMethodManager) target.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(target.getWindowToken(), 0);
}
getSupportFragmentManager().beginTransaction().add(R.id.uploadsFragmentContainer, categorizationFragment, "categorization").commitAllowingStateLoss();
//See http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa
}
Aggregations