diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java index e2e09f052..910365394 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java @@ -193,7 +193,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements if (data.moveToFirst()) { // TODO: put findViewById in onCreate! mPubKeyId = data.getLong(INDEX_MASTER_KEY_ID); - String keyIdStr = PgpKeyHelper.convertKeyIdToHexShort(mPubKeyId); + String keyIdStr = PgpKeyHelper.convertKeyIdToHex(mPubKeyId); ((TextView) findViewById(R.id.key_id)).setText(keyIdStr); String mainUserId = data.getString(INDEX_USER_ID); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index 8028ca041..a7543d194 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -39,6 +39,7 @@ import com.beardedhen.androidbootstrap.BootstrapButton; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; +import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRingData; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.Keys; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; @@ -204,8 +205,9 @@ public class ViewKeyMainFragment extends Fragment implements * because the notification triggers faster than the activity closes. */ // Avoid NullPointerExceptions... - if(data.getCount() == 0) + if(data.getCount() == 0) { return; + } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { @@ -232,7 +234,8 @@ public class ViewKeyMainFragment extends Fragment implements mActionEdit.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent editIntent = new Intent(getActivity(), EditKeyActivity.class); - editIntent.setData(mDataUri); + editIntent.setData( + KeyRingData.buildSecretKeyRingUri(mDataUri)); editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY); startActivityForResult(editIntent, 0); } @@ -330,7 +333,8 @@ public class ViewKeyMainFragment extends Fragment implements private void encryptToContact(Uri dataUri) { // TODO preselect from uri? should be feasible without trivial query try { - long keyId = ProviderHelper.getMasterKeyId(getActivity(), dataUri); + long keyId = ProviderHelper.getMasterKeyId(getActivity(), + KeyRingData.buildPublicKeyRingUri(dataUri)); long[] encryptionKeyIds = new long[]{ keyId }; Intent intent = new Intent(getActivity(), EncryptActivity.class); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java index 09137f745..82c311f59 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -28,7 +28,9 @@ import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; + import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import org.sufficientlysecure.keychain.provider.KeychainContract.Certs; @@ -43,7 +45,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. private final ArrayList mCheckStates; - public static final String[] USER_IDS_PROJECTION = new String[] { + public static final String[] USER_IDS_PROJECTION = new String[]{ UserIds._ID, UserIds.USER_ID, UserIds.RANK, UserIds.VERIFIED, UserIds.IS_PRIMARY, UserIds.IS_REVOKED }; @@ -57,6 +59,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. initIndex(c); } + public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags) { this(context, c, flags, false); } @@ -70,7 +73,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. int count = newCursor.getCount(); mCheckStates.ensureCapacity(count); // initialize to true (use case knowledge: we usually want to sign all uids) - for(int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { newCursor.moveToPosition(i); int verified = newCursor.getInt(mVerifiedId); mCheckStates.add(verified != Certs.VERIFIED_SECRET); @@ -105,7 +108,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. TextView vAddress = (TextView) view.findViewById(R.id.address); ImageView vVerified = (ImageView) view.findViewById(R.id.certified); - if(cursor.getInt(mIsPrimary) > 0) { + if (cursor.getInt(mIsPrimary) > 0) { vRank.setText("+"); } else { vRank.setText(Integer.toString(cursor.getInt(mIndexRank))); @@ -119,18 +122,28 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. } vAddress.setText(userId[1]); - if(cursor.getInt(mIsRevoked) > 0) { + if (cursor.getInt(mIsRevoked) > 0) { vRank.setText(" "); vVerified.setImageResource(android.R.drawable.presence_away); + + // disable and strike through text for revoked user ids + vUserId.setEnabled(false); + vAddress.setEnabled(false); + vUserId.setText(OtherHelper.strikeOutText(vUserId.getText())); + vAddress.setText(OtherHelper.strikeOutText(vAddress.getText())); } else { + vUserId.setEnabled(true); + vAddress.setEnabled(true); + int verified = cursor.getInt(mVerifiedId); // TODO introduce own resources for this :) - if(verified == Certs.VERIFIED_SECRET) + if (verified == Certs.VERIFIED_SECRET) { vVerified.setImageResource(android.R.drawable.presence_online); - else if(verified == Certs.VERIFIED_SELF) + } else if (verified == Certs.VERIFIED_SELF) { vVerified.setImageResource(android.R.drawable.presence_invisible); - else + } else { vVerified.setImageResource(android.R.drawable.presence_busy); + } } // don't care further if checkboxes aren't shown @@ -154,7 +167,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. public void onItemClick(AdapterView adapter, View view, int position, long id) { CheckBox box = ((CheckBox) view.findViewById(R.id.checkBox)); - if(box != null) { + if (box != null) { box.toggle(); } } diff --git a/OpenKeychain/src/main/res/layout/certify_key_activity.xml b/OpenKeychain/src/main/res/layout/certify_key_activity.xml index 3fa0468de..0ae46a261 100644 --- a/OpenKeychain/src/main/res/layout/certify_key_activity.xml +++ b/OpenKeychain/src/main/res/layout/certify_key_activity.xml @@ -3,14 +3,14 @@ xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" - android:layout_height="match_parent" > + android:layout_height="match_parent"> + android:orientation="vertical"> + android:layout_height="wrap_content" /> diff --git a/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml b/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml index 408c0c54e..8c3b61cda 100644 --- a/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml +++ b/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml @@ -52,8 +52,7 @@ android:layout_marginRight="5dip" android:text="" android:visibility="gone" - android:textAppearance="?android:attr/textAppearanceSmall" - android:paddingLeft="10dp" /> + android:textAppearance="?android:attr/textAppearanceSmall" /> + android:paddingRight="5dip" + android:typeface="monospace" />