Prettify more layouts, fix edit and encrypt intents from key view

This commit is contained in:
Dominik Schürmann
2014-04-09 20:10:23 +02:00
parent 6d00ca7fdb
commit eba0640d3e
6 changed files with 35 additions and 19 deletions

View File

@@ -193,7 +193,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
if (data.moveToFirst()) { if (data.moveToFirst()) {
// TODO: put findViewById in onCreate! // TODO: put findViewById in onCreate!
mPubKeyId = data.getLong(INDEX_MASTER_KEY_ID); 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); ((TextView) findViewById(R.id.key_id)).setText(keyIdStr);
String mainUserId = data.getString(INDEX_USER_ID); String mainUserId = data.getString(INDEX_USER_ID);

View File

@@ -39,6 +39,7 @@ import com.beardedhen.androidbootstrap.BootstrapButton;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; 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.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys; import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; 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. * because the notification triggers faster than the activity closes.
*/ */
// Avoid NullPointerExceptions... // Avoid NullPointerExceptions...
if(data.getCount() == 0) if(data.getCount() == 0) {
return; return;
}
// Swap the new cursor in. (The framework will take care of closing the // Swap the new cursor in. (The framework will take care of closing the
// old cursor once we return.) // old cursor once we return.)
switch (loader.getId()) { switch (loader.getId()) {
@@ -232,7 +234,8 @@ public class ViewKeyMainFragment extends Fragment implements
mActionEdit.setOnClickListener(new View.OnClickListener() { mActionEdit.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
Intent editIntent = new Intent(getActivity(), EditKeyActivity.class); Intent editIntent = new Intent(getActivity(), EditKeyActivity.class);
editIntent.setData(mDataUri); editIntent.setData(
KeyRingData.buildSecretKeyRingUri(mDataUri));
editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY); editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY);
startActivityForResult(editIntent, 0); startActivityForResult(editIntent, 0);
} }
@@ -330,7 +333,8 @@ public class ViewKeyMainFragment extends Fragment implements
private void encryptToContact(Uri dataUri) { private void encryptToContact(Uri dataUri) {
// TODO preselect from uri? should be feasible without trivial query // TODO preselect from uri? should be feasible without trivial query
try { try {
long keyId = ProviderHelper.getMasterKeyId(getActivity(), dataUri); long keyId = ProviderHelper.getMasterKeyId(getActivity(),
KeyRingData.buildPublicKeyRingUri(dataUri));
long[] encryptionKeyIds = new long[]{ keyId }; long[] encryptionKeyIds = new long[]{ keyId };
Intent intent = new Intent(getActivity(), EncryptActivity.class); Intent intent = new Intent(getActivity(), EncryptActivity.class);

View File

@@ -28,7 +28,9 @@ import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.OtherHelper;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs; import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
@@ -57,6 +59,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
initIndex(c); initIndex(c);
} }
public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags) { public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags) {
this(context, c, flags, false); this(context, c, flags, false);
} }
@@ -122,16 +125,26 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
if (cursor.getInt(mIsRevoked) > 0) { if (cursor.getInt(mIsRevoked) > 0) {
vRank.setText(" "); vRank.setText(" ");
vVerified.setImageResource(android.R.drawable.presence_away); 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 { } else {
vUserId.setEnabled(true);
vAddress.setEnabled(true);
int verified = cursor.getInt(mVerifiedId); int verified = cursor.getInt(mVerifiedId);
// TODO introduce own resources for this :) // TODO introduce own resources for this :)
if(verified == Certs.VERIFIED_SECRET) if (verified == Certs.VERIFIED_SECRET) {
vVerified.setImageResource(android.R.drawable.presence_online); 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); vVerified.setImageResource(android.R.drawable.presence_invisible);
else } else {
vVerified.setImageResource(android.R.drawable.presence_busy); vVerified.setImageResource(android.R.drawable.presence_busy);
} }
}
// don't care further if checkboxes aren't shown // don't care further if checkboxes aren't shown
if (mCheckStates == null) { if (mCheckStates == null) {

View File

@@ -77,8 +77,7 @@
<TextView <TextView
android:id="@+id/main_user_id" android:id="@+id/main_user_id"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:typeface="monospace" />
</TableRow> </TableRow>

View File

@@ -52,8 +52,7 @@
android:layout_marginRight="5dip" android:layout_marginRight="5dip"
android:text="" android:text=""
android:visibility="gone" android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:paddingLeft="10dp" />
<TextView <TextView
android:id="@+id/select_secret_key_master_key_hex" android:id="@+id/select_secret_key_master_key_hex"

View File

@@ -61,7 +61,8 @@
android:id="@+id/signee_key" android:id="@+id/signee_key"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="5dip" /> android:paddingRight="5dip"
android:typeface="monospace" />
</TableRow> </TableRow>
<TableRow> <TableRow>