Fix sleep timer checkbox color

This commit is contained in:
h4h13 2019-11-28 19:46:54 +05:30
parent 0c5edf8ef6
commit 53e7f7660e
3 changed files with 9 additions and 4 deletions

View file

@ -28,6 +28,7 @@ import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
@ -109,7 +110,7 @@ class SleepTimerDialog : DialogFragment() {
shouldFinishLastSong = materialDialog.getCustomView().findViewById(R.id.shouldFinishLastSong) shouldFinishLastSong = materialDialog.getCustomView().findViewById(R.id.shouldFinishLastSong)
seekBar = materialDialog.getCustomView().findViewById(R.id.seekBar) seekBar = materialDialog.getCustomView().findViewById(R.id.seekBar)
timerDisplay = materialDialog.getCustomView().findViewById(R.id.timerDisplay) timerDisplay = materialDialog.getCustomView().findViewById(R.id.timerDisplay)
TintHelper.setTintAuto(shouldFinishLastSong, ThemeStore.accentColor(requireContext()), false)
val finishMusic = PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic val finishMusic = PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic
shouldFinishLastSong.isChecked = finishMusic shouldFinishLastSong.isChecked = finishMusic
@ -119,7 +120,7 @@ class SleepTimerDialog : DialogFragment() {
updateTimeDisplayTime() updateTimeDisplayTime()
seekBar.progress = seekArcProgress seekBar.progress = seekArcProgress
setProgressBarColor(ThemeStore.accentColor(context!!)) setProgressBarColor(ThemeStore.accentColor(requireContext()))
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) { override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) {
@ -181,6 +182,7 @@ class SleepTimerDialog : DialogFragment() {
updateCancelButton() updateCancelButton()
} }
} }
private fun setProgressBarColor(dark: Int) { private fun setProgressBarColor(dark: Int) {
ViewUtil.setProgressDrawable(progressSlider = seekBar, newColor = dark) ViewUtil.setProgressDrawable(progressSlider = seekBar, newColor = dark)
} }

View file

@ -63,6 +63,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
accentColorPref.setOnPreferenceClickListener { accentColorPref.setOnPreferenceClickListener {
MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show { MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(R.string.accent_color) title(R.string.accent_color)
positiveButton(R.string.set) positiveButton(R.string.set)
colorChooser(colors = ACCENT_COLORS, allowCustomArgb = true, subColors = ACCENT_COLORS_SUB) { _, color -> colorChooser(colors = ACCENT_COLORS, allowCustomArgb = true, subColors = ACCENT_COLORS_SUB) { _, color ->
@ -77,7 +78,6 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
val blackTheme: ATESwitchPreference? = findPreference("black_theme") val blackTheme: ATESwitchPreference? = findPreference("black_theme")
blackTheme?.setOnPreferenceChangeListener { _, _ -> blackTheme?.setOnPreferenceChangeListener { _, _ ->
ThemeStore.markChanged(requireContext()) ThemeStore.markChanged(requireContext())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue("black")) requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue("black"))
DynamicShortcutManager(requireContext()).updateDynamicShortcuts() DynamicShortcutManager(requireContext()).updateDynamicShortcuts()

View file

@ -71,9 +71,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:paddingStart="0dp" android:paddingStart="0dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"
android:thumbOffset="3dp" android:thumbOffset="2dp"
app:layout_constraintEnd_toStartOf="@+id/seekbar_value" app:layout_constraintEnd_toStartOf="@+id/seekbar_value"
app:layout_constraintStart_toStartOf="@+id/guideline_front_margin" app:layout_constraintStart_toStartOf="@+id/guideline_front_margin"
app:layout_constraintTop_toBottomOf="@android:id/summary" /> app:layout_constraintTop_toBottomOf="@android:id/summary" />