Tune AllApps bottom sheet VisD and motion
- Make AllApps bottom sheet solid and appears from bottom
- Teleport AllApps bottom sheet as user drag to reduce drag range
- Consider teleport interpolation for state transition sdetection
- Tuned workspace motions for AllApps bottom sheet (no translate, shrink)
- Add portrait vertical translate for tablet portrait including taskbar AllApps
- Updated bottom sheet handle and created common variables for other bottom sheets
Bug: 208599118
Test: manual on tablet AllApps, taskbar Allapps and handheld AllApps
Change-Id: I69dba5f155914cd012cc8ef3be1ef71fb2be5a40
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
index 7accfbb..02aa3f2 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
@@ -23,6 +23,7 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.views.AbstractSlideInView;
@@ -30,14 +31,14 @@
import java.util.Optional;
/** Wrapper for taskbar all apps with slide-in behavior. */
-public class TaskbarAllAppsSlideInView extends
- AbstractSlideInView<TaskbarAllAppsContext> implements Insettable {
-
+public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllAppsContext>
+ implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
static final int DEFAULT_OPEN_DURATION = 500;
static final int DEFAULT_CLOSE_DURATION = 200;
private TaskbarAllAppsContainerView mAppsView;
private OnCloseListener mOnCloseBeginListener;
+ private float mShiftRange;
public TaskbarAllAppsSlideInView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -88,6 +89,11 @@
super.onFinishInflate();
mAppsView = findViewById(R.id.apps_view);
mContent = mAppsView;
+
+ DeviceProfile dp = mActivityContext.getDeviceProfile();
+ setShiftRange(dp.allAppsShiftRange);
+
+ mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
@@ -113,4 +119,24 @@
public void setInsets(Rect insets) {
mAppsView.setInsets(insets);
}
+
+ @Override
+ public void onDeviceProfileChanged(DeviceProfile dp) {
+ setShiftRange(dp.allAppsShiftRange);
+ setTranslationShift(TRANSLATION_SHIFT_OPENED);
+ }
+
+ private void setShiftRange(float shiftRange) {
+ mShiftRange = shiftRange;
+ }
+
+ @Override
+ protected float getShiftRange() {
+ return mShiftRange;
+ }
+
+ @Override
+ protected boolean isEventOverContent(MotionEvent ev) {
+ return getPopupContainer().isEventOverView(mAppsView.getVisibleContainerView(), ev);
+ }
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 26d8f30..fec591b 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -53,9 +53,16 @@
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
- ScaleAndTranslation scaleAndTranslation = LauncherState.OVERVIEW
- .getWorkspaceScaleAndTranslation(launcher);
- scaleAndTranslation.scale = 1;
+ ScaleAndTranslation scaleAndTranslation =
+ new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
+ if (launcher.getDeviceProfile().isTablet) {
+ scaleAndTranslation.scale = 0.97f;
+ } else {
+ ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW
+ .getWorkspaceScaleAndTranslation(launcher);
+ scaleAndTranslation.translationX = overviewScaleAndTranslation.translationX;
+ scaleAndTranslation.translationY = overviewScaleAndTranslation.translationY;
+ }
return scaleAndTranslation;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
index 099915a..f93917f 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
@@ -23,8 +23,13 @@
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
+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.anim.Interpolators.LINEAR_TELEPORT;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
import android.view.MotionEvent;
@@ -126,23 +131,31 @@
private StateAnimationConfig getNormalToAllAppsAnimation() {
StateAnimationConfig builder = new StateAnimationConfig();
- builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL,
- ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
- ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
+ boolean isTablet = mLauncher.getDeviceProfile().isTablet;
+ builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
+ ? INSTANT
+ : Interpolators.clampToProgress(ACCEL,
+ ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
+ ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL,
ALL_APPS_SCRIM_VISIBLE_THRESHOLD,
ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
+ builder.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR);
return builder;
}
private StateAnimationConfig getAllAppsToNormalAnimation() {
StateAnimationConfig builder = new StateAnimationConfig();
- builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
- 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
- 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
+ boolean isTablet = mLauncher.getDeviceProfile().isTablet;
+ builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
+ ? FINAL_FRAME
+ : Interpolators.clampToProgress(DEACCEL,
+ 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
+ 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
+ builder.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR);
return builder;
}
diff --git a/res/drawable/bg_all_apps_bottom_sheet.xml b/res/drawable/bg_all_apps_bottom_sheet.xml
deleted file mode 100644
index dba2fee..0000000
--- a/res/drawable/bg_all_apps_bottom_sheet.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2022 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<ripple android:color="?android:attr/colorControlHighlight"
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item>
- <shape android:shape="rectangle"
- android:tint="?colorButtonNormal">
- <corners
- android:topLeftRadius="@dimen/dialogCornerRadius"
- android:topRightRadius="@dimen/dialogCornerRadius"/>
- <solid android:color="?attr/allAppsScrimColor" />
- </shape>
- </item>
-</ripple>
\ No newline at end of file
diff --git a/res/drawable/bg_rounded_corner_bottom_sheet.xml b/res/drawable/bg_rounded_corner_bottom_sheet.xml
index aa49bce..dfcd354 100644
--- a/res/drawable/bg_rounded_corner_bottom_sheet.xml
+++ b/res/drawable/bg_rounded_corner_bottom_sheet.xml
@@ -16,7 +16,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
- <solid android:color="@color/surface" />
+ <solid android:color="?android:attr/colorBackground" />
<corners
android:topLeftRadius="@dimen/dialogCornerRadius"
android:topRightRadius="@dimen/dialogCornerRadius" />
diff --git a/res/drawable/bg_rounded_corner_bottom_sheet_handle.xml b/res/drawable/bg_rounded_corner_bottom_sheet_handle.xml
new file mode 100644
index 0000000..c502178
--- /dev/null
+++ b/res/drawable/bg_rounded_corner_bottom_sheet_handle.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle" >
+ <solid android:color="?androidprv:attr/colorSurfaceVariant"/>
+ <corners android:radius="@dimen/bottom_sheet_handle_corner_radius" />
+</shape>
diff --git a/res/layout/all_apps_bottom_sheet_background.xml b/res/layout/all_apps_bottom_sheet_background.xml
index ad10d68..12b6b7b 100644
--- a/res/layout/all_apps_bottom_sheet_background.xml
+++ b/res/layout/all_apps_bottom_sheet_background.xml
@@ -17,19 +17,19 @@
android:id="@+id/bottom_sheet_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/bg_all_apps_bottom_sheet">
+ android:background="@drawable/bg_rounded_corner_bottom_sheet">
<View
android:id="@+id/bottom_sheet_handle_area"
android:layout_width="match_parent"
- android:layout_height="34dp" />
+ android:layout_height="36dp" />
<View
android:id="@+id/bottom_sheet_handle"
- android:layout_width="48dp"
- android:layout_height="2dp"
+ android:layout_width="@dimen/bottom_sheet_handle_width"
+ android:layout_height="@dimen/bottom_sheet_handle_height"
android:layout_gravity="center_horizontal"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
- android:background="?android:attr/textColorSecondary" />
+ android:layout_marginTop="@dimen/bottom_sheet_handle_margin"
+ android:layout_marginBottom="@dimen/bottom_sheet_handle_margin"
+ android:background="@drawable/bg_rounded_corner_bottom_sheet_handle" />
</FrameLayout>
diff --git a/res/layout/widgets_bottom_sheet_content.xml b/res/layout/widgets_bottom_sheet_content.xml
index 1a2cfc6..a5f72ef 100644
--- a/res/layout/widgets_bottom_sheet_content.xml
+++ b/res/layout/widgets_bottom_sheet_content.xml
@@ -19,16 +19,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_rounded_corner_bottom_sheet"
- android:paddingTop="16dp"
+ android:paddingTop="@dimen/bottom_sheet_handle_margin"
android:orientation="vertical">
<View
android:id="@+id/collapse_handle"
- android:layout_width="48dp"
- android:layout_height="2dp"
+ android:layout_width="@dimen/bottom_sheet_handle_width"
+ android:layout_height="@dimen/bottom_sheet_handle_height"
android:layout_gravity="center_horizontal"
- android:layout_marginBottom="16dp"
+ android:layout_marginBottom="@dimen/bottom_sheet_handle_margin"
android:visibility="gone"
- android:background="?android:attr/textColorSecondary"/>
+ android:background="@drawable/bg_rounded_corner_bottom_sheet_handle"/>
<TextView
style="@style/TextHeadline"
android:id="@+id/title"
diff --git a/res/layout/widgets_full_sheet.xml b/res/layout/widgets_full_sheet.xml
index 309dc42..505ecb1 100644
--- a/res/layout/widgets_full_sheet.xml
+++ b/res/layout/widgets_full_sheet.xml
@@ -31,11 +31,11 @@
<View
android:id="@+id/collapse_handle"
- android:layout_width="48dp"
- android:layout_height="2dp"
- android:layout_marginTop="16dp"
+ android:layout_width="@dimen/bottom_sheet_handle_width"
+ android:layout_height="@dimen/bottom_sheet_handle_height"
+ android:layout_marginTop="@dimen/bottom_sheet_handle_margin"
android:layout_centerHorizontal="true"
- android:background="?android:attr/textColorSecondary"/>
+ android:background="@drawable/bg_rounded_corner_bottom_sheet_handle"/>
<TextView
android:id="@+id/no_widgets_text"
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 3dde3f6..92f806e 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -22,7 +22,8 @@
<dimen name="widget_list_horizontal_margin">32dp</dimen>
<!-- AllApps -->
- <dimen name="all_apps_bottom_sheet_horizontal_padding">32dp</dimen>
+ <dimen name="all_apps_search_bar_content_overlap">0dp</dimen>
+ <dimen name="all_apps_bottom_sheet_horizontal_padding">46dp</dimen>
<!-- Fast scroll -->
<dimen name="fastscroll_popup_width">75dp</dimen>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..a9e0fb8
--- /dev/null
+++ b/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at`
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+<!-- AllApps -->
+ <dimen name="all_apps_top_padding">0dp</dimen>
+</resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 9d7941f..5c314d5 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -16,5 +16,6 @@
<resources>
<!-- AllApps -->
- <dimen name="all_apps_bottom_sheet_horizontal_padding">41dp</dimen>
+ <dimen name="all_apps_top_padding">300dp</dimen>
+ <dimen name="all_apps_bottom_sheet_horizontal_padding">65dp</dimen>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ddc7d10..3e666fc 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -93,8 +93,11 @@
<dimen name="fastscroll_end_margin">-26dp</dimen>
<!-- All Apps -->
- <dimen name="all_apps_open_vertical_translate">320dp</dimen>
+ <dimen name="all_apps_starting_vertical_translate">320dp</dimen>
+ <dimen name="all_apps_top_padding">0dp</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>
<dimen name="all_apps_search_bar_bottom_padding">30dp</dimen>
<dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
<dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen>
@@ -363,4 +366,9 @@
<dimen name="search_row_small_icon_size">32dp</dimen>
<dimen name="padded_rounded_button_padding">8dp</dimen>
+<!-- Bottom sheet related parameters -->
+ <dimen name="bottom_sheet_handle_width">32dp</dimen>
+ <dimen name="bottom_sheet_handle_height">4dp</dimen>
+ <dimen name="bottom_sheet_handle_margin">16dp</dimen>
+ <dimen name="bottom_sheet_handle_corner_radius">2dp</dimen>
</resources>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 62703ad..7189ef7 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -171,7 +171,8 @@
// All apps
public Point allAppsBorderSpacePx;
- public int allAppsOpenVerticalTranslate;
+ public int allAppsShiftRange;
+ public int allAppsTopPadding;
public int allAppsCellHeightPx;
public int allAppsCellWidthPx;
public int allAppsIconSizePx;
@@ -288,8 +289,11 @@
desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res);
desiredWorkspaceHorizontalMarginOriginalPx = desiredWorkspaceHorizontalMarginPx;
- allAppsOpenVerticalTranslate = res.getDimensionPixelSize(
- R.dimen.all_apps_open_vertical_translate);
+ allAppsTopPadding = res.getDimensionPixelSize(R.dimen.all_apps_top_padding)
+ + (isTablet ? heightPx - availableHeightPx : 0);
+ allAppsShiftRange = isTablet
+ ? heightPx - allAppsTopPadding
+ : res.getDimensionPixelSize(R.dimen.all_apps_starting_vertical_translate);
folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale);
folderContentPaddingLeftRight =
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index b6a2459..cdc313f 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -89,15 +89,15 @@
private float mShiftRange; // changes depending on the orientation
private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent
- private float mScrollRangeDelta = 0;
private ScrimView mScrimView;
public AllAppsTransitionController(Launcher l) {
mLauncher = l;
- mShiftRange = mLauncher.getDeviceProfile().heightPx;
+ DeviceProfile dp = mLauncher.getDeviceProfile();
+ setShiftRange(dp.allAppsShiftRange);
mProgress = 1f;
- mIsVerticalLayout = mLauncher.getDeviceProfile().isVerticalBarLayout();
+ mIsVerticalLayout = dp.isVerticalBarLayout();
mLauncher.addOnDeviceProfileChangeListener(this);
}
@@ -108,7 +108,7 @@
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
mIsVerticalLayout = dp.isVerticalBarLayout();
- setScrollRangeDelta(mScrollRangeDelta);
+ setShiftRange(dp.allAppsShiftRange);
if (mIsVerticalLayout) {
mLauncher.getHotseat().setTranslationY(0);
@@ -160,12 +160,14 @@
}
// need to decide depending on the release velocity
- Interpolator interpolator = (config.userControlled ? LINEAR : DEACCEL_1_7);
-
+ Interpolator verticalProgressInterpolator = config.getInterpolator(ANIM_VERTICAL_PROGRESS,
+ config.userControlled ? LINEAR : DEACCEL_1_7);
Animator anim = createSpringAnimation(mProgress, targetProgress);
- anim.setInterpolator(config.getInterpolator(ANIM_VERTICAL_PROGRESS, interpolator));
+ anim.setInterpolator(verticalProgressInterpolator);
anim.addListener(getProgressAnimatorListener());
builder.add(anim);
+ // Use ANIM_VERTICAL_PROGRESS's interpolator to determine state transition threshold.
+ builder.setInterpolator(verticalProgressInterpolator);
setAlphas(toState, config, builder);
@@ -215,9 +217,8 @@
/**
* Updates the total scroll range but does not update the UI.
*/
- public void setScrollRangeDelta(float delta) {
- mScrollRangeDelta = delta;
- mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta;
+ public void setShiftRange(float shiftRange) {
+ mShiftRange = shiftRange;
}
/**
diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
index 59e21c0..bfc7515 100644
--- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java
@@ -408,7 +408,7 @@
if (grid.isVerticalBarLayout()) {
setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0);
} else {
- setPadding(0, grid.isTablet ? insets.top : 0, 0, 0);
+ setPadding(0, grid.allAppsTopPadding, 0, 0);
}
InsettableFrameLayout.dispatchInsets(this, insets);
@@ -765,4 +765,11 @@
&& mVerticalFadingEdge);
}
}
+
+ /**
+ * Returns a view that denotes the visible part of all apps container view.
+ */
+ public View getVisibleContainerView() {
+ return mActivityContext.getDeviceProfile().isTablet ? mBottomSheetBackground : this;
+ }
}
diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
index 30d33f9..8601819 100644
--- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
@@ -16,7 +16,6 @@
package com.android.launcher3.allapps;
import android.content.Context;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -59,12 +58,4 @@
}
return super.onTouchEvent(ev);
}
-
- @Override
- public void setInsets(Rect insets) {
- super.setInsets(insets);
- int allAppsStartingPositionY = mActivityContext.getDeviceProfile().availableHeightPx
- - mActivityContext.getDeviceProfile().allAppsOpenVerticalTranslate;
- mActivityContext.getAllAppsController().setScrollRangeDelta(allAppsStartingPositionY);
- }
}
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index ffc049b..4a886a4 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -82,7 +82,7 @@
setHint(prefixTextWithIcon(getContext(), R.drawable.ic_allapps_search, getHint()));
mContentOverlap =
- getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_field_height) / 2;
+ getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_content_overlap);
}
@Override
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index 1e7b224..9c12abd 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -130,6 +130,23 @@
}
};
+ public static final Interpolator LINEAR_TELEPORT = t -> {
+ float startTeleport = 0.2f;
+ float endTeleport = 0.4f;
+ float teleportProgress = 0.5f;
+ float v;
+ if (t < startTeleport) {
+ v = LINEAR.getInterpolation(t);
+ } else if (t < endTeleport) {
+ v = Utilities.mapToRange(t, startTeleport, endTeleport, startTeleport,
+ endTeleport + teleportProgress, ACCEL_DEACCEL);
+ } else {
+ v = LINEAR.getInterpolation(t) + teleportProgress;
+ }
+ v = Utilities.boundToRange(v, 0f, 1f);
+ return v;
+ };
+
private static final float FAST_FLING_PX_MS = 10;
public static Interpolator scrollInterpolatorForVelocity(float velocity) {
diff --git a/src/com/android/launcher3/anim/PendingAnimation.java b/src/com/android/launcher3/anim/PendingAnimation.java
index 3ab893b..1300ce7 100644
--- a/src/com/android/launcher3/anim/PendingAnimation.java
+++ b/src/com/android/launcher3/anim/PendingAnimation.java
@@ -77,6 +77,13 @@
addAnimationHoldersRecur(a, mDuration, springProperty, mAnimHolders);
}
+ /**
+ * Configures interpolator of the underlying AnimatorSet.
+ */
+ public void setInterpolator(TimeInterpolator interpolator) {
+ mAnim.setInterpolator(interpolator);
+ }
+
@Override
public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) {
if (view == null || view.getAlpha() == alpha) {
diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java
index 989a9e4..f7d3492 100644
--- a/src/com/android/launcher3/touch/AllAppsSwipeController.java
+++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java
@@ -17,9 +17,13 @@
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
+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.anim.Interpolators.LINEAR_TELEPORT;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
import android.view.MotionEvent;
import android.view.animation.Interpolator;
@@ -94,9 +98,9 @@
LauncherState toState) {
StateAnimationConfig config = super.getConfigForStates(fromState, toState);
if (fromState == NORMAL && toState == ALL_APPS) {
- applyNormalToAllAppsAnimConfig(config);
+ applyNormalToAllAppsAnimConfig(mLauncher, config);
} else if (fromState == ALL_APPS && toState == NORMAL) {
- applyAllAppsToNormalConfig(config);
+ applyAllAppsToNormalConfig(mLauncher, config);
}
return config;
}
@@ -104,17 +108,24 @@
/**
* Applies Animation config values for transition from all apps to home
*/
- public static void applyAllAppsToNormalConfig(StateAnimationConfig config) {
+ public static void applyAllAppsToNormalConfig(Launcher launcher, StateAnimationConfig config) {
+ boolean isTablet = launcher.getDeviceProfile().isTablet;
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
- config.setInterpolator(ANIM_ALL_APPS_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
+ config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
+ ? FINAL_FRAME : ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
+ config.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR);
}
/**
* Applies Animation config values for transition from home to all apps
*/
- public static void applyNormalToAllAppsAnimConfig(StateAnimationConfig config) {
+ 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, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
+ config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
+ ? INSTANT : ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
+ config.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR);
}
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index c22d60d..5d88884 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -113,9 +113,16 @@
return -1;
}
+ /**
+ * Returns the range in height that the slide in view can be dragged.
+ */
+ protected float getShiftRange() {
+ return mContent.getHeight();
+ }
+
protected void setTranslationShift(float translationShift) {
mTranslationShift = translationShift;
- mContent.setTranslationY(mTranslationShift * mContent.getHeight());
+ mContent.setTranslationY(mTranslationShift * getShiftRange());
if (mColorScrim != null) {
mColorScrim.setAlpha(1 - mTranslationShift);
}
@@ -132,8 +139,7 @@
mSwipeDetector.setDetectableScrollConditions(
directionsToDetectScroll, false);
mSwipeDetector.onTouchEvent(ev);
- return mSwipeDetector.isDraggingOrSettling()
- || !getPopupContainer().isEventOverView(mContent, ev);
+ return mSwipeDetector.isDraggingOrSettling() || !isEventOverContent(ev);
}
@Override
@@ -142,13 +148,23 @@
if (ev.getAction() == MotionEvent.ACTION_UP && mSwipeDetector.isIdleState()
&& !isOpeningAnimationRunning()) {
// If we got ACTION_UP without ever starting swipe, close the panel.
- if (!getPopupContainer().isEventOverView(mContent, ev)) {
+ if (!isEventOverContent(ev)) {
close(true);
}
}
return true;
}
+ /**
+ * Returns {@code true} if the touch event is over the visible area of the bottom sheet.
+ *
+ * By default will check if the touch event is over {@code mContent}, subclasses should override
+ * this method if the visible area of the bottom sheet is different from {@code mContent}.
+ */
+ protected boolean isEventOverContent(MotionEvent ev) {
+ return getPopupContainer().isEventOverView(mContent, ev);
+ }
+
private boolean isOpeningAnimationRunning() {
return mIsOpen && mOpenCloseAnimator.isRunning();
}
@@ -160,7 +176,7 @@
@Override
public boolean onDrag(float displacement) {
- float range = mContent.getHeight();
+ float range = getShiftRange();
displacement = Utilities.boundToRange(displacement, 0, range);
setTranslationShift(displacement / range);
return true;
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
index 5543cc2..8a435c9 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -55,8 +55,15 @@
@Override
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
- return new ScaleAndTranslation(1f, 0,
- -launcher.getAllAppsController().getShiftRange() * PARALLAX_COEFFICIENT);
+ ScaleAndTranslation scaleAndTranslation =
+ new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
+ if (launcher.getDeviceProfile().isTablet) {
+ scaleAndTranslation.scale = 0.97f;
+ } else {
+ scaleAndTranslation.translationY =
+ -launcher.getAllAppsController().getShiftRange() * PARALLAX_COEFFICIENT;
+ }
+ return scaleAndTranslation;
}
@Override