show only a single trust id icon
This commit is contained in:
@@ -354,7 +354,7 @@ public class KeySectionedListAdapter extends SectionCursorAdapter<KeySectionedLi
|
||||
public class KeyItemViewHolder extends SectionCursorAdapter.ViewHolder
|
||||
implements View.OnClickListener, View.OnLongClickListener {
|
||||
|
||||
private final ViewGroup mTrustIdIcons;
|
||||
private final ImageView mTrustIdIcon;
|
||||
private final TextView mMainUserId;
|
||||
private final TextView mMainUserIdRest;
|
||||
private final TextView mCreationDate;
|
||||
@@ -371,7 +371,7 @@ public class KeySectionedListAdapter extends SectionCursorAdapter<KeySectionedLi
|
||||
mSlinger = itemView.findViewById(R.id.key_list_item_slinger_view);
|
||||
mSlingerButton = (ImageButton) itemView.findViewById(R.id.key_list_item_slinger_button);
|
||||
mCreationDate = (TextView) itemView.findViewById(R.id.key_list_item_creation);
|
||||
mTrustIdIcons = (ViewGroup) itemView.findViewById(R.id.key_list_item_tid_icon);
|
||||
mTrustIdIcon = (ImageView) itemView.findViewById(R.id.key_list_item_tid_icon);
|
||||
|
||||
itemView.setClickable(true);
|
||||
itemView.setLongClickable(true);
|
||||
@@ -498,27 +498,18 @@ public class KeySectionedListAdapter extends SectionCursorAdapter<KeySectionedLi
|
||||
{ // set icons
|
||||
List<String> packageNames = keyItem.getTrustIdPackages();
|
||||
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
|
||||
while (mTrustIdIcons.getChildCount() < packageNames.size()) {
|
||||
layoutInflater.inflate(R.layout.trust_id_icon, mTrustIdIcons, true);
|
||||
}
|
||||
|
||||
int visibleIcons = 0;
|
||||
for (int i = 0; i < packageNames.size(); i++) {
|
||||
ImageView imageView = (ImageView) mTrustIdIcons.getChildAt(i);
|
||||
Drawable drawable = getDrawableForPackageName(packageNames.get(i));
|
||||
if (drawable == null) {
|
||||
continue;
|
||||
if (!keyItem.isSecret() && !packageNames.isEmpty()) {
|
||||
String packageName = packageNames.get(0);
|
||||
Drawable drawable = getDrawableForPackageName(packageName);
|
||||
if (drawable != null) {
|
||||
mTrustIdIcon.setImageDrawable(drawable);
|
||||
mTrustIdIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mTrustIdIcon.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
imageView.setImageDrawable(drawable);
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
visibleIcons += 1;
|
||||
} else {
|
||||
mTrustIdIcon.setVisibility(View.GONE);
|
||||
}
|
||||
for (int i = visibleIcons; i < mTrustIdIcons.getChildCount(); i++) {
|
||||
mTrustIdIcons.getChildAt(i).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
android:focusable="false"
|
||||
tools:layout_marginTop="30dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_margin="4dp"
|
||||
android:id="@+id/key_list_item_tid_icon"
|
||||
tools:src="@drawable/apps_k9" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/key_list_item_data"
|
||||
android:layout_width="0dip"
|
||||
@@ -55,19 +62,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/key_list_item_tid_icon"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<!--
|
||||
<include layout="@layout/trust_id_icon" />
|
||||
-->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/key_list_item_slinger_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user