Merge "Include shell+stage-split in legacy recents animations" into sc-v2-dev
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 957484b..096ac6c 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -387,8 +387,11 @@
mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> {
ThumbnailData snapshot = mGestureState.consumeRecentsAnimationCanceledSnapshot();
if (snapshot != null) {
- mRecentsView.switchToScreenshot(snapshot,
- () -> mRecentsAnimationController.cleanupScreenshot());
+ mRecentsView.switchToScreenshot(snapshot, () -> {
+ if (mRecentsAnimationController != null) {
+ mRecentsAnimationController.cleanupScreenshot();
+ }
+ });
mRecentsView.onRecentsAnimationComplete();
}
});
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 0103acf..897dfbe 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -82,6 +82,7 @@
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.FloatProperty;
+import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
@@ -128,8 +129,8 @@
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.ResourceBasedOverride.Overrides;
-import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.RunnableList;
+import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TranslateEdgeEffect;
@@ -988,6 +989,7 @@
@Override
protected void onPageBeginTransition() {
super.onPageBeginTransition();
+ Log.d("b/193125090", "Disabling ActionsView due to scrolling");
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, true);
}
@@ -995,7 +997,10 @@
protected void onPageEndTransition() {
super.onPageEndTransition();
if (isClearAllHidden()) {
+ Log.d("b/193125090", "Enabling ActionsView due after scrolling");
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
+ } else {
+ Log.d("b/193125090", "Not enabling ActionsView due to ClearAll not hidden");
}
if (getNextPage() > 0) {
setSwipeDownShouldLaunchApp(true);
@@ -1159,6 +1164,7 @@
}
if (mFocusedTaskId == -1 && getTaskViewCount() > 0) {
mFocusedTaskId = getTaskViewAt(0).getTaskId();
+ Log.d("b/193125090", "applyLoadPlan - mFocusedTaskId: " + mFocusedTaskId);
}
updateTaskSize();
@@ -1475,14 +1481,22 @@
}
private void updateActionsViewScrollAlpha() {
+ Log.d("b/193125090", "updateActionsViewScrollAlpha - showAsGrid: " + showAsGrid());
float scrollAlpha = 1f;
if (showAsGrid()) {
TaskView focusedTaskView = getFocusedTaskView();
+ Log.d("b/193125090",
+ "updateActionsViewScrollAlpha - focusedTaskView: " + focusedTaskView);
if (focusedTaskView != null) {
float scrollDiff = Math.abs(getScrollForPage(indexOfChild(focusedTaskView))
- mOrientationHandler.getPrimaryScroll(this));
float delta = (mGridSideMargin - scrollDiff) / (float) mGridSideMargin;
scrollAlpha = Utilities.boundToRange(delta, 0, 1);
+ Log.d("b/193125090",
+ "updateActionsViewScrollAlpha - focusedTaskScroll: " + getScrollForPage(
+ indexOfChild(focusedTaskView)) + ", primaryScroll: "
+ + mOrientationHandler.getPrimaryScroll(this) + ", mGridSideMargin: "
+ + mGridSideMargin);
}
}
mActionsView.getScrollAlpha().setValue(scrollAlpha);
@@ -2742,6 +2756,7 @@
@Override
public void setVisibility(int visibility) {
+ Log.d("b/193125090", "setVisibility: " + visibility);
super.setVisibility(visibility);
if (mActionsView != null) {
mActionsView.updateHiddenFlags(HIDDEN_NO_RECENTS, visibility != VISIBLE);
diff --git a/res/drawable/work_card.xml b/res/drawable/work_card.xml
index 7048955..4a66cac 100644
--- a/res/drawable/work_card.xml
+++ b/res/drawable/work_card.xml
@@ -19,6 +19,6 @@
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
<solid android:color="?androidprv:attr/colorSurface" />
- <corners android:radius="@dimen/work_edu_card_margin" />
+ <corners android:radius="@dimen/work_edu_card_radius" />
</shape>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 9a49e8a..a4a562e 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -120,13 +120,14 @@
<!-- Floating action button inside work tab to toggle work profile -->
<dimen name="work_fab_height">56dp</dimen>
- <dimen name="work_fab_radius">24dp</dimen>
+ <dimen name="work_fab_radius">28dp</dimen>
<dimen name="work_card_padding_horizontal">24dp</dimen>
<dimen name="work_card_padding_vertical">32dp</dimen>
<dimen name="work_fab_margin">16dp</dimen>
<dimen name="work_profile_footer_padding">20dp</dimen>
<dimen name="work_profile_footer_text_size">16sp</dimen>
<dimen name="work_edu_card_margin">16dp</dimen>
+ <dimen name="work_edu_card_radius">28dp</dimen>
<!-- rounded button shown inside card views, and snack bars -->
<dimen name="padded_rounded_button_height">48dp</dimen>
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index a5c142d..12fd026 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -51,6 +51,8 @@
public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
implements OnClickListener, OnLongClickListener, DragSource,
PopupDataProvider.PopupDataChangeListener, Insettable {
+ /** The default number of cells that can fit horizontally in a widget sheet. */
+ protected static final int DEFAULT_MAX_HORIZONTAL_SPANS = 4;
/**
* The maximum scale, [0, 1], of the device screen width that the widgets picker can consume
* on large screen devices.
@@ -152,6 +154,17 @@
MeasureSpec.getSize(heightMeasureSpec));
}
+ /** Returns the number of cells that can fit horizontally in a given {@code content}. */
+ protected int computeMaxHorizontalSpans(View content, int contentHorizontalPaddingPx) {
+ DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+ int availableWidth = content.getMeasuredWidth() - contentHorizontalPaddingPx;
+ Point cellSize = deviceProfile.getCellSize();
+ if (cellSize.x > 0) {
+ return availableWidth / cellSize.x;
+ }
+ return DEFAULT_MAX_HORIZONTAL_SPANS;
+ }
+
private boolean beginDraggingWidget(WidgetCell v) {
// Get the widget preview as the drag representation
WidgetImageView image = v.getWidgetView();
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index c045cf1..14aeaf6 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -70,9 +70,11 @@
private static final int DEFAULT_CLOSE_DURATION = 200;
private static final long EDUCATION_TIP_DELAY_MS = 300;
+ private final int mWidgetSheetContentHorizontalPadding;
+
private ItemInfo mOriginalItemInfo;
private final int mMaxTableHeight;
- private int mMaxHorizontalSpan = 4;
+ private int mMaxHorizontalSpan = DEFAULT_MAX_HORIZONTAL_SPANS;
private final OnLayoutChangeListener mLayoutChangeListenerToShowTips =
new OnLayoutChangeListener() {
@@ -117,6 +119,9 @@
if (!hasSeenEducationTip()) {
addOnLayoutChangeListener(mLayoutChangeListenerToShowTips);
}
+
+ mWidgetSheetContentHorizontalPadding = getResources().getDimensionPixelSize(
+ R.dimen.widget_list_horizontal_margin);
}
@Override
@@ -137,10 +142,8 @@
private boolean updateMaxSpansPerRow() {
if (getMeasuredWidth() == 0) return false;
- int paddingPx = 2 * getResources().getDimensionPixelOffset(
- R.dimen.widget_cell_horizontal_padding);
- int maxHorizontalSpan = findViewById(R.id.widgets_table).getMeasuredWidth()
- / (mActivityContext.getDeviceProfile().cellWidthPx + paddingPx);
+ int maxHorizontalSpan = computeMaxHorizontalSpans(mContent,
+ mWidgetSheetContentHorizontalPadding);
if (mMaxHorizontalSpan != maxHorizontalSpan) {
// Ensure the table layout is showing widgets in the right column after measure.
mMaxHorizontalSpan = maxHorizontalSpan;
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 6c2cca6..5e1a534 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Process;
import android.os.UserHandle;
@@ -148,13 +149,13 @@
private final int mTabsHeight;
private final int mViewPagerTopPadding;
private final int mSearchAndRecommendationContainerBottomMargin;
- private final int mWidgetCellHorizontalPadding;
+ private final int mWidgetSheetContentHorizontalPadding;
@Nullable private WidgetsRecyclerView mCurrentWidgetsRecyclerView;
@Nullable private PersonalWorkPagedView mViewPager;
private boolean mIsInSearchMode;
private boolean mIsNoWidgetsViewNeeded;
- private int mMaxSpansPerRow = 4;
+ private int mMaxSpansPerRow = DEFAULT_MAX_HORIZONTAL_SPANS;
private View mTabsView;
private TextView mNoWidgetsView;
private SearchAndRecommendationViewHolder mSearchAndRecommendationViewHolder;
@@ -166,19 +167,20 @@
mAdapters.put(AdapterHolder.PRIMARY, new AdapterHolder(AdapterHolder.PRIMARY));
mAdapters.put(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK));
mAdapters.put(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
+
+ Resources resources = getResources();
mTabsHeight = mHasWorkProfile
- ? getContext().getResources()
- .getDimensionPixelSize(R.dimen.all_apps_header_pill_height)
+ ? resources.getDimensionPixelSize(R.dimen.all_apps_header_pill_height)
: 0;
mViewPagerTopPadding = mHasWorkProfile
? getContext().getResources()
.getDimensionPixelSize(R.dimen.widget_picker_view_pager_top_padding)
: 0;
- mSearchAndRecommendationContainerBottomMargin = getContext().getResources()
- .getDimensionPixelSize(mHasWorkProfile
+ mSearchAndRecommendationContainerBottomMargin = resources.getDimensionPixelSize(
+ mHasWorkProfile
? R.dimen.search_and_recommended_widgets_container_small_bottom_margin
: R.dimen.search_and_recommended_widgets_container_bottom_margin);
- mWidgetCellHorizontalPadding = 2 * getResources().getDimensionPixelOffset(
+ mWidgetSheetContentHorizontalPadding = 2 * resources.getDimensionPixelSize(
R.dimen.widget_cell_horizontal_padding);
}
@@ -375,11 +377,10 @@
private boolean updateMaxSpansPerRow() {
if (getMeasuredWidth() == 0) return false;
- int previousMaxSpansPerRow = mMaxSpansPerRow;
- mMaxSpansPerRow = getMeasuredWidth()
- / (mActivityContext.getDeviceProfile().cellWidthPx + mWidgetCellHorizontalPadding);
-
- if (previousMaxSpansPerRow != mMaxSpansPerRow) {
+ int maxHorizontalSpans = computeMaxHorizontalSpans(mContent,
+ mWidgetSheetContentHorizontalPadding);
+ if (mMaxSpansPerRow != maxHorizontalSpans) {
+ mMaxSpansPerRow = maxHorizontalSpans;
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsListAdapter.setMaxHorizontalSpansPerRow(
mMaxSpansPerRow);
mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.setMaxHorizontalSpansPerRow(