aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-07-26 23:06:32 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-07-26 23:06:32 +0200
commit8132b9ac745f6eedd4a7746f1e67358a61e9e4a7 (patch)
treef1c8c520a449f3ef306e1e1e7e2b1bc70a3240ad /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
parentd8f278229352a58dbdcf49bb65538249f8c4ccc0 (diff)
parent45722d7cfbb2996ff994b3f2143e5871c2e564ba (diff)
downloadopen-keychain-8132b9ac745f6eedd4a7746f1e67358a61e9e4a7.tar.gz
open-keychain-8132b9ac745f6eedd4a7746f1e67358a61e9e4a7.tar.bz2
open-keychain-8132b9ac745f6eedd4a7746f1e67358a61e9e4a7.zip
Merge branch 'master' into ditch-appmsg
Conflicts: OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
index d729648e5..18312660a 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
@@ -40,9 +40,7 @@ import java.util.ArrayList;
public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemClickListener {
private LayoutInflater mInflater;
-
private final ArrayList<Boolean> mCheckStates;
-
private SaveKeyringParcel mSaveKeyringParcel;
public static final String[] USER_IDS_PROJECTION = new String[]{
@@ -60,7 +58,6 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
private static final int INDEX_IS_PRIMARY = 4;
private static final int INDEX_IS_REVOKED = 5;
-
public UserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes,
SaveKeyringParcel saveKeyringParcel) {
super(context, c, flags);
@@ -134,15 +131,18 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
// for edit key
if (mSaveKeyringParcel != null) {
- boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.changePrimaryUserId != null);
- boolean changeThisPrimaryUserId = (mSaveKeyringParcel.changePrimaryUserId != null
- && mSaveKeyringParcel.changePrimaryUserId.equals(userId));
- boolean revokeThisUserId = (mSaveKeyringParcel.revokeUserIds.contains(userId));
+ boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null);
+ boolean changeThisPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null
+ && mSaveKeyringParcel.mChangePrimaryUserId.equals(userId));
+ boolean revokeThisUserId = (mSaveKeyringParcel.mRevokeUserIds.contains(userId));
+ // only if primary user id will be changed
+ // (this is not triggered if the user id is currently the primary one)
if (changeAnyPrimaryUserId) {
- // change all user ids, only this one should be primary
+ // change _all_ primary user ids and set new one to true
isPrimary = changeThisPrimaryUserId;
}
+
if (revokeThisUserId) {
if (!isRevoked) {
isRevoked = true;
@@ -233,7 +233,7 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
- View view = mInflater.inflate(R.layout.view_key_userids_item, null);
+ View view = mInflater.inflate(R.layout.view_key_user_id_item, null);
// only need to do this once ever, since mShowCheckBoxes is final
view.findViewById(R.id.checkBox).setVisibility(mCheckStates != null ? View.VISIBLE : View.GONE);
return view;