mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-20 17:57:29 +00:00
Add better check boxes.
This commit is contained in:
@@ -138,19 +138,7 @@ public class ContactSelectionListItem extends ConstraintLayout implements Recipi
|
||||
}
|
||||
|
||||
public void setChecked(boolean selected, boolean animate) {
|
||||
boolean wasSelected = checkBox.isChecked();
|
||||
|
||||
if (wasSelected != selected) {
|
||||
checkBox.setChecked(selected);
|
||||
|
||||
float alpha = selected ? 1f : 0f;
|
||||
if (animate) {
|
||||
checkBox.animate().setDuration(250L).alpha(alpha);
|
||||
} else {
|
||||
checkBox.animate().cancel();
|
||||
checkBox.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
checkBox.setChecked(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="250" android:exitFadeDuration="250">
|
||||
<item android:state_checked="true" android:state_enabled="false">
|
||||
<layer-list>
|
||||
<item>
|
||||
@@ -23,6 +23,8 @@
|
||||
</layer-list>
|
||||
</item>
|
||||
<item android:state_checked="false">
|
||||
<color android:color="@null" />
|
||||
<shape android:shape="oval">
|
||||
<stroke android:width="2dp" android:color="@color/core_grey_75" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="250" android:exitFadeDuration="250">
|
||||
<item android:state_checked="true" android:state_enabled="false">
|
||||
<layer-list>
|
||||
<item>
|
||||
@@ -23,6 +23,8 @@
|
||||
</layer-list>
|
||||
</item>
|
||||
<item android:state_checked="false">
|
||||
<color android:color="@null" />
|
||||
<shape android:shape="oval">
|
||||
<stroke android:width="2dp" android:color="@color/core_grey_25" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -37,9 +37,8 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/check_box"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:alpha="0"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:background="@drawable/contact_selection_checkbox"
|
||||
android:button="@null"
|
||||
android:clickable="false"
|
||||
@@ -80,7 +79,11 @@
|
||||
android:textColor="@color/signal_text_secondary"
|
||||
android:textDirection="ltr"
|
||||
app:emoji_forceCustom="true"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/label"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@id/contact_photo_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
tools:text="@sample/contacts.json/data/number" />
|
||||
@@ -94,6 +97,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
||||
android:textColor="@color/signal_text_secondary"
|
||||
app:layout_constraintEnd_toEndOf="@id/name"
|
||||
app:layout_constraintStart_toEndOf="@id/number"
|
||||
app:layout_constraintTop_toTopOf="@id/number"
|
||||
tools:ignore="RtlSymmetry"
|
||||
|
||||
Reference in New Issue
Block a user