From 01bf20e972a78bd8434e62bcb68cde51303d0f96 Mon Sep 17 00:00:00 2001 From: Sasikanth Miriyampalli Date: Mon, 25 Jan 2021 09:48:25 +0530 Subject: [PATCH] Add temporary fix for `scheduleButton` CSL state in `NotificationsListAdapter` 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. --- .../notifications/adapter/NotificationsListAdapter.kt | 8 ++++++++ app/src/main/res/color/schedule_indicator_icon_state.xml | 4 ++-- .../main/res/color/schedule_indicator_stroke_state.xml | 4 ++-- app/src/main/res/color/schedule_indicator_text_state.xml | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/dev/sasikanth/pinnit/notifications/adapter/NotificationsListAdapter.kt b/app/src/main/java/dev/sasikanth/pinnit/notifications/adapter/NotificationsListAdapter.kt index 81073a08..a7ab9596 100644 --- a/app/src/main/java/dev/sasikanth/pinnit/notifications/adapter/NotificationsListAdapter.kt +++ b/app/src/main/java/dev/sasikanth/pinnit/notifications/adapter/NotificationsListAdapter.kt @@ -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 } diff --git a/app/src/main/res/color/schedule_indicator_icon_state.xml b/app/src/main/res/color/schedule_indicator_icon_state.xml index 1121daf5..1d40d066 100644 --- a/app/src/main/res/color/schedule_indicator_icon_state.xml +++ b/app/src/main/res/color/schedule_indicator_icon_state.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/color/schedule_indicator_stroke_state.xml b/app/src/main/res/color/schedule_indicator_stroke_state.xml index 97ab98cf..3e925969 100644 --- a/app/src/main/res/color/schedule_indicator_stroke_state.xml +++ b/app/src/main/res/color/schedule_indicator_stroke_state.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/color/schedule_indicator_text_state.xml b/app/src/main/res/color/schedule_indicator_text_state.xml index 1121daf5..1d40d066 100644 --- a/app/src/main/res/color/schedule_indicator_text_state.xml +++ b/app/src/main/res/color/schedule_indicator_text_state.xml @@ -1,5 +1,5 @@ - - + +