Snap for 8572535 from 2c3de6efe0 to tm-release

Change-Id: I33f20d862c688a26c301d024b04c18a21e363903
This commit is contained in:
Android Build Coastguard Worker
2022-05-11 23:09:02 +00:00
22 changed files with 132 additions and 42 deletions
@@ -58,17 +58,21 @@ public class AllAppsState extends LauncherState {
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
ScaleAndTranslation scaleAndTranslation =
new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
return new ScaleAndTranslation(0.97f, NO_OFFSET, NO_OFFSET);
}
@Override
public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
if (launcher.getDeviceProfile().isTablet) {
scaleAndTranslation.scale = 0.97f;
return getWorkspaceScaleAndTranslation(launcher);
} else {
ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW
.getWorkspaceScaleAndTranslation(launcher);
scaleAndTranslation.translationX = overviewScaleAndTranslation.translationX;
scaleAndTranslation.translationY = overviewScaleAndTranslation.translationY;
return new ScaleAndTranslation(
NO_SCALE,
overviewScaleAndTranslation.translationX,
overviewScaleAndTranslation.translationY);
}
return scaleAndTranslation;
}
@Override
@@ -192,7 +192,10 @@ public class QuickstepAtomicAnimationFactory extends
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE);
} else if (fromState == NORMAL && toState == ALL_APPS) {
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE);
if (mActivity.getDeviceProfile().isTablet) {
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE);
}
// TODO(b/231682175): centralize this setup in AllAppsSwipeController
}
}
}
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent2_50"
android:color="@android:color/system_accent2_500"
android:lStar="98" />
</selector>
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_neutral2_50"
android:color="@android:color/system_neutral2_500"
android:lStar="35" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_neutral2_50"
android:color="@android:color/system_neutral2_500"
android:lStar="30" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_neutral1_50"
android:color="@android:color/system_neutral1_500"
android:lStar="98" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent1_50"
android:color="@android:color/system_accent1_500"
android:lStar="40" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent2_50"
android:color="@android:color/system_accent2_500"
android:lStar="48" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent1_50"
android:color="@android:color/system_accent1_500"
android:lStar="35" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent3_50"
android:color="@android:color/system_accent3_500"
android:lStar="48" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_neutral1_50"
android:color="@android:color/system_neutral1_500"
android:lStar="98" />
</selector>
+1 -1
View File
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:color="@android:color/system_accent2_50"
android:color="@android:color/system_accent2_500"
android:lStar="80" />
</selector>
+1 -1
View File
@@ -100,7 +100,7 @@
<dimen name="fastscroll_end_margin">-26dp</dimen>
<!-- All Apps -->
<dimen name="all_apps_starting_vertical_translate">320dp</dimen>
<dimen name="all_apps_starting_vertical_translate">300dp</dimen>
<dimen name="all_apps_search_bar_field_height">48dp</dimen>
<!-- all_apps_search_bar_field_height / 2 -->
<dimen name="all_apps_search_bar_content_overlap">24dp</dimen>
+17 -4
View File
@@ -65,6 +65,7 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.folder.PreviewBackground;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.util.CellAndSpan;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.ParcelableSparseArray;
@@ -290,7 +291,7 @@ public class CellLayout extends ViewGroup {
for (int i = 0; i < mDragOutlineAnims.length; i++) {
final InterruptibleInOutAnimator anim =
new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue);
new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue);
anim.getAnimator().setInterpolator(mEaseOutInterpolator);
final int thisIndex = i;
anim.getAnimator().addUpdateListener(new AnimatorUpdateListener() {
@@ -2440,7 +2441,7 @@ public class CellLayout extends ViewGroup {
// First we determine if things have moved enough to cause a different layout
ItemConfiguration swapSolution = findReorderSolution(pixelXY[0], pixelXY[1], spanX, spanY,
spanX, spanY, direction, dragView, true, new ItemConfiguration());
spanX, spanY, direction, dragView, true, new ItemConfiguration());
setUseTempCoords(true);
if (swapSolution != null && swapSolution.isSolution) {
@@ -2477,7 +2478,7 @@ public class CellLayout extends ViewGroup {
// direction vector, since we want the solution to match the preview, and it's possible
// that the exact position of the item has changed to result in a new reordering outcome.
if ((mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL || mode == MODE_ACCEPT_DROP)
&& mPreviousReorderDirection[0] != INVALID_DIRECTION) {
&& mPreviousReorderDirection[0] != INVALID_DIRECTION) {
mDirectionVector[0] = mPreviousReorderDirection[0];
mDirectionVector[1] = mPreviousReorderDirection[1];
// We reset this vector after drop
@@ -2493,7 +2494,7 @@ public class CellLayout extends ViewGroup {
// Find a solution involving pushing / displacing any items in the way
ItemConfiguration swapSolution = findReorderSolution(pixelX, pixelY, minSpanX, minSpanY,
spanX, spanY, mDirectionVector, dragView, true, new ItemConfiguration());
spanX, spanY, mDirectionVector, dragView, true, new ItemConfiguration());
// We attempt the approach which doesn't shuffle views at all
ItemConfiguration noShuffleSolution = findConfigurationNoShuffle(pixelX, pixelY, minSpanX,
@@ -2733,12 +2734,24 @@ public class CellLayout extends ViewGroup {
}
public void markCellsAsOccupiedForView(View view) {
if (view instanceof LauncherAppWidgetHostView
&& view.getTag() instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
mOccupied.markCells(info.cellX, info.cellY, info.spanX, info.spanY, true);
return;
}
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
LayoutParams lp = (LayoutParams) view.getLayoutParams();
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, true);
}
public void markCellsAsUnoccupiedForView(View view) {
if (view instanceof LauncherAppWidgetHostView
&& view.getTag() instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) view.getTag();
mOccupied.markCells(info.cellX, info.cellY, info.spanX, info.spanY, false);
return;
}
if (view == null || view.getParent() != mShortcutsAndWidgets) return;
LayoutParams lp = (LayoutParams) view.getLayoutParams();
mOccupied.markCells(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan, false);
@@ -36,6 +36,7 @@ import static com.android.launcher3.anim.Interpolators.ZOOM_OUT;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
@@ -117,8 +118,6 @@ public class WorkspaceStateTransitionAnimation {
}
int elements = state.getVisibleElements(mLauncher);
Interpolator fadeInterpolator = config.getInterpolator(ANIM_WORKSPACE_FADE,
pageAlphaProvider.interpolator);
Hotseat hotseat = mWorkspace.getHotseat();
Interpolator scaleInterpolator = config.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
LauncherState fromState = mLauncher.getStateManager().getState();
@@ -146,11 +145,15 @@ public class WorkspaceStateTransitionAnimation {
hotseatScaleInterpolator);
}
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, fadeInterpolator);
Interpolator workspaceFadeInterpolator = config.getInterpolator(ANIM_WORKSPACE_FADE,
pageAlphaProvider.interpolator);
float workspacePageIndicatorAlpha = (elements & WORKSPACE_PAGE_INDICATOR) != 0 ? 1 : 0;
propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(),
workspacePageIndicatorAlpha, fadeInterpolator);
workspacePageIndicatorAlpha, workspaceFadeInterpolator);
Interpolator hotseatFadeInterpolator = config.getInterpolator(ANIM_HOTSEAT_FADE,
workspaceFadeInterpolator);
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, hotseatFadeInterpolator);
// Update the accessibility flags for hotseat based on launcher state.
hotseat.setImportantForAccessibility(
@@ -228,6 +228,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
requestFocus();
mgr.logger().sendToInteractionJankMonitor(
LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this);
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
getApplicationWindowToken());
break;
case SCROLL_STATE_IDLE:
mgr.logger().sendToInteractionJankMonitor(
@@ -243,8 +245,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
&& mEmptySearchBackground != null && mEmptySearchBackground.getAlpha() > 0) {
mEmptySearchBackground.setHotspot(e.getX(), e.getY());
}
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
getApplicationWindowToken());
return result;
}
@@ -17,6 +17,7 @@ package com.android.launcher3.allapps;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
import static com.android.launcher3.util.UiThreadHelper.hideKeyboardAsync;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -458,6 +459,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
mActivityContext.getStatsLogManager().logger()
.log(LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB);
}
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
getApplicationWindowToken());
});
findViewById(R.id.tab_work)
.setOnClickListener((View view) -> {
@@ -465,6 +468,8 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
mActivityContext.getStatsLogManager().logger()
.log(LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB);
}
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
getApplicationWindowToken());
});
setDeviceManagementResources();
onActivePageChanged(mViewPager.getNextPage());
@@ -57,6 +57,11 @@ public class Interpolators {
public static final Interpolator DECELERATED_EASE = new PathInterpolator(0, 0, .2f, 1f);
public static final Interpolator ACCELERATED_EASE = new PathInterpolator(0.4f, 0, 1f, 1f);
public static final Interpolator EMPHASIZED_ACCELERATE = new PathInterpolator(
0.3f, 0f, 0.8f, 0.15f);
public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator(
0.05f, 0.7f, 0.1f, 1f);
public static final Interpolator EXAGGERATED_EASE;
public static final Interpolator INSTANT = t -> 1;
@@ -53,6 +53,7 @@ public class StateAnimationConfig {
ANIM_WORKSPACE_FADE,
ANIM_HOTSEAT_SCALE,
ANIM_HOTSEAT_TRANSLATE,
ANIM_HOTSEAT_FADE,
ANIM_OVERVIEW_SCALE,
ANIM_OVERVIEW_TRANSLATE_X,
ANIM_OVERVIEW_TRANSLATE_Y,
@@ -72,6 +73,7 @@ public class StateAnimationConfig {
public static final int ANIM_WORKSPACE_FADE = 3;
public static final int ANIM_HOTSEAT_SCALE = 4;
public static final int ANIM_HOTSEAT_TRANSLATE = 5;
public static final int ANIM_HOTSEAT_FADE = 16;
public static final int ANIM_OVERVIEW_SCALE = 6;
public static final int ANIM_OVERVIEW_TRANSLATE_X = 7;
public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8;
@@ -83,7 +85,7 @@ public class StateAnimationConfig {
public static final int ANIM_OVERVIEW_ACTIONS_FADE = 14;
public static final int ANIM_WORKSPACE_PAGE_TRANSLATE_X = 15;
private static final int ANIM_TYPES_COUNT = 16;
private static final int ANIM_TYPES_COUNT = 17;
protected final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];
@@ -17,11 +17,19 @@ package com.android.launcher3.touch;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.Interpolators.DECELERATED_EASE;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED_ACCELERATE;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED_DECELERATE;
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import android.view.MotionEvent;
import android.view.animation.Interpolator;
@@ -39,11 +47,41 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
private static final float ALLAPPS_STAGGERED_FADE_THRESHOLD = 0.5f;
// Custom timing for NORMAL -> ALL_APPS on phones only.
private static final float WORKSPACE_MOTION_START = 0.1667f;
private static final float ALL_APPS_STATE_TRANSITION = 0.305f;
private static final float ALL_APPS_FADE_END = 0.4717f;
public static final Interpolator ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER =
Interpolators.clampToProgress(LINEAR, 0, ALLAPPS_STAGGERED_FADE_THRESHOLD);
public static final Interpolator ALLAPPS_STAGGERED_FADE_LATE_RESPONDER =
Interpolators.clampToProgress(LINEAR, ALLAPPS_STAGGERED_FADE_THRESHOLD, 1f);
// Custom interpolators for NORMAL -> ALL_APPS on phones only.
public static final Interpolator BLUR =
Interpolators.clampToProgress(
EMPHASIZED_DECELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
public static final Interpolator WORKSPACE_SCALE =
Interpolators.clampToProgress(
EMPHASIZED_DECELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
public static final Interpolator HOTSEAT_FADE =
Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION);
public static final Interpolator HOTSEAT_TRANSLATE =
Interpolators.clampToProgress(
EMPHASIZED_ACCELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
public static final Interpolator SCRIM_FADE =
Interpolators.clampToProgress(
Interpolators.mapToProgress(LINEAR, 0f, 0.8f),
WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
public static final Interpolator ALL_APPS_FADE =
Interpolators.clampToProgress(
Interpolators.mapToProgress(DECELERATED_EASE, 0.2f, 1.0f),
ALL_APPS_STATE_TRANSITION, ALL_APPS_FADE_END);
public static final Interpolator ALL_APPS_VERTICAL_PROGRESS =
Interpolators.clampToProgress(
Interpolators.mapToProgress(EMPHASIZED_DECELERATE, 0.4f, 1.0f),
ALL_APPS_STATE_TRANSITION, 1.0f);
public AllAppsSwipeController(Launcher l) {
super(l, SingleAxisSwipeDetector.VERTICAL);
}
@@ -118,11 +156,17 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
*/
public static void applyNormalToAllAppsAnimConfig(Launcher launcher,
StateAnimationConfig config) {
boolean isTablet = launcher.getDeviceProfile().isTablet;
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
? INSTANT : ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
if (launcher.getDeviceProfile().isTablet) {
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT);
} else {
config.setInterpolator(ANIM_DEPTH, BLUR);
config.setInterpolator(ANIM_WORKSPACE_SCALE, WORKSPACE_SCALE);
config.setInterpolator(ANIM_HOTSEAT_FADE, HOTSEAT_FADE);
config.setInterpolator(ANIM_HOTSEAT_TRANSLATE, HOTSEAT_TRANSLATE);
config.setInterpolator(ANIM_SCRIM_FADE, SCRIM_FADE);
config.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_FADE);
config.setInterpolator(ANIM_VERTICAL_PROGRESS, ALL_APPS_VERTICAL_PROGRESS);
}
}
}
@@ -20,6 +20,8 @@ import static android.view.HapticFeedbackConstants.CLOCK_TICK;
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
import static com.android.launcher3.util.UiThreadHelper.hideKeyboardAsync;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
@@ -283,6 +285,9 @@ public class RecyclerViewFastScroller extends View {
}
break;
case MotionEvent.ACTION_UP:
hideKeyboardAsync(ActivityContext.lookupContext(getContext()),
getApplicationWindowToken());
break;
case MotionEvent.ACTION_CANCEL:
mRv.onFastScrollCompleted();
mTouchOffsetY = 0;
@@ -59,15 +59,21 @@ public class AllAppsState extends LauncherState {
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
ScaleAndTranslation scaleAndTranslation =
new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
return new ScaleAndTranslation(0.97f, NO_OFFSET, NO_OFFSET);
}
@Override
public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
if (launcher.getDeviceProfile().isTablet) {
scaleAndTranslation.scale = 0.97f;
return getWorkspaceScaleAndTranslation(launcher);
} else {
scaleAndTranslation.translationY =
-launcher.getAllAppsController().getShiftRange() * PARALLAX_COEFFICIENT;
ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW
.getWorkspaceScaleAndTranslation(launcher);
return new ScaleAndTranslation(
NO_SCALE,
overviewScaleAndTranslation.translationX,
overviewScaleAndTranslation.translationY);
}
return scaleAndTranslation;
}
@Override