mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 21:24:34 +00:00
Tristate keyword checkbox
This commit is contained in:
parent
6a81d43557
commit
eeb86dfb88
5 changed files with 39 additions and 2 deletions
|
@ -98,7 +98,10 @@ public class AdapterKeyword extends RecyclerView.Adapter<AdapterKeyword.ViewHold
|
|||
private void bindTo(TupleKeyword keyword) {
|
||||
cbKeyword.setText(getTitle(keyword.name));
|
||||
cbKeyword.setChecked(keyword.selected);
|
||||
cbKeyword.setAlpha(keyword.partial ? Helper.LOW_LIGHT : 1.0f);
|
||||
if (keyword.partial)
|
||||
cbKeyword.setButtonDrawable(R.drawable.ic_indeterminate);
|
||||
else
|
||||
cbKeyword.setButtonDrawable(keyword.selected ? R.drawable.ic_checked : R.drawable.ic_unchecked);
|
||||
btnColor.setColor(keyword.color, true);
|
||||
grpNotEdit.setVisibility(View.VISIBLE);
|
||||
grpEdit.setVisibility(View.GONE);
|
||||
|
@ -112,7 +115,7 @@ public class AdapterKeyword extends RecyclerView.Adapter<AdapterKeyword.ViewHold
|
|||
|
||||
TupleKeyword keyword = all.get(pos);
|
||||
keyword.selected = isChecked;
|
||||
buttonView.setAlpha(1.0f);
|
||||
cbKeyword.setButtonDrawable(keyword.selected ? R.drawable.ic_checked : R.drawable.ic_unchecked);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putLongArray("ids", ids);
|
||||
|
|
10
app/src/main/res/drawable/ic_checked.xml
Normal file
10
app/src/main/res/drawable/ic_checked.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" />
|
||||
</vector>
|
13
app/src/main/res/drawable/ic_indeterminate.xml
Normal file
13
app/src/main/res/drawable/ic_indeterminate.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h24v24H0z M 0,0" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM17,13L7,13v-2h10v2z" />
|
||||
</group>
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_unchecked.xml
Normal file
10
app/src/main/res/drawable/ic_unchecked.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z" />
|
||||
</vector>
|
|
@ -15,6 +15,7 @@
|
|||
android:id="@+id/cbKeyword"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:text="Keyword"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
Loading…
Reference in a new issue