Fix dark theme toggle issue

This commit is contained in:
Tommaso Berlose
2020-05-11 12:40:42 +02:00
parent 7d2ea5a4d8
commit 385806413e
9 changed files with 10 additions and 61 deletions

View File

@ -32,15 +32,11 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
if (lastEvent.activityType == DetectedActivity.WALKING || lastEvent.activityType == DetectedActivity.RUNNING && lastEvent.transitionType == ActivityTransition.ACTIVITY_TRANSITION_EXIT) {
requestDailySteps(context)
setTimeout(context)
} else {
resetDailySteps()
}
} else {
if (intent.action == Intent.ACTION_BOOT_COMPLETED || intent.action == Intent.ACTION_MY_PACKAGE_REPLACED && Preferences.showDailySteps && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || context.checkGrantedPermission(Manifest.permission.ACTIVITY_RECOGNITION)) {
registerFence(context)
} else {
resetDailySteps()
registerFence(context)
}
}
}
@ -154,6 +150,7 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
}
}.toLong()
MainWidget.updateWidget(context)
setTimeout(context)
}
}
}

View File

@ -81,6 +81,8 @@ class CalendarTabFragment : Fragment() {
binding: FragmentCalendarSettingsBinding,
viewModel: MainViewModel
) {
binding.isCalendarEnabled = Preferences.showEvents
viewModel.showEvents.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
binding.isCalendarEnabled = it

View File

@ -85,6 +85,8 @@ class ClockTabFragment : Fragment() {
binding: FragmentClockSettingsBinding,
viewModel: MainViewModel
) {
binding.isClockVisible = Preferences.showClock
viewModel.showBigClockWarning.observe(viewLifecycleOwner, Observer {
large_clock_warning?.isVisible = it
small_clock_warning?.isVisible = !it

View File

@ -87,6 +87,7 @@ class GlanceTabFragment : Fragment() {
binding: FragmentGlanceSettingsBinding,
viewModel: MainViewModel
) {
binding.isGlanceVisible = Preferences.showGlance
viewModel.showGlance.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {

View File

@ -79,6 +79,8 @@ class WeatherTabFragment : Fragment() {
binding: FragmentWeatherSettingsBinding,
viewModel: MainViewModel
) {
binding.isWeatherVisible = Preferences.showWeather
viewModel.showWeatherWarning.observe(viewLifecycleOwner, Observer {
weather_warning?.isVisible = it
checkLocationPermission()