mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2024-11-24 04:36:03 -06:00
Fix reset button in timetable widget (#298)
This commit is contained in:
parent
fc9981aa5d
commit
e1a83927c4
@ -52,6 +52,7 @@
|
||||
|
||||
<receiver
|
||||
android:name=".ui.widgets.timetable.TimetableWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/timetable_title">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
|
@ -62,7 +62,7 @@ class TimetableWidgetProvider : BroadcastReceiver() {
|
||||
|
||||
private fun onUpdate(context: Context, intent: Intent) {
|
||||
if (intent.getStringExtra(EXTRA_BUTTON_TYPE) === null) {
|
||||
intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS).forEach { appWidgetId ->
|
||||
intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS)?.forEach { appWidgetId ->
|
||||
updateWidget(context, appWidgetId, now().nextOrSameSchoolDay)
|
||||
}
|
||||
} else {
|
||||
@ -95,7 +95,7 @@ class TimetableWidgetProvider : BroadcastReceiver() {
|
||||
.apply { action = createWidgetKey(appWidgetId) })
|
||||
setOnClickPendingIntent(R.id.timetableWidgetNext, createNavIntent(context, appWidgetId, appWidgetId, BUTTON_NEXT))
|
||||
setOnClickPendingIntent(R.id.timetableWidgetPrev, createNavIntent(context, -appWidgetId, appWidgetId, BUTTON_PREV))
|
||||
createNavIntent(context, Int.MAX_VALUE, appWidgetId, BUTTON_RESET).also {
|
||||
createNavIntent(context, Int.MAX_VALUE - appWidgetId, appWidgetId, BUTTON_RESET).also {
|
||||
setOnClickPendingIntent(R.id.timetableWidgetDate, it)
|
||||
setOnClickPendingIntent(R.id.timetableWidgetDay, it)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user