Merge "Fix recents task view launch animation unclipping issue." into ub-launcher3-edmonton
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index ad5f767..ed18bf5 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -21,6 +21,7 @@
<dimen name="task_menu_background_radius">12dp</dimen>
<dimen name="task_corner_radius">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
+ <dimen name="quickscrub_adjacent_visible_width">20dp</dimen>
<!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
loading full resolution screenshots. -->
diff --git a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
index d86ba6a..1eaa8bc 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
@@ -18,8 +18,6 @@
import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import android.view.View;
-
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -62,11 +60,6 @@
}
@Override
- public View getFinalFocus(Launcher launcher) {
- return launcher.getAppsView();
- }
-
- @Override
public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
float[] scaleAndTranslation = LauncherState.OVERVIEW.getWorkspaceScaleAndTranslation(
launcher);
diff --git a/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java
index da85990..43d9822 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java
@@ -15,8 +15,13 @@
*/
package com.android.launcher3.uioverrides;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Rect;
+
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
import com.android.quickstep.QuickScrubController;
import com.android.quickstep.views.RecentsView;
@@ -25,6 +30,12 @@
*/
public class FastOverviewState extends OverviewState {
+ private static final float MAX_PREVIEW_SCALE_UP = 1.3f;
+ /**
+ * Vertical transition of the task previews relative to the full container.
+ */
+ public static final float OVERVIEW_TRANSLATION_FACTOR = 0.5f;
+
private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_DISABLE_INTERACTION
| FLAG_OVERVIEW_UI | FLAG_HIDE_BACK_BUTTON | FLAG_DISABLE_ACCESSIBILITY;
@@ -46,15 +57,23 @@
@Override
public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) {
- return new float[] {getOverviewScale(launcher.getDeviceProfile()), 0.5f};
+ RecentsView recentsView = launcher.getOverviewPanel();
+ recentsView.getTaskSize(sTempRect);
+
+ return new float[] {getOverviewScale(launcher.getDeviceProfile(), sTempRect, launcher),
+ OVERVIEW_TRANSLATION_FACTOR};
}
- public static float getOverviewScale(DeviceProfile dp) {
- if (dp.isMultiWindowMode || dp.isVerticalBarLayout()) {
+ public static float getOverviewScale(DeviceProfile dp, Rect taskRect, Context context) {
+ if (dp.isVerticalBarLayout()) {
return 1f;
}
- // TODO: Calculate it dynamically based on available space
- return 1.3f;
+ Resources res = context.getResources();
+ float usedHeight = taskRect.height() + res.getDimension(R.dimen.task_thumbnail_top_margin);
+ float usedWidth = taskRect.width() + 2 * (res.getDimension(R.dimen.recents_page_spacing)
+ + res.getDimension(R.dimen.quickscrub_adjacent_visible_width));
+ return Math.min(Math.min(dp.availableHeightPx / usedHeight,
+ dp.availableWidthPx / usedWidth), MAX_PREVIEW_SCALE_UP);
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 0116a8e..9169ffb 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -83,11 +83,6 @@
DiscoveryBounce.showForOverviewIfNeeded(launcher);
}
- @Override
- public View getFinalFocus(Launcher launcher) {
- return launcher.getOverviewPanel();
- }
-
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
return new PageAlphaProvider(DEACCEL_2) {
@Override
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index d47fec5..e202c57 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -153,8 +153,8 @@
@Override
public float getTranslationYForQuickScrub(Launcher activity) {
LauncherRecentsView recentsView = activity.getOverviewPanel();
- float transYFactor = FAST_OVERVIEW.getOverviewScaleAndTranslationYFactor(activity)[1];
- return recentsView.computeTranslationYForFactor(transYFactor);
+ return recentsView.computeTranslationYForFactor(
+ FastOverviewState.OVERVIEW_TRANSLATION_FACTOR);
}
@Override
@@ -167,7 +167,7 @@
@InteractionType int interactionType, TransformedRect outRect) {
LayoutUtils.calculateLauncherTaskSize(context, dp, outRect.rect);
if (interactionType == INTERACTION_QUICK_SCRUB) {
- outRect.scale = FastOverviewState.getOverviewScale(dp);
+ outRect.scale = FastOverviewState.getOverviewScale(dp, outRect.rect, context);
}
if (dp.isVerticalBarLayout()) {
Rect targetInsets = dp.getInsets();
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index e93c807..191c237 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -273,8 +273,8 @@
| STATE_SCALED_CONTROLLER_APP,
this::notifyTransitionCancelled);
- mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_QUICK_SCRUB_START,
- this::onQuickScrubStart);
+ mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_QUICK_SCRUB_START
+ | STATE_APP_CONTROLLER_RECEIVED, this::onQuickScrubStart);
mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_QUICK_SCRUB_START
| STATE_SCALED_CONTROLLER_RECENTS, this::onFinishedTransitionToQuickScrub);
mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_CURRENT_TASK_FINISHED
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 4f169fb..dee15d0 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -271,6 +271,7 @@
.getDimensionPixelSize(R.dimen.recents_empty_message_text_padding);
setWillNotDraw(false);
updateEmptyMessage();
+ setFocusable(false);
}
public boolean isRtl() {
@@ -931,16 +932,6 @@
return true;
}
- @Override
- public void onVisibilityAggregated(boolean isVisible) {
- super.onVisibilityAggregated(isVisible);
- if (isVisible && !isFocused()) {
- // Having focus, even in touch mode, keeps us from losing [Alt+]Tab by preventing
- // switching to keyboard mode.
- requestFocus();
- }
- }
-
private void runDismissAnimation(PendingAnimation pendingAnim) {
AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(
pendingAnim.anim, DISMISS_TASK_DURATION);
@@ -1285,6 +1276,7 @@
private void onChildViewsChanged() {
final int childCount = getChildCount();
mClearAllButton.setVisibility(childCount == 0 ? INVISIBLE : VISIBLE);
+ setFocusable(childCount != 0);
}
public void revealClearAllButton() {
@@ -1315,8 +1307,9 @@
super.onInitializeAccessibilityEvent(event);
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
- event.setFromIndex(getCurrentPage());
- event.setToIndex(getCurrentPage());
+ final int visiblePageNumber = getChildCount() - getCurrentPage() - 1;
+ event.setFromIndex(visiblePageNumber);
+ event.setToIndex(visiblePageNumber);
event.setItemCount(getChildCount());
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java b/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
index 3391214..31c8b64 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
@@ -113,8 +113,15 @@
@Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
- // Carousel is first in tab order.
- views.add(mRecentsView);
- views.add(mClearAllButton);
+ if (mRecentsView.getChildCount() > 0) {
+ // Carousel is first in tab order.
+ views.add(mRecentsView);
+ views.add(mClearAllButton);
+ }
+ }
+
+ public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
+ return mRecentsView.requestFocus(direction, previouslyFocusedRect) ||
+ super.requestFocus(direction, previouslyFocusedRect);
}
}
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 213d9cb..5413a13 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -325,7 +325,8 @@
final AccessibilityNodeInfo.CollectionItemInfo itemInfo =
AccessibilityNodeInfo.CollectionItemInfo.obtain(
- 0, 1, recentsView.indexOfChild(this), 1, false);
+ 0, 1, recentsView.getChildCount() - recentsView.indexOfChild(this) - 1, 1,
+ false);
info.setCollectionItemInfo(itemInfo);
}
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 631626f..2b760f3 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -45,7 +45,7 @@
<style name="LauncherTheme" parent="@style/BaseLauncherThemeWithCustomAttrs"></style>
- <style name="LauncherThemeDarkText" parent="@style/LauncherTheme">
+ <style name="LauncherTheme.DarkText" parent="@style/LauncherTheme">
<item name="workspaceTextColor">#FF212121</item>
<item name="workspaceShadowColor">@android:color/transparent</item>
<item name="workspaceAmbientShadowColor">@android:color/transparent</item>
@@ -70,6 +70,15 @@
<item name="isMainColorDark">true</item>
</style>
+ <style name="LauncherThemeDark.DarKText" parent="@style/LauncherThemeDark">
+ <item name="workspaceTextColor">#FF212121</item>
+ <item name="workspaceShadowColor">@android:color/transparent</item>
+ <item name="workspaceAmbientShadowColor">@android:color/transparent</item>
+ <item name="workspaceKeyShadowColor">@android:color/transparent</item>
+ <item name="isWorkspaceDarkText">true</item>
+ <item name="workspaceStatusBarScrim">@null</item>
+ </style>
+
<!--
Theme overrides to element on homescreen, i.e., which are drawn on top on wallpaper.
Various foreground colors are overridden to be workspaceTextColor so that they are properly
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index d9e7d20..8af9acc 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -90,11 +90,11 @@
protected int getThemeRes(WallpaperColorInfo wallpaperColorInfo) {
if (wallpaperColorInfo.isDark()) {
- return R.style.LauncherThemeDark;
- } else if (wallpaperColorInfo.supportsDarkText()) {
- return R.style.LauncherThemeDarkText;
+ return wallpaperColorInfo.supportsDarkText() ?
+ R.style.LauncherThemeDark_DarKText : R.style.LauncherThemeDark;
} else {
- return R.style.LauncherTheme;
+ return wallpaperColorInfo.supportsDarkText() ?
+ R.style.LauncherTheme_DarkText : R.style.LauncherTheme;
}
}
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 76681f2..5b010dc 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -18,11 +18,11 @@
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
+
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
import android.graphics.Rect;
-import android.view.View;
import android.view.animation.Interpolator;
import com.android.launcher3.states.SpringLoadedState;
@@ -196,10 +196,6 @@
public void onStateDisabled(Launcher launcher) { }
- public View getFinalFocus(Launcher launcher) {
- return launcher.getWorkspace();
- }
-
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
return HOTSEAT_ICONS | VERTICAL_SWIPE_INDICATOR;
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 3fcdee9..f938e24 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -17,6 +17,7 @@
package com.android.launcher3;
import static android.view.View.VISIBLE;
+
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
@@ -35,7 +36,6 @@
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.IntDef;
-import android.view.View;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
@@ -251,7 +251,7 @@
prepareForAtomicAnimation(mState, state, builder);
AnimatorSet animation = createAnimationToNewWorkspaceInternal(
state, builder, onCompleteRunnable);
- Runnable runnable = new StartAnimRunnable(animation, state.getFinalFocus(mLauncher));
+ Runnable runnable = new StartAnimRunnable(animation);
if (delay > 0) {
mUiHandler.postDelayed(runnable, delay);
} else {
@@ -397,6 +397,8 @@
}
UiFactory.onLauncherStateOrResumeChanged(mLauncher);
+
+ mLauncher.getDragLayer().requestFocus();
}
public void onWindowFocusChanged() {
@@ -480,11 +482,9 @@
private class StartAnimRunnable implements Runnable {
private final AnimatorSet mAnim;
- private final View mViewToFocus;
- public StartAnimRunnable(AnimatorSet anim, View viewToFocus) {
+ public StartAnimRunnable(AnimatorSet anim) {
mAnim = anim;
- mViewToFocus = viewToFocus;
}
@Override
@@ -492,9 +492,6 @@
if (mConfig.mCurrentAnimation != mAnim) {
return;
}
- if (mViewToFocus != null) {
- mViewToFocus.requestFocus();
- }
mAnim.start();
}
}
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index aa7d0d5..35f7f88 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -19,7 +19,6 @@
import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
import android.graphics.Rect;
-import android.view.View;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InstallShortcutReceiver;
@@ -98,9 +97,4 @@
InstallShortcutReceiver.disableAndFlushInstallQueue(
InstallShortcutReceiver.FLAG_DRAG_AND_DROP, launcher);
}
-
- @Override
- public View getFinalFocus(Launcher launcher) {
- return null;
- }
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
index 4a2f544..f7bb254 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
@@ -19,8 +19,6 @@
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
-import android.view.View;
-
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -68,11 +66,6 @@
}
@Override
- public View getFinalFocus(Launcher launcher) {
- return launcher.getAppsView();
- }
-
- @Override
public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
return new float[] { 1f, 0,
-launcher.getAllAppsController().getShiftRange() * PARALLAX_COEFFICIENT};