mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Two-zone model: swipe up from nav bar vs above it
When ENABLE_OVERVIEW_ACTIONS flag is enabled, swiping up from the nav
bar goes to overview if you hold, or the first home screen if you don't.
- Added NoButtonNavBarToOverviewTouchController, which extends
FlingAndHoldTouchController but only works if you start from the nav
bar. Otherwise it falls back to PortraitStatesTouchController to
handle normal state transition to all apps.
- Added HintState. This is where the workspace/hotseat/qsb scale down
when you swipe up from the nav bar, to hint that you're about to
either go to overview or the first home screen.
- Added getQsbScaleAndTranslation() to allow Overview and Hint states
to treat it as part of the hotseat.
- Since Overview needs to show above the QSB as it's animating, bring
Overview to the front and update OverviewScrim to handle the case
where there's no view above Overview to draw the scrim beneath.
- ENABLE_OVERVIEW_ACTIONS is always false in 2-button mode, since the
shelf is crucial to that mode.
Bug: 143361609
Change-Id: I743481bb239dc77f7024dc98ba68a43534da2637
This commit is contained in:
@@ -36,6 +36,7 @@ import android.view.animation.Interpolator;
|
||||
import com.android.launcher3.LauncherState.PageAlphaProvider;
|
||||
import com.android.launcher3.LauncherState.ScaleAndTranslation;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.allapps.AllAppsContainerView;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.graphics.WorkspaceAndHotseatScrim;
|
||||
@@ -77,6 +78,7 @@ public class WorkspaceStateTransitionAnimation {
|
||||
ScaleAndTranslation scaleAndTranslation = state.getWorkspaceScaleAndTranslation(mLauncher);
|
||||
ScaleAndTranslation hotseatScaleAndTranslation = state.getHotseatScaleAndTranslation(
|
||||
mLauncher);
|
||||
ScaleAndTranslation qsbScaleAndTranslation = state.getQsbScaleAndTranslation(mLauncher);
|
||||
mNewScale = scaleAndTranslation.scale;
|
||||
PageAlphaProvider pageAlphaProvider = state.getWorkspacePageAlphaProvider(mLauncher);
|
||||
final int childCount = mWorkspace.getChildCount();
|
||||
@@ -90,24 +92,24 @@ public class WorkspaceStateTransitionAnimation {
|
||||
pageAlphaProvider.interpolator);
|
||||
boolean playAtomicComponent = config.playAtomicOverviewScaleComponent();
|
||||
Hotseat hotseat = mWorkspace.getHotseat();
|
||||
// Since we set the pivot relative to mWorkspace, we need to scale a sibling of Workspace.
|
||||
AllAppsContainerView qsbScaleView = mLauncher.getAppsView();
|
||||
View qsbView = qsbScaleView.getSearchView();
|
||||
if (playAtomicComponent) {
|
||||
Interpolator scaleInterpolator = builder.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
|
||||
propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
|
||||
|
||||
if (!hotseat.getRotationMode().isTransposed) {
|
||||
// Set the hotseat's pivot point to match the workspace's, so that it scales
|
||||
// together. Since both hotseat and workspace can move, transform the point
|
||||
// manually instead of using dragLayer.getDescendantCoordRelativeToSelf and
|
||||
// related methods.
|
||||
hotseat.setPivotY(mWorkspace.getPivotY() + mWorkspace.getTop() - hotseat.getTop());
|
||||
hotseat.setPivotX(mWorkspace.getPivotX()
|
||||
+ mWorkspace.getLeft() - hotseat.getLeft());
|
||||
setPivotToScaleWithWorkspace(hotseat);
|
||||
setPivotToScaleWithWorkspace(qsbScaleView);
|
||||
}
|
||||
float hotseatScale = hotseatScaleAndTranslation.scale;
|
||||
Interpolator hotseatScaleInterpolator = builder.getInterpolator(ANIM_HOTSEAT_SCALE,
|
||||
scaleInterpolator);
|
||||
propertySetter.setFloat(hotseat, SCALE_PROPERTY, hotseatScale,
|
||||
hotseatScaleInterpolator);
|
||||
propertySetter.setFloat(qsbScaleView, SCALE_PROPERTY, qsbScaleAndTranslation.scale,
|
||||
hotseatScaleInterpolator);
|
||||
|
||||
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
|
||||
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, fadeInterpolator);
|
||||
@@ -134,10 +136,24 @@ public class WorkspaceStateTransitionAnimation {
|
||||
hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
|
||||
propertySetter.setFloat(mWorkspace.getPageIndicator(), View.TRANSLATION_Y,
|
||||
hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
|
||||
propertySetter.setFloat(qsbView, View.TRANSLATION_Y,
|
||||
qsbScaleAndTranslation.translationY, hotseatTranslationInterpolator);
|
||||
|
||||
setScrim(propertySetter, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the given view's pivot point to match the workspace's, so that it scales together. Since
|
||||
* both this view and workspace can move, transform the point manually instead of using
|
||||
* dragLayer.getDescendantCoordRelativeToSelf and related methods.
|
||||
*/
|
||||
private void setPivotToScaleWithWorkspace(View sibling) {
|
||||
sibling.setPivotY(mWorkspace.getPivotY() + mWorkspace.getTop()
|
||||
- sibling.getTop() - sibling.getTranslationY());
|
||||
sibling.setPivotX(mWorkspace.getPivotX() + mWorkspace.getLeft()
|
||||
- sibling.getLeft() - sibling.getTranslationX());
|
||||
}
|
||||
|
||||
public void setScrim(PropertySetter propertySetter, LauncherState state) {
|
||||
WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
|
||||
propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher),
|
||||
|
||||
Reference in New Issue
Block a user