mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 05:52:52 +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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue