mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Add preference categories and move the import button to preferences
This commit is contained in:
parent
6672c18399
commit
317e42ed4c
4 changed files with 50 additions and 31 deletions
|
@ -230,6 +230,11 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
// perform any pending actions
|
||||
int action = data.getIntExtra("action", -1);
|
||||
switch (action) {
|
||||
case PreferencesActivity.ACTION_IMPORT:
|
||||
if (PermissionHelper.request(this, CODE_PERM_IMPORT, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
onImport();
|
||||
}
|
||||
break;
|
||||
case PreferencesActivity.ACTION_EXPORT:
|
||||
onExport();
|
||||
break;
|
||||
|
@ -586,11 +591,6 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
|||
intent.putExtra("encrypted", _db.getFile().isEncrypted());
|
||||
startActivityForResult(intent, CODE_PREFERENCES);
|
||||
return true;
|
||||
case R.id.action_import:
|
||||
if (PermissionHelper.request(this, CODE_PERM_IMPORT, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
onImport();
|
||||
}
|
||||
return true;
|
||||
case R.id.action_lock:
|
||||
_keyProfileView.clearKeys();
|
||||
try {
|
||||
|
|
|
@ -8,8 +8,9 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.widget.Toast;
|
||||
|
||||
public class PreferencesActivity extends AegisActivity {
|
||||
public static final int ACTION_EXPORT = 0;
|
||||
public static final int ACTION_SLOTS = 1;
|
||||
public static final int ACTION_IMPORT = 0;
|
||||
public static final int ACTION_EXPORT = 1;
|
||||
public static final int ACTION_SLOTS = 2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -58,8 +59,18 @@ public class PreferencesActivity extends AegisActivity {
|
|||
}
|
||||
});
|
||||
|
||||
Preference exportPreference = findPreference("pref_export");
|
||||
Preference exportPreference = findPreference("pref_import");
|
||||
exportPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
_result.putExtra("action", ACTION_IMPORT);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Preference importPreference = findPreference("pref_export");
|
||||
importPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
_result.putExtra("action", ACTION_EXPORT);
|
||||
|
|
|
@ -7,11 +7,6 @@
|
|||
android:icon="@drawable/ic_lock"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title=""/>
|
||||
<item
|
||||
android:id="@+id/action_import"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_import"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/settings">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="Appearance">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_night_mode"
|
||||
|
@ -13,15 +15,26 @@
|
|||
android:key="pref_issuer"
|
||||
android:title="@string/pref_issuers"
|
||||
android:summary="@string/pref_issuers_description"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="Security">
|
||||
<Preference
|
||||
android:key="pref_slots"
|
||||
android:title="Key slots"
|
||||
android:summary="Manage the list of keys that can decrypt the database"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="Tools">
|
||||
<Preference
|
||||
android:key="pref_import"
|
||||
android:title="Import"
|
||||
android:summary="Import a database"/>
|
||||
<Preference
|
||||
android:key="pref_export"
|
||||
android:title="Export"
|
||||
android:summary="Export the database"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue