mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-20 13:59:14 +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 backgroundColor = getThemeColorAsHex(backgroundColorResource);
|
||||||
String textColor = getThemeColorAsHex(R.attr.primaryText);
|
String textColor = getThemeColorAsHex(R.attr.primaryText);
|
||||||
String licenseColor = getThemeColorAsHex(R.attr.cardBackgroundFocused);
|
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);
|
stylesheet = String.format(stylesheet, backgroundColor, textColor, licenseColor, linkColor);
|
||||||
|
|
||||||
|
|
|
@ -163,19 +163,17 @@ public class AssignIconsActivity extends AegisActivity implements AssignIconAdap
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case android.R.id.home:
|
if (itemId == android.R.id.home) {
|
||||||
discardAndFinish();
|
discardAndFinish();
|
||||||
break;
|
} else if (itemId == R.id.action_save) {
|
||||||
case R.id.action_save:
|
try {
|
||||||
try {
|
saveAndFinish();
|
||||||
saveAndFinish();
|
} catch (IOException e) {
|
||||||
} catch (IOException e) {
|
Toast.makeText(this, R.string.saving_assign_icons_error, Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(this, R.string.saving_assign_icons_error, Toast.LENGTH_SHORT).show();
|
}
|
||||||
}
|
} else {
|
||||||
break;
|
return super.onOptionsItemSelected(item);
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -448,38 +448,33 @@ public class EditEntryActivity extends AegisActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case android.R.id.home:
|
if (itemId == android.R.id.home) {
|
||||||
discardAndFinish();
|
discardAndFinish();
|
||||||
break;
|
} else if (itemId == R.id.action_save) {
|
||||||
case R.id.action_save:
|
onSave();
|
||||||
onSave();
|
} else if (itemId == R.id.action_delete) {
|
||||||
break;
|
Dialogs.showDeleteEntriesDialog(this, Collections.singletonList(_origEntry), (dialog, which) -> {
|
||||||
case R.id.action_delete:
|
deleteAndFinish(_origEntry);
|
||||||
Dialogs.showDeleteEntriesDialog(this, Collections.singletonList(_origEntry), (dialog, which) -> {
|
});
|
||||||
deleteAndFinish(_origEntry);
|
} else if (itemId == R.id.action_edit_icon) {
|
||||||
});
|
startIconSelection();
|
||||||
break;
|
} else if (itemId == R.id.action_reset_usage_count) {
|
||||||
case R.id.action_edit_icon:
|
Dialogs.showSecureDialog(new AlertDialog.Builder(this)
|
||||||
startIconSelection();
|
.setTitle(R.string.action_reset_usage_count)
|
||||||
break;
|
.setMessage(R.string.action_reset_usage_count_dialog)
|
||||||
case R.id.action_reset_usage_count:
|
.setPositiveButton(android.R.string.yes, (dialog, which) -> resetUsageCount())
|
||||||
Dialogs.showSecureDialog(new AlertDialog.Builder(this)
|
.setNegativeButton(android.R.string.no, null)
|
||||||
.setTitle(R.string.action_reset_usage_count)
|
.create());
|
||||||
.setMessage(R.string.action_reset_usage_count_dialog)
|
} else if (itemId == R.id.action_default_icon) {
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, which) -> resetUsageCount())
|
TextDrawable drawable = TextDrawableHelper.generate(_origEntry.getIssuer(), _origEntry.getName(), _iconView);
|
||||||
.setNegativeButton(android.R.string.no, null)
|
_iconView.setImageDrawable(drawable);
|
||||||
.create());
|
|
||||||
break;
|
|
||||||
case R.id.action_default_icon:
|
|
||||||
TextDrawable drawable = TextDrawableHelper.generate(_origEntry.getIssuer(), _origEntry.getName(), _iconView);
|
|
||||||
_iconView.setImageDrawable(drawable);
|
|
||||||
|
|
||||||
_selectedIcon = null;
|
_selectedIcon = null;
|
||||||
_hasCustomIcon = false;
|
_hasCustomIcon = false;
|
||||||
_hasChangedIcon = true;
|
_hasChangedIcon = true;
|
||||||
default:
|
} else {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -147,18 +147,15 @@ public class GroupManagerActivity extends AegisActivity implements GroupAdapter.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case android.R.id.home:
|
if (itemId == android.R.id.home) {
|
||||||
discardAndFinish();
|
discardAndFinish();
|
||||||
break;
|
} else if (itemId == R.id.action_save) {
|
||||||
case R.id.action_save:
|
saveAndFinish();
|
||||||
saveAndFinish();
|
} else if (itemId == R.id.action_delete_unused_groups) {
|
||||||
break;
|
onRemoveUnusedGroups();
|
||||||
case R.id.action_delete_unused_groups:
|
} else {
|
||||||
onRemoveUnusedGroups();
|
return super.onOptionsItemSelected(item);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -347,18 +347,15 @@ public class ImportEntriesActivity extends AegisActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case android.R.id.home:
|
if (itemId == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
break;
|
} else if (itemId == R.id.toggle_checkboxes) {
|
||||||
case R.id.toggle_checkboxes:
|
_adapter.toggleCheckboxes();
|
||||||
_adapter.toggleCheckboxes();
|
} else if (itemId == R.id.toggle_wipe_vault) {
|
||||||
break;
|
item.setChecked(!item.isChecked());
|
||||||
case R.id.toggle_wipe_vault:
|
} else {
|
||||||
item.setChecked(!item.isChecked());
|
return super.onOptionsItemSelected(item);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -770,51 +770,42 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.action_settings: {
|
if (itemId == R.id.action_settings) {
|
||||||
startPreferencesActivity();
|
startPreferencesActivity();
|
||||||
return true;
|
} else if (itemId == R.id.action_about) {
|
||||||
}
|
Intent intent = new Intent(this, AboutActivity.class);
|
||||||
case R.id.action_about: {
|
startActivity(intent);
|
||||||
Intent intent = new Intent(this, AboutActivity.class);
|
} else if (itemId == R.id.action_lock) {
|
||||||
startActivity(intent);
|
_vaultManager.lock(true);
|
||||||
return true;
|
} else {
|
||||||
}
|
if (item.getGroupId() == R.id.action_sort_category) {
|
||||||
case R.id.action_lock:
|
item.setChecked(true);
|
||||||
_vaultManager.lock(true);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
if (item.getGroupId() == R.id.action_sort_category) {
|
|
||||||
item.setChecked(true);
|
|
||||||
|
|
||||||
SortCategory sortCategory;
|
SortCategory sortCategory;
|
||||||
switch (item.getItemId()) {
|
int subItemId = item.getItemId();
|
||||||
case R.id.menu_sort_alphabetically:
|
if (subItemId == R.id.menu_sort_alphabetically) {
|
||||||
sortCategory = SortCategory.ISSUER;
|
sortCategory = SortCategory.ISSUER;
|
||||||
break;
|
} else if (subItemId == R.id.menu_sort_alphabetically_reverse) {
|
||||||
case R.id.menu_sort_alphabetically_reverse:
|
sortCategory = SortCategory.ISSUER_REVERSED;
|
||||||
sortCategory = SortCategory.ISSUER_REVERSED;
|
} else if (subItemId == R.id.menu_sort_alphabetically_name) {
|
||||||
break;
|
sortCategory = SortCategory.ACCOUNT;
|
||||||
case R.id.menu_sort_alphabetically_name:
|
} else if (subItemId == R.id.menu_sort_alphabetically_name_reverse) {
|
||||||
sortCategory = SortCategory.ACCOUNT;
|
sortCategory = SortCategory.ACCOUNT_REVERSED;
|
||||||
break;
|
} else if (subItemId == R.id.menu_sort_usage_count) {
|
||||||
case R.id.menu_sort_alphabetically_name_reverse:
|
sortCategory = SortCategory.USAGE_COUNT;
|
||||||
sortCategory = SortCategory.ACCOUNT_REVERSED;
|
} else {
|
||||||
break;
|
sortCategory = SortCategory.CUSTOM;
|
||||||
case R.id.menu_sort_usage_count:
|
|
||||||
sortCategory = SortCategory.USAGE_COUNT;
|
|
||||||
break;
|
|
||||||
case R.id.menu_sort_custom:
|
|
||||||
default:
|
|
||||||
sortCategory = SortCategory.CUSTOM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_entryListView.setSortCategory(sortCategory, true);
|
|
||||||
_prefs.setCurrentSortCategory(sortCategory);
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
|
_entryListView.setSortCategory(sortCategory, true);
|
||||||
|
_prefs.setCurrentSortCategory(sortCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collapseSearchView() {
|
private void collapseSearchView() {
|
||||||
|
@ -1105,84 +1096,75 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ActionModeCallbacks implements ActionMode.Callback {
|
private class ActionModeCallbacks implements ActionMode.Callback {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.menu_action_mode, menu);
|
inflater.inflate(R.menu.menu_action_mode, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
|
if (_selectedEntries.size() == 0) {
|
||||||
|
mode.finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
int itemId = item.getItemId();
|
||||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
if (itemId == R.id.action_copy) {
|
||||||
|
copyEntryCode(_selectedEntries.get(0));
|
||||||
|
mode.finish();
|
||||||
|
} else if (itemId == R.id.action_edit) {
|
||||||
|
startEditEntryActivity(CODE_EDIT_ENTRY, _selectedEntries.get(0));
|
||||||
|
mode.finish();
|
||||||
|
} else if (itemId == R.id.action_toggle_favorite) {
|
||||||
|
for (VaultEntry entry : _selectedEntries) {
|
||||||
|
entry.setIsFavorite(!entry.isFavorite());
|
||||||
|
_entryListView.replaceEntry(entry.getUUID(), entry);
|
||||||
|
}
|
||||||
|
_entryListView.refresh(true);
|
||||||
|
|
||||||
|
saveAndBackupVault();
|
||||||
|
mode.finish();
|
||||||
|
} else if (itemId == R.id.action_share_qr) {
|
||||||
|
Intent intent = new Intent(getBaseContext(), TransferEntriesActivity.class);
|
||||||
|
ArrayList<GoogleAuthInfo> authInfos = new ArrayList<>();
|
||||||
|
for (VaultEntry entry : _selectedEntries) {
|
||||||
|
GoogleAuthInfo authInfo = new GoogleAuthInfo(entry.getInfo(), entry.getName(), entry.getIssuer());
|
||||||
|
authInfos.add(authInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
intent.putExtra("authInfos", authInfos);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
mode.finish();
|
||||||
|
} else if (itemId == R.id.action_delete) {
|
||||||
|
Dialogs.showDeleteEntriesDialog(MainActivity.this, _selectedEntries, (d, which) -> {
|
||||||
|
deleteEntries(_selectedEntries);
|
||||||
|
_entryListView.setGroups(_vaultManager.getVault().getUsedGroups());
|
||||||
|
mode.finish();
|
||||||
|
});
|
||||||
|
} else if (itemId == R.id.action_assign_icons) {
|
||||||
|
startAssignIconsActivity(CODE_ASSIGN_ICONS, _selectedEntries);
|
||||||
|
mode.finish();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return true;
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
}
|
||||||
if (_selectedEntries.size() == 0) {
|
|
||||||
mode.finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case R.id.action_copy:
|
|
||||||
copyEntryCode(_selectedEntries.get(0));
|
|
||||||
mode.finish();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case R.id.action_edit:
|
@Override
|
||||||
startEditEntryActivity(CODE_EDIT_ENTRY, _selectedEntries.get(0));
|
public void onDestroyActionMode(ActionMode mode) {
|
||||||
mode.finish();
|
_entryListView.setActionModeState(false, null);
|
||||||
return true;
|
_actionModeBackPressHandler.setEnabled(false);
|
||||||
|
_selectedEntries.clear();
|
||||||
case R.id.action_toggle_favorite:
|
_actionMode = null;
|
||||||
for (VaultEntry entry : _selectedEntries) {
|
}
|
||||||
entry.setIsFavorite(!entry.isFavorite());
|
|
||||||
_entryListView.replaceEntry(entry.getUUID(), entry);
|
|
||||||
}
|
|
||||||
_entryListView.refresh(true);
|
|
||||||
|
|
||||||
saveAndBackupVault();
|
|
||||||
mode.finish();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case R.id.action_share_qr:
|
|
||||||
Intent intent = new Intent(getBaseContext(), TransferEntriesActivity.class);
|
|
||||||
ArrayList<GoogleAuthInfo> authInfos = new ArrayList<>();
|
|
||||||
for (VaultEntry entry : _selectedEntries) {
|
|
||||||
GoogleAuthInfo authInfo = new GoogleAuthInfo(entry.getInfo(), entry.getName(), entry.getIssuer());
|
|
||||||
authInfos.add(authInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
intent.putExtra("authInfos", authInfos);
|
|
||||||
startActivity(intent);
|
|
||||||
|
|
||||||
mode.finish();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case 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:
|
|
||||||
startAssignIconsActivity(CODE_ASSIGN_ICONS, _selectedEntries);
|
|
||||||
mode.finish();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyActionMode(ActionMode mode) {
|
|
||||||
_entryListView.setActionModeState(false, null);
|
|
||||||
_actionModeBackPressHandler.setEnabled(false);
|
|
||||||
_selectedEntries.clear();
|
|
||||||
_actionMode = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class TransferEntriesActivity extends AegisActivity {
|
||||||
@ColorInt int backgroundColor = Color.WHITE;
|
@ColorInt int backgroundColor = Color.WHITE;
|
||||||
if (getConfiguredTheme() == Theme.LIGHT) {
|
if (getConfiguredTheme() == Theme.LIGHT) {
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
getTheme().resolveAttribute(R.attr.background, typedValue, true);
|
getTheme().resolveAttribute(androidx.appcompat.R.attr.background, typedValue, true);
|
||||||
backgroundColor = typedValue.data;
|
backgroundColor = typedValue.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,18 +74,14 @@ public class SecurityPickerSlide extends SlideFragment {
|
||||||
int buttonId = _buttonGroup.getCheckedRadioButtonId();
|
int buttonId = _buttonGroup.getCheckedRadioButtonId();
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
switch (buttonId) {
|
if (buttonId == R.id.rb_none) {
|
||||||
case R.id.rb_none:
|
type = CRYPT_TYPE_NONE;
|
||||||
type = CRYPT_TYPE_NONE;
|
} else if (buttonId == R.id.rb_password) {
|
||||||
break;
|
type = CRYPT_TYPE_PASS;
|
||||||
case R.id.rb_password:
|
} else if (buttonId == R.id.rb_biometrics) {
|
||||||
type = CRYPT_TYPE_PASS;
|
type = CRYPT_TYPE_BIOMETRIC;
|
||||||
break;
|
} else {
|
||||||
case R.id.rb_biometrics:
|
throw new RuntimeException(String.format("Unsupported security type: %d", buttonId));
|
||||||
type = CRYPT_TYPE_BIOMETRIC;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException(String.format("Unsupported security type: %d", buttonId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
introState.putInt("cryptType", type);
|
introState.putInt("cryptType", type);
|
||||||
|
|
|
@ -626,7 +626,7 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
||||||
private class CompactDividerDecoration extends MaterialDividerItemDecoration {
|
private class CompactDividerDecoration extends MaterialDividerItemDecoration {
|
||||||
public CompactDividerDecoration() {
|
public CompactDividerDecoration() {
|
||||||
super(requireContext(), DividerItemDecoration.VERTICAL);
|
super(requireContext(), DividerItemDecoration.VERTICAL);
|
||||||
setDividerColor(ThemeHelper.getThemeColor(R.attr.divider, requireContext().getTheme()));
|
setDividerColor(ThemeHelper.getThemeColor(androidx.appcompat.R.attr.divider, requireContext().getTheme()));
|
||||||
setLastItemDecorated(false);
|
setLastItemDecorated(false);
|
||||||
setDividerThickness(MetricsHelper.convertDpToPixels(requireContext(), 0.5f));
|
setDividerThickness(MetricsHelper.convertDpToPixels(requireContext(), 0.5f));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,5 @@
|
||||||
|
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
android.enableJetifier=false
|
android.enableJetifier=false
|
||||||
android.nonFinalResIds=false
|
|
||||||
android.nonTransitiveRClass=false
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx8g
|
org.gradle.jvmargs=-Xmx8g
|
||||||
|
|
Loading…
Add table
Reference in a new issue