mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
nicer list items
This commit is contained in:
parent
c434c426e7
commit
99ec57aeaa
@ -24,7 +24,6 @@ import org.sufficientlysecure.keychain.Constants;
|
|||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
|
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
|
||||||
@ -37,6 +36,7 @@ import android.support.v4.widget.CursorAdapter;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,29 +91,43 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea
|
|||||||
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
|
||||||
TextView revoked = (TextView) view.findViewById(R.id.revoked);
|
TextView revoked = (TextView) view.findViewById(R.id.revoked);
|
||||||
|
|
||||||
mainUserId.setText(R.string.user_id_no_name);
|
|
||||||
mainUserIdRest.setText("");
|
|
||||||
revoked.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
String userId = cursor.getString(mIndexUserId);
|
String userId = cursor.getString(mIndexUserId);
|
||||||
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
|
||||||
|
|
||||||
if (userIdSplit[0] != null) {
|
if (userIdSplit[0] != null) {
|
||||||
mainUserId.setText(userIdSplit[0]);
|
mainUserId.setText(userIdSplit[0]);
|
||||||
|
} else {
|
||||||
|
mainUserId.setText(R.string.user_id_no_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userIdSplit[1] != null) {
|
if (userIdSplit[1] != null) {
|
||||||
mainUserIdRest.setText(userIdSplit[1]);
|
mainUserIdRest.setText(userIdSplit[1]);
|
||||||
|
mainUserIdRest.setVisibility(View.VISIBLE);
|
||||||
|
// disable centering of main user id field
|
||||||
|
RelativeLayout.LayoutParams layoutParams =
|
||||||
|
(RelativeLayout.LayoutParams) mainUserId.getLayoutParams();
|
||||||
|
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
|
||||||
|
mainUserId.setLayoutParams(layoutParams);
|
||||||
|
} else {
|
||||||
|
mainUserIdRest.setVisibility(View.INVISIBLE);
|
||||||
|
// center main user id field
|
||||||
|
RelativeLayout.LayoutParams layoutParams =
|
||||||
|
(RelativeLayout.LayoutParams) mainUserId.getLayoutParams();
|
||||||
|
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
|
||||||
|
mainUserId.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0;
|
boolean isRevoked = cursor.getInt(mIndexIsRevoked) > 0;
|
||||||
if (isRevoked) {
|
if (isRevoked) {
|
||||||
revoked.setVisibility(View.VISIBLE);
|
revoked.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
revoked.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||||
return mInflater.inflate(R.layout.key_list_item, null);
|
return mInflater.inflate(R.layout.key_list_public_item, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ public class KeyListSecretAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||||
return mInflater.inflate(R.layout.key_list_item, null);
|
return mInflater.inflate(R.layout.key_list_secret_item, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** -------------------------- MULTI-SELECTION METHODS -------------- */
|
/** -------------------------- MULTI-SELECTION METHODS -------------- */
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="left"
|
android:paddingTop="4dp"
|
||||||
android:orientation="horizontal" >
|
android:paddingBottom="4dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/api_apps_adapter_item_icon"
|
android:id="@+id/api_apps_adapter_item_icon"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
@ -22,7 +21,7 @@
|
|||||||
android:layout_toRightOf="@+id/api_apps_adapter_item_icon"
|
android:layout_toRightOf="@+id/api_apps_adapter_item_icon"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:text="Set in-code!"
|
android:text="Application Name"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -2,17 +2,21 @@
|
|||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/key_list_secret_fragment"
|
android:id="@+id/key_list_secret_fragment"
|
||||||
android:name="org.sufficientlysecure.keychain.ui.KeyListSecretFragment"
|
android:name="org.sufficientlysecure.keychain.ui.KeyListSecretFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:scrollbarStyle="outsideOverlay" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<include layout="@layout/drawer_list" />
|
<include layout="@layout/drawer_list" />
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:layout_marginRight="?android:attr/scrollbarSize"
|
android:layout_marginRight="?android:attr/scrollbarSize"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
android:singleLine="true">
|
android:singleLine="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -26,15 +28,4 @@
|
|||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true" />
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/revoked"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:text="@string/revoked"
|
|
||||||
android:textColor="#e00"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user