From bdc19efe3d3fce2e9359e76103b1400b0129ff7c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 7 Mar 2017 14:32:07 +0100 Subject: [PATCH] Fix up account list item layouts --- .../com/keylesspalace/tusky/FollowAdapter.java | 15 +++++++++------ app/src/main/res/layout/item_account.xml | 12 +++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java b/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java index c19afcb4..4e7b42c9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java @@ -20,10 +20,12 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.NetworkImageView; +import com.squareup.picasso.Picasso; /** Both for follows and following lists. */ class FollowAdapter extends AccountAdapter { @@ -78,7 +80,7 @@ class FollowAdapter extends AccountAdapter { private TextView username; private TextView displayName; private TextView note; - private NetworkImageView avatar; + private ImageView avatar; private String id; AccountViewHolder(View itemView) { @@ -87,9 +89,7 @@ class FollowAdapter extends AccountAdapter { username = (TextView) itemView.findViewById(R.id.account_username); displayName = (TextView) itemView.findViewById(R.id.account_display_name); note = (TextView) itemView.findViewById(R.id.account_note); - avatar = (NetworkImageView) itemView.findViewById(R.id.account_avatar); - avatar.setDefaultImageResId(R.drawable.avatar_default); - avatar.setErrorImageResId(R.drawable.avatar_error); + avatar = (ImageView) itemView.findViewById(R.id.account_avatar); } void setupWithAccount(Account account) { @@ -100,8 +100,11 @@ class FollowAdapter extends AccountAdapter { displayName.setText(account.displayName); note.setText(account.note); Context context = avatar.getContext(); - ImageLoader imageLoader = VolleySingleton.getInstance(context).getImageLoader(); - avatar.setImageUrl(account.avatar, imageLoader); + Picasso.with(context) + .load(account.avatar) + .placeholder(R.drawable.avatar_default) + .error(R.drawable.avatar_error) + .into(avatar); } void setupActionListener(final AccountActionListener listener) { diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_account.xml index 64e99b01..7f1f9dc1 100644 --- a/app/src/main/res/layout/item_account.xml +++ b/app/src/main/res/layout/item_account.xml @@ -3,19 +3,18 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="16dp" android:id="@+id/account_container"> - + android:layout_marginRight="10dp" /> @@ -43,6 +44,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/account_note" - android:layout_margin="@dimen/account_note_margin" /> + android:paddingTop="4dp" + android:textColor="?android:textColorTertiary" /> \ No newline at end of file