Correct the algorithm to check if to show weather as a glance provider.
This commit is contained in:
parent
e89b377b68
commit
6d7d90e762
@ -114,11 +114,11 @@ object GlanceProviderHelper {
|
|||||||
(MediaPlayerHelper.isSomeonePlaying(context)) ||
|
(MediaPlayerHelper.isSomeonePlaying(context)) ||
|
||||||
(Preferences.showBatteryCharging && Preferences.isCharging || Preferences.isBatteryLevelLow) ||
|
(Preferences.showBatteryCharging && Preferences.isCharging || Preferences.isBatteryLevelLow) ||
|
||||||
(Preferences.customNotes.isNotEmpty()) ||
|
(Preferences.customNotes.isNotEmpty()) ||
|
||||||
(Preferences.showWeatherAsGlanceProvider && Preferences.weatherIcon != "") ||
|
(Preferences.showWeatherAsGlanceProvider && Preferences.showWeather && Preferences.weatherIcon != "") ||
|
||||||
(Preferences.showDailySteps && Preferences.googleFitSteps > 0) ||
|
(Preferences.showDailySteps && Preferences.googleFitSteps > 0) ||
|
||||||
(Preferences.showGreetings && GreetingsHelper.showGreetings()) ||
|
(Preferences.showGreetings && GreetingsHelper.showGreetings()) ||
|
||||||
(Preferences.showEventsAsGlanceProvider && Preferences.showEvents && context.checkGrantedPermission(
|
(Preferences.showEventsAsGlanceProvider && Preferences.showEvents && context.checkGrantedPermission(
|
||||||
Manifest.permission.READ_CALENDAR) && eventRepository.getNextEvent() != null)
|
Manifest.permission.READ_CALENDAR) && eventRepository.getNextEvent() != null)
|
||||||
)
|
)
|
||||||
eventRepository.close()
|
eventRepository.close()
|
||||||
return showGlance
|
return showGlance
|
||||||
|
@ -366,7 +366,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Constants.GlanceProviderId.WEATHER -> {
|
Constants.GlanceProviderId.WEATHER -> {
|
||||||
if (Preferences.showWeather && Preferences.weatherIcon != "") {
|
if (Preferences.showWeatherAsGlanceProvider && Preferences.showWeather && Preferences.weatherIcon != "") {
|
||||||
val i = Intent(context, WidgetClickListenerReceiver::class.java)
|
val i = Intent(context, WidgetClickListenerReceiver::class.java)
|
||||||
i.action = Actions.ACTION_OPEN_WEATHER_INTENT
|
i.action = Actions.ACTION_OPEN_WEATHER_INTENT
|
||||||
val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0)
|
val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0)
|
||||||
@ -742,7 +742,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Constants.GlanceProviderId.WEATHER -> {
|
Constants.GlanceProviderId.WEATHER -> {
|
||||||
if (Preferences.showWeatherAsGlanceProvider && Preferences.weatherIcon != "") {
|
if (Preferences.showWeatherAsGlanceProvider && Preferences.showWeather && Preferences.weatherIcon != "") {
|
||||||
bindingView.subLineText.text = String.format(
|
bindingView.subLineText.text = String.format(
|
||||||
Locale.getDefault(),
|
Locale.getDefault(),
|
||||||
"%d°%s %s",
|
"%d°%s %s",
|
||||||
|
@ -394,7 +394,7 @@ class StandardWidget(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Constants.GlanceProviderId.WEATHER -> {
|
Constants.GlanceProviderId.WEATHER -> {
|
||||||
if (Preferences.showWeather && Preferences.weatherIcon != "") {
|
if (Preferences.showWeatherAsGlanceProvider && Preferences.showWeather && Preferences.weatherIcon != "") {
|
||||||
val i = Intent(context, WidgetClickListenerReceiver::class.java)
|
val i = Intent(context, WidgetClickListenerReceiver::class.java)
|
||||||
i.action = Actions.ACTION_OPEN_WEATHER_INTENT
|
i.action = Actions.ACTION_OPEN_WEATHER_INTENT
|
||||||
val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0)
|
val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0)
|
||||||
@ -774,7 +774,7 @@ class StandardWidget(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Constants.GlanceProviderId.WEATHER -> {
|
Constants.GlanceProviderId.WEATHER -> {
|
||||||
if (Preferences.showWeatherAsGlanceProvider && Preferences.weatherIcon != "") {
|
if (Preferences.showWeatherAsGlanceProvider && Preferences.showWeather && Preferences.weatherIcon != "") {
|
||||||
bindingView.subLineText.text = String.format(
|
bindingView.subLineText.text = String.format(
|
||||||
Locale.getDefault(),
|
Locale.getDefault(),
|
||||||
"%d°%s %s",
|
"%d°%s %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user