Circle avatars in follow lists

main
Eugen Rochko 8 years ago
parent daf7e6ed6a
commit b3b3f2a88d
  1. 10
      app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java
  2. 37
      app/src/main/res/layout/item_account.xml

@ -24,8 +24,11 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.keylesspalace.tusky.entity.Account; import com.keylesspalace.tusky.entity.Account;
import com.pkmmte.view.CircularImageView;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import butterknife.ButterKnife;
/** Both for follows and following lists. */ /** Both for follows and following lists. */
class FollowAdapter extends AccountAdapter { class FollowAdapter extends AccountAdapter {
private static final int VIEW_TYPE_ACCOUNT = 0; private static final int VIEW_TYPE_ACCOUNT = 0;
@ -77,8 +80,7 @@ class FollowAdapter extends AccountAdapter {
private View container; private View container;
private TextView username; private TextView username;
private TextView displayName; private TextView displayName;
private TextView note; private CircularImageView avatar;
private ImageView avatar;
private String id; private String id;
AccountViewHolder(View itemView) { AccountViewHolder(View itemView) {
@ -86,8 +88,7 @@ class FollowAdapter extends AccountAdapter {
container = itemView.findViewById(R.id.account_container); container = itemView.findViewById(R.id.account_container);
username = (TextView) itemView.findViewById(R.id.account_username); username = (TextView) itemView.findViewById(R.id.account_username);
displayName = (TextView) itemView.findViewById(R.id.account_display_name); displayName = (TextView) itemView.findViewById(R.id.account_display_name);
note = (TextView) itemView.findViewById(R.id.account_note); avatar = (CircularImageView) itemView.findViewById(R.id.account_avatar);
avatar = (ImageView) itemView.findViewById(R.id.account_avatar);
} }
void setupWithAccount(Account account) { void setupWithAccount(Account account) {
@ -96,7 +97,6 @@ class FollowAdapter extends AccountAdapter {
String formattedUsername = String.format(format, account.username); String formattedUsername = String.format(format, account.username);
username.setText(formattedUsername); username.setText(formattedUsername);
displayName.setText(account.getDisplayName()); displayName.setText(account.getDisplayName());
note.setText(account.note);
Context context = avatar.getContext(); Context context = avatar.getContext();
Picasso.with(context) Picasso.with(context)
.load(account.avatar) .load(account.avatar)

@ -1,29 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="72dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:gravity="center_vertical"
android:id="@+id/account_container"> android:id="@+id/account_container">
<RelativeLayout <com.pkmmte.view.CircularImageView
android:paddingTop="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_centerVertical="true"
android:id="@+id/account_avatar" android:id="@+id/account_avatar"
android:layout_marginRight="10dp" /> android:layout_marginRight="24dp" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/account_avatar"> android:layout_toRightOf="@id/account_avatar">
<TextView <TextView
@ -31,6 +26,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/account_display_name" android:id="@+id/account_display_name"
android:text="Display name" android:text="Display name"
android:maxLines="1"
android:ellipsize="end"
android:textSize="16sp"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textStyle="normal|bold" /> android:textStyle="normal|bold" />
@ -38,19 +36,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="\@username" android:text="\@username"
android:maxLines="1"
android:ellipsize="end"
android:textSize="14sp"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:id="@+id/account_username" /> android:id="@+id/account_username" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/account_note"
android:paddingTop="4dp"
android:paddingBottom="8dp"
android:textColor="?android:textColorTertiary" />
</LinearLayout>
Loading…
Cancel
Save