|
15 | 15 | name="isDeleting"
|
16 | 16 | type="androidx.databinding.ObservableBoolean" />
|
17 | 17 |
|
| 18 | + <variable |
| 19 | + name="isFocused" |
| 20 | + type="androidx.databinding.ObservableBoolean" /> |
| 21 | + |
18 | 22 | <variable
|
19 | 23 | name="key"
|
20 | 24 | type="String" />
|
|
24 | 28 | type="com.wireguard.android.model.ObservableTunnel" />
|
25 | 29 | </data>
|
26 | 30 |
|
27 |
| - <!-- Rather than changing the background tint to red for deleting mode, it should instead just change the selection color --> |
28 | 31 | <com.google.android.material.card.MaterialCardView
|
29 | 32 | android:layout_width="225dp"
|
30 | 33 | android:layout_height="110dp"
|
31 | 34 | android:layout_margin="8dp"
|
32 | 35 | android:layout_marginTop="4dp"
|
33 | 36 | android:layout_marginBottom="0dp"
|
34 |
| - android:backgroundTint="@{isDeleting ? @color/error_tag_color : item.state == State.UP ? @color/secondary_dark_color : @color/tv_card_background}" |
35 | 37 | android:checkable="true"
|
36 | 38 | android:focusable="true"
|
| 39 | + android:backgroundTint="@{(item.state == State.UP && !isDeleting) ? @color/secondary_dark_color : (isDeleting && isFocused) ? @color/tv_card_delete_background : @color/tv_card_background}" |
37 | 40 | app:contentPadding="8dp">
|
38 | 41 |
|
39 | 42 | <androidx.constraintlayout.widget.ConstraintLayout
|
|
61 | 64 | app:layout_constraintStart_toStartOf="parent"
|
62 | 65 | tools:text="rx: 200 MB, tx: 100 MB" />
|
63 | 66 |
|
64 |
| - <!-- TODO: replace the "&& true" stuff with && isSelected() --> |
65 | 67 | <com.google.android.material.textview.MaterialTextView
|
66 | 68 | android:id="@+id/tunnel_delete"
|
67 | 69 | android:layout_width="wrap_content"
|
68 | 70 | android:layout_height="wrap_content"
|
69 | 71 | android:text="@string/tv_delete"
|
70 |
| - android:visibility="@{isDeleting && true ? View.VISIBLE : View.GONE}" |
| 72 | + android:visibility="@{(isDeleting && isFocused) ? View.VISIBLE : View.GONE}" |
71 | 73 | app:layout_constraintBottom_toBottomOf="parent"
|
72 | 74 | app:layout_constraintStart_toStartOf="parent"
|
73 | 75 | tools:visibility="gone" />
|
|
0 commit comments