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
|
// perform any pending actions
|
||||||
int action = data.getIntExtra("action", -1);
|
int action = data.getIntExtra("action", -1);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
case PreferencesActivity.ACTION_IMPORT:
|
||||||
|
if (PermissionHelper.request(this, CODE_PERM_IMPORT, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||||
|
onImport();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PreferencesActivity.ACTION_EXPORT:
|
case PreferencesActivity.ACTION_EXPORT:
|
||||||
onExport();
|
onExport();
|
||||||
break;
|
break;
|
||||||
|
@ -586,11 +591,6 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
||||||
intent.putExtra("encrypted", _db.getFile().isEncrypted());
|
intent.putExtra("encrypted", _db.getFile().isEncrypted());
|
||||||
startActivityForResult(intent, CODE_PREFERENCES);
|
startActivityForResult(intent, CODE_PREFERENCES);
|
||||||
return true;
|
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:
|
case R.id.action_lock:
|
||||||
_keyProfileView.clearKeys();
|
_keyProfileView.clearKeys();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,8 +8,9 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class PreferencesActivity extends AegisActivity {
|
public class PreferencesActivity extends AegisActivity {
|
||||||
public static final int ACTION_EXPORT = 0;
|
public static final int ACTION_IMPORT = 0;
|
||||||
public static final int ACTION_SLOTS = 1;
|
public static final int ACTION_EXPORT = 1;
|
||||||
|
public static final int ACTION_SLOTS = 2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
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() {
|
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
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
_result.putExtra("action", ACTION_EXPORT);
|
_result.putExtra("action", ACTION_EXPORT);
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
android:icon="@drawable/ic_lock"
|
android:icon="@drawable/ic_lock"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:title=""/>
|
android:title=""/>
|
||||||
<item
|
|
||||||
android:id="@+id/action_import"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:title="@string/action_import"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
|
|
@ -2,26 +2,39 @@
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/settings">
|
android:title="@string/settings">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<PreferenceCategory
|
||||||
android:defaultValue="false"
|
android:title="Appearance">
|
||||||
android:key="pref_night_mode"
|
<CheckBoxPreference
|
||||||
android:title="@string/pref_night_mode"
|
android:defaultValue="false"
|
||||||
android:summary="@string/pref_night_mode_description"/>
|
android:key="pref_night_mode"
|
||||||
|
android:title="@string/pref_night_mode"
|
||||||
|
android:summary="@string/pref_night_mode_description"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_issuer"
|
android:key="pref_issuer"
|
||||||
android:title="@string/pref_issuers"
|
android:title="@string/pref_issuers"
|
||||||
android:summary="@string/pref_issuers_description"/>
|
android:summary="@string/pref_issuers_description"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<Preference
|
<PreferenceCategory
|
||||||
android:key="pref_slots"
|
android:title="Security">
|
||||||
android:title="Key slots"
|
<Preference
|
||||||
android:summary="Manage the list of keys that can decrypt the database"/>
|
android:key="pref_slots"
|
||||||
|
android:title="Key slots"
|
||||||
|
android:summary="Manage the list of keys that can decrypt the database"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<Preference
|
<PreferenceCategory
|
||||||
android:key="pref_export"
|
android:title="Tools">
|
||||||
android:title="Export"
|
<Preference
|
||||||
android:summary="Export the database"/>
|
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>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue