mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-26 00:48:51 -05:00
Use new status icons in key list
This commit is contained in:
parent
0c3b2a6ed4
commit
a3045c710e
@ -436,8 +436,6 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
private class ItemViewHolder {
|
private class ItemViewHolder {
|
||||||
TextView mMainUserId;
|
TextView mMainUserId;
|
||||||
TextView mMainUserIdRest;
|
TextView mMainUserIdRest;
|
||||||
FrameLayout mStatusLayout;
|
|
||||||
TextView mRevoked;
|
|
||||||
ImageView mStatus;
|
ImageView mStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,8 +445,6 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
ItemViewHolder holder = new ItemViewHolder();
|
ItemViewHolder holder = new ItemViewHolder();
|
||||||
holder.mMainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
holder.mMainUserId = (TextView) view.findViewById(R.id.mainUserId);
|
||||||
holder.mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
holder.mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||||
holder.mStatusLayout = (FrameLayout) view.findViewById(R.id.status_layout);
|
|
||||||
holder.mRevoked = (TextView) view.findViewById(R.id.revoked);
|
|
||||||
holder.mStatus = (ImageView) view.findViewById(R.id.status_image);
|
holder.mStatus = (ImageView) view.findViewById(R.id.status_image);
|
||||||
view.setTag(holder);
|
view.setTag(holder);
|
||||||
return view;
|
return view;
|
||||||
@ -485,29 +481,36 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
|
|
||||||
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
|
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
|
||||||
// this is a secret key
|
// this is a secret key
|
||||||
h.mStatusLayout.setVisibility(View.VISIBLE);
|
|
||||||
h.mRevoked.setVisibility(View.GONE);
|
|
||||||
h.mStatus.setVisibility(View.GONE);
|
h.mStatus.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
// this is a public key - show if it's revoked
|
// this is a public key - show if it's revoked, expired, or verified
|
||||||
|
|
||||||
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
||||||
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
|
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
|
||||||
&& new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date());
|
&& new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date());
|
||||||
if(isRevoked || isExpired) {
|
|
||||||
h.mStatusLayout.setVisibility(View.VISIBLE);
|
|
||||||
h.mRevoked.setVisibility(View.VISIBLE);
|
|
||||||
h.mStatus.setVisibility(View.GONE);
|
|
||||||
h.mRevoked.setText(isRevoked ? R.string.revoked : R.string.expired);
|
|
||||||
} else {
|
|
||||||
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
||||||
h.mStatusLayout.setVisibility(isVerified ? View.VISIBLE : View.GONE);
|
|
||||||
h.mRevoked.setVisibility(View.GONE);
|
// Note: order is important!
|
||||||
h.mStatus.setVisibility(isVerified ? View.VISIBLE : View.GONE);
|
if (isRevoked) {
|
||||||
if (isVerified) {
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
|
h.mStatus.setImageDrawable(
|
||||||
|
getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
|
||||||
|
h.mStatus.setColorFilter(getResources().getColor(R.color.result_red),
|
||||||
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
|
} else if (isExpired) {
|
||||||
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
|
h.mStatus.setImageDrawable(
|
||||||
|
getResources().getDrawable(R.drawable.status_signature_expired_cutout));
|
||||||
|
h.mStatus.setColorFilter(getResources().getColor(R.color.result_orange),
|
||||||
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
|
} else if (isVerified) {
|
||||||
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
|
h.mStatus.setImageDrawable(
|
||||||
|
getResources().getDrawable(R.drawable.status_signature_verified_cutout));
|
||||||
h.mStatus.setColorFilter(getResources().getColor(R.color.result_green),
|
h.mStatus.setColorFilter(getResources().getColor(R.color.result_green),
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
}
|
} else {
|
||||||
|
h.mStatus.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,23 +38,6 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/status_layout"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/revoked"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:text="@string/revoked"
|
|
||||||
android:textColor="#e00"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:padding="12dp" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -62,6 +45,5 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:src="@drawable/status_signature_verified_cutout"
|
android:src="@drawable/status_signature_verified_cutout"
|
||||||
android:padding="16dp" />
|
android:padding="16dp" />
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user