Improved blocked users layout

main
Eugen Rochko 8 years ago
parent f508e8bc34
commit 470b3b1236
  1. 28
      app/src/main/java/com/keylesspalace/tusky/BlocksAdapter.java
  2. 9
      app/src/main/res/drawable/ic_clear_24dp.xml
  3. 63
      app/src/main/res/layout/item_blocked_user.xml
  4. 2
      app/src/main/res/values/strings.xml

@ -20,15 +20,20 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.keylesspalace.tusky.entity.Account;
import com.pkmmte.view.CircularImageView;
import com.squareup.picasso.Picasso;
import java.util.HashSet;
import java.util.Set;
import butterknife.BindView;
import butterknife.ButterKnife;
class BlocksAdapter extends AccountAdapter {
private static final int VIEW_TYPE_BLOCKED_USER = 0;
private static final int VIEW_TYPE_FOOTER = 1;
@ -88,19 +93,17 @@ class BlocksAdapter extends AccountAdapter {
notifyItemChanged(position);
}
private static class BlockedUserViewHolder extends RecyclerView.ViewHolder {
private ImageView avatar;
private TextView username;
private TextView displayName;
private Button unblock;
static class BlockedUserViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.blocked_user_avatar) CircularImageView avatar;
@BindView(R.id.blocked_user_username) TextView username;
@BindView(R.id.blocked_user_display_name) TextView displayName;
@BindView(R.id.blocked_user_unblock) ImageButton unblock;
private String id;
BlockedUserViewHolder(View itemView) {
super(itemView);
avatar = (ImageView) itemView.findViewById(R.id.blocked_user_avatar);
displayName = (TextView) itemView.findViewById(R.id.blocked_user_display_name);
username = (TextView) itemView.findViewById(R.id.blocked_user_username);
unblock = (Button) itemView.findViewById(R.id.blocked_user_unblock);
ButterKnife.bind(this, itemView);
}
void setupWithAccount(Account account) {
@ -118,13 +121,6 @@ class BlocksAdapter extends AccountAdapter {
void setupActionListener(final AccountActionListener listener, final boolean blocked,
final int position) {
int unblockTextId;
if (blocked) {
unblockTextId = R.string.action_unblock;
} else {
unblockTextId = R.string.action_block;
}
unblock.setText(unblock.getContext().getString(unblockTextId));
unblock.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/toolbar_icon_dark"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>

@ -1,60 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:scaleType="fitCenter"
android:layout_height="72dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:gravity="center_vertical">
<com.pkmmte.view.CircularImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/blocked_user_avatar"
android:padding="@dimen/status_avatar_padding"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="24dp"
android:layout_centerVertical="true"/>
<ImageButton
app:srcCompat="@drawable/ic_clear_24dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/blocked_user_unblock"
android:layout_gravity="center_vertical"
android:text="@string/action_unblock"
style="?attr/image_button_style"
android:layout_alignParentRight="true"
android:layout_marginLeft="16dp"
android:layout_centerVertical="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="64dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_toRightOf="@id/blocked_user_avatar"
android:layout_toLeftOf="@id/blocked_user_unblock">
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/blocked_user_display_name"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"
android:text="Display name"
android:maxLines="1"
android:ellipsize="end"
android:textSize="16sp"
android:textColor="?android:textColorPrimary"
android:textStyle="normal|bold" />
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\@username"
android:maxLines="1"
android:ellipsize="end"
android:textSize="14sp"
android:id="@+id/blocked_user_username"
android:textColor="?android:textColorSecondary" />
<Space
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>

@ -34,7 +34,7 @@
<string name="title_follows">Follows</string>
<string name="title_followers">Followers</string>
<string name="title_favourites">Favourites</string>
<string name="title_blocks">Blocked Users</string>
<string name="title_blocks">Blocked users</string>
<string name="status_username_format">\@%s</string>
<string name="status_boosted_format">%s boosted</string>

Loading…
Cancel
Save