Pass trough masterKeyId and fingerprint to advanced key edit fragments
This commit is contained in:
@@ -120,7 +120,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
setContentView(R.layout.view_key_adv_activity);
|
||||
}
|
||||
|
||||
private void initTabs(Uri dataUri, boolean hasSecret) {
|
||||
private void initTabs(Uri dataUri, boolean hasSecret, long masterKeyId, byte[] fingerprint) {
|
||||
|
||||
mHasSecret = hasSecret;
|
||||
|
||||
@@ -139,6 +139,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
Bundle userIdsBundle = new Bundle();
|
||||
userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
|
||||
userIdsBundle.putBoolean(ViewKeyAdvUserIdsFragment.ARG_HAS_SECRET, hasSecret);
|
||||
userIdsBundle.putLong(ViewKeyAdvUserIdsFragment.ARG_MASTER_KEY_ID, masterKeyId);
|
||||
userIdsBundle.putByteArray(ViewKeyAdvUserIdsFragment.ARG_FINGERPRINT, fingerprint);
|
||||
mTabAdapter.addTab(ViewKeyAdvUserIdsFragment.class,
|
||||
userIdsBundle, getString(R.string.section_user_ids));
|
||||
mTabsWithActionMode[1] = true;
|
||||
@@ -146,6 +148,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
Bundle keysBundle = new Bundle();
|
||||
keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri);
|
||||
keysBundle.putBoolean(ViewKeyAdvSubkeysFragment.ARG_HAS_SECRET, hasSecret);
|
||||
keysBundle.putLong(ViewKeyAdvSubkeysFragment.ARG_MASTER_KEY_ID, masterKeyId);
|
||||
keysBundle.putByteArray(ViewKeyAdvSubkeysFragment.ARG_FINGERPRINT, fingerprint);
|
||||
mTabAdapter.addTab(ViewKeyAdvSubkeysFragment.class,
|
||||
keysBundle, getString(R.string.key_view_tab_keys));
|
||||
mTabsWithActionMode[2] = true;
|
||||
@@ -175,7 +179,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
KeychainContract.KeyRings.IS_REVOKED,
|
||||
KeychainContract.KeyRings.IS_EXPIRED,
|
||||
KeychainContract.KeyRings.VERIFIED,
|
||||
KeychainContract.KeyRings.HAS_ANY_SECRET
|
||||
KeychainContract.KeyRings.HAS_ANY_SECRET,
|
||||
KeychainContract.KeyRings.FINGERPRINT,
|
||||
};
|
||||
|
||||
static final int INDEX_MASTER_KEY_ID = 1;
|
||||
@@ -184,6 +189,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
static final int INDEX_IS_EXPIRED = 4;
|
||||
static final int INDEX_VERIFIED = 5;
|
||||
static final int INDEX_HAS_ANY_SECRET = 6;
|
||||
static final int INDEX_FINGERPRINT = 7;
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
@@ -217,6 +223,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
setTitle(R.string.user_id_no_name);
|
||||
}
|
||||
|
||||
byte[] fingerprint = data.getBlob(INDEX_FINGERPRINT);
|
||||
|
||||
// get key id from MASTER_KEY_ID
|
||||
long masterKeyId = data.getLong(INDEX_MASTER_KEY_ID);
|
||||
getSupportActionBar().setSubtitle(KeyFormattingUtils.beautifyKeyIdWithPrefix(this, masterKeyId));
|
||||
@@ -243,7 +251,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
mStatusBar.setBackgroundColor(ViewKeyActivity.getStatusBarBackgroundColor(color));
|
||||
mSlidingTabLayout.setBackgroundColor(color);
|
||||
|
||||
initTabs(mDataUri, isSecret);
|
||||
initTabs(mDataUri, isSecret, masterKeyId, fingerprint);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ public class ViewKeyAdvSubkeysFragment extends LoaderFragment implements
|
||||
|
||||
public static final String ARG_DATA_URI = "data_uri";
|
||||
public static final String ARG_HAS_SECRET = "has_secret";
|
||||
public static final String ARG_MASTER_KEY_ID = "master_key_id";
|
||||
public static final String ARG_FINGERPRINT = "fingerprint";
|
||||
|
||||
public static final int LOADER_ID_SUBKEYS = 0;
|
||||
|
||||
@@ -71,23 +73,11 @@ public class ViewKeyAdvSubkeysFragment extends LoaderFragment implements
|
||||
|
||||
private Uri mDataUriSubkeys;
|
||||
|
||||
private long mMasterKeyId;
|
||||
private byte[] mFingerprint;
|
||||
private boolean mHasSecret;
|
||||
private SaveKeyringParcel mEditModeSaveKeyringParcel;
|
||||
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
*/
|
||||
public static ViewKeyAdvSubkeysFragment newInstance(Uri dataUri, boolean hasSecret) {
|
||||
ViewKeyAdvSubkeysFragment frag = new ViewKeyAdvSubkeysFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_DATA_URI, dataUri);
|
||||
args.putBoolean(ARG_HAS_SECRET, hasSecret);
|
||||
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
@@ -139,6 +129,8 @@ public class ViewKeyAdvSubkeysFragment extends LoaderFragment implements
|
||||
return;
|
||||
}
|
||||
mHasSecret = getArguments().getBoolean(ARG_HAS_SECRET);
|
||||
mMasterKeyId = getArguments().getLong(ARG_MASTER_KEY_ID);
|
||||
mFingerprint = getArguments().getByteArray(ARG_FINGERPRINT);
|
||||
|
||||
loadData(dataUri);
|
||||
}
|
||||
@@ -204,7 +196,7 @@ public class ViewKeyAdvSubkeysFragment extends LoaderFragment implements
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
|
||||
mEditModeSaveKeyringParcel = new SaveKeyringParcel(0L, new byte[0]);
|
||||
mEditModeSaveKeyringParcel = new SaveKeyringParcel(mMasterKeyId, mFingerprint);
|
||||
|
||||
mSubkeysAddedAdapter =
|
||||
new SubkeysAddedAdapter(getActivity(), mEditModeSaveKeyringParcel.mAddSubKeys, false);
|
||||
|
||||
@@ -57,6 +57,8 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
||||
|
||||
public static final String ARG_DATA_URI = "uri";
|
||||
public static final String ARG_HAS_SECRET = "has_secret";
|
||||
public static final String ARG_MASTER_KEY_ID = "master_key_id";
|
||||
public static final String ARG_FINGERPRINT = "fingerprint";
|
||||
|
||||
private static final int LOADER_ID_USER_IDS = 0;
|
||||
|
||||
@@ -69,6 +71,9 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
||||
private UserIdsAddedAdapter mUserIdsAddedAdapter;
|
||||
|
||||
private Uri mDataUri;
|
||||
|
||||
private long mMasterKeyId;
|
||||
private byte[] mFingerprint;
|
||||
private boolean mHasSecret;
|
||||
private SaveKeyringParcel mEditModeSaveKeyringParcel;
|
||||
|
||||
@@ -216,14 +221,15 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
||||
getActivity().finish();
|
||||
return;
|
||||
}
|
||||
boolean hasSecret = getArguments().getBoolean(ARG_HAS_SECRET);
|
||||
mHasSecret = getArguments().getBoolean(ARG_HAS_SECRET);
|
||||
mMasterKeyId = getArguments().getLong(ARG_MASTER_KEY_ID);
|
||||
mFingerprint = getArguments().getByteArray(ARG_FINGERPRINT);
|
||||
|
||||
loadData(dataUri, hasSecret);
|
||||
loadData(dataUri);
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri, boolean hasSecret) {
|
||||
private void loadData(Uri dataUri) {
|
||||
mDataUri = dataUri;
|
||||
mHasSecret = hasSecret;
|
||||
|
||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri);
|
||||
|
||||
@@ -295,7 +301,7 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
|
||||
mEditModeSaveKeyringParcel = new SaveKeyringParcel(0L, new byte[0]);
|
||||
mEditModeSaveKeyringParcel = new SaveKeyringParcel(mMasterKeyId, mFingerprint);
|
||||
|
||||
mUserIdsAddedAdapter =
|
||||
new UserIdsAddedAdapter(getActivity(), mEditModeSaveKeyringParcel.mAddUserIds, false);
|
||||
|
||||
Reference in New Issue
Block a user