Show divider only when used

This commit is contained in:
Dominik Schürmann 2014-03-26 18:34:48 +01:00
parent ac134790a0
commit cc8fd35137
2 changed files with 8 additions and 2 deletions

View File

@ -498,11 +498,15 @@ public class KeyListFragment extends Fragment
}
{ // set edit button and revoked info, specific by key type
View statusDivider = (View) view.findViewById(R.id.status_divider);
FrameLayout statusLayout = (FrameLayout) view.findViewById(R.id.status_layout);
Button button = (Button) view.findViewById(R.id.edit);
TextView revoked = (TextView) view.findViewById(R.id.revoked);
if (cursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
// this is a secret key - show the edit button
statusDivider.setVisibility(View.VISIBLE);
statusLayout.setVisibility(View.VISIBLE);
revoked.setVisibility(View.GONE);
button.setVisibility(View.VISIBLE);
@ -519,9 +523,11 @@ public class KeyListFragment extends Fragment
});
} else {
// this is a public key - hide the edit button, show if it's revoked
statusDivider.setVisibility(View.GONE);
button.setVisibility(View.GONE);
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
statusLayout.setVisibility(isRevoked ? View.VISIBLE : View.GONE);
revoked.setVisibility(isRevoked ? View.VISIBLE : View.GONE);
}
}

View File

@ -39,6 +39,7 @@
</LinearLayout>
<View
android:id="@+id/status_divider"
android:layout_width="1dip"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
@ -46,6 +47,7 @@
android:background="?android:attr/listDivider" />
<FrameLayout
android:id="@+id/status_layout"
android:layout_width="80dp"
android:layout_height="match_parent">
@ -55,7 +57,6 @@
android:layout_height="match_parent"
android:id="@+id/edit"
android:focusable="false"
android:visibility="visible"
android:enabled="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black"
@ -71,7 +72,6 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/revoked"
android:textColor="#e00"
android:visibility="visible"
android:layout_gravity="center" />
</FrameLayout>