Merge pull request #1318 from adithyaphilip/remove-nan

Prevent NaN Progress Dialog on import with no selected keys
This commit is contained in:
Vincent 2015-05-30 23:16:07 +02:00
commit 5d87872245
2 changed files with 8 additions and 3 deletions

View File

@ -384,6 +384,13 @@ public class ImportKeysActivity extends BaseNfcActivity {
*/
public void importKeys() {
ImportKeysListFragment.LoaderState ls = mListFragment.getLoaderState();
if (mListFragment.getSelectedEntries().size() == 0) {
Notify.create(this, R.string.error_nothing_import_selected, Notify.Style.ERROR)
.show((ViewGroup) findViewById(R.id.import_snackbar));
return;
}
if (ls instanceof ImportKeysListFragment.BytesLoaderState) {
Log.d(Constants.TAG, "importKeys started");
@ -488,9 +495,6 @@ public class ImportKeysActivity extends BaseNfcActivity {
// start service with intent
startService(intent);
} else {
Notify.create(this, R.string.error_nothing_import, Notify.Style.ERROR)
.show((ViewGroup) findViewById(R.id.import_snackbar));
}
}

View File

@ -281,6 +281,7 @@
<string name="error_nfc_needed">"NFC must be enabled!"</string>
<string name="error_beam_needed">"Beam must be enabled!"</string>
<string name="error_nothing_import">"No keys found!"</string>
<string name="error_nothing_import_selected">"No keys selected for import!"</string>
<string name="error_contacts_key_id_missing">"Retrieving the key ID from contacts failed!"</string>
<string name="error_generic_report_bug">"A generic error occurred, please create a new bug report for OpenKeychain."</string>