Skip to content
Snippets Groups Projects
Commit 207fc65d authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Duncan McNamara
Browse files

Improve widgets threading to avoid race conditions

parent dfc836a8
No related branches found
No related tags found
1 merge request!1384Improve widgets threading to avoid race conditions
Pipeline #223763 passed with stage
in 5 minutes and 35 seconds
......@@ -331,19 +331,25 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
when (widgetType) {
WidgetType.MICRO -> {
val bitmap = widgetCacheEntry.generateCircularProgressbar(context, 128.dp.toFloat(), pos)
views.setImageViewBitmap(R.id.progress_round, bitmap)
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
runOnMainThread {
views.setImageViewBitmap(R.id.progress_round, bitmap)
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
}
}
WidgetType.PILL -> {
widgetCacheEntry.generatePillProgressbar(context, pos)?.let { bitmap ->
views.setImageViewBitmap(R.id.progress_round, bitmap)
runOnMainThread {
views.setImageViewBitmap(R.id.progress_round, bitmap)
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
}
}
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
}
WidgetType.MINI, WidgetType.MACRO -> {
val bitmap = widgetCacheEntry.generateCircularProgressbar(context, 32.dp.toFloat(), pos, 3.dp.toFloat())
views.setImageViewBitmap(R.id.progress_round, bitmap)
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
runOnMainThread {
views.setImageViewBitmap(R.id.progress_round, bitmap)
if (!forPreview) applyUpdate(context, views, partial, appWidgetId)
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment