mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 16:55:05 -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()) {
|
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);
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
@ -43,7 +45,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
|
|||||||
|
|
||||||
private final ArrayList<Boolean> mCheckStates;
|
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._ID, UserIds.USER_ID, UserIds.RANK,
|
||||||
UserIds.VERIFIED, UserIds.IS_PRIMARY, UserIds.IS_REVOKED
|
UserIds.VERIFIED, UserIds.IS_PRIMARY, UserIds.IS_REVOKED
|
||||||
};
|
};
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -70,7 +73,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
|
|||||||
int count = newCursor.getCount();
|
int count = newCursor.getCount();
|
||||||
mCheckStates.ensureCapacity(count);
|
mCheckStates.ensureCapacity(count);
|
||||||
// initialize to true (use case knowledge: we usually want to sign all uids)
|
// 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);
|
newCursor.moveToPosition(i);
|
||||||
int verified = newCursor.getInt(mVerifiedId);
|
int verified = newCursor.getInt(mVerifiedId);
|
||||||
mCheckStates.add(verified != Certs.VERIFIED_SECRET);
|
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);
|
TextView vAddress = (TextView) view.findViewById(R.id.address);
|
||||||
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
|
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
|
||||||
|
|
||||||
if(cursor.getInt(mIsPrimary) > 0) {
|
if (cursor.getInt(mIsPrimary) > 0) {
|
||||||
vRank.setText("+");
|
vRank.setText("+");
|
||||||
} else {
|
} else {
|
||||||
vRank.setText(Integer.toString(cursor.getInt(mIndexRank)));
|
vRank.setText(Integer.toString(cursor.getInt(mIndexRank)));
|
||||||
@ -119,18 +122,28 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
|
|||||||
}
|
}
|
||||||
vAddress.setText(userId[1]);
|
vAddress.setText(userId[1]);
|
||||||
|
|
||||||
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
|
||||||
@ -154,7 +167,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView.
|
|||||||
|
|
||||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||||
CheckBox box = ((CheckBox) view.findViewById(R.id.checkBox));
|
CheckBox box = ((CheckBox) view.findViewById(R.id.checkBox));
|
||||||
if(box != null) {
|
if (box != null) {
|
||||||
box.toggle();
|
box.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/SectionHeader"
|
style="@style/SectionHeader"
|
||||||
@ -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>
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user