diff options
author | Becky Qiu <xuqiu@google.com> | 2019-09-03 15:49:56 -0700 |
---|---|---|
committer | Becky Qiu <xuqiu@google.com> | 2019-09-26 18:05:47 +0000 |
commit | d3f6d72ebfa8f3759802d3bb26a86ac6db7b9fa4 (patch) | |
tree | f4a18ce593d5622b4d6278bec5d68f4127d98991 /quickstep | |
parent | 0b72d6a8913012f3f3aab2c28924185accbb6cb4 (diff) | |
download | Launcher3-d3f6d72ebfa8f3759802d3bb26a86ac6db7b9fa4.tar.gz |
Add OverviewScreenshotActions plugin interface and use it in TaskView.
Bug: 139828243
Change-Id: Idbefc11ef32619dd5eaaa5552088859eb2304e1e
Merged-In: Idbefc11ef32619dd5eaaa5552088859eb2304e1e
Diffstat (limited to 'quickstep')
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java index 7f1e8980b9..044292aa67 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java @@ -39,24 +39,28 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Property; import android.view.View; +import android.view.ViewGroup; import com.android.launcher3.BaseActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.util.Themes; import com.android.quickstep.TaskOverlayFactory; import com.android.quickstep.TaskOverlayFactory.TaskOverlay; import com.android.quickstep.util.TaskCornerRadius; +import com.android.systemui.plugins.OverviewScreenshotActions; +import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; /** * A task in the Recents view. */ -public class TaskThumbnailView extends View { +public class TaskThumbnailView extends View implements PluginListener<OverviewScreenshotActions> { private final static ColorMatrix COLOR_MATRIX = new ColorMatrix(); private final static ColorMatrix SATURATION_COLOR_MATRIX = new ColorMatrix(); @@ -100,6 +104,7 @@ public class TaskThumbnailView extends View { private boolean mOverlayEnabled; private boolean mRotated; + private OverviewScreenshotActions mOverviewScreenshotActionsPlugin; public TaskThumbnailView(Context context) { this(context, null); @@ -147,6 +152,11 @@ public class TaskThumbnailView extends View { mPaint.setShader(null); mOverlay.reset(); } + + if (mOverviewScreenshotActionsPlugin != null) { + mOverviewScreenshotActionsPlugin + .setupActions((ViewGroup) getTaskView(), getThumbnail(), mActivity); + } updateThumbnailPaintFilter(); } @@ -211,6 +221,33 @@ public class TaskThumbnailView extends View { canvas.restore(); } + @Override + public void onPluginConnected(OverviewScreenshotActions overviewScreenshotActions, + Context context) { + mOverviewScreenshotActionsPlugin = overviewScreenshotActions; + mOverviewScreenshotActionsPlugin.setupActions(getTaskView(), getThumbnail(), mActivity); + } + + @Override + public void onPluginDisconnected(OverviewScreenshotActions plugin) { + if (mOverviewScreenshotActionsPlugin != null) { + mOverviewScreenshotActionsPlugin = null; + } + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + PluginManagerWrapper.INSTANCE.get(getContext()) + .addPluginListener(this, OverviewScreenshotActions.class); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(this); + } + public RectF getInsetsToDrawInFullscreen(boolean isMultiWindowMode) { // Don't show insets in multi window mode. return isMultiWindowMode ? EMPTY_RECT_F : mClippedInsets; |