diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
commit | 0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch) | |
tree | 2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java | |
parent | 744d192669a148bde24d36bef02deb05c2f7a1fa (diff) | |
parent | 02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff) | |
download | android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2 android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip |
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31
* tag 'android-10.0.0_r31': (218 commits)
Increase drag distance threshold when drag starts from deep press
Fix shortcut componentname in workspace layout logging
Fix shortcut componentname in workspace layout logging
perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity
Persist predicted items when dragged to workspace
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Align badging logic with platform IconDrawableFactory.
Fix bug where icon remains invisible after returning home.
Fix quick switch from home biased towards returning home
Fix recents scale sometimes lagging behind window scale
Fix folder open/close animation when grid size is small.
fix custom shortcut test
Improve quick switch from home by tracking both x and y motion
Move shelf peeking anim code to ShelfPeekAnim class
Fix folder available height calculation
Tapl: AllApps: ensuring a minimal vertical size of an icon
Enable a11y scrolling with item drag
disable custom shortcut test in oop
include predicted_rank in app launch logging
...
Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java')
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java index 03441c87e..c2cb720ae 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java @@ -35,6 +35,7 @@ import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; +import android.widget.FrameLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Hotseat; @@ -45,11 +46,14 @@ import com.android.launcher3.R; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.appprediction.PredictionUiStateManager.Client; +import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; import com.android.launcher3.views.ScrimView; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.util.ClipAnimationHelper; import com.android.quickstep.util.ClipAnimationHelper.TransformParams; import com.android.quickstep.util.LayoutUtils; +import com.android.systemui.plugins.PluginListener; +import com.android.systemui.plugins.RecentsExtraCard; /** * {@link RecentsView} used in Launcher activity @@ -57,8 +61,29 @@ import com.android.quickstep.util.LayoutUtils; @TargetApi(Build.VERSION_CODES.O) public class LauncherRecentsView extends RecentsView<Launcher> implements StateListener { + private static final Rect sTempRect = new Rect(); + private final TransformParams mTransformParams = new TransformParams(); + private RecentsExtraCard mRecentsExtraCardPlugin; + private RecentsExtraViewContainer mRecentsExtraViewContainer; + private PluginListener<RecentsExtraCard> mRecentsExtraCardPluginListener = + new PluginListener<RecentsExtraCard>() { + @Override + public void onPluginConnected(RecentsExtraCard recentsExtraCard, Context context) { + createRecentsExtraCard(); + mRecentsExtraCardPlugin = recentsExtraCard; + mRecentsExtraCardPlugin.setupView(context, mRecentsExtraViewContainer, mActivity); + } + + @Override + public void onPluginDisconnected(RecentsExtraCard plugin) { + removeView(mRecentsExtraViewContainer); + mRecentsExtraCardPlugin = null; + mRecentsExtraViewContainer = null; + } + }; + public LauncherRecentsView(Context context) { this(context, null); } @@ -144,6 +169,25 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL LayoutUtils.calculateLauncherTaskSize(getContext(), dp, outRect); } + /** + * @return The translationX to apply to this view so that the first task is just offscreen. + */ + public float getOffscreenTranslationX(float recentsScale) { + float offscreenX = NORMAL.getOverviewScaleAndTranslation(mActivity).translationX; + // Offset since scale pushes tasks outwards. + getTaskSize(sTempRect); + int taskWidth = sTempRect.width(); + offscreenX += taskWidth * (recentsScale - 1) / 2; + if (mRunningTaskTileHidden) { + // The first task is hidden, so offset by its width. + offscreenX -= (taskWidth + getPageSpacing()) * recentsScale; + } + if (isRtl()) { + offscreenX = -offscreenX; + } + return offscreenX; + } + @Override protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { @@ -264,4 +308,66 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL } return super.shouldStealTouchFromSiblingsBelow(ev); } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + PluginManagerWrapper.INSTANCE.get(getContext()) + .addPluginListener(mRecentsExtraCardPluginListener, RecentsExtraCard.class); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener( + mRecentsExtraCardPluginListener); + } + + @Override + protected int computeMinScrollX() { + if (canComputeScrollX() && !mIsRtl) { + return computeScrollX(); + } + return super.computeMinScrollX(); + } + + @Override + protected int computeMaxScrollX() { + if (canComputeScrollX() && mIsRtl) { + return computeScrollX(); + } + return super.computeMaxScrollX(); + } + + private boolean canComputeScrollX() { + return mRecentsExtraCardPlugin != null && getTaskViewCount() > 0 + && !mDisallowScrollToClearAll; + } + + private int computeScrollX() { + int scrollIndex = getTaskViewStartIndex() - 1; + while (scrollIndex >= 0 && getChildAt(scrollIndex) instanceof RecentsExtraViewContainer + && ((RecentsExtraViewContainer) getChildAt(scrollIndex)).isScrollable()) { + scrollIndex--; + } + return getScrollForPage(scrollIndex + 1); + } + + private void createRecentsExtraCard() { + mRecentsExtraViewContainer = new RecentsExtraViewContainer(getContext()); + FrameLayout.LayoutParams helpCardParams = + new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.MATCH_PARENT); + mRecentsExtraViewContainer.setLayoutParams(helpCardParams); + mRecentsExtraViewContainer.setScrollable(true); + addView(mRecentsExtraViewContainer, 0); + } + + @Override + public void resetTaskVisuals() { + super.resetTaskVisuals(); + if (mRecentsExtraViewContainer != null) { + mRecentsExtraViewContainer.setAlpha(mContentAlpha); + } + } } |