Fix #671 - Improve toggle for blocked accounts

This commit is contained in:
Thomas 2022-12-23 18:32:56 +01:00
parent c9479aee20
commit 45dad375ad
2 changed files with 9 additions and 5 deletions

View File

@ -142,14 +142,18 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
if (account.relationShip.blocking) {
accountViewHolder.binding.block.setChecked(true);
accountViewHolder.binding.block.setBackgroundTintList(ColorStateList.valueOf(ThemeHelper.getAttColor(context, R.attr.colorError)));
accountViewHolder.binding.block.setIconResource(R.drawable.ic_baseline_lock_open_24);
accountViewHolder.binding.block.setContentDescription(context.getString(R.string.action_unblock));
accountViewHolder.binding.block.setOnClickListener(v -> accountsVM.unblock(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
.observe((LifecycleOwner) context, relationShip -> {
account.relationShip = relationShip;
adapter.notifyItemChanged(position);
}));
} else {
accountViewHolder.binding.block.setChecked(false);
accountViewHolder.binding.block.setBackgroundTintList(ColorStateList.valueOf(ThemeHelper.getAttColor(context, R.attr.colorPrimary)));
accountViewHolder.binding.block.setIconResource(R.drawable.ic_baseline_block_24);
accountViewHolder.binding.block.setContentDescription(context.getString(R.string.more_action_2));
accountViewHolder.binding.block.setOnClickListener(v -> accountsVM.block(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
.observe((LifecycleOwner) context, relationShip -> {
account.relationShip = relationShip;

View File

@ -143,15 +143,15 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/block"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Material3.Button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="24dp"
android:layout_marginTop="6dp"
android:layout_marginTop="4dp"
android:padding="0dp"
app:icon="@drawable/ic_baseline_block_24"
app:iconGravity="textStart"
app:iconPadding="0dp"
app:icon="@drawable/ic_baseline_block_24"
app:layout_constraintStart_toEndOf="@id/mute_group"
app:layout_constraintTop_toBottomOf="@id/bio" />