Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f98e1eb authored by Steven Ng's avatar Steven Ng
Browse files

Notify WidgetHostView drag content change only at onDraw

Reapply RemoteViews can happen asynchronously. RemoteViews may
not finish reinflation right after setColorResource. Let's call
it onDraw.

Test: Manual

Bug: 182282587

Change-Id: I3653b4c64a5897637181f61096464b75945ab5f5
parent f7864fed
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3.widget;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Handler;
@@ -120,8 +121,12 @@ public class LauncherAppWidgetHostView extends NavigableAppWidgetHostView
        } else {
            super.setColorResources(colors);
        }
    }

        if (mDragListener != null) {
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (mIsInDragMode && mDragListener != null) {
            mDragListener.onDragContentChanged();
        }
    }
+3 −1
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ public final class AppWidgetHostViewDragListener implements DragController.DragL

    /** Notifies when there is a content change in the drag view. */
    public void onDragContentChanged() {
        if (mDragObject.dragView != null) {
            mDragObject.dragView.invalidate();
        }
    }
}