Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
Add temporary fix for scheduleButton CSL state in `NotificationsLis…
Browse files Browse the repository at this point in the history
…tAdapter`

Had to use `state_selected` for CSL instaed of `state_enabled` because of weird issues when pinning and un-pinning. Need to resolve it later.

Reproducing steps: Pin a past note with schedule, close the app, open the app, unpin note with `state_enabled` in CSL the icon color is not set to disabled color.
  • Loading branch information
msasikanth committed Jan 25, 2021
1 parent ced2ace commit 01bf20e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ class NotificationsListAdapter(
val isPinned = notification.isPinned
val scheduleIsRepeatable = schedule.scheduleType != null

// Had to use `state_selected` for CSL instaed of `state_enabled`
// because of weird issues when pinning and un-pinning. Need to resolve
// it later.

// Reproducing steps: Pin a past note with schedule, close the app, open the app, unpin note
// with `state_enabled` in CSL the icon color is not set to disabled color.
scheduleButton.isSelected = isInFuture
scheduleButton.isEnabled = isInFuture

if (isPinned && !scheduleIsRepeatable) {
scheduleButton.isVisible = false
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/color/schedule_indicator_icon_state.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.32" android:color="?attr/colorSecondary" android:state_enabled="false" />
<item android:color="?attr/colorSecondary" android:state_enabled="true" />
<item android:alpha="0.32" android:color="?attr/colorSecondary" android:state_selected="false" />
<item android:color="?attr/colorSecondary" android:state_selected="true" />
</selector>
4 changes: 2 additions & 2 deletions app/src/main/res/color/schedule_indicator_stroke_state.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.16" android:color="?attr/colorSecondary" android:state_enabled="false" />
<item android:color="?attr/colorSecondary" android:state_enabled="true" />
<item android:alpha="0.16" android:color="?attr/colorSecondary" android:state_selected="false" />
<item android:color="?attr/colorSecondary" android:state_selected="true" />
</selector>
4 changes: 2 additions & 2 deletions app/src/main/res/color/schedule_indicator_text_state.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.32" android:color="?attr/colorSecondary" android:state_enabled="false" />
<item android:color="?attr/colorSecondary" android:state_enabled="true" />
<item android:alpha="0.32" android:color="?attr/colorSecondary" android:state_selected="false" />
<item android:color="?attr/colorSecondary" android:state_selected="true" />
</selector>

0 comments on commit 01bf20e

Please sign in to comment.