mirror of
https://github.com/jrpie/Launcher.git
synced 2025-06-07 17:59:54 +02:00
delete appwidgethost when resetting settings
Some checks failed
Android CI / build (push) Has been cancelled
Some checks failed
Android CI / build (push) Has been cancelled
This commit is contained in:
parent
3c2efe04de
commit
15d36eeff4
2 changed files with 2 additions and 8 deletions
|
@ -2,7 +2,6 @@ package de.jrpie.android.launcher.preferences
|
|||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import de.jrpie.android.launcher.Application
|
||||
import de.jrpie.android.launcher.BuildConfig
|
||||
import de.jrpie.android.launcher.actions.Action
|
||||
import de.jrpie.android.launcher.apps.AbstractAppInfo
|
||||
|
@ -21,8 +20,8 @@ import de.jrpie.android.launcher.widgets.ClockWidget
|
|||
import de.jrpie.android.launcher.widgets.DebugInfoWidget
|
||||
import de.jrpie.android.launcher.widgets.WidgetPanel
|
||||
import de.jrpie.android.launcher.widgets.WidgetPosition
|
||||
import de.jrpie.android.launcher.widgets.deleteAllWidgets
|
||||
import de.jrpie.android.launcher.widgets.generateInternalId
|
||||
import de.jrpie.android.launcher.widgets.getAppWidgetHost
|
||||
|
||||
/* Current version of the structure of preferences.
|
||||
* Increase when breaking changes are introduced and write an appropriate case in
|
||||
|
@ -92,7 +91,7 @@ fun resetPreferences(context: Context) {
|
|||
Log.i(TAG, "Resetting preferences")
|
||||
LauncherPreferences.clear()
|
||||
LauncherPreferences.internal().versionCode(PREFERENCE_VERSION)
|
||||
deleteAllWidgets(context)
|
||||
context.getAppWidgetHost().deleteHost()
|
||||
|
||||
LauncherPreferences.widgets().widgets(
|
||||
setOf(
|
||||
|
|
|
@ -15,11 +15,6 @@ import de.jrpie.android.launcher.Application
|
|||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||
import kotlin.math.min
|
||||
|
||||
fun deleteAllWidgets(context: Context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.getAppWidgetHost().appWidgetIds.forEach { AppWidget(it).delete(context) }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to bind [providerInfo] to the id [id].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue