mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-19 21:39:18 +00:00
Transition to non-final resource IDs and non-transitive R classes
Future versions of AGP will force us to do this, so we might as well get it over with now.
This commit is contained in:
parent
d09e81232a
commit
c13d4e7f8d
10 changed files with 162 additions and 199 deletions
|
@ -136,7 +136,7 @@ public class AboutActivity extends AegisActivity {
|
|||
String backgroundColor = getThemeColorAsHex(backgroundColorResource);
|
||||
String textColor = getThemeColorAsHex(R.attr.primaryText);
|
||||
String licenseColor = getThemeColorAsHex(R.attr.cardBackgroundFocused);
|
||||
String linkColor = getThemeColorAsHex(R.attr.colorAccent);
|
||||
String linkColor = getThemeColorAsHex(androidx.appcompat.R.attr.colorAccent);
|
||||
|
||||
stylesheet = String.format(stylesheet, backgroundColor, textColor, licenseColor, linkColor);
|
||||
|
||||
|
|
|
@ -163,18 +163,16 @@ public class AssignIconsActivity extends AegisActivity implements AssignIconAdap
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
discardAndFinish();
|
||||
break;
|
||||
case R.id.action_save:
|
||||
} else if (itemId == R.id.action_save) {
|
||||
try {
|
||||
saveAndFinish();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(this, R.string.saving_assign_icons_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -448,37 +448,32 @@ public class EditEntryActivity extends AegisActivity {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
discardAndFinish();
|
||||
break;
|
||||
case R.id.action_save:
|
||||
} else if (itemId == R.id.action_save) {
|
||||
onSave();
|
||||
break;
|
||||
case R.id.action_delete:
|
||||
} else if (itemId == R.id.action_delete) {
|
||||
Dialogs.showDeleteEntriesDialog(this, Collections.singletonList(_origEntry), (dialog, which) -> {
|
||||
deleteAndFinish(_origEntry);
|
||||
});
|
||||
break;
|
||||
case R.id.action_edit_icon:
|
||||
} else if (itemId == R.id.action_edit_icon) {
|
||||
startIconSelection();
|
||||
break;
|
||||
case R.id.action_reset_usage_count:
|
||||
} else if (itemId == R.id.action_reset_usage_count) {
|
||||
Dialogs.showSecureDialog(new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.action_reset_usage_count)
|
||||
.setMessage(R.string.action_reset_usage_count_dialog)
|
||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> resetUsageCount())
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.create());
|
||||
break;
|
||||
case R.id.action_default_icon:
|
||||
} else if (itemId == R.id.action_default_icon) {
|
||||
TextDrawable drawable = TextDrawableHelper.generate(_origEntry.getIssuer(), _origEntry.getName(), _iconView);
|
||||
_iconView.setImageDrawable(drawable);
|
||||
|
||||
_selectedIcon = null;
|
||||
_hasCustomIcon = false;
|
||||
_hasChangedIcon = true;
|
||||
default:
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,17 +147,14 @@ public class GroupManagerActivity extends AegisActivity implements GroupAdapter.
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
discardAndFinish();
|
||||
break;
|
||||
case R.id.action_save:
|
||||
} else if (itemId == R.id.action_save) {
|
||||
saveAndFinish();
|
||||
break;
|
||||
case R.id.action_delete_unused_groups:
|
||||
} else if (itemId == R.id.action_delete_unused_groups) {
|
||||
onRemoveUnusedGroups();
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -347,17 +347,14 @@ public class ImportEntriesActivity extends AegisActivity {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
finish();
|
||||
break;
|
||||
case R.id.toggle_checkboxes:
|
||||
} else if (itemId == R.id.toggle_checkboxes) {
|
||||
_adapter.toggleCheckboxes();
|
||||
break;
|
||||
case R.id.toggle_wipe_vault:
|
||||
} else if (itemId == R.id.toggle_wipe_vault) {
|
||||
item.setChecked(!item.isChecked());
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -154,7 +154,7 @@ public class TransferEntriesActivity extends AegisActivity {
|
|||
@ColorInt int backgroundColor = Color.WHITE;
|
||||
if (getConfiguredTheme() == Theme.LIGHT) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.background, typedValue, true);
|
||||
getTheme().resolveAttribute(androidx.appcompat.R.attr.background, typedValue, true);
|
||||
backgroundColor = typedValue.data;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,17 +74,13 @@ public class SecurityPickerSlide extends SlideFragment {
|
|||
int buttonId = _buttonGroup.getCheckedRadioButtonId();
|
||||
|
||||
int type;
|
||||
switch (buttonId) {
|
||||
case R.id.rb_none:
|
||||
if (buttonId == R.id.rb_none) {
|
||||
type = CRYPT_TYPE_NONE;
|
||||
break;
|
||||
case R.id.rb_password:
|
||||
} else if (buttonId == R.id.rb_password) {
|
||||
type = CRYPT_TYPE_PASS;
|
||||
break;
|
||||
case R.id.rb_biometrics:
|
||||
} else if (buttonId == R.id.rb_biometrics) {
|
||||
type = CRYPT_TYPE_BIOMETRIC;
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
throw new RuntimeException(String.format("Unsupported security type: %d", buttonId));
|
||||
}
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
|||
private class CompactDividerDecoration extends MaterialDividerItemDecoration {
|
||||
public CompactDividerDecoration() {
|
||||
super(requireContext(), DividerItemDecoration.VERTICAL);
|
||||
setDividerColor(ThemeHelper.getThemeColor(R.attr.divider, requireContext().getTheme()));
|
||||
setDividerColor(ThemeHelper.getThemeColor(androidx.appcompat.R.attr.divider, requireContext().getTheme()));
|
||||
setLastItemDecorated(false);
|
||||
setDividerThickness(MetricsHelper.convertDpToPixels(requireContext(), 0.5f));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,5 @@
|
|||
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.enableJetifier=false
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx8g
|
||||
|
|
Loading…
Add table
Reference in a new issue