adding some widget related null checks
This commit is contained in:
parent
4841666e18
commit
fc2d42490a
|
@ -89,7 +89,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||
private fun saveConfig() {
|
||||
val views = RemoteViews(packageName, R.layout.widget)
|
||||
views.setBackgroundColor(R.id.widget_holder, mBgColor)
|
||||
AppWidgetManager.getInstance(this).updateAppWidget(mWidgetId, views)
|
||||
AppWidgetManager.getInstance(this)?.updateAppWidget(mWidgetId, views) ?: return
|
||||
config.showWidgetFolderName = folder_picker_show_folder_name.isChecked
|
||||
val widget = Widget(null, mWidgetId, mFolderPath)
|
||||
ensureBackgroundThread {
|
||||
|
|
|
@ -818,7 +818,7 @@ fun Context.deleteMediumWithPath(path: String) {
|
|||
}
|
||||
|
||||
fun Context.updateWidgets() {
|
||||
val widgetIDs = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java))
|
||||
val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java)) ?: return
|
||||
if (widgetIDs.isNotEmpty()) {
|
||||
Intent(applicationContext, MyWidgetProvider::class.java).apply {
|
||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
|
|
Loading…
Reference in New Issue