Use rounded images for selecting recipients, and for the recipient list.

This commit is contained in:
Robert Spencer 2019-07-11 20:33:04 +01:00
parent b083bb0173
commit e84b7948f6
3 changed files with 88 additions and 77 deletions

View file

@ -27,7 +27,6 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.ListPopupWindow;
import android.widget.ListView;
import android.widget.TextView;
@ -43,6 +42,7 @@ import com.fsck.k9.view.RecipientSelectView.Recipient;
import com.tokenautocomplete.TokenCompleteTextView;
import org.apache.james.mime4j.util.CharsetUtil;
import timber.log.Timber;
import de.hdodenhof.circleimageview.CircleImageView;
public class RecipientSelectView extends TokenCompleteTextView<Recipient> implements LoaderCallbacks<List<Recipient>>,
@ -120,7 +120,10 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
@SuppressLint("InflateParams")
private View inflateLayout() {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
return layoutInflater.inflate(R.layout.recipient_token_item, null, false);
View layout = layoutInflater.inflate(R.layout.recipient_token_item, null, false);
View contactPhoto = layout.findViewById(R.id.contact_photo);
contactPhoto.setZ(1.f);
return layout;
}
private void bindObjectView(Recipient recipient, View view) {
@ -536,7 +539,7 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
private static class RecipientTokenViewHolder {
final TextView vName;
final ImageView vContactPhoto;
final CircleImageView vContactPhoto;
final View cryptoStatusRed;
final View cryptoStatusOrange;
final View cryptoStatusGreen;

View file

@ -7,7 +7,7 @@
android:gravity="center"
android:orientation="horizontal">
<ImageView
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="12dp"

View file

@ -3,10 +3,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:background="?attr/contactTokenBackgroundColor">
android:layout_height="32dp">
<ImageView
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:gravity="center_vertical"
@ -14,82 +13,91 @@
tools:src="@drawable/ic_contact_picture"
/>
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@android:id/text1"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:maxLines="1"
android:ellipsize="end"
tools:text="Name"
/>
android:layout_height="match_parent"
android:background="?attr/contactTokenBackgroundColor"
android:layout_marginLeft="-16dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_black"
tools:visibility="visible"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@android:id/text1"
android:layout_gravity="center_vertical"
android:layout_marginLeft="24dp"
android:layout_marginRight="8dp"
android:maxLines="1"
android:ellipsize="end"
tools:text="Name"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple_enabled"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_green"
tools:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_black"
tools:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple_error"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_red"
tools:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple_enabled"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_green"
tools:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_red"
android:src="@drawable/status_dots_1"
android:tint="?attr/openpgp_red"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/contact_crypto_status_icon_simple_error"
android:src="@drawable/ic_status_corner"
android:visibility="gone"
android:tint="?openpgp_red"
tools:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_orange"
android:src="@drawable/status_dots_2"
android:tint="?attr/openpgp_orange"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_red"
android:src="@drawable/status_dots_1"
android:tint="?attr/openpgp_red"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_green"
android:src="@drawable/status_dots_3"
android:tint="?attr/openpgp_green"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_orange"
android:src="@drawable/status_dots_2"
android:tint="?attr/openpgp_orange"
android:visibility="gone"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:id="@+id/contact_crypto_status_green"
android:src="@drawable/status_dots_3"
android:tint="?attr/openpgp_green"
android:visibility="gone"
/>
</LinearLayout>
</LinearLayout>