ImportKeys: Use the parsed key id and move it in extra part
This commit is contained in:
@@ -236,6 +236,8 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
|
||||
ImportKeysListEntry entry = mData.get(mCurrent);
|
||||
|
||||
entry.setKeyId(keyRing.getMasterKeyId());
|
||||
|
||||
ArrayList<String> realUserIdsPlusKeybase = keyRing.getUnorderedUserIds();
|
||||
realUserIdsPlusKeybase.addAll(entry.getKeybaseUserIds());
|
||||
entry.setUserIds(realUserIdsPlusKeybase);
|
||||
|
||||
@@ -17,20 +17,16 @@ import java.util.Map;
|
||||
|
||||
public class ImportKeysExtraBindings {
|
||||
|
||||
@BindingAdapter({"app:keyId", "app:keyRevokedOrExpired"})
|
||||
public static void setKeyId(TextView textView, String keyId, boolean revokedOrExpired) {
|
||||
Context context = textView.getContext();
|
||||
|
||||
@BindingAdapter({"app:keyId"})
|
||||
public static void setKeyId(TextView textView, String keyId) {
|
||||
if (keyId == null)
|
||||
keyId = "";
|
||||
|
||||
textView.setText(KeyFormattingUtils.beautifyKeyIdWithPrefix(keyId));
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpired));
|
||||
}
|
||||
|
||||
@BindingAdapter({"app:keyUserIds", "app:keyRevokedOrExpired", "app:query"})
|
||||
public static void setUserIds(LinearLayout linearLayout, ArrayList userIds,
|
||||
boolean revokedOrExpired, String query) {
|
||||
@BindingAdapter({"app:keyUserIds", "app:query"})
|
||||
public static void setUserIds(LinearLayout linearLayout, ArrayList userIds, String query) {
|
||||
|
||||
linearLayout.removeAllViews();
|
||||
|
||||
@@ -49,12 +45,7 @@ public class ImportKeysExtraBindings {
|
||||
R.layout.import_keys_list_entry_user_id, null);
|
||||
uidView.setText(highlighter.highlight(name));
|
||||
uidView.setPadding(0, 0, FormattingUtils.dpToPx(context, 8), 0);
|
||||
|
||||
if (revokedOrExpired) {
|
||||
uidView.setTextColor(context.getResources().getColor(R.color.key_flag_gray));
|
||||
} else {
|
||||
uidView.setTextColor(FormattingUtils.getColorFromAttr(context, R.attr.colorText));
|
||||
}
|
||||
uidView.setTextColor(FormattingUtils.getColorFromAttr(context, R.attr.colorText));
|
||||
linearLayout.addView(uidView);
|
||||
|
||||
for (String email : emails) {
|
||||
@@ -64,12 +55,7 @@ public class ImportKeysExtraBindings {
|
||||
FormattingUtils.dpToPx(context, 16), 0,
|
||||
FormattingUtils.dpToPx(context, 8), 0);
|
||||
emailView.setText(highlighter.highlight(email));
|
||||
|
||||
if (revokedOrExpired) {
|
||||
emailView.setTextColor(context.getResources().getColor(R.color.key_flag_gray));
|
||||
} else {
|
||||
emailView.setTextColor(FormattingUtils.getColorFromAttr(context, R.attr.colorText));
|
||||
}
|
||||
emailView.setTextColor(FormattingUtils.getColorFromAttr(context, R.attr.colorText));
|
||||
linearLayout.addView(emailView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
android:layout_toLeftOf="@+id/status"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{entry.algorithm}"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -127,10 +121,7 @@
|
||||
|
||||
<include
|
||||
layout="@layout/import_keys_list_item_extra"
|
||||
app:keyIdHex="@{entry.keyIdHex}"
|
||||
app:keyUserIds="@{entry.sortedUserIds}"
|
||||
app:query="@{entry.query}"
|
||||
app:revokedOrExpired="@{entry.revokedOrExpired}" />
|
||||
app:entry="@{entry}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="java.util.ArrayList" />
|
||||
<import type="org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry" />
|
||||
|
||||
<variable name="keyIdHex" type="String" />
|
||||
<variable name="keyUserIds" type="ArrayList" />
|
||||
<variable name="query" type="String" />
|
||||
<variable name="revokedOrExpired" type="boolean" />
|
||||
<variable name="entry" type="ImportKeysListEntry" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
@@ -19,17 +16,38 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
app:keyId="@{keyIdHex}"
|
||||
app:keyRevokedOrExpired="@{revokedOrExpired}" />
|
||||
android:textColor="?attr/colorText"
|
||||
app:keyId="@{entry.keyIdHex}" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
app:keyRevokedOrExpired="@{revokedOrExpired}"
|
||||
app:keyUserIds="@{keyUserIds}"
|
||||
app:query="@{query}" />
|
||||
app:keyUserIds="@{entry.sortedUserIds}"
|
||||
app:query="@{entry.query}" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_algorithm_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@{entry.algorithm}"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@
|
||||
<string name="label_passphrase_again">"Repeat Password"</string>
|
||||
<string name="label_show_passphrase">"Show Password"</string>
|
||||
<string name="label_algorithm">"Algorithm"</string>
|
||||
<string name="label_algorithm_colon">"Algorithm:"</string>
|
||||
<string name="label_ascii_armor">"File ASCII Armor"</string>
|
||||
<string name="label_file_ascii_armor">"Enable ASCII Armor"</string>
|
||||
<string name="label_write_version_header">"Let others know that you're using OpenKeychain"</string>
|
||||
|
||||
Reference in New Issue
Block a user