mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-20 13:59:14 +00:00
Added Focus Search on App Start
Renamed key Removed unnecessary code
This commit is contained in:
parent
adfc472a39
commit
0652eaa5cd
4 changed files with 26 additions and 2 deletions
|
@ -257,6 +257,14 @@ public class Preferences {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean getFocusSearchEnabled() {
|
||||
return _prefs.getBoolean("pref_focus_search", false);
|
||||
}
|
||||
|
||||
public void setFocusSearch(boolean enabled) {
|
||||
_prefs.edit().putBoolean("pref_focus_search", enabled).apply();
|
||||
}
|
||||
|
||||
public void setBackupsLocation(Uri location) {
|
||||
_prefs.edit().putString("pref_backups_location", location == null ? null : location.toString()).apply();
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
|
||||
private boolean _isAuthenticating;
|
||||
private boolean _isDoingIntro;
|
||||
private boolean _isRecreated;
|
||||
|
||||
private List<VaultEntry> _selectedEntries;
|
||||
private ActionMode _actionMode;
|
||||
|
@ -105,6 +106,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
_loaded = false;
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
_isRecreated = true;
|
||||
_isAuthenticating = savedInstanceState.getBoolean("isAuthenticating");
|
||||
_isDoingIntro = savedInstanceState.getBoolean("isDoingIntro");
|
||||
}
|
||||
|
@ -561,8 +563,14 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
MenuItem searchViewMenuItem = menu.findItem(R.id.mi_search);
|
||||
|
||||
_searchView = (SearchView) searchViewMenuItem.getActionView();
|
||||
_searchView.setFocusable(false);
|
||||
|
||||
_searchView.setQueryHint(getString(R.string.search));
|
||||
if (getPreferences().getFocusSearchEnabled() && !_isRecreated) {
|
||||
_searchView.setIconified(false);
|
||||
_searchView.setFocusable(true);
|
||||
_searchView.requestFocus();
|
||||
_searchView.requestFocusFromTouch();
|
||||
}
|
||||
_searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
|
@ -768,7 +776,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
if (userInitiated) {
|
||||
startAuthActivity(true);
|
||||
} else {
|
||||
super.onLocked(userInitiated);
|
||||
super.onLocked(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -402,4 +402,6 @@
|
|||
|
||||
<string name="importer_help_direct">Import entries directly from %s. This requires the app to be installed on this device and for root access to be granted to Aegis.</string>
|
||||
<string name="groups">Groups</string>
|
||||
<string name="pref_focus_search">Focus search on app start</string>
|
||||
<string name="pref_focus_search_summary">Focus the search immediately after opening the app.</string>
|
||||
</resources>
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/pref_section_behavior_title">
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="pref_focus_search"
|
||||
android:title="@string/pref_focus_search"
|
||||
android:summary="@string/pref_focus_search_summary"
|
||||
app:iconSpaceReserved="false"/>
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="pref_copy_on_tap"
|
||||
|
|
Loading…
Add table
Reference in a new issue