use of fr.free.nrw.commons.contributions.ContributionsActivity in project apps-android-commons by commons-app.
the class MediaDetailPagerFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
MediaDetailProvider provider = (MediaDetailProvider) getActivity();
Media m = provider.getMediaAtPosition(pager.getCurrentItem());
switch(item.getItemId()) {
case R.id.menu_share_current_image:
// Share - this is just logs it, intent set in onCreateOptionsMenu, around line 252
EventLog.schema(CommonsApplication.EVENT_SHARE_ATTEMPT).param("username", app.getCurrentAccount().name).param("filename", m.getFilename()).log();
return true;
case R.id.menu_browser_current_image:
// View in browser
Intent viewIntent = new Intent();
viewIntent.setAction(Intent.ACTION_VIEW);
viewIntent.setData(Uri.parse(m.getMobileDescriptionUrl()));
startActivity(viewIntent);
return true;
case R.id.menu_download_current_image:
// Download
downloadMedia(m);
return true;
case R.id.menu_retry_current_image:
// Retry
((ContributionsActivity) getActivity()).retryUpload(pager.getCurrentItem());
getActivity().getSupportFragmentManager().popBackStack();
return true;
case R.id.menu_cancel_current_image:
// todo: delete image
((ContributionsActivity) getActivity()).deleteUpload(pager.getCurrentItem());
getActivity().getSupportFragmentManager().popBackStack();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
use of fr.free.nrw.commons.contributions.ContributionsActivity in project apps-android-commons by commons-app.
the class ExistingFileAsync method onPostExecute.
@Override
protected void onPostExecute(Boolean fileExists) {
super.onPostExecute(fileExists);
// Use soft warning for now (user able to choose to proceed) until have determined that implementation works without bugs
if (fileExists) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.file_exists).setTitle(R.string.warning);
builder.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//Go back to ContributionsActivity
Intent intent = new Intent(context, ContributionsActivity.class);
context.startActivity(intent);
}
});
builder.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//No need to do anything, user remains on upload screen
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}
Aggregations