mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-02 11:34:29 +00:00
Add ability to select all tokens
This commit is contained in:
parent
92e9e047a7
commit
1c86c5fd51
5 changed files with 33 additions and 0 deletions
|
@ -1149,6 +1149,10 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
_entryListView.setGroups(_vaultManager.getVault().getUsedGroups());
|
||||
mode.finish();
|
||||
});
|
||||
} else if (itemId == R.id.action_select_all) {
|
||||
_selectedEntries = _entryListView.selectAllEntries();
|
||||
setFavoriteMenuItemVisiblity();
|
||||
setIsMultipleSelected(_selectedEntries.size() > 1);
|
||||
} else if (itemId == R.id.action_assign_icons) {
|
||||
startAssignIconsActivity(CODE_ASSIGN_ICONS, _selectedEntries);
|
||||
mode.finish();
|
||||
|
|
|
@ -693,6 +693,23 @@ public class EntryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
updateDraggableStatus();
|
||||
}
|
||||
|
||||
public List<VaultEntry> selectAllEntries() {
|
||||
_selectedEntries.clear();
|
||||
|
||||
for (VaultEntry entry: _shownEntries) {
|
||||
for (EntryHolder holder: _holders) {
|
||||
if (holder.getEntry() == entry) {
|
||||
holder.setFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
_selectedEntries.add(entry);
|
||||
updateDraggableStatus();
|
||||
}
|
||||
|
||||
return new ArrayList<>(_selectedEntries);
|
||||
}
|
||||
|
||||
public void deselectAllEntries() {
|
||||
for (VaultEntry entry: _selectedEntries) {
|
||||
for (EntryHolder holder : _holders) {
|
||||
|
|
|
@ -191,6 +191,10 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
|||
_adapter.setCopyBehavior(copyBehavior);
|
||||
}
|
||||
|
||||
public List<VaultEntry> selectAllEntries() {
|
||||
return _adapter.selectAllEntries();
|
||||
}
|
||||
|
||||
public void setActionModeState(boolean enabled, VaultEntry entry) {
|
||||
_touchCallback.setSelectedEntry(entry);
|
||||
_touchCallback.setIsLongPressDragEnabled(enabled && _adapter.isDragAndDropAllowed());
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
android:title="@string/edit"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_select_all"
|
||||
android:title="@string/select_all"
|
||||
android:orderInCategory="95"
|
||||
android:tint="?attr/iconColorPrimary"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_assign_icons"
|
||||
android:title="@string/assign_icons"
|
||||
|
|
|
@ -171,6 +171,7 @@
|
|||
<string name="set_up_biometric">Set up biometric unlock</string>
|
||||
<string name="copy">Copy</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="select_all">Select all</string>
|
||||
<string name="assign_icons">Assign icons</string>
|
||||
<string name="favorite" comment="Verb">Favorite</string>
|
||||
<string name="unfavorite" comment="Verb">Unfavorite</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue