mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 08:45:08 -05:00
Prettify more layouts, fix edit and encrypt intents from key view
This commit is contained in:
parent
6d00ca7fdb
commit
eba0640d3e
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<Boolean> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
@ -77,8 +77,7 @@
|
||||
<TextView
|
||||
android:id="@+id/main_user_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:typeface="monospace" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/select_secret_key_master_key_hex"
|
||||
|
@ -61,7 +61,8 @@
|
||||
android:id="@+id/signee_key"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dip" />
|
||||
android:paddingRight="5dip"
|
||||
android:typeface="monospace" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
Loading…
Reference in New Issue
Block a user