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

Widgets: fix color flickering when resizing a pelette widget

parent 33d8fe87
No related branches found
No related tags found
1 merge request!1363New widgets
......@@ -55,8 +55,8 @@ class WidgetRepository(private val widgetDao: WidgetDao) {
widgetDao.insert(widget)
}
suspend fun updateWidget(widget:Widget) {
WidgetCache.clear(widget)
suspend fun updateWidget(widget:Widget, preventCacheClear:Boolean = false) {
if (!preventCacheClear) WidgetCache.clear(widget)
withContext(Dispatchers.IO) {
widgetDao.update(widget)
}
......
......@@ -177,7 +177,7 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
widgetCacheEntry.currentCoverInvalidated = true
log(appWidgetId, WidgetLogType.INFO, "Updating widget entry to: $widgetCacheEntry.widget")
widgetRepository.updateWidget(widgetCacheEntry.widget)
widgetRepository.updateWidget(widgetCacheEntry.widget, true)
}
val correctedSize = if (size.first == 0 && size.second == 0) {
log(appWidgetId, WidgetLogType.INFO, "Size is 0. Getting size from db: $widgetCacheEntry.widget")
......@@ -232,7 +232,7 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
if (colorChanged) {
if (widgetType == WidgetType.MACRO) views.setImageViewBitmap(R.id.cover_background, context.getColoredBitmapFromColor(R.drawable.widget_rectangle_background, widgetCacheEntry.widget.getBackgroundColor(context, palette), widgetCacheEntry.widget.width.dp, widgetCacheEntry.widget.width.dp))
log(appWidgetId, WidgetLogType.BITMAP_GENERATION, "Bugfix Color changed!!! for widget $appWidgetId // forPreview $forPreview")
log(appWidgetId, WidgetLogType.BITMAP_GENERATION, "Bugfix Color changed!!! for widget $appWidgetId // forPreview $forPreview // foreground color: ${java.lang.String.format("#%06X", 0xFFFFFF and foregroundColor)} /// palette ${widgetCacheEntry.palette}")
if (android.text.TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
views.setImageViewBitmap(R.id.forward, context.getColoredBitmapFromColor(R.drawable.ic_widget_previous_normal, foregroundColor))
views.setImageViewBitmap(R.id.backward, context.getColoredBitmapFromColor(R.drawable.ic_widget_next_normal, foregroundColor))
......
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