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) {
|
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
||||||
h.mStatusLayout.setVisibility(View.VISIBLE);
|
|
||||||
h.mRevoked.setVisibility(View.VISIBLE);
|
// Note: order is important!
|
||||||
h.mStatus.setVisibility(View.GONE);
|
if (isRevoked) {
|
||||||
h.mRevoked.setText(isRevoked ? R.string.revoked : R.string.expired);
|
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),
|
||||||
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
} else {
|
} else {
|
||||||
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
h.mStatus.setVisibility(View.GONE);
|
||||||
h.mStatusLayout.setVisibility(isVerified ? View.VISIBLE : View.GONE);
|
|
||||||
h.mRevoked.setVisibility(View.GONE);
|
|
||||||
h.mStatus.setVisibility(isVerified ? View.VISIBLE : View.GONE);
|
|
||||||
if (isVerified) {
|
|
||||||
h.mStatus.setColorFilter(getResources().getColor(R.color.result_green),
|
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,30 +38,12 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<ImageView
|
||||||
android:id="@+id/status_layout"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/status_image"
|
||||||
<TextView
|
android:layout_gravity="center"
|
||||||
android:id="@+id/revoked"
|
android:src="@drawable/status_signature_verified_cutout"
|
||||||
android:layout_width="wrap_content"
|
android:padding="16dp" />
|
||||||
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
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/status_image"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:src="@drawable/status_signature_verified_cutout"
|
|
||||||
android:padding="16dp" />
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user