Update dialog for sharing no files to be more intuitive

This commit is contained in:
Juan Carlos González Cabrero 2016-03-31 09:45:51 +02:00
parent 996fdc4fa4
commit da6b0c0162
2 changed files with 17 additions and 3 deletions

View file

@ -68,8 +68,8 @@
<string name="uploader_wrn_no_account_text">There are no %1$s accounts on your device. Please set up an account first.</string>
<string name="uploader_wrn_no_account_setup_btn_text">Setup</string>
<string name="uploader_wrn_no_account_quit_btn_text">Quit</string>
<string name="uploader_wrn_no_content_title">No content to upload</string>
<string name="uploader_wrn_no_content_text">No content was received. Nothing to upload.</string>
<string name="uploader_wrn_no_content_title">No file to upload</string>
<string name="uploader_wrn_no_content_text">Sorry, the received data does not content any file.</string>
<string name="uploader_error_forbidden_content">%1$s is not allowed to access the shared content</string>
<string name="uploader_info_uploading">Uploading</string>
<string name="file_list_seconds_ago">seconds ago</string>
@ -99,6 +99,7 @@
<string name="common_retry_upload">Retry upload</string>
<string name="common_cancel_sync">Cancel sync</string>
<string name="common_cancel">Cancel</string>
<string name="common_back">Back</string>
<string name="common_save_exit">Save &amp; exit</string>
<string name="common_error">Error</string>
<string name="common_loading">Loading &#8230;</string>

View file

@ -51,6 +51,7 @@ import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AlertDialog.Builder;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@ -227,6 +228,17 @@ public class Uploader extends FileActivity
@Override
protected Dialog onCreateDialog(final int id) {
final AlertDialog.Builder builder = new Builder(this);
// Create key listener for back button pressed
DialogInterface.OnKeyListener onKeyListener = new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
dialog.dismiss();
}
return true;
}
};
switch (id) {
case DIALOG_WAITING:
final ProgressDialog pDialog = new ProgressDialog(this, R.style.ProgressDialogTheme);
@ -314,12 +326,13 @@ public class Uploader extends FileActivity
builder.setTitle(R.string.uploader_wrn_no_content_title);
builder.setMessage(R.string.uploader_wrn_no_content_text);
builder.setCancelable(false);
builder.setNegativeButton(R.string.common_cancel, new OnClickListener() {
builder.setNegativeButton(R.string.common_back, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.setOnKeyListener(onKeyListener);
return builder.create();
default:
throw new IllegalArgumentException("Unknown dialog id: " + id);