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

Commit 14a46849 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix issue in scrolling in remote compose widgets" into main

parents 9fdf9efd 1f72f9b3
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView

    private static final String TRACE_METHOD_NAME = "appwidget load-widget ";

    private static final Integer NO_LAYOUT_ID = Integer.valueOf(0);

    private final CheckLongPressHelper mLongPressHelper;
    protected final ActivityContext mActivityContext;

@@ -164,6 +166,21 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
        return false;
    }

    private boolean isTaggedAsScrollable() {
        // TODO: Introduce new api in AppWidgetHostView to indicate whether the widget is
        // scrollable.
        for (int i = 0; i < this.getChildCount(); i++) {
            View child = this.getChildAt(i);
            final Integer layoutId = (Integer) child.getTag(android.R.id.widget_frame);
            if (layoutId != null) {
                // The layout id is only set to 0 when RemoteViews is created from
                // DrawInstructions.
                return NO_LAYOUT_ID.equals(layoutId);
            }
        }
        return false;
    }

    /**
     * Returns true if the application of {@link RemoteViews} through {@link #updateAppWidget} are
     * currently being deferred.
@@ -266,7 +283,7 @@ public class LauncherAppWidgetHostView extends BaseLauncherAppWidgetHostView
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        mIsScrollable = checkScrollableRecursively(this);
        mIsScrollable = isTaggedAsScrollable() || checkScrollableRecursively(this);
    }

    /**