aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-11-14 03:24:07 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-12-27 15:00:14 +0100
commit00e97586b06e5e61f6639b75423f9ec3edba47a0 (patch)
tree594795a6d66d4d3f0a09a0b9108b2d533691397f /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter
parentfd119bda00bac1cfe6dbcafa2736c65e3624c083 (diff)
downloadopen-keychain-00e97586b06e5e61f6639b75423f9ec3edba47a0.tar.gz
open-keychain-00e97586b06e5e61f6639b75423f9ec3edba47a0.tar.bz2
open-keychain-00e97586b06e5e61f6639b75423f9ec3edba47a0.zip
inline subkey editing (wip commit)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
index 24f5f04a1..84608f2dc 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
@@ -22,6 +22,7 @@ import android.content.res.ColorStateList;
import android.database.Cursor;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
+import android.support.annotation.Nullable;
import android.support.v4.widget.CursorAdapter;
import android.text.Spannable;
import android.text.SpannableString;
@@ -49,7 +50,7 @@ public class SubkeysAdapter extends CursorAdapter {
private LayoutInflater mInflater;
private SaveKeyringParcel mSaveKeyringParcel;
- private boolean hasAnySecret;
+ private boolean mHasAnySecret;
private ColorStateList mDefaultTextColor;
public static final String[] SUBKEYS_PROJECTION = new String[]{
@@ -85,16 +86,10 @@ public class SubkeysAdapter extends CursorAdapter {
private static final int INDEX_EXPIRY = 13;
private static final int INDEX_FINGERPRINT = 14;
- public SubkeysAdapter(Context context, Cursor c, int flags,
- SaveKeyringParcel saveKeyringParcel) {
+ public SubkeysAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
mInflater = LayoutInflater.from(context);
- mSaveKeyringParcel = saveKeyringParcel;
- }
-
- public SubkeysAdapter(Context context, Cursor c, int flags) {
- this(context, c, flags, null);
}
public long getKeyId(int position) {
@@ -133,12 +128,12 @@ public class SubkeysAdapter extends CursorAdapter {
@Override
public Cursor swapCursor(Cursor newCursor) {
- hasAnySecret = false;
+ mHasAnySecret = false;
if (newCursor != null && newCursor.moveToFirst()) {
do {
SecretKeyType hasSecret = SecretKeyType.fromNum(newCursor.getInt(INDEX_HAS_SECRET));
if (hasSecret.isUsable()) {
- hasAnySecret = true;
+ mHasAnySecret = true;
break;
}
} while (newCursor.moveToNext());
@@ -354,4 +349,18 @@ public class SubkeysAdapter extends CursorAdapter {
}
}
+ /** Set this adapter into edit mode. This mode displays additional info for
+ * each item from a supplied SaveKeyringParcel reference.
+ *
+ * Note that it is up to the caller to reload the underlying cursor after
+ * updating the SaveKeyringParcel!
+ *
+ * @see SaveKeyringParcel
+ *
+ * @param saveKeyringParcel The parcel to get info from, or null to leave edit mode.
+ */
+ public void setEditMode(@Nullable SaveKeyringParcel saveKeyringParcel) {
+ mSaveKeyringParcel = saveKeyringParcel;
+ }
+
}