prevent NaN dialog on import with no selected keys

This commit is contained in:
Adithya Abraham Philip
2015-05-31 02:36:45 +05:30
parent 3be44898db
commit cfeffef80d
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));
}
}