|
|
|
@ -770,51 +770,42 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
case R.id.action_settings: {
|
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
|
if (itemId == R.id.action_settings) {
|
|
|
|
|
startPreferencesActivity();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case R.id.action_about: {
|
|
|
|
|
} else if (itemId == R.id.action_about) {
|
|
|
|
|
Intent intent = new Intent(this, AboutActivity.class);
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case R.id.action_lock:
|
|
|
|
|
} else if (itemId == R.id.action_lock) {
|
|
|
|
|
_vaultManager.lock(true);
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
} else {
|
|
|
|
|
if (item.getGroupId() == R.id.action_sort_category) {
|
|
|
|
|
item.setChecked(true);
|
|
|
|
|
|
|
|
|
|
SortCategory sortCategory;
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
case R.id.menu_sort_alphabetically:
|
|
|
|
|
int subItemId = item.getItemId();
|
|
|
|
|
if (subItemId == R.id.menu_sort_alphabetically) {
|
|
|
|
|
sortCategory = SortCategory.ISSUER;
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_sort_alphabetically_reverse:
|
|
|
|
|
} else if (subItemId == R.id.menu_sort_alphabetically_reverse) {
|
|
|
|
|
sortCategory = SortCategory.ISSUER_REVERSED;
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_sort_alphabetically_name:
|
|
|
|
|
} else if (subItemId == R.id.menu_sort_alphabetically_name) {
|
|
|
|
|
sortCategory = SortCategory.ACCOUNT;
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_sort_alphabetically_name_reverse:
|
|
|
|
|
} else if (subItemId == R.id.menu_sort_alphabetically_name_reverse) {
|
|
|
|
|
sortCategory = SortCategory.ACCOUNT_REVERSED;
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_sort_usage_count:
|
|
|
|
|
} else if (subItemId == R.id.menu_sort_usage_count) {
|
|
|
|
|
sortCategory = SortCategory.USAGE_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_sort_custom:
|
|
|
|
|
default:
|
|
|
|
|
} else {
|
|
|
|
|
sortCategory = SortCategory.CUSTOM;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_entryListView.setSortCategory(sortCategory, true);
|
|
|
|
|
_prefs.setCurrentSortCategory(sortCategory);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void collapseSearchView() {
|
|
|
|
@ -1123,18 +1114,15 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
case R.id.action_copy:
|
|
|
|
|
|
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
|
if (itemId == R.id.action_copy) {
|
|
|
|
|
copyEntryCode(_selectedEntries.get(0));
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_edit:
|
|
|
|
|
} else if (itemId == R.id.action_edit) {
|
|
|
|
|
startEditEntryActivity(CODE_EDIT_ENTRY, _selectedEntries.get(0));
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_toggle_favorite:
|
|
|
|
|
} else if (itemId == R.id.action_toggle_favorite) {
|
|
|
|
|
for (VaultEntry entry : _selectedEntries) {
|
|
|
|
|
entry.setIsFavorite(!entry.isFavorite());
|
|
|
|
|
_entryListView.replaceEntry(entry.getUUID(), entry);
|
|
|
|
@ -1143,9 +1131,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|
|
|
|
|
|
|
|
|
saveAndBackupVault();
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_share_qr:
|
|
|
|
|
} else if (itemId == R.id.action_share_qr) {
|
|
|
|
|
Intent intent = new Intent(getBaseContext(), TransferEntriesActivity.class);
|
|
|
|
|
ArrayList<GoogleAuthInfo> authInfos = new ArrayList<>();
|
|
|
|
|
for (VaultEntry entry : _selectedEntries) {
|
|
|
|
@ -1157,24 +1143,20 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_delete:
|
|
|
|
|
} else if (itemId == R.id.action_delete) {
|
|
|
|
|
Dialogs.showDeleteEntriesDialog(MainActivity.this, _selectedEntries, (d, which) -> {
|
|
|
|
|
deleteEntries(_selectedEntries);
|
|
|
|
|
_entryListView.setGroups(_vaultManager.getVault().getUsedGroups());
|
|
|
|
|
mode.finish();
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case R.id.action_assign_icons:
|
|
|
|
|
} else if (itemId == R.id.action_assign_icons) {
|
|
|
|
|
startAssignIconsActivity(CODE_ASSIGN_ICONS, _selectedEntries);
|
|
|
|
|
mode.finish();
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|