Fix up account list item layouts
This commit is contained in:
parent
2cf387bc21
commit
bdc19efe3d
|
@ -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) {
|
||||
|
|
|
@ -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">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.android.volley.toolbox.NetworkImageView
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/account_avatar"
|
||||
android:layout_marginLeft="@dimen/account_avatar_margin"
|
||||
android:layout_marginRight="@dimen/account_avatar_margin"
|
||||
android:layout_marginTop="@dimen/account_avatar_margin" />
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -28,11 +27,13 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/account_display_name"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="normal|bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:id="@+id/account_username" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -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" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue