1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 01:36:55 +00:00

Added answer item indicators

This commit is contained in:
M66B 2020-09-13 19:36:01 +02:00
parent b6d4b10211
commit eb7fde9945
3 changed files with 44 additions and 3 deletions

View file

@ -32,6 +32,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -64,6 +65,8 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
private View view;
private TextView tvName;
private TextView tvGroup;
private ImageView ivStandard;
private ImageView ivFavorite;
private TwoStateOwner powner = new TwoStateOwner(owner, "RulePopup");
@ -73,6 +76,8 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
view = itemView.findViewById(R.id.clItem);
tvName = itemView.findViewById(R.id.tvName);
tvGroup = itemView.findViewById(R.id.tvGroup);
ivStandard = itemView.findViewById(R.id.ivStandard);
ivFavorite = itemView.findViewById(R.id.ivFavorite);
}
private void wire() {
@ -87,9 +92,11 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
private void bindTo(EntityAnswer answer) {
view.setAlpha(answer.hide ? Helper.LOW_LIGHT : 1.0f);
tvName.setText(answer.toString());
tvName.setText(answer.name);
tvGroup.setText(answer.group);
tvGroup.setVisibility(TextUtils.isEmpty(answer.group) ? View.GONE : View.VISIBLE);
ivStandard.setVisibility(answer.standard ? View.VISIBLE : View.GONE);
ivFavorite.setVisibility(answer.favorite ? View.VISIBLE : View.GONE);
}
@Override

View file

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M22,4c0,-1.1 -0.9,-2 -2,-2H4C2.9,2 2.01,2.9 2.01,4L2,22l4,-4h9v-8h7V4z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M22.5,16l-2.2,0l1.7,-4l-5,0l0,6l2,0l0,5z"/>
</vector>

View file

@ -22,9 +22,10 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:minHeight="24dp"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivStandard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -36,9 +37,29 @@
android:maxLines="1"
android:text="Group"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivStandard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvName" />
<ImageView
android:id="@+id/ivStandard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivFavorite"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_quickreply_24" />
<ImageView
android:id="@+id/ivFavorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_star_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ViewCardOptional>
</FrameLayout>