enc-export: use BackupActivity for backup from ViewKeyActivity
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
@@ -28,6 +29,7 @@ import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
|
||||
public class BackupActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_MASTER_KEY_IDS = "master_key_ids";
|
||||
public static final String EXTRA_SECRET = "export_secret";
|
||||
|
||||
@Override
|
||||
@@ -43,8 +45,11 @@ public class BackupActivity extends BaseActivity {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
boolean exportSecret = getIntent().getBooleanExtra(EXTRA_SECRET, false);
|
||||
Fragment frag = BackupCodeFragment.newInstance(null, exportSecret);
|
||||
Intent intent = getIntent();
|
||||
boolean exportSecret = intent.getBooleanExtra(EXTRA_SECRET, false);
|
||||
long[] masterKeyIds = intent.getLongArrayExtra(EXTRA_MASTER_KEY_IDS);
|
||||
|
||||
Fragment frag = BackupCodeFragment.newInstance(masterKeyIds, exportSecret);
|
||||
|
||||
FragmentManager fragMan = getSupportFragmentManager();
|
||||
fragMan.beginTransaction()
|
||||
|
||||
@@ -345,7 +345,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
startActivity(homeIntent);
|
||||
return true;
|
||||
}
|
||||
case R.id.menu_key_view_export_file: {
|
||||
case R.id.menu_key_view_backup: {
|
||||
startPassphraseActivity(REQUEST_BACKUP);
|
||||
return true;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
MenuItem editKey = menu.findItem(R.id.menu_key_view_edit);
|
||||
editKey.setVisible(mIsSecret);
|
||||
|
||||
MenuItem exportKey = menu.findItem(R.id.menu_key_view_export_file);
|
||||
MenuItem exportKey = menu.findItem(R.id.menu_key_view_backup);
|
||||
exportKey.setVisible(mIsSecret);
|
||||
|
||||
MenuItem addLinked = menu.findItem(R.id.menu_key_view_add_linked_identity);
|
||||
@@ -455,10 +455,11 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
private void backupToFile() {
|
||||
new ExportHelper(this).showExportKeysDialog(
|
||||
mMasterKeyId, new File(Constants.Path.APP_DIR,
|
||||
KeyFormattingUtils.convertKeyIdToHex(mMasterKeyId) + ".sec.asc"), true);
|
||||
private void startBackupActivity() {
|
||||
Intent intent = new Intent(this, BackupActivity.class);
|
||||
intent.putExtra(BackupActivity.EXTRA_MASTER_KEY_IDS, new long[] { mMasterKeyId });
|
||||
intent.putExtra(BackupActivity.EXTRA_SECRET, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void deleteKey() {
|
||||
@@ -514,7 +515,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
return;
|
||||
}
|
||||
|
||||
backupToFile();
|
||||
startBackupActivity();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user