Compare commits
3 Commits
release/v2
...
02f697faf7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02f697faf7 | ||
| 2dd81f1327 | |||
| 558aa2e69b |
@@ -28,8 +28,8 @@ android {
|
||||
// which builds this version and then creates the matching vX.Y.Z tag +
|
||||
// release itself (versionCode is pinned to MAJOR*10000 + MINOR*100 +
|
||||
// PATCH from versionName, e.g. 2.7.2 -> 20702). See docs/RELEASING.md.
|
||||
versionCode = 21901
|
||||
versionName = "2.19.1"
|
||||
versionCode = 21902
|
||||
versionName = "2.19.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import androidx.glance.appwidget.cornerRadius
|
||||
import androidx.glance.appwidget.lazy.LazyColumn
|
||||
import androidx.glance.appwidget.lazy.items
|
||||
import androidx.glance.appwidget.provideContent
|
||||
import androidx.glance.appwidget.updateAll
|
||||
import androidx.glance.background
|
||||
import androidx.glance.currentState
|
||||
import androidx.glance.state.PreferencesGlanceStateDefinition
|
||||
@@ -135,10 +134,14 @@ class AgendaWidget : GlanceAppWidget() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Re-reads the calendar and redraws the widget (header refresh button). */
|
||||
/**
|
||||
* Re-reads the calendar and redraws the widget (header refresh button). Targets
|
||||
* the tapped widget's own id rather than `updateAll`, whose provider-name lookup
|
||||
* is empty in a process a tap woke from cold — see `ShiftMonthAction` (#18).
|
||||
*/
|
||||
class RefreshAgendaAction : ActionCallback {
|
||||
override suspend fun onAction(context: Context, glanceId: GlanceId, parameters: ActionParameters) {
|
||||
AgendaWidget().updateAll(context.applicationContext)
|
||||
AgendaWidget().update(context.applicationContext, glanceId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import androidx.glance.appwidget.action.actionStartActivity
|
||||
import androidx.glance.appwidget.cornerRadius
|
||||
import androidx.glance.appwidget.provideContent
|
||||
import androidx.glance.appwidget.state.updateAppWidgetState
|
||||
import androidx.glance.appwidget.updateAll
|
||||
import androidx.glance.background
|
||||
import androidx.glance.currentState
|
||||
import androidx.glance.layout.Alignment
|
||||
@@ -118,7 +117,17 @@ class MonthWidget : GlanceAppWidget() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Step the displayed month by the `delta` action parameter (±1). */
|
||||
/**
|
||||
* Step the displayed month by the `delta` action parameter (±1).
|
||||
*
|
||||
* Redrawn through [GlanceAppWidget.update] with the id the callback was handed,
|
||||
* never `updateAll`. `updateAll` resolves its targets through the provider-name
|
||||
* -> app-widget-id map Glance persists for the *receiver*, and in a process that
|
||||
* has done nothing else yet — the one a tap wakes after a reboot — that lookup
|
||||
* comes back empty and the redraw is dropped: the state write lands, nothing
|
||||
* recomposes, and the arrows read as dead until something else opens the app and
|
||||
* starts a session (#18). The tapped widget's own id needs no lookup.
|
||||
*/
|
||||
class ShiftMonthAction : ActionCallback {
|
||||
override suspend fun onAction(context: Context, glanceId: GlanceId, parameters: ActionParameters) {
|
||||
val delta = parameters[deltaKey] ?: 0
|
||||
@@ -126,7 +135,7 @@ class ShiftMonthAction : ActionCallback {
|
||||
val cur = prefs[MONTH_INDEX_KEY] ?: currentMonthIndex(systemZone())
|
||||
prefs[MONTH_INDEX_KEY] = cur + delta
|
||||
}
|
||||
MonthWidget().updateAll(context.applicationContext)
|
||||
MonthWidget().update(context.applicationContext, glanceId)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -134,11 +143,11 @@ class ShiftMonthAction : ActionCallback {
|
||||
}
|
||||
}
|
||||
|
||||
/** Jump the displayed month back to the current month. */
|
||||
/** Jump the displayed month back to the current month. See [ShiftMonthAction]. */
|
||||
class ResetMonthAction : ActionCallback {
|
||||
override suspend fun onAction(context: Context, glanceId: GlanceId, parameters: ActionParameters) {
|
||||
updateAppWidgetState(context, glanceId) { prefs -> prefs.remove(MONTH_INDEX_KEY) }
|
||||
MonthWidget().updateAll(context.applicationContext)
|
||||
MonthWidget().update(context.applicationContext, glanceId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user