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() {
|
private fun saveConfig() {
|
||||||
val views = RemoteViews(packageName, R.layout.widget)
|
val views = RemoteViews(packageName, R.layout.widget)
|
||||||
views.setBackgroundColor(R.id.widget_holder, mBgColor)
|
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
|
config.showWidgetFolderName = folder_picker_show_folder_name.isChecked
|
||||||
val widget = Widget(null, mWidgetId, mFolderPath)
|
val widget = Widget(null, mWidgetId, mFolderPath)
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
|
|
@ -818,7 +818,7 @@ fun Context.deleteMediumWithPath(path: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.updateWidgets() {
|
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()) {
|
if (widgetIDs.isNotEmpty()) {
|
||||||
Intent(applicationContext, MyWidgetProvider::class.java).apply {
|
Intent(applicationContext, MyWidgetProvider::class.java).apply {
|
||||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||||
|
|
Loading…
Reference in New Issue