From 876af028c2beb3a0f3af267653c802641549f8db Mon Sep 17 00:00:00 2001 From: Fahim Date: Fri, 17 Sep 2021 14:26:45 +0600 Subject: [PATCH] 3808-Q-Forcefully_enable_dark_mode issue: https://gitlab.e.foundation/e/backlog/-/issues/3808 --- res/drawable/ic_backspace.xml | 2 +- res/layout/custom_pref_dropdown_layout.xml | 2 ++ res/layout/custom_pref_layout.xml | 1 + res/layout/custom_pref_switch_layout.xml | 1 + res/layout/day_button.xml | 1 + res/layout/digital_widget.xml | 6 +++--- res/layout/timer_setup_time.xml | 2 ++ res/layout/world_clock_remote_list_item.xml | 13 ++++++------- res/values/colors.xml | 1 + res/values/styles.xml | 1 + res/values/themes.xml | 8 +++++++- src/com/android/deskclock/DeskClockApplication.java | 4 ++++ .../alarms/dataadapter/ExpandedAlarmViewHolder.java | 6 +++--- .../deskclock/stopwatch/StopwatchCircleView.java | 3 ++- .../android/deskclock/timer/TimerCircleView.java | 3 ++- 15 files changed, 37 insertions(+), 17 deletions(-) diff --git a/res/drawable/ic_backspace.xml b/res/drawable/ic_backspace.xml index bbcb90a31..e91089794 100644 --- a/res/drawable/ic_backspace.xml +++ b/res/drawable/ic_backspace.xml @@ -19,7 +19,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:width="@dimen/backspace_icon_size" android:height="@dimen/backspace_icon_size" - android:tint="?attr/colorControlNormal" + android:tint="@color/accent_color" android:tintMode="src_in" android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/res/layout/custom_pref_dropdown_layout.xml b/res/layout/custom_pref_dropdown_layout.xml index ec13ee58c..6cbca8a74 100644 --- a/res/layout/custom_pref_dropdown_layout.xml +++ b/res/layout/custom_pref_dropdown_layout.xml @@ -7,6 +7,7 @@ android:gravity="center_vertical" android:paddingEnd="?android:attr/scrollbarSize" android:background="@color/default_background" + android:foreground="?android:attr/selectableItemBackground" android:focusable="true" > diff --git a/res/layout/custom_pref_layout.xml b/res/layout/custom_pref_layout.xml index a49bebf9a..85c8467ed 100644 --- a/res/layout/custom_pref_layout.xml +++ b/res/layout/custom_pref_layout.xml @@ -7,6 +7,7 @@ android:gravity="center_vertical" android:paddingEnd="?android:attr/scrollbarSize" android:background="@color/default_background" + android:foreground="?android:attr/selectableItemBackground" android:focusable="true" > \ No newline at end of file diff --git a/res/layout/digital_widget.xml b/res/layout/digital_widget.xml index 78663f143..5290d8470 100644 --- a/res/layout/digital_widget.xml +++ b/res/layout/digital_widget.xml @@ -33,7 +33,7 @@ android:format24Hour="@string/lock_screen_24_hour_format" android:includeFontPadding="false" android:singleLine="true" - android:textColor="@color/color_default_primary_text" /> + android:textColor="@color/color_default_view_on_accent" /> + android:textColor="@color/color_default_view_on_accent" /> + android:textColor="@color/color_default_view_on_accent" /> diff --git a/res/layout/timer_setup_time.xml b/res/layout/timer_setup_time.xml index f770a604f..2c33a3ba9 100644 --- a/res/layout/timer_setup_time.xml +++ b/res/layout/timer_setup_time.xml @@ -48,8 +48,10 @@ android:layout_height="wrap_content" android:contentDescription="@string/timer_delete" android:background="@color/default_background" + android:foreground="?android:attr/selectableItemBackground" android:padding="12dp" android:scaleType="center" + android:tint="@color/accent_color" app:srcCompat="@drawable/ic_backspace" /> diff --git a/res/layout/world_clock_remote_list_item.xml b/res/layout/world_clock_remote_list_item.xml index 80ffa4537..fa6698fa7 100644 --- a/res/layout/world_clock_remote_list_item.xml +++ b/res/layout/world_clock_remote_list_item.xml @@ -17,7 +17,6 @@ @@ -43,7 +42,7 @@ android:layout_gravity="center" android:baselineAligned="true" android:gravity="center" - android:textColor="@color/color_default_primary_text" /> + android:textColor="@color/color_default_view_on_accent" /> @@ -83,7 +82,7 @@ android:includeFontPadding="false" android:singleLine="true" android:textAllCaps="true" - android:textColor="@color/color_default_primary_text" + android:textColor="@color/color_default_view_on_accent" android:textSize="@dimen/city_widget_name_font_size" /> @@ -105,7 +104,7 @@ android:layout_gravity="center" android:baselineAligned="true" android:gravity="center" - android:textColor="@color/color_default_primary_text" /> + android:textColor="@color/color_default_view_on_accent" /> @@ -145,7 +144,7 @@ android:includeFontPadding="false" android:singleLine="true" android:textAllCaps="true" - android:textColor="@color/color_default_primary_text" + android:textColor="@color/color_default_view_on_accent" android:textSize="@dimen/city_widget_name_font_size" /> diff --git a/res/values/colors.xml b/res/values/colors.xml index 5968fd63f..cbf097ff4 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -34,6 +34,7 @@ @lineageos.platform:color/color_default_primary_text @lineageos.platform:color/color_default_secondary_text @lineageos.platform:color/color_default_divider + @lineageos.platform:color/color_default_view_on_accent @lineageos.platform:color/color_default_gray1 @lineageos.platform:color/color_default_gray2 diff --git a/res/values/styles.xml b/res/values/styles.xml index d2e540016..4bb82113f 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -159,6 +159,7 @@ @color/transparent @color/transparent @color/accent_color + @color/accent_color diff --git a/src/com/android/deskclock/DeskClockApplication.java b/src/com/android/deskclock/DeskClockApplication.java index 395d38518..3f2afb32a 100644 --- a/src/com/android/deskclock/DeskClockApplication.java +++ b/src/com/android/deskclock/DeskClockApplication.java @@ -28,12 +28,16 @@ import com.android.deskclock.data.DataModel; import com.android.deskclock.events.LogEventTracker; import com.android.deskclock.uidata.UiDataModel; +import androidx.appcompat.app.AppCompatDelegate; + public class DeskClockApplication extends Application { @Override public void onCreate() { super.onCreate(); + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + final Context applicationContext = getApplicationContext(); final SharedPreferences prefs = getDefaultSharedPreferences(applicationContext); diff --git a/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java b/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java index 9a07bd484..f6db75ac7 100644 --- a/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java +++ b/src/com/android/deskclock/alarms/dataadapter/ExpandedAlarmViewHolder.java @@ -101,6 +101,7 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { final int weekday = weekdays.get(i); dayButton.setText(UiDataModel.getUiDataModel().getShortWeekday(weekday)); dayButton.setContentDescription(UiDataModel.getUiDataModel().getLongWeekday(weekday)); + dayButton.setTextColor(context.getApplicationContext().getResources().getColor(R.color.color_default_view_on_accent)); repeatDays.addView(dayButtonFrame); dayButtons[i] = dayButton; } @@ -221,11 +222,10 @@ public final class ExpandedAlarmViewHolder extends AlarmItemViewHolder { final CompoundButton dayButton = dayButtons[i]; if (alarm.daysOfWeek.isBitOn(weekdays.get(i))) { dayButton.setChecked(true); - dayButton.setTextColor(ThemeUtils.resolveColor(context, - android.R.attr.windowBackground)); + dayButton.setTextColor(context.getApplicationContext().getResources().getColor(R.color.color_default_view_on_accent)); } else { dayButton.setChecked(false); - dayButton.setTextColor(context.getApplicationContext().getResources().getColor(R.color.color_default_primary_text)); + dayButton.setTextColor(context.getApplicationContext().getResources().getColor(R.color.color_default_view_on_accent)); } } if (alarm.daysOfWeek.isRepeating()) { diff --git a/src/com/android/deskclock/stopwatch/StopwatchCircleView.java b/src/com/android/deskclock/stopwatch/StopwatchCircleView.java index 8f010bd70..297fd9a0a 100644 --- a/src/com/android/deskclock/stopwatch/StopwatchCircleView.java +++ b/src/com/android/deskclock/stopwatch/StopwatchCircleView.java @@ -81,7 +81,7 @@ public final class StopwatchCircleView extends View { mMarkerStrokeSize = resources.getDimension(R.dimen.circletimer_marker_size); mRadiusOffset = Utils.calculateRadiusOffset(mStrokeSize, dotDiameter, mMarkerStrokeSize); - mRemainderColor = context.getApplicationContext().getResources().getColor(R.color.gray1); + mRemainderColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); mCompletedColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); mPaint.setAntiAlias(true); @@ -108,6 +108,7 @@ public final class StopwatchCircleView extends View { // Reset old painting state. mPaint.setColor(mRemainderColor); + mPaint.setAlpha(100); mPaint.setStrokeWidth(mStrokeSize); final List laps = getLaps(); diff --git a/src/com/android/deskclock/timer/TimerCircleView.java b/src/com/android/deskclock/timer/TimerCircleView.java index 2a3012e11..c55cc88e4 100644 --- a/src/com/android/deskclock/timer/TimerCircleView.java +++ b/src/com/android/deskclock/timer/TimerCircleView.java @@ -71,7 +71,7 @@ public final class TimerCircleView extends View { mStrokeSize = resources.getDimension(R.dimen.circletimer_circle_size); mRadiusOffset = Utils.calculateRadiusOffset(mStrokeSize, dotDiameter, 0); - mRemainderColor = context.getApplicationContext().getResources().getColor(R.color.gray1); + mRemainderColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); mCompletedColor = ThemeUtils.resolveColor(context, R.attr.colorAccent); mPaint.setAntiAlias(true); @@ -102,6 +102,7 @@ public final class TimerCircleView extends View { // Reset old painting state. mPaint.setColor(mRemainderColor); + mPaint.setAlpha(100); mPaint.setStrokeWidth(mStrokeSize); // If the timer is reset, draw a simple white circle. -- GitLab