Merge "Simplifying/fixing logic for ignoring touches in quick scrub" into ub-launcher3-master
diff --git a/go/res/xml/device_profiles.xml b/go/res/xml/device_profiles.xml
index 487c026..16d7e13 100644
--- a/go/res/xml/device_profiles.xml
+++ b/go/res/xml/device_profiles.xml
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<profiles xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" >
+<profiles xmlns:launcher="http://schemas.android.com/apk/res-auto" >
<profile
launcher:name="Go Device"
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index 18ddeee..85b40d0 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/res/layout/longpress_options_menu.xml b/quickstep/res/layout/longpress_options_menu.xml
new file mode 100644
index 0000000..9cf0fcf
--- /dev/null
+++ b/quickstep/res/layout/longpress_options_menu.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<com.android.launcher3.uioverrides.OptionsPopupView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="96dp"
+ android:background="?attr/popupColorPrimary"
+ android:elevation="@dimen/deep_shortcuts_elevation"
+ android:orientation="horizontal"
+ launcher:layout_ignoreInsets="true">
+
+ <FrameLayout
+ android:id="@+id/wallpaper_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:background="?android:attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:drawablePadding="4dp"
+ android:drawableTint="?android:attr/textColorPrimary"
+ android:drawableTop="@drawable/ic_wallpaper"
+ android:fontFamily="sans-serif-condensed"
+ android:gravity="center"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:text="@string/wallpaper_button_text"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="12sp"/>
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/widget_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:background="?android:attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:drawablePadding="4dp"
+ android:drawableTint="?android:attr/textColorPrimary"
+ android:drawableTop="@drawable/ic_widget"
+ android:fontFamily="sans-serif-condensed"
+ android:gravity="center"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:text="@string/widget_button_text"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="12sp"/>
+
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/settings_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:background="?android:attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:drawablePadding="4dp"
+ android:drawableTint="?android:attr/textColorPrimary"
+ android:drawableTop="@drawable/ic_setting"
+ android:fontFamily="sans-serif-condensed"
+ android:gravity="center"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:text="@string/settings_button_text"
+ android:textColor="?android:attr/textColorPrimary"
+ android:textSize="12sp"/>
+
+ </FrameLayout>
+
+</com.android.launcher3.uioverrides.OptionsPopupView>
\ No newline at end of file
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 9ef8e82..bdc7c36 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -16,11 +16,14 @@
<resources>
+ <dimen name="options_menu_icon_size">24dp</dimen>
+
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_menu_background_radius">12dp</dimen>
<dimen name="task_corner_radius">2dp</dimen>
<dimen name="task_fade_length">20dp</dimen>
+ <dimen name="recents_page_spacing">10dp</dimen>
<dimen name="quickstep_fling_threshold_velocity">500dp</dimen>
@@ -31,6 +34,7 @@
<!-- TODO: This can be calculated using other resource values -->
<dimen name="all_apps_search_box_full_height">90dp</dimen>
- <dimen name="drag_layer_trans_y">25dp</dimen>
-
+ <!-- Launcher app transition -->
+ <dimen name="content_trans_y">25dp</dimen>
+ <dimen name="workspace_trans_y">80dp</dimen>
</resources>
diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
new file mode 100644
index 0000000..489e55b
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+package com.android.launcher3;
+
+import android.animation.AnimatorSet;
+import android.os.Handler;
+
+import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
+
+import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
+
+public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCompat {
+
+ AnimatorSet mAnimator;
+ private Launcher mLauncher;
+
+ LauncherAnimationRunner(Launcher launcher) {
+ mLauncher = launcher;
+ }
+
+ @Override
+ public void onAnimationCancelled() {
+ postAtFrontOfQueueAsynchronously(mLauncher.getWindow().getDecorView().getHandler(), () -> {
+ if (mAnimator != null) {
+ mAnimator.cancel();
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
index dd05cfe..47179c5 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.systemui.shared.recents.utilities.Utilities.getNextFrameNumber;
import static com.android.systemui.shared.recents.utilities.Utilities.getSurface;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
@@ -25,10 +26,13 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@@ -36,50 +40,70 @@
import android.widget.ImageView;
import com.android.launcher3.InsettableFrameLayout.LayoutParams;
+import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.dragndrop.DragLayer;
+import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
+import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TransactionCompat;
+import com.android.systemui.shared.system.WindowManagerWrapper;
/**
- * Manages the opening app animations from Launcher.
+ * Manages the opening and closing app transitions from Launcher.
*/
public class LauncherAppTransitionManager {
+ private static final String TAG = "LauncherTransition";
private static final int REFRESH_RATE_MS = 16;
+ private static final int CLOSING_TRANSITION_DURATION_MS = 350;
+
+ // Progress = 0: All apps is fully pulled up, Progress = 1: All apps is fully pulled down.
+ private static final float ALL_APPS_PROGRESS_START = 1.3059858f;
+ private static final float ALL_APPS_PROGRESS_SLIDE_END = 0.99581414f;
+
private final DragLayer mDragLayer;
private final Launcher mLauncher;
private final DeviceProfile mDeviceProfile;
- private final float mDragLayerTransY;
+ private final float mContentTransY;
+ private final float mWorkspaceTransY;
private ImageView mFloatingView;
+ private boolean mIsRtl;
public LauncherAppTransitionManager(Launcher launcher) {
mLauncher = launcher;
mDragLayer = launcher.getDragLayer();
mDeviceProfile = launcher.getDeviceProfile();
- mDragLayerTransY =
- launcher.getResources().getDimensionPixelSize(R.dimen.drag_layer_trans_y);
+ mIsRtl = Utilities.isRtl(launcher.getResources());
+
+ Resources res = launcher.getResources();
+ mContentTransY = res.getDimensionPixelSize(R.dimen.content_trans_y);
+ mWorkspaceTransY = res.getDimensionPixelSize(R.dimen.workspace_trans_y);
}
+ /**
+ * @return A Bundle with remote animations that controls how the window of the opening
+ * targets are displayed.
+ */
public Bundle getActivityLauncherOptions(View v) {
- RemoteAnimationRunnerCompat runner = new RemoteAnimationRunnerCompat() {
+ RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mLauncher) {
@Override
public void onAnimationStart(RemoteAnimationTargetCompat[] targets,
Runnable finishedCallback) {
// Post at front of queue ignoring sync barriers to make sure it gets processed
// before the next frame.
postAtFrontOfQueueAsynchronously(v.getHandler(), () -> {
- AnimatorSet both = new AnimatorSet();
- both.play(getLauncherAnimators(v));
- both.play(getAppWindowAnimators(v, targets));
- both.addListener(new AnimatorListenerAdapter() {
+ mAnimator = new AnimatorSet();
+ mAnimator.play(getLauncherAnimators(v));
+ mAnimator.play(getWindowAnimators(v, targets));
+ mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// Reset launcher to normal state
@@ -96,51 +120,62 @@
finishedCallback.run();
}
});
- both.start();
+ mAnimator.start();
// Because t=0 has the app icon in its original spot, we can skip the first
// frame and have the same movement one frame earlier.
- both.setCurrentPlayTime(REFRESH_RATE_MS);
+ mAnimator.setCurrentPlayTime(REFRESH_RATE_MS);
});
}
-
- @Override
- public void onAnimationCancelled() {
- }
};
return ActivityOptionsCompat.makeRemoteAnimation(
new RemoteAnimationAdapterCompat(runner, 500, 380)).toBundle();
}
+ /**
+ * @return Animators that control the movements of the Launcher and icon of the opening target.
+ */
private AnimatorSet getLauncherAnimators(View v) {
AnimatorSet launcherAnimators = new AnimatorSet();
- launcherAnimators.play(getHideLauncherAnimator());
- launcherAnimators.play(getAppIconAnimator(v));
+ launcherAnimators.play(getLauncherContentAnimator(false /* show */));
+ launcherAnimators.play(getIconAnimator(v));
return launcherAnimators;
}
- private AnimatorSet getHideLauncherAnimator() {
+ /**
+ * Content is everything on screen except the background and the floating view (if any).
+ *
+ * @param show If true: Animate the content so that it moves upwards and fades in.
+ * Else: Animate the content so that it moves downwards and fades out.
+ */
+ private AnimatorSet getLauncherContentAnimator(boolean show) {
AnimatorSet hideLauncher = new AnimatorSet();
- // Animate the background content so that it moves downwards and fades out.
- if (mLauncher.isInState(LauncherState.ALL_APPS)) {
+ float[] alphas = show
+ ? new float[] {0, 1}
+ : new float[] {1, 0};
+ float[] trans = show
+ ? new float[] {mContentTransY, 0,}
+ : new float[] {0, mContentTransY};
+
+ if (mLauncher.isInState(LauncherState.ALL_APPS) && !mDeviceProfile.isVerticalBarLayout()) {
+ // All Apps in portrait mode is full screen, so we only animate AllAppsContainerView.
View appsView = mLauncher.getAppsView();
- ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, 1f, 0f);
+ ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
alpha.setDuration(217);
alpha.setInterpolator(Interpolators.LINEAR);
- ObjectAnimator transY = ObjectAnimator.ofFloat(appsView, View.TRANSLATION_Y, 0,
- mDragLayerTransY);
+ ObjectAnimator transY = ObjectAnimator.ofFloat(appsView, View.TRANSLATION_Y, trans);
transY.setInterpolator(Interpolators.AGGRESSIVE_EASE);
transY.setDuration(350);
hideLauncher.play(alpha);
hideLauncher.play(transY);
} else {
- ObjectAnimator dragLayerAlpha = ObjectAnimator.ofFloat(mDragLayer, View.ALPHA, 1f, 0f);
+ ObjectAnimator dragLayerAlpha = ObjectAnimator.ofFloat(mDragLayer, View.ALPHA, alphas);
dragLayerAlpha.setDuration(217);
dragLayerAlpha.setInterpolator(Interpolators.LINEAR);
ObjectAnimator dragLayerTransY = ObjectAnimator.ofFloat(mDragLayer, View.TRANSLATION_Y,
- 0, mDragLayerTransY);
+ trans);
dragLayerTransY.setInterpolator(Interpolators.AGGRESSIVE_EASE);
dragLayerTransY.setDuration(350);
@@ -150,22 +185,32 @@
return hideLauncher;
}
- private AnimatorSet getAppIconAnimator(View v) {
- // Create a copy of the app icon
+ /**
+ * @return Animator that controls the icon used to launch the target.
+ */
+ private AnimatorSet getIconAnimator(View v) {
+ boolean isBubbleTextView = v instanceof BubbleTextView;
mFloatingView = new ImageView(mLauncher);
- Bitmap iconBitmap = ((FastBitmapDrawable) ((BubbleTextView) v).getIcon()).getBitmap();
- mFloatingView.setImageDrawable(new FastBitmapDrawable(iconBitmap));
+ if (isBubbleTextView) {
+ // Create a copy of the app icon
+ Bitmap iconBitmap = ((FastBitmapDrawable) ((BubbleTextView) v).getIcon()).getBitmap();
+ mFloatingView.setImageDrawable(new FastBitmapDrawable(iconBitmap));
+ }
- // Position the copy of the app icon exactly on top of the original
+ // Position the floating view exactly on top of the original
Rect rect = new Rect();
mDragLayer.getDescendantRectRelativeToSelf(v, rect);
- int viewLocationLeft = rect.left;
+ int viewLocationStart = mIsRtl
+ ? mDeviceProfile.widthPx - rect.right
+ : rect.left;
int viewLocationTop = rect.top;
- ((BubbleTextView) v).getIconBounds(rect);
+ if (isBubbleTextView) {
+ ((BubbleTextView) v).getIconBounds(rect);
+ }
LayoutParams lp = new LayoutParams(rect.width(), rect.height());
lp.ignoreInsets = true;
- lp.leftMargin = viewLocationLeft + rect.left;
+ lp.setMarginStart(viewLocationStart + rect.left);
lp.topMargin = viewLocationTop + rect.top;
mFloatingView.setLayoutParams(lp);
@@ -177,8 +222,13 @@
// Animate the app icon to the center
float centerX = mDeviceProfile.widthPx / 2;
float centerY = mDeviceProfile.heightPx / 2;
- float dX = centerX - lp.leftMargin - (lp.width / 2);
+
+ float xPosition = mIsRtl
+ ? mDeviceProfile.widthPx - lp.getMarginStart() - rect.width()
+ : lp.getMarginStart();
+ float dX = centerX - xPosition - (lp.width / 2);
float dY = centerY - lp.topMargin - (lp.height / 2);
+
ObjectAnimator x = ObjectAnimator.ofFloat(mFloatingView, View.TRANSLATION_X, 0f, dX);
ObjectAnimator y = ObjectAnimator.ofFloat(mFloatingView, View.TRANSLATION_Y, 0f, dY);
@@ -213,9 +263,16 @@
return appIconAnimatorSet;
}
- private ValueAnimator getAppWindowAnimators(View v, RemoteAnimationTargetCompat[] targets) {
- Rect iconBounds = new Rect();
- ((BubbleTextView) v).getIconBounds(iconBounds);
+ /**
+ * @return Animator that controls the window of the opening targets.
+ */
+ private ValueAnimator getWindowAnimators(View v, RemoteAnimationTargetCompat[] targets) {
+ Rect bounds = new Rect();
+ if (v instanceof BubbleTextView) {
+ ((BubbleTextView) v).getIconBounds(bounds);
+ } else {
+ mDragLayer.getDescendantRectRelativeToSelf(v, bounds);
+ }
int[] floatingViewBounds = new int[2];
Rect crop = new Rect();
@@ -228,12 +285,19 @@
@Override
public void onAnimationUpdate(ValueAnimator animation) {
+ final Surface surface = getSurface(mFloatingView);
+ final long frameNumber = surface != null ? getNextFrameNumber(surface) : -1;
+ if (frameNumber == -1) {
+ // Booo, not cool! Our surface got destroyed, so no reason to animate anything.
+ Log.w(TAG, "Failed to animate, surface got destroyed.");
+ return;
+ }
final float percent = animation.getAnimatedFraction();
final float easePercent = Interpolators.AGGRESSIVE_EASE.getInterpolation(percent);
// Calculate app icon size.
- float iconWidth = iconBounds.width() * mFloatingView.getScaleX();
- float iconHeight = iconBounds.height() * mFloatingView.getScaleY();
+ float iconWidth = bounds.width() * mFloatingView.getScaleX();
+ float iconHeight = bounds.height() * mFloatingView.getScaleY();
// Scale the app window to match the icon size.
float scaleX = iconWidth / mDeviceProfile.widthPx;
@@ -257,7 +321,7 @@
// Fade in the app window.
float alphaDelay = 0;
float alphaDuration = 50;
- float alpha = getValue(1f, 0f, alphaDelay, alphaDuration,
+ float alpha = getValue(0f, 1f, alphaDelay, alphaDuration,
appAnimator.getDuration() * percent, Interpolators.AGGRESSIVE_EASE);
// Animate the window crop so that it starts off as a square, and then reveals
@@ -273,9 +337,12 @@
for (RemoteAnimationTargetCompat target : targets) {
if (target.mode == RemoteAnimationTargetCompat.MODE_OPENING) {
t.setAlpha(target.leash, alpha);
+
+ // TODO: This isn't correct at the beginning of the animation, but better
+ // than nothing.
+ matrix.postTranslate(target.position.x, target.position.y);
t.setMatrix(target.leash, matrix);
t.setWindowCrop(target.leash, crop);
- Surface surface = getSurface(mFloatingView);
t.deferTransactionUntil(target.leash, surface, getNextFrameNumber(surface));
}
if (isFirstFrame) {
@@ -287,19 +354,166 @@
matrix.reset();
isFirstFrame = false;
}
-
- /**
- * Helper method that allows us to get interpolated values for embedded
- * animations with a delay and/or different duration.
- */
- private float getValue(float start, float end, float delay, float duration,
- float currentPlayTime, Interpolator i) {
- float time = Math.max(0, currentPlayTime - delay);
- float newPercent = Math.min(1f, time / duration);
- newPercent = i.getInterpolation(newPercent);
- return start * newPercent + end * (1 - newPercent);
- }
});
return appAnimator;
}
+
+ /**
+ * Registers remote animations used when closing apps to home screen.
+ */
+ public void registerRemoteAnimations() {
+ RemoteAnimationDefinitionCompat definition = new RemoteAnimationDefinitionCompat();
+ definition.addRemoteAnimation(WindowManagerWrapper.TRANSIT_WALLPAPER_OPEN,
+ new RemoteAnimationAdapterCompat(getWallpaperOpenRunner(), 0,
+ CLOSING_TRANSITION_DURATION_MS));
+
+// TODO: App controlled transition for unlock to home TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER
+
+ new ActivityCompat(mLauncher).registerRemoteAnimations(definition);
+ }
+
+ /**
+ * @return Runner that plays when user goes to Launcher
+ * ie. pressing home, swiping up from nav bar.
+ */
+ private RemoteAnimationRunnerCompat getWallpaperOpenRunner() {
+ return new LauncherAnimationRunner(mLauncher) {
+ @Override
+ public void onAnimationStart(RemoteAnimationTargetCompat[] targets,
+ Runnable finishedCallback) {
+ Handler handler = mLauncher.getWindow().getDecorView().getHandler();
+ postAtFrontOfQueueAsynchronously(handler, () -> {
+ // We use a separate transition for Overview mode.
+ if (mLauncher.isInState(LauncherState.OVERVIEW)) {
+ finishedCallback.run();
+ return;
+ }
+
+ mAnimator = new AnimatorSet();
+ mAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ finishedCallback.run();
+ }
+ });
+ mAnimator.play(getClosingWindowAnimators(targets));
+ mAnimator.play(getLauncherResumeAnimation());
+ mAnimator.start();
+ });
+ }
+ };
+ }
+
+ /**
+ * Animator that controls the transformations of the windows the targets that are closing.
+ */
+ private Animator getClosingWindowAnimators(RemoteAnimationTargetCompat[] targets) {
+ Matrix matrix = new Matrix();
+ float height = mLauncher.getDeviceProfile().heightPx;
+ float width = mLauncher.getDeviceProfile().widthPx;
+ float endX = Utilities.isRtl(mLauncher.getResources()) ? -width : width;
+
+ ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
+ closingAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
+
+ closingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ boolean isFirstFrame = true;
+
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ final float percent = animation.getAnimatedFraction();
+ float currentPlayTime = percent * closingAnimator.getDuration();
+
+ float scale = getValue(1f, 0.8f, 0, 267, currentPlayTime,
+ Interpolators.AGGRESSIVE_EASE);
+ matrix.setScale(scale, scale);
+
+ float dX = getValue(0, endX, 0, 350, currentPlayTime,
+ Interpolators.AGGRESSIVE_EASE_IN_OUT);
+
+ TransactionCompat t = new TransactionCompat();
+ for (RemoteAnimationTargetCompat app : targets) {
+ if (app.mode == RemoteAnimationTargetCompat.MODE_CLOSING) {
+ t.setAlpha(app.leash, 1f - percent);
+
+ float dY = (height - (app.clipRect.height() * scale)) / 2f;
+ matrix.postTranslate(dX, dY);
+ t.setMatrix(app.leash, matrix);
+ }
+ // TODO: Layer should be set only once, but there is possibly a race condition
+ // where WindowManager is also calling setLayer.
+ int layer = app.mode == RemoteAnimationTargetCompat.MODE_CLOSING
+ ? Integer.MAX_VALUE
+ : app.prefixOrderIndex;
+ t.setLayer(app.leash, layer);
+ if (isFirstFrame) {
+ t.show(app.leash);
+ }
+ }
+ t.apply();
+
+ matrix.reset();
+ isFirstFrame = false;
+ }
+ });
+ return closingAnimator;
+ }
+
+ /**
+ * @return Animator that modifies Launcher as a result from {@link #getWallpaperOpenRunner}.
+ */
+ private AnimatorSet getLauncherResumeAnimation() {
+ if (mLauncher.isInState(LauncherState.ALL_APPS)
+ || mLauncher.getDeviceProfile().isVerticalBarLayout()) {
+ return getLauncherContentAnimator(true /* show */);
+ } else {
+ AnimatorSet workspaceAnimator = new AnimatorSet();
+ mLauncher.getWorkspace().setTranslationY(mWorkspaceTransY);
+ mLauncher.getWorkspace().setAlpha(0f);
+ workspaceAnimator.play(ObjectAnimator.ofFloat(mLauncher.getWorkspace(),
+ View.TRANSLATION_Y, mWorkspaceTransY, 0));
+ workspaceAnimator.play(ObjectAnimator.ofFloat(mLauncher.getWorkspace(), View.ALPHA,
+ 0, 1f));
+ workspaceAnimator.setStartDelay(150);
+ workspaceAnimator.setDuration(333);
+ workspaceAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
+
+ // Animate the shelf in two parts: slide in, and overeshoot.
+ AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
+ // The shelf will start offscreen
+ final float startY = ALL_APPS_PROGRESS_START;
+ // And will end slightly pulled up, so that there is something to overshoot back to 1f.
+ final float slideEnd = ALL_APPS_PROGRESS_SLIDE_END;
+
+ allAppsController.setProgress(startY);
+
+ Animator allAppsSlideIn =
+ ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, startY, slideEnd);
+ allAppsSlideIn.setStartDelay(150);
+ allAppsSlideIn.setDuration(317);
+ allAppsSlideIn.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
+
+ Animator allAppsOvershoot =
+ ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, slideEnd, 1f);
+ allAppsOvershoot.setDuration(153);
+ allAppsOvershoot.setInterpolator(Interpolators.OVERSHOOT_0);
+
+ AnimatorSet resumeLauncherAnimation = new AnimatorSet();
+ resumeLauncherAnimation.play(workspaceAnimator);
+ resumeLauncherAnimation.playSequentially(allAppsSlideIn, allAppsOvershoot);
+ return resumeLauncherAnimation;
+ }
+ }
+
+ /**
+ * Helper method that allows us to get interpolated values for embedded
+ * animations with a delay and/or different duration.
+ */
+ private static float getValue(float start, float end, float delay, float duration,
+ float currentPlayTime, Interpolator i) {
+ float time = Math.max(0, currentPlayTime - delay);
+ float newPercent = Math.min(1f, time / duration);
+ newPercent = i.getInterpolation(newPercent);
+ return end * newPercent + start * (1 - newPercent);
+ }
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
index 6395473..426fe35 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java
@@ -83,7 +83,7 @@
@Override
public float getHoseatAlpha(Launcher launcher) {
- return launcher.getDeviceProfile().isVerticalBarLayout() ? 0 : 1;
+ return 0;
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OptionsPopupView.java b/quickstep/src/com/android/launcher3/uioverrides/OptionsPopupView.java
new file mode 100644
index 0000000..c089d06
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/OptionsPopupView.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+package com.android.launcher3.uioverrides;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Outline;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.ViewOutlineProvider;
+import android.widget.Toast;
+
+import com.android.launcher3.AbstractFloatingView;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAnimUtils;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.anim.RevealOutlineAnimation;
+import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
+import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.graphics.GradientView;
+import com.android.launcher3.widget.WidgetsFullSheet;
+
+/**
+ * Popup shown on long pressing an empty space in launcher
+ */
+public class OptionsPopupView extends AbstractFloatingView implements OnClickListener {
+
+ private final float mOutlineRadius;
+ private final Launcher mLauncher;
+ private final PointF mTouchPoint = new PointF();
+
+ private final GradientView mGradientView;
+
+ protected Animator mOpenCloseAnimator;
+
+ public OptionsPopupView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public OptionsPopupView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+
+ mOutlineRadius = getResources().getDimension(R.dimen.bg_round_rect_radius);
+ setClipToOutline(true);
+ setOutlineProvider(new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mOutlineRadius);
+ }
+ });
+
+ mLauncher = Launcher.getLauncher(context);
+
+ mGradientView = (GradientView) mLauncher.getLayoutInflater().inflate(
+ R.layout.widgets_bottom_sheet_scrim, mLauncher.getDragLayer(), false);
+ mGradientView.setProgress(1, false);
+ mGradientView.setAlpha(0);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ findViewById(R.id.wallpaper_button).setOnClickListener(this);
+ findViewById(R.id.widget_button).setOnClickListener(this);
+ findViewById(R.id.settings_button).setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (view.getId() == R.id.wallpaper_button) {
+ mLauncher.onClickWallpaperPicker(null);
+ close(true);
+ } else if (view.getId() == R.id.widget_button) {
+ if (mLauncher.getPackageManager().isSafeMode()) {
+ Toast.makeText(mLauncher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
+ } else {
+ WidgetsFullSheet.show(mLauncher, true /* animated */);
+ close(true);
+ }
+ } else if (view.getId() == R.id.settings_button) {
+ mLauncher.startActivity(new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
+ .setPackage(mLauncher.getPackageName())
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+ close(true);
+ }
+ }
+
+ @Override
+ public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() != MotionEvent.ACTION_DOWN) {
+ return false;
+ }
+ if (mLauncher.getDragLayer().isEventOverView(this, ev)) {
+ return false;
+ }
+ close(true);
+ return true;
+ }
+
+ @Override
+ protected void handleClose(boolean animate) {
+ if (animate) {
+ animateClose();
+ } else {
+ closeComplete();
+ }
+ }
+
+ protected void animateClose() {
+ if (!mIsOpen) {
+ return;
+ }
+ mIsOpen = false;
+
+ final AnimatorSet closeAnim = LauncherAnimUtils.createAnimatorSet();
+ closeAnim.setDuration(getResources().getInteger(R.integer.config_popupOpenCloseDuration));
+
+ // Rectangular reveal (reversed).
+ final ValueAnimator revealAnim = createOpenCloseOutlineProvider()
+ .createRevealAnimator(this, true);
+ closeAnim.play(revealAnim);
+
+ Animator fadeOut = ObjectAnimator.ofFloat(this, ALPHA, 0);
+ fadeOut.setInterpolator(Interpolators.DEACCEL);
+ closeAnim.play(fadeOut);
+
+ Animator gradientAlpha = ObjectAnimator.ofFloat(mGradientView, ALPHA, 0);
+ gradientAlpha.setInterpolator(Interpolators.DEACCEL);
+ closeAnim.play(gradientAlpha);
+
+ closeAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mOpenCloseAnimator = null;
+ closeComplete();
+ }
+ });
+ if (mOpenCloseAnimator != null) {
+ mOpenCloseAnimator.cancel();
+ }
+ mOpenCloseAnimator = closeAnim;
+ closeAnim.start();
+ }
+
+ /**
+ * Closes the popup without animation.
+ */
+ private void closeComplete() {
+ if (mOpenCloseAnimator != null) {
+ mOpenCloseAnimator.cancel();
+ mOpenCloseAnimator = null;
+ }
+ mIsOpen = false;
+ mLauncher.getDragLayer().removeView(this);
+ mLauncher.getDragLayer().removeView(mGradientView);
+ }
+
+ @Override
+ public void logActionCommand(int command) {
+ // TODO:
+ }
+
+ @Override
+ protected boolean isOfType(int type) {
+ return (type & TYPE_OPTIONS_POPUP) != 0;
+ }
+
+ private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
+ Rect startRect = new Rect();
+ startRect.offset((int) (mTouchPoint.x - lp.x), (int) (mTouchPoint.y - lp.y));
+
+ Rect endRect = new Rect(0, 0, lp.width, lp.height);
+ if (getOutlineProvider() instanceof RevealOutlineAnimation) {
+ ((RevealOutlineAnimation) getOutlineProvider()).getOutline(endRect);
+ }
+
+ return new RoundedRectRevealOutlineProvider
+ (mOutlineRadius, mOutlineRadius, startRect, endRect);
+ }
+
+ private void animateOpen() {
+ mIsOpen = true;
+ final AnimatorSet openAnim = LauncherAnimUtils.createAnimatorSet();
+ openAnim.setDuration(getResources().getInteger(R.integer.config_popupOpenCloseDuration));
+
+ final ValueAnimator revealAnim = createOpenCloseOutlineProvider()
+ .createRevealAnimator(this, false);
+ openAnim.play(revealAnim);
+
+ Animator gradientAlpha = ObjectAnimator.ofFloat(mGradientView, ALPHA, 1);
+ gradientAlpha.setInterpolator(Interpolators.ACCEL);
+ openAnim.play(gradientAlpha);
+
+ mOpenCloseAnimator = openAnim;
+
+ openAnim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mOpenCloseAnimator = null;
+ }
+ });
+ openAnim.start();
+ }
+
+ public static void show(Launcher launcher, float x, float y) {
+ DragLayer dl = launcher.getDragLayer();
+ OptionsPopupView view = (OptionsPopupView) launcher.getLayoutInflater()
+ .inflate(R.layout.longpress_options_menu, dl, false);
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) view.getLayoutParams();
+
+ int maxWidth = dl.getWidth();
+ int maxHeight = dl.getHeight();
+ if (x <= 0 || y <= 0 || x >= maxWidth || y >= maxHeight) {
+ x = maxWidth / 2;
+ y = maxHeight / 2;
+ }
+ view.mTouchPoint.set(x, y);
+
+ int height = lp.height;
+
+ // Find a good width;
+ int childCount = view.getChildCount();
+ int heightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
+ int widthSpec = MeasureSpec.makeMeasureSpec(maxWidth / childCount, MeasureSpec.AT_MOST);
+ int maxChildWidth = 0;
+
+ for (int i = 0; i < childCount; i ++) {
+ View child = ((ViewGroup) view.getChildAt(i)).getChildAt(0);
+ child.measure(widthSpec, heightSpec);
+ maxChildWidth = Math.max(maxChildWidth, child.getMeasuredWidth());
+ }
+ Rect insets = dl.getInsets();
+ int margin = (int) (2 * view.getElevation());
+
+ int width = Math.min(maxWidth - insets.left - insets.right - 2 * margin,
+ maxChildWidth * childCount);
+ lp.width = width;
+
+ // Position is towards the finger
+ lp.customPosition = true;
+ lp.x = Utilities.boundToRange((int) (x - width / 2), insets.left + margin,
+ maxWidth - insets.right - width - margin);
+ lp.y = Utilities.boundToRange((int) (y - height / 2), insets.top + margin,
+ maxHeight - insets.bottom - height - margin);
+
+ launcher.getDragLayer().addView(view.mGradientView);
+ launcher.getDragLayer().addView(view);
+ view.animateOpen();
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 24adf24..a004dac 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -16,28 +16,28 @@
package com.android.launcher3.uioverrides;
-import android.content.Intent;
+import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.PointF;
import android.os.Bundle;
import android.view.View;
import android.view.View.AccessibilityDelegate;
-import android.widget.PopupMenu;
-import android.widget.Toast;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppTransitionManager;
import com.android.launcher3.LauncherStateManager.StateHandler;
-import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.util.TouchController;
-import com.android.launcher3.widget.WidgetsFullSheet;
import com.android.quickstep.RecentsView;
import com.android.systemui.shared.recents.view.RecentsTransition;
public class UiFactory {
+ private static final String CONTROL_REMOTE_APP_TRANSITION_PERMISSION =
+ "android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
+
public static final boolean USE_HARDWARE_BITMAP = false; // FeatureFlags.IS_DOGFOOD_BUILD;
public static TouchController[] createTouchControllers(Launcher launcher) {
@@ -65,31 +65,8 @@
new RecentsViewStateController(launcher)};
}
- public static void onWorkspaceLongPress(Launcher launcher) {
- PopupMenu menu = new PopupMenu(launcher.getApplicationContext(),
- launcher.getWorkspace().getPageIndicator());
-
- menu.getMenu().add(R.string.wallpaper_button_text).setOnMenuItemClickListener((i) -> {
- launcher.onClickWallpaperPicker(null);
- return true;
- });
- menu.getMenu().add(R.string.widget_button_text).setOnMenuItemClickListener((i) -> {
- if (launcher.getPackageManager().isSafeMode()) {
- Toast.makeText(launcher, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show();
- } else {
- WidgetsFullSheet.show(launcher, true /* animated */);
- }
- return true;
- });
- if (launcher.hasSettings()) {
- menu.getMenu().add(R.string.settings_button_text).setOnMenuItemClickListener((i) -> {
- launcher.startActivity(new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
- .setPackage(launcher.getPackageName())
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
- return true;
- });
- }
- menu.show();
+ public static void onWorkspaceLongPress(Launcher launcher, PointF touchPoint) {
+ OptionsPopupView.show(launcher, touchPoint.x, touchPoint.y);
}
public static Bitmap createFromRenderer(int width, int height, boolean forceSoftwareRenderer,
@@ -108,13 +85,30 @@
recents.reset();
}
+ private static boolean hasControlRemoteAppTransitionPermission(Launcher launcher) {
+ return launcher.checkSelfPermission(CONTROL_REMOTE_APP_TRANSITION_PERMISSION)
+ == PackageManager.PERMISSION_GRANTED;
+ }
+
public static Bundle getActivityLaunchOptions(Launcher launcher, View v) {
- try {
- return new LauncherAppTransitionManager(launcher).getActivityLauncherOptions(v);
- } catch (NoClassDefFoundError e) {
- // Gracefully fall back to default launch options if the user's platform doesn't have
- // the latest changes.
- return launcher.getDefaultActivityLaunchOptions(v);
+ if (hasControlRemoteAppTransitionPermission(launcher)) {
+ try {
+ return new LauncherAppTransitionManager(launcher).getActivityLauncherOptions(v);
+ } catch (NoClassDefFoundError e) {
+ // Gracefully fall back to default launch options if the user's platform doesn't
+ // have the latest changes.
+ }
+ }
+ return launcher.getDefaultActivityLaunchOptions(v);
+ }
+
+ public static void registerRemoteAnimations(Launcher launcher) {
+ if (hasControlRemoteAppTransitionPermission(launcher)) {
+ try {
+ new LauncherAppTransitionManager(launcher).registerRemoteAnimations();
+ } catch (NoClassDefFoundError e) {
+ // Gracefully fall back if the user's platform doesn't have the latest changes
+ }
}
}
}
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index 168c1fe..b295df0 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -15,6 +15,11 @@
*/
package com.android.quickstep;
+import static com.android.quickstep.TouchInteractionService.INTERACTION_NORMAL;
+import static com.android.quickstep.TouchInteractionService.INTERACTION_QUICK_SCRUB;
+import static com.android.quickstep.TouchInteractionService.INTERACTION_QUICK_SWITCH;
+import static com.android.quickstep.TouchInteractionService.isInteractionQuick;
+
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.RectEvaluator;
@@ -27,7 +32,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Build;
-import android.os.Handler;
import android.os.UserHandle;
import android.support.annotation.UiThread;
import android.view.View;
@@ -41,12 +45,13 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.states.InternalStateHandler;
-import com.android.launcher3.uioverrides.RecentsViewStateController;
+import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.TraceHelper;
-import com.android.launcher3.views.AllAppsScrim;
+import com.android.quickstep.TouchInteractionService.InteractionType;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey;
@@ -61,7 +66,6 @@
private static final int STATE_SCALED_SNAPSHOT_RECENTS = 1 << 5;
private static final int STATE_SCALED_SNAPSHOT_APP = 1 << 6;
- private static final long RECENTS_VIEW_VISIBILITY_DURATION = 150;
private static final long MAX_SWIPE_DURATION = 200;
private static final long MIN_SWIPE_DURATION = 80;
private static final int QUICK_SWITCH_SNAP_DURATION = 120;
@@ -95,21 +99,22 @@
private Launcher mLauncher;
private SnapshotDragView mDragView;
private RecentsView mRecentsView;
- private RecentsViewStateController mStateController;
private QuickScrubController mQuickScrubController;
private Hotseat mHotseat;
- private AllAppsScrim mAllAppsScrim;
+
+ private boolean mWasLauncherAlreadyVisible;
private boolean mLauncherReady;
private boolean mTouchEndHandled;
private float mCurrentDisplacement;
- private @TouchInteractionService.InteractionType int mInteractionType;
+
+ private @InteractionType int mInteractionType;
private boolean mStartedQuickScrubFromHome;
private Bitmap mTaskSnapshot;
NavBarSwipeInteractionHandler(RunningTaskInfo runningTaskInfo, Context context,
- @TouchInteractionService.InteractionType int interactionType) {
+ @InteractionType int interactionType) {
// TODO: We need a better way for this
TaskKey taskKey = new TaskKey(runningTaskInfo.id, 0, null, UserHandle.myUserId(), 0);
mRunningTask = new Task(taskKey, null, null, "", "", Color.BLACK, Color.BLACK,
@@ -186,9 +191,8 @@
mLauncher = launcher;
mRecentsView = launcher.getOverviewPanel();
mRecentsView.showTask(mRunningTask);
- mStateController = mRecentsView.getStateController();
mHotseat = mLauncher.getHotseat();
- mAllAppsScrim = mLauncher.findViewById(R.id.all_apps_scrim);
+ mWasLauncherAlreadyVisible = alreadyOnHome;
AbstractFloatingView.closeAllOpenViews(mLauncher, alreadyOnHome);
mLauncher.getStateManager().goToState(LauncherState.OVERVIEW, alreadyOnHome);
@@ -198,17 +202,8 @@
mDragView.setPivotX(0);
mDragView.setPivotY(0);
- boolean interactionIsQuick
- = mInteractionType == TouchInteractionService.INTERACTION_QUICK_SCRUB
- || mInteractionType == TouchInteractionService.INTERACTION_QUICK_SWITCH;
- mStartedQuickScrubFromHome = alreadyOnHome && interactionIsQuick;
- if (interactionIsQuick) {
- mQuickScrubController = mRecentsView.getQuickScrubController();
- mQuickScrubController.onQuickScrubStart(mStartedQuickScrubFromHome);
- animateToProgress(1f, MAX_SWIPE_DURATION);
- if (mStartedQuickScrubFromHome) {
- mDragView.setVisibility(View.INVISIBLE);
- }
+ if (isInteractionQuick(mInteractionType)) {
+ updateUiForQuickScrub();
}
// Optimization
@@ -219,6 +214,34 @@
TraceHelper.partitionSection("TouchInt", "Launcher on new intent");
}
+
+ public void updateInteractionType(@InteractionType int interactionType) {
+ Preconditions.assertUIThread();
+ if (mInteractionType != INTERACTION_NORMAL) {
+ throw new IllegalArgumentException(
+ "Can't change interaction type from " + mInteractionType);
+ }
+ if (!isInteractionQuick(interactionType)) {
+ throw new IllegalArgumentException(
+ "Can't change interaction type to " + interactionType);
+ }
+ mInteractionType = interactionType;
+
+ if (mLauncher != null) {
+ updateUiForQuickScrub();
+ }
+ }
+
+ private void updateUiForQuickScrub() {
+ mStartedQuickScrubFromHome = mWasLauncherAlreadyVisible;
+ mQuickScrubController = mRecentsView.getQuickScrubController();
+ mQuickScrubController.onQuickScrubStart(mStartedQuickScrubFromHome);
+ animateToProgress(1f, MAX_SWIPE_DURATION);
+ if (mStartedQuickScrubFromHome) {
+ mDragView.setVisibility(View.INVISIBLE);
+ }
+ }
+
@UiThread
public void updateDisplacement(float displacement) {
mCurrentDisplacement = displacement;
@@ -242,11 +265,10 @@
}
float shift = mCurrentShift.value * mActivityMultiplier.value;
- int hotseatSize = getHotseatSize();
- float hotseatTranslation = (1 - shift) * hotseatSize;
- mHotseat.setTranslationY(hotseatTranslation);
- mAllAppsScrim.setTranslationY(hotseatTranslation);
+ AllAppsTransitionController controller = mLauncher.getAllAppsController();
+ float range = getHotseatSize() / controller.getShiftRange();
+ controller.setProgress(1 + (1 - shift) * range);
mRectEvaluator.evaluate(shift, mSourceRect, mTargetRect);
@@ -329,8 +351,7 @@
private void cleanupLauncher() {
// TODO: These should be done as part of ActivityOptions#OnAnimationStarted
- mHotseat.setTranslationY(0);
- mAllAppsScrim.setTranslationY(0);
+ mLauncher.getStateManager().reapplyState();
mLauncher.setOnResumeCallback(() -> mDragView.close(false));
}
@@ -340,7 +361,7 @@
if (currentRecentsPage instanceof TaskView) {
((TaskView) currentRecentsPage).animateIconToScale(1f);
}
- if (mInteractionType == TouchInteractionService.INTERACTION_QUICK_SWITCH) {
+ if (mInteractionType == INTERACTION_QUICK_SWITCH) {
for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) {
TaskView taskView = (TaskView) mRecentsView.getPageAt(i);
// TODO: Match the keys directly
@@ -351,7 +372,7 @@
break;
}
}
- } else if (mInteractionType == TouchInteractionService.INTERACTION_QUICK_SCRUB) {
+ } else if (mInteractionType == INTERACTION_QUICK_SCRUB) {
if (mQuickScrubController != null) {
mQuickScrubController.snapToPageForCurrentQuickScrubSection();
}
@@ -361,12 +382,16 @@
public void onQuickScrubEnd() {
if (mQuickScrubController != null) {
mQuickScrubController.onQuickScrubEnd();
+ } else {
+ // TODO:
}
}
public void onQuickScrubProgress(float progress) {
if (mQuickScrubController != null) {
mQuickScrubController.onQuickScrubProgress(progress);
+ } else {
+ // TODO:
}
}
}
diff --git a/quickstep/src/com/android/quickstep/RecentsView.java b/quickstep/src/com/android/quickstep/RecentsView.java
index 836e713..31f8058 100644
--- a/quickstep/src/com/android/quickstep/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/RecentsView.java
@@ -438,7 +438,9 @@
}
mFirstTask = task;
setCurrentPage(mFirstTaskIndex);
- ((TaskView) getPageAt(mCurrentPage)).setIconScale(0);
+ if (mCurrentPage >= mFirstTaskIndex) {
+ ((TaskView) getPageAt(mCurrentPage)).setIconScale(0);
+ }
}
private static boolean keysEquals(Task t1, Task t2) {
diff --git a/quickstep/src/com/android/quickstep/TaskMenuView.java b/quickstep/src/com/android/quickstep/TaskMenuView.java
index bf75376..196a227 100644
--- a/quickstep/src/com/android/quickstep/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/TaskMenuView.java
@@ -35,6 +35,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.dragndrop.DragLayer;
@@ -170,7 +171,8 @@
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
mLauncher.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect);
Rect insets = mLauncher.getDragLayer().getInsets();
- setX(sTempRect.left + (sTempRect.width() - getMeasuredWidth()) / 2 - insets.left);
+ int x = sTempRect.left + (sTempRect.width() - getMeasuredWidth()) / 2 - insets.left;
+ setX(Utilities.isRtl(getResources()) ? -x : x);
setY(sTempRect.top - mTaskIconAndName.getPaddingTop() - insets.top);
}
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 06ed484..fe18703 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -52,6 +52,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.util.TraceHelper;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
@@ -99,6 +100,7 @@
@Override
public void onQuickSwitch() {
startTouchTracking(INTERACTION_QUICK_SWITCH);
+ mInteractionHandler = null;
}
@Override
@@ -111,6 +113,7 @@
public void onQuickScrubEnd() {
if (mInteractionHandler != null) {
mInteractionHandler.onQuickScrubEnd();
+ mInteractionHandler = null;
}
sQuickScrubEnabled = false;
}
@@ -144,6 +147,7 @@
private Intent mHomeIntent;
private ComponentName mLauncher;
private MotionEventQueue mEventQueue;
+ private MainThreadExecutor mMainThreadExecutor;
private final PointF mDownPos = new PointF();
private final PointF mLastPos = new PointF();
@@ -163,6 +167,7 @@
super.onCreate();
mAM = ActivityManagerWrapper.getInstance();
mRecentsModel = RecentsModel.getInstance(this);
+ mMainThreadExecutor = new MainThreadExecutor();
mHomeIntent = new Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME)
@@ -291,7 +296,17 @@
return mDisplayRotation == Surface.ROTATION_270 && mStableInsets.left > 0;
}
+
private void startTouchTracking(@InteractionType int interactionType) {
+ if (isInteractionQuick(interactionType)) {
+ // TODO: Send action cancel if its the Launcher consumer
+ }
+ if (mInteractionHandler != null) {
+ final NavBarSwipeInteractionHandler handler = mInteractionHandler;
+ mMainThreadExecutor.execute(() -> handler.updateInteractionType(interactionType));
+ return;
+ }
+
// Create the shared handler
final NavBarSwipeInteractionHandler handler =
new NavBarSwipeInteractionHandler(mRunningTask, this, interactionType);
@@ -437,4 +452,9 @@
ev.setEdgeFlags(flags);
}
}
+
+ public static boolean isInteractionQuick(@InteractionType int interactionType) {
+ return interactionType == INTERACTION_QUICK_SCRUB ||
+ interactionType == INTERACTION_QUICK_SWITCH;
+ }
}
diff --git a/res/drawable/ic_setting.xml b/res/drawable/ic_setting.xml
index 1bab189..08eba25 100644
--- a/res/drawable/ic_setting.xml
+++ b/res/drawable/ic_setting.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
+ android:width="@dimen/options_menu_icon_size"
+ android:height="@dimen/options_menu_icon_size"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
diff --git a/res/drawable/ic_star_rating.xml b/res/drawable/ic_star_rating.xml
deleted file mode 100644
index 4e34fa3..0000000
--- a/res/drawable/ic_star_rating.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12dp"
- android:height="12dp"
- android:viewportWidth="12"
- android:viewportHeight="12">
-
- <path
- android:fillColor="#FB8C00"
- android:fillType="evenOdd"
- android:strokeWidth="1"
- android:pathData="M 9.76511755 11.9348136 L 8.33665684 7.16088817 L 12.080006 4.41656311 L 7.49967039 4.41856896 L 6.03138903 0 L 4.57932894 4.41856896 L -1.34115008e-16 4.41656311 L 3.72612122 7.16088817 L 2.29967385 11.9348136 L 6.03138903 8.82574452 Z" />
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_wallpaper.xml b/res/drawable/ic_wallpaper.xml
index 9e9222f..0c5a125 100644
--- a/res/drawable/ic_wallpaper.xml
+++ b/res/drawable/ic_wallpaper.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
+ android:width="@dimen/options_menu_icon_size"
+ android:height="@dimen/options_menu_icon_size"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
diff --git a/res/drawable/ic_widget.xml b/res/drawable/ic_widget.xml
index de2980f..4bb23b3 100644
--- a/res/drawable/ic_widget.xml
+++ b/res/drawable/ic_widget.xml
@@ -14,12 +14,12 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
+ android:width="@dimen/options_menu_icon_size"
+ android:height="@dimen/options_menu_icon_size"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="?android:attr/textColorPrimary"
android:pathData="M26,28v12c0,1,0.8,2,2,2h12c1,0,2-1,2-2V28c0-1.2-1-2-2-2H28C26.8,26,26,26.8,26,28z M8,42h12c1.2,0,2-1,2-2V28
c0-1.2-0.8-2-2-2H8c-1,0-2,0.8-2,2v12C6,41,7,42,8,42z M6,8v12c0,1.2,1,2,2,2h12c1.2,0,2-0.8,2-2V8c0-1-0.8-2-2-2H8C7,6,6,7,6,8z
M32.6,4.6l-8,8c-0.8,0.8-0.8,2,0,2.8l8,8c0.8,0.8,2,0.8,2.8,0l8-8c0.8-0.8,0.8-2,0-2.8l-8-8C34.6,3.8,33.4,3.8,32.6,4.6z"/>
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
deleted file mode 100644
index bcaba81..0000000
--- a/res/layout-land/launcher.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<!-- Full screen view projects under the status bar and contains the background -->
-<com.android.launcher3.LauncherRootView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto"
- android:id="@+id/launcher"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="?attr/workspaceStatusBarScrim"
- android:fitsSystemWindows="true">
-
- <com.android.launcher3.dragndrop.DragLayer
- android:id="@+id/drag_layer"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:importantForAccessibility="no"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- The workspace contains 5 screens of cells -->
- <!-- DO NOT CHANGE THE ID -->
- <com.android.launcher3.Workspace
- android:theme="@style/HomeScreenElementTheme"
- android:id="@+id/workspace"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- launcher:pageIndicator="@id/page_indicator" />
-
- <com.android.launcher3.pageindicators.PageIndicatorLandscape
- android:id="@+id/page_indicator"
- android:theme="@style/HomeScreenElementTheme"
- android:layout_width="@dimen/dynamic_grid_min_page_indicator_size"
- android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
- android:layout_gravity="bottom|left"
- android:background="@drawable/all_apps_handle_landscape" />
-
- <include layout="@layout/overview_panel"
- android:id="@+id/overview_panel"
- android:visibility="gone" />
-
- <com.android.launcher3.views.AllAppsScrim
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/all_apps_scrim" />
-
- <!-- DO NOT CHANGE THE ID -->
- <include layout="@layout/hotseat"
- android:id="@+id/hotseat"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <include
- android:id="@+id/drop_target_bar"
- layout="@layout/drop_target_bar" />
-
- <include layout="@layout/all_apps"
- android:id="@+id/apps_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
-
- </com.android.launcher3.dragndrop.DragLayer>
-
-</com.android.launcher3.LauncherRootView>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
deleted file mode 100644
index eb9c34c..0000000
--- a/res/layout-port/launcher.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<!-- Full screen view projects under the status bar and contains the background -->
-<com.android.launcher3.LauncherRootView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res-auto"
-
- android:id="@+id/launcher"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="?attr/workspaceStatusBarScrim"
- android:fitsSystemWindows="true">
-
- <com.android.launcher3.dragndrop.DragLayer
- android:id="@+id/drag_layer"
- android:clipChildren="false"
- android:importantForAccessibility="no"
- android:clipToPadding="false"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- The workspace contains 5 screens of cells -->
- <!-- DO NOT CHANGE THE ID -->
- <com.android.launcher3.Workspace
- android:theme="@style/HomeScreenElementTheme"
- android:id="@+id/workspace"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- launcher:pageIndicator="@+id/page_indicator">
- </com.android.launcher3.Workspace>
-
- <include layout="@layout/overview_panel"
- android:id="@+id/overview_panel"
- android:visibility="gone" />
-
- <com.android.launcher3.views.AllAppsScrim
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/all_apps_scrim" />
-
- <!-- DO NOT CHANGE THE ID -->
- <include layout="@layout/hotseat"
- android:id="@+id/hotseat"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <!-- Keep these behind the workspace so that they are not visible when
- we go into AllApps -->
- <include layout="@layout/page_indicator"
- android:id="@+id/page_indicator" />
-
- <include
- android:id="@+id/drop_target_bar"
- layout="@layout/drop_target_bar" />
-
- <include layout="@layout/all_apps"
- android:id="@+id/apps_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible" />
- </com.android.launcher3.dragndrop.DragLayer>
-
-</com.android.launcher3.LauncherRootView>
diff --git a/res/layout/all_apps_discovery_item.xml b/res/layout/all_apps_discovery_item.xml
deleted file mode 100644
index 728283f..0000000
--- a/res/layout/all_apps_discovery_item.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<com.android.launcher3.discovery.AppDiscoveryItemView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:clickable="true"
- android:background="?android:selectableItemBackground">
-
- <ImageView
- android:id="@+id/image"
- android:layout_width="56dp"
- android:layout_height="56dp"
- android:padding="8dp"
- android:scaleType="fitCenter"
- android:focusable="false"
- android:importantForAccessibility="no"/>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_centerVertical="true"
- android:layout_toRightOf="@id/image">
-
- <TextView
- android:id="@+id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textColor="?android:textColorSecondary"
- android:textSize="15sp"/>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <TextView
- android:id="@+id/rating"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?android:textColorSecondary"
- android:textSize="14sp"
- android:layout_gravity="center_vertical"
- android:includeFontPadding="false"/>
-
- <com.android.launcher3.discovery.RatingView
- android:id="@+id/rating_view"
- android:layout_width="70dp"
- android:layout_height="16dp"
- android:layout_marginLeft="5dp"
- android:layout_marginRight="5dp"
- android:layout_gravity="center_vertical"/>
-
- <TextView
- android:id="@+id/review_count"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dp"
- android:textColor="?android:textColorHint"
- android:textSize="14sp"
- android:layout_gravity="center_vertical"/>
-
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1"/>
-
- <TextView
- android:id="@+id/price"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="?android:textColorHint"
- android:textSize="14sp"
- android:layout_marginRight="12dp"
- android:textAllCaps="true"/>
- </LinearLayout>
- </LinearLayout>
-
- <ImageView
- android:importantForAccessibility="no"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:paddingLeft="@dimen/dynamic_grid_edge_margin"
- android:paddingRight="@dimen/dynamic_grid_edge_margin"
- android:src="@drawable/all_apps_divider"
- android:scaleType="fitXY"
- android:focusable="false" />
-</com.android.launcher3.discovery.AppDiscoveryItemView>
\ No newline at end of file
diff --git a/res/layout/all_apps_discovery_loading_divider.xml b/res/layout/all_apps_discovery_loading_divider.xml
deleted file mode 100644
index 005847c..0000000
--- a/res/layout/all_apps_discovery_loading_divider.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="6dp"
- android:paddingLeft="@dimen/dynamic_grid_edge_margin"
- android:paddingRight="@dimen/dynamic_grid_edge_margin">
-
- <ProgressBar
- android:id="@+id/loadingProgressBar"
- style="@android:style/Widget.Material.ProgressBar.Horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="6dp"
- android:maxHeight="6dp"
- android:indeterminate="true"
- android:layout_gravity="center"/>
-
- <View
- android:id="@+id/loadedDivider"
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="@drawable/all_apps_divider"
- android:layout_gravity="bottom"
- android:visibility="invisible"/>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout/launcher.xml
similarity index 73%
rename from res/layout-sw720dp/launcher.xml
rename to res/layout/launcher.xml
index fa1a100..314359b 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout/launcher.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2007 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.
@@ -13,8 +12,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<!-- Full screen view projects under the status bar and contains the background -->
<com.android.launcher3.LauncherRootView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto"
@@ -26,49 +23,54 @@
<com.android.launcher3.dragndrop.DragLayer
android:id="@+id/drag_layer"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
- android:importantForAccessibility="no"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:importantForAccessibility="no">
<!-- The workspace contains 5 screens of cells -->
<!-- DO NOT CHANGE THE ID -->
<com.android.launcher3.Workspace
- android:theme="@style/HomeScreenElementTheme"
- android:layout_gravity="center"
android:id="@+id/workspace"
android:layout_width="match_parent"
android:layout_height="match_parent"
- launcher:pageIndicator="@id/page_indicator">
- </com.android.launcher3.Workspace>
+ android:layout_gravity="center"
+ android:theme="@style/HomeScreenElementTheme"
+ launcher:pageIndicator="@+id/page_indicator" />
- <include layout="@layout/overview_panel"
+ <include
android:id="@+id/overview_panel"
+ layout="@layout/overview_panel"
android:visibility="gone" />
<com.android.launcher3.views.AllAppsScrim
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/all_apps_scrim" />
-
- <!-- DO NOT CHANGE THE ID -->
- <include layout="@layout/hotseat"
- android:id="@+id/hotseat"
+ android:id="@+id/all_apps_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent" />
+ <!-- DO NOT CHANGE THE ID -->
+ <include
+ android:id="@+id/hotseat"
+ layout="@layout/hotseat"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <!-- Keep these behind the workspace so that they are not visible when
+ we go into AllApps -->
+ <com.android.launcher3.pageindicators.WorkspacePageIndicator
+ android:id="@+id/page_indicator"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
+ android:theme="@style/HomeScreenElementTheme" />
+
<include
android:id="@+id/drop_target_bar"
layout="@layout/drop_target_bar" />
- <!-- Keep these behind the workspace so that they are not visible when
- we go into AllApps -->
- <include layout="@layout/page_indicator"
- android:id="@+id/page_indicator" />
-
- <include layout="@layout/all_apps"
+ <include
android:id="@+id/apps_view"
+ layout="@layout/all_apps"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />
diff --git a/res/layout/page_indicator.xml b/res/layout/page_indicator.xml
deleted file mode 100644
index 7de0cde..0000000
--- a/res/layout/page_indicator.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-
-<com.android.launcher3.pageindicators.PageIndicatorLine
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:theme="@style/HomeScreenElementTheme"
- android:layout_width="match_parent"
- android:layout_height="@dimen/dynamic_grid_min_page_indicator_size" />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 00ef8b2..2aff936 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -227,6 +227,6 @@
<dimen name="popup_item_divider_height">0.5dp</dimen>
<dimen name="swipe_helper_falsing_threshold">70dp</dimen>
-<!-- Recents -->
- <dimen name="recents_page_spacing">10dp</dimen>
+<!-- Overview -->
+ <dimen name="options_menu_icon_size">48dp</dimen>
</resources>
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 824040a..12f022f 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -42,9 +42,11 @@
TYPE_WIDGETS_BOTTOM_SHEET,
TYPE_WIDGET_RESIZE_FRAME,
TYPE_WIDGETS_FULL_SHEET,
- TYPE_QUICKSTEP_PREVIEW,
TYPE_ON_BOARD_POPUP,
- TYPE_TASK_MENU
+
+ TYPE_QUICKSTEP_PREVIEW,
+ TYPE_TASK_MENU,
+ TYPE_OPTIONS_POPUP
})
@Retention(RetentionPolicy.SOURCE)
public @interface FloatingViewType {}
@@ -53,17 +55,20 @@
public static final int TYPE_WIDGETS_BOTTOM_SHEET = 1 << 2;
public static final int TYPE_WIDGET_RESIZE_FRAME = 1 << 3;
public static final int TYPE_WIDGETS_FULL_SHEET = 1 << 4;
- public static final int TYPE_QUICKSTEP_PREVIEW = 1 << 5;
- public static final int TYPE_ON_BOARD_POPUP = 1 << 6;
+ public static final int TYPE_ON_BOARD_POPUP = 1 << 5;
+
+ // Popups related to quickstep UI
+ public static final int TYPE_QUICKSTEP_PREVIEW = 1 << 6;
public static final int TYPE_TASK_MENU = 1 << 7;
+ public static final int TYPE_OPTIONS_POPUP = 1 << 8;
public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP
| TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET
- | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_TASK_MENU;
+ | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_TASK_MENU | TYPE_OPTIONS_POPUP;
// Type of popups which should be kept open during launcher rebind
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
- | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP;
+ | TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP | TYPE_OPTIONS_POPUP;
protected boolean mIsOpen;
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index 289242f..e52fd76 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -70,7 +70,7 @@
Rect sourceBounds, Bundle opts) {
if (info instanceof PromiseAppInfo) {
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
- context.startActivity(promiseAppInfo.getMarketIntent());
+ context.startActivity(promiseAppInfo.getMarketIntent(context));
return null;
}
ComponentName componentName = null;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 38a3044..5db0a3b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -56,6 +56,7 @@
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Point;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
@@ -268,7 +269,7 @@
*/
private PendingRequestArgs mPendingRequestArgs;
- private float mLastDispatchTouchEventX = 0.0f;
+ private final PointF mLastDispatchTouchEvent = new PointF();
public ViewGroupFocusHelper mFocusHandler;
private boolean mRotationEnabled = false;
@@ -402,6 +403,10 @@
getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW,
Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
+ if (!isInMultiWindowModeCompat()) {
+ UiFactory.registerRemoteAnimations(this);
+ }
+
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onCreate(savedInstanceState);
}
@@ -1738,7 +1743,7 @@
private void startMarketIntentForPackage(View v, String packageName) {
ItemInfo item = (ItemInfo) v.getTag();
- Intent intent = PackageManagerHelper.getMarketIntent(packageName);
+ Intent intent = new PackageManagerHelper(v.getContext()).getMarketIntent(packageName);
startActivitySafely(v, intent, item);
}
@@ -1803,7 +1808,7 @@
Intent intent;
if (item instanceof PromiseAppInfo) {
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) item;
- intent = promiseAppInfo.getMarketIntent();
+ intent = promiseAppInfo.getMarketIntent(this);
} else {
intent = item.getIntent();
}
@@ -2013,7 +2018,7 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
- mLastDispatchTouchEventX = ev.getX();
+ mLastDispatchTouchEvent.set(ev.getX(), ev.getY());
return super.dispatchTouchEvent(ev);
}
@@ -2024,7 +2029,7 @@
if (!isInState(NORMAL) && !isInState(OVERVIEW)) return false;
boolean ignoreLongPressToOverview =
- mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEventX);
+ mDeviceProfile.shouldIgnoreLongPressToOverview(mLastDispatchTouchEvent.x);
if (v instanceof Workspace) {
if (!isInState(OVERVIEW)) {
@@ -2032,7 +2037,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- UiFactory.onWorkspaceLongPress(this);
+ UiFactory.onWorkspaceLongPress(this, mLastDispatchTouchEvent);
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
return true;
@@ -2069,7 +2074,7 @@
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
Action.Direction.NONE, ContainerType.WORKSPACE,
mWorkspace.getCurrentPage());
- UiFactory.onWorkspaceLongPress(this);
+ UiFactory.onWorkspaceLongPress(this, mLastDispatchTouchEvent);
}
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
diff --git a/src/com/android/launcher3/PromiseAppInfo.java b/src/com/android/launcher3/PromiseAppInfo.java
index 07515d0..ea9f752 100644
--- a/src/com/android/launcher3/PromiseAppInfo.java
+++ b/src/com/android/launcher3/PromiseAppInfo.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
@@ -46,7 +47,7 @@
return shortcut;
}
- public Intent getMarketIntent() {
- return PackageManagerHelper.getMarketIntent(componentName.getPackageName());
+ public Intent getMarketIntent(Context context) {
+ return new PackageManagerHelper(context).getMarketIntent(componentName.getPackageName());
}
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c946a44..e6aa6be 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -179,27 +179,6 @@
private SpringLoadedDragController mSpringLoadedDragController;
- // Direction used for moving the workspace and hotseat UI
- public enum Direction {
- X (TRANSLATION_X),
- Y (TRANSLATION_Y);
-
- private final Property<View, Float> viewProperty;
-
- Direction(Property<View, Float> viewProperty) {
- this.viewProperty = viewProperty;
- }
- }
-
- private static final int HOTSEAT_STATE_ALPHA_INDEX = 2;
-
- /**
- * Hotseat alpha can be changed when moving horizontally, vertically, changing states.
- * The values correspond to {@link Direction#X}, {@link Direction#Y} &
- * {@link #HOTSEAT_STATE_ALPHA_INDEX} respectively.
- */
- private final float[] mHotseatAlpha = new float[] {1, 1, 1};
-
private boolean mIsSwitchingState = false;
boolean mChildrenLayersEnabled = true;
@@ -1206,81 +1185,8 @@
// TODO(adamcohen): figure out a final effect here. We may need to recommend
// different effects based on device performance. On at least one relatively high-end
// device I've tried, translating the launcher causes things to get quite laggy.
- setWorkspaceTranslationAndAlpha(transX, alpha);
- setHotseatTranslationAndAlpha(Direction.X, transX, alpha);
- }
-
- /**
- * Moves the workspace UI in the provided direction.
- * @param translation the amount of horizontal shift.
- * @param alpha the alpha for the workspace page
- */
- private void setWorkspaceTranslationAndAlpha(float translation, float alpha) {
- float finalAlpha = alpha;
-
- View currentChild = getChildAt(getCurrentPage());
- if (currentChild != null) {
- currentChild.setTranslationX(translation);
- currentChild.setAlpha(finalAlpha);
- }
-
- // When the animation finishes, reset all pages, just in case we missed a page.
- if (Float.compare(translation, 0) == 0) {
- for (int i = getChildCount() - 1; i >= 0; i--) {
- View child = getChildAt(i);
- child.setTranslationX(0);
- child.setAlpha(finalAlpha);
- }
- }
- }
-
- /**
- * Moves the Hotseat UI in the provided direction.
- * @param direction the direction to move the workspace
- * @param translation the amount of shift.
- * @param alpha the alpha for the hotseat page
- */
- public void setHotseatTranslationAndAlpha(Direction direction, float translation, float alpha) {
- Property<View, Float> property = direction.viewProperty;
- // Skip the page indicator movement in the vertical bar layout
- if (direction != Direction.Y || !mLauncher.getDeviceProfile().isVerticalBarLayout()) {
- property.set(mPageIndicator, translation);
- }
- property.set(mLauncher.getHotseat(), translation);
- setHotseatAlphaAtIndex(alpha, direction.ordinal());
- }
-
- private void setHotseatAlphaAtIndex(float alpha, int index) {
- mHotseatAlpha[index] = alpha;
- final float hotseatAlpha = mHotseatAlpha[0] * mHotseatAlpha[1] * mHotseatAlpha[2];
- final float pageIndicatorAlpha = mHotseatAlpha[0] * mHotseatAlpha[2];
-
- mLauncher.getHotseat().setAlpha(hotseatAlpha);
- mPageIndicator.setAlpha(pageIndicatorAlpha);
- }
-
- public ValueAnimator createHotseatAlphaAnimator(float finalValue) {
- if (Float.compare(finalValue, mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX]) == 0) {
- // Return a dummy animator to avoid null checks.
- return ValueAnimator.ofFloat(0, 0);
- } else {
- ValueAnimator animator = ValueAnimator
- .ofFloat(mHotseatAlpha[HOTSEAT_STATE_ALPHA_INDEX], finalValue);
- animator.addUpdateListener(new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator valueAnimator) {
- float value = (Float) valueAnimator.getAnimatedValue();
- setHotseatAlphaAtIndex(value, HOTSEAT_STATE_ALPHA_INDEX);
- }
- });
-
- final boolean accessibilityEnabled = isAccessibilityEnabled(mLauncher);
- animator.addUpdateListener(
- new AlphaUpdateListener(mLauncher.getHotseat(), accessibilityEnabled));
- animator.addUpdateListener(
- new AlphaUpdateListener(mPageIndicator, accessibilityEnabled));
- return animator;
- }
+ mLauncher.getDragLayer().setTranslationX(transX);
+ mLauncher.getDragLayer().setAlpha(alpha);
}
@Override
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index cf35e52..21f5d67 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -138,9 +138,8 @@
propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y,
scaleAndTranslation[2], Interpolators.ZOOM_IN);
- float hotseatAlpha = state.getHoseatAlpha(mLauncher);
- propertySetter.setViewAlpha(mWorkspace.createHotseatAlphaAnimator(hotseatAlpha),
- mLauncher.getHotseat(), hotseatAlpha);
+ propertySetter.setViewAlpha(mLauncher.getHotseat(), state.getHoseatAlpha(mLauncher),
+ pageAlphaProvider.interpolator);
// Set scrim
propertySetter.setInt(mLauncher.getDragLayer().getScrim(), DRAWABLE_ALPHA,
@@ -165,11 +164,7 @@
public static class PropertySetter {
- public void setViewAlpha(Animator anim, View view, float alpha) {
- if (anim != null) {
- anim.end();
- return;
- }
+ public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) {
view.setAlpha(alpha);
AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext()));
}
@@ -196,17 +191,14 @@
}
@Override
- public void setViewAlpha(Animator anim, View view, float alpha) {
- if (anim == null) {
- if (view.getAlpha() == alpha) {
- return;
- }
- anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha);
- anim.addListener(new AlphaUpdateListener(view,
- isAccessibilityEnabled(view.getContext())));
+ public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) {
+ if (view.getAlpha() == alpha) {
+ return;
}
-
- anim.setDuration(mDuration).setInterpolator(getFadeInterpolator(alpha));
+ ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha);
+ anim.addListener(new AlphaUpdateListener(
+ view, isAccessibilityEnabled(view.getContext())));
+ anim.setDuration(mDuration).setInterpolator(interpolator);
mStateAnimator.play(anim);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index 769f9ba..2103106 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -43,8 +43,6 @@
import com.android.launcher3.anim.SpringAnimationHandler;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.discovery.AppDiscoveryAppInfo;
-import com.android.launcher3.discovery.AppDiscoveryItemView;
import com.android.launcher3.util.PackageManagerHelper;
import java.util.List;
@@ -72,17 +70,13 @@
public static final int VIEW_TYPE_ALL_APPS_DIVIDER = 1 << 5;
// The divider that separates prediction icons from the app list
public static final int VIEW_TYPE_PREDICTION_DIVIDER = 1 << 6;
- public static final int VIEW_TYPE_APPS_LOADING_DIVIDER = 1 << 7;
- public static final int VIEW_TYPE_DISCOVERY_ITEM = 1 << 8;
- public static final int VIEW_TYPE_WORK_TAB_FOOTER = 1 << 9;
+ public static final int VIEW_TYPE_WORK_TAB_FOOTER = 1 << 7;
// Common view type masks
public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER
| VIEW_TYPE_PREDICTION_DIVIDER;
public static final int VIEW_TYPE_MASK_ICON = VIEW_TYPE_ICON
| VIEW_TYPE_PREDICTION_ICON;
- public static final int VIEW_TYPE_MASK_CONTENT = VIEW_TYPE_MASK_ICON
- | VIEW_TYPE_DISCOVERY_ITEM;
public static final int VIEW_TYPE_MASK_HAS_SPRINGS = VIEW_TYPE_MASK_ICON
| VIEW_TYPE_PREDICTION_DIVIDER;
@@ -161,7 +155,7 @@
adapterPosition = Math.max(adapterPosition, mApps.getAdapterItems().size() - 1);
int extraRows = 0;
for (int i = 0; i <= adapterPosition; i++) {
- if (!isViewType(items.get(i).viewType, VIEW_TYPE_MASK_CONTENT)) {
+ if (!isViewType(items.get(i).viewType, VIEW_TYPE_MASK_ICON)) {
extraRows++;
}
}
@@ -301,12 +295,6 @@
// Ensure the all apps icon height matches the workspace icons in portrait mode.
icon.getLayoutParams().height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
return new ViewHolder(icon);
- case VIEW_TYPE_DISCOVERY_ITEM:
- AppDiscoveryItemView appDiscoveryItemView = (AppDiscoveryItemView) mLayoutInflater
- .inflate(R.layout.all_apps_discovery_item, parent, false);
- appDiscoveryItemView.init(mIconClickListener, mLauncher.getAccessibilityDelegate(),
- mIconLongClickListener);
- return new ViewHolder(appDiscoveryItemView);
case VIEW_TYPE_EMPTY_SEARCH:
return new ViewHolder(mLayoutInflater.inflate(R.layout.all_apps_empty_search,
parent, false));
@@ -320,10 +308,6 @@
}
});
return new ViewHolder(searchMarketView);
- case VIEW_TYPE_APPS_LOADING_DIVIDER:
- View loadingDividerView = mLayoutInflater.inflate(
- R.layout.all_apps_discovery_loading_divider, parent, false);
- return new ViewHolder(loadingDividerView);
case VIEW_TYPE_PREDICTION_DIVIDER:
case VIEW_TYPE_ALL_APPS_DIVIDER:
return new ViewHolder(mLayoutInflater.inflate(
@@ -346,12 +330,6 @@
icon.reset();
icon.applyFromApplicationInfo(info);
break;
- case VIEW_TYPE_DISCOVERY_ITEM:
- AppDiscoveryAppInfo appDiscoveryAppInfo = (AppDiscoveryAppInfo)
- mApps.getAdapterItems().get(position).appInfo;
- AppDiscoveryItemView view = (AppDiscoveryItemView) holder.itemView;
- view.apply(appDiscoveryAppInfo);
- break;
case VIEW_TYPE_EMPTY_SEARCH:
TextView emptyViewText = (TextView) holder.itemView;
emptyViewText.setText(mEmptySearchMessage);
@@ -366,12 +344,6 @@
searchView.setVisibility(View.GONE);
}
break;
- case VIEW_TYPE_APPS_LOADING_DIVIDER:
- int visLoading = mApps.isAppDiscoveryRunning() ? View.VISIBLE : View.GONE;
- int visLoaded = !mApps.isAppDiscoveryRunning() ? View.VISIBLE : View.GONE;
- holder.itemView.findViewById(R.id.loadingProgressBar).setVisibility(visLoading);
- holder.itemView.findViewById(R.id.loadedDivider).setVisibility(visLoaded);
- break;
case VIEW_TYPE_ALL_APPS_DIVIDER:
// nothing to do
break;
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 4f931ca..4792cc2 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -170,12 +170,6 @@
AllAppsGridAdapter.VIEW_TYPE_EMPTY_SEARCH);
putSameHeightFor(adapter, widthMeasureSpec, heightMeasureSpec,
AllAppsGridAdapter.VIEW_TYPE_WORK_TAB_FOOTER);
- if (FeatureFlags.DISCOVERY_ENABLED) {
- putSameHeightFor(adapter, widthMeasureSpec, heightMeasureSpec,
- AllAppsGridAdapter.VIEW_TYPE_APPS_LOADING_DIVIDER);
- putSameHeightFor(adapter, widthMeasureSpec, heightMeasureSpec,
- AllAppsGridAdapter.VIEW_TYPE_DISCOVERY_ITEM);
- }
}
private void putSameHeightFor(AllAppsGridAdapter adapter, int w, int h, int... viewTypes) {
@@ -263,7 +257,7 @@
// Always scroll the view to the top so the user can see the changed results
scrollToTop();
- if (mApps.shouldShowEmptySearch()) {
+ if (mApps.hasNoFilteredResults()) {
if (mEmptySearchBackground == null) {
mEmptySearchBackground = DrawableFactory.get(getContext())
.getAllAppsBackground(getContext());
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index d8a0d64..dadc6cd 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -20,7 +20,6 @@
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorSetBuilder;
-import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.AllAppsScrim;
@@ -38,8 +37,8 @@
public class AllAppsTransitionController
implements SearchUiManager.OnScrollRangeChangeListener, LauncherStateManager.StateHandler {
- private static final Property<AllAppsTransitionController, Float> PROGRESS =
- new Property<AllAppsTransitionController, Float>(Float.class, "progress") {
+ public static final Property<AllAppsTransitionController, Float> ALL_APPS_PROGRESS =
+ new Property<AllAppsTransitionController, Float>(Float.class, "allAppsProgress") {
@Override
public Float get(AllAppsTransitionController controller) {
@@ -52,8 +51,6 @@
}
};
- private final Interpolator mHotseatAccelInterpolator = Interpolators.ACCEL_1_5;
-
public static final float PARALLAX_COEFFICIENT = .125f;
private AllAppsContainerView mAppsView;
@@ -111,7 +108,6 @@
float workspaceHotseatAlpha = Utilities.boundToRange(progress, 0f, 1f);
float alpha = 1 - workspaceHotseatAlpha;
- float hotseatAlpha = mHotseatAccelInterpolator.getInterpolation(workspaceHotseatAlpha);
mAppsView.setTranslationY(shiftCurrent);
if (mAllAppsScrim == null) {
@@ -122,8 +118,8 @@
if (!mIsVerticalLayout) {
mAppsView.setAlpha(alpha);
- mWorkspace.setHotseatTranslationAndAlpha(Workspace.Direction.Y, hotseatTranslation,
- hotseatAlpha);
+ mLauncher.getHotseat().setTranslationY(hotseatTranslation);
+ mLauncher.getWorkspace().getPageIndicator().setTranslationY(hotseatTranslation);
// Use a light system UI (dark icons) if all apps is behind at least half of the
// status bar.
@@ -168,7 +164,8 @@
}
Interpolator interpolator = config.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
- ObjectAnimator anim = ObjectAnimator.ofFloat(this, PROGRESS, mProgress, targetProgress);
+ ObjectAnimator anim =
+ ObjectAnimator.ofFloat(this, ALL_APPS_PROGRESS, mProgress, targetProgress);
anim.setDuration(config.duration);
anim.setInterpolator(interpolator);
anim.addListener(getProgressAnimatorListener());
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index eecd009..76828de 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -27,9 +27,6 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.discovery.AppDiscoveryAppInfo;
-import com.android.launcher3.discovery.AppDiscoveryItem;
-import com.android.launcher3.discovery.AppDiscoveryUpdateState;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ComponentKeyMapper;
@@ -58,8 +55,6 @@
private final int mFastScrollDistributionMode = FAST_SCROLL_FRACTION_DISTRIBUTE_BY_NUM_SECTIONS;
- private AppDiscoveryUpdateState mAppDiscoveryUpdateState;
-
/**
* Info about a fast scroller section, depending if sections are merged, the fast scroller
* sections will not be the same set as the section headers.
@@ -118,17 +113,6 @@
return item;
}
- public static AdapterItem asDiscoveryItem(int pos, String sectionName, AppInfo appInfo,
- int appIndex) {
- AdapterItem item = new AdapterItem();
- item.viewType = AllAppsGridAdapter.VIEW_TYPE_DISCOVERY_ITEM;
- item.position = pos;
- item.sectionName = sectionName;
- item.appInfo = appInfo;
- item.appIndex = appIndex;
- return item;
- }
-
public static AdapterItem asEmptySearch(int pos) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_EMPTY_SEARCH;
@@ -150,13 +134,6 @@
return item;
}
- public static AdapterItem asLoadingDivider(int pos) {
- AdapterItem item = new AdapterItem();
- item.viewType = AllAppsGridAdapter.VIEW_TYPE_APPS_LOADING_DIVIDER;
- item.position = pos;
- return item;
- }
-
public static AdapterItem asMarketSearch(int pos) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_SEARCH_MARKET;
@@ -188,7 +165,6 @@
private final List<ComponentKeyMapper<AppInfo>> mPredictedAppComponents = new ArrayList<>();
// The set of predicted apps resolved from the component names and the current set of apps
private final List<AppInfo> mPredictedApps = new ArrayList<>();
- private final List<AppDiscoveryAppInfo> mDiscoveredApps = new ArrayList<>();
// Is it the work profile app list.
private final boolean mIsWork;
@@ -293,10 +269,6 @@
return (mSearchResults != null) && mFilteredApps.isEmpty();
}
- boolean shouldShowEmptySearch() {
- return hasNoFilteredResults() && !isAppDiscoveryRunning() && mDiscoveredApps.isEmpty();
- }
-
/**
* Sets the sorted list of filtered components.
*/
@@ -310,20 +282,6 @@
return false;
}
- public void onAppDiscoverySearchUpdate(@Nullable AppDiscoveryItem app,
- @NonNull AppDiscoveryUpdateState state) {
- mAppDiscoveryUpdateState = state;
- switch (state) {
- case START:
- mDiscoveredApps.clear();
- break;
- case UPDATE:
- mDiscoveredApps.add(new AppDiscoveryAppInfo(app));
- break;
- }
- updateAdapterItems();
- }
-
private List<AppInfo> processPredictedAppComponents(List<ComponentKeyMapper<AppInfo>> components) {
if (mComponentToAppMap.isEmpty()) {
// Apps have not been bound yet.
@@ -540,32 +498,13 @@
}
if (hasFilter()) {
- if (isAppDiscoveryRunning() || mDiscoveredApps.size() > 0) {
- mAdapterItems.add(AdapterItem.asLoadingDivider(position++));
- // Append all app discovery results
- for (int i = 0; i < mDiscoveredApps.size(); i++) {
- AppDiscoveryAppInfo appDiscoveryAppInfo = mDiscoveredApps.get(i);
- if (appDiscoveryAppInfo.isRecent) {
- // already handled in getFilteredAppInfos()
- continue;
- }
- AdapterItem item = AdapterItem.asDiscoveryItem(position++,
- "", appDiscoveryAppInfo, appIndex++);
- mAdapterItems.add(item);
- }
-
- if (!isAppDiscoveryRunning()) {
- mAdapterItems.add(AdapterItem.asMarketSearch(position++));
- }
+ // Append the search market item
+ if (hasNoFilteredResults()) {
+ mAdapterItems.add(AdapterItem.asEmptySearch(position++));
} else {
- // Append the search market item
- if (hasNoFilteredResults()) {
- mAdapterItems.add(AdapterItem.asEmptySearch(position++));
- } else {
- mAdapterItems.add(AdapterItem.asAllAppsDivider(position++));
- }
- mAdapterItems.add(AdapterItem.asMarketSearch(position++));
+ mAdapterItems.add(AdapterItem.asAllAppsDivider(position++));
}
+ mAdapterItems.add(AdapterItem.asMarketSearch(position++));
}
if (mNumAppsPerRow != 0) {
@@ -635,11 +574,6 @@
== PackageManager.PERMISSION_GRANTED);
}
- public boolean isAppDiscoveryRunning() {
- return mAppDiscoveryUpdateState == AppDiscoveryUpdateState.START
- || mAppDiscoveryUpdateState == AppDiscoveryUpdateState.UPDATE;
- }
-
private List<AppInfo> getFiltersAppInfos() {
if (mSearchResults == null) {
return mApps;
@@ -651,17 +585,6 @@
result.add(match);
}
}
-
- // adding recently used instant apps
- if (mDiscoveredApps.size() > 0) {
- for (int i = 0; i < mDiscoveredApps.size(); i++) {
- AppDiscoveryAppInfo discoveryAppInfo = mDiscoveredApps.get(i);
- if (discoveryAppInfo.isRecent) {
- result.add(discoveryAppInfo);
- }
- }
- Collections.sort(result, mAppNameComparator);
- }
return result;
}
diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
index bf03a0e..e83904f 100644
--- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
@@ -28,8 +28,6 @@
import com.android.launcher3.ExtendedEditText;
import com.android.launcher3.Launcher;
import com.android.launcher3.Utilities;
-import com.android.launcher3.discovery.AppDiscoveryItem;
-import com.android.launcher3.discovery.AppDiscoveryUpdateState;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageManagerHelper;
@@ -164,18 +162,6 @@
* Called when the search results should be cleared.
*/
void clearSearchResult();
-
- /**
- * Called when the app discovery is providing an update of search, which can either be
- * START for starting a new discovery,
- * UPDATE for providing a new search result, can be called multiple times,
- * END for indicating the end of results.
- *
- * @param app result item if UPDATE, else null
- * @param app the update state, START, UPDATE or END
- */
- void onAppDiscoverySearchUpdate(@Nullable AppDiscoveryItem app,
- @NonNull AppDiscoveryUpdateState state);
}
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index ed41f13..6f07eeb 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -39,8 +39,6 @@
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AlphabeticalAppsList;
import com.android.launcher3.allapps.SearchUiManager;
-import com.android.launcher3.discovery.AppDiscoveryItem;
-import com.android.launcher3.discovery.AppDiscoveryUpdateState;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.util.ComponentKey;
@@ -187,15 +185,6 @@
mAppsView.onClearSearchResult();
}
- @Override
- public void onAppDiscoverySearchUpdate(
- @Nullable AppDiscoveryItem app, @NonNull AppDiscoveryUpdateState state) {
- if (!mLauncher.isDestroyed()) {
- mApps.onAppDiscoverySearchUpdate(app, state);
- notifyResultChanged();
- }
- }
-
private void notifyResultChanged() {
mElevationController.reset();
mAppsView.onSearchResultsChanged();
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index f3a3539..ee0dba6 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -20,6 +20,7 @@
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
+import android.view.animation.OvershootInterpolator;
import android.view.animation.PathInterpolator;
@@ -43,6 +44,9 @@
public static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
public static final Interpolator AGGRESSIVE_EASE = new PathInterpolator(0.2f, 0f, 0f, 1f);
+ public static final Interpolator AGGRESSIVE_EASE_IN_OUT = new PathInterpolator(0.8f,0, 0.4f, 1);
+
+ public static final Interpolator OVERSHOOT_0 = new OvershootInterpolator(0);
/**
* Inversion of zInterpolate, compounded with an ease-out.
diff --git a/src/com/android/launcher3/anim/RevealOutlineAnimation.java b/src/com/android/launcher3/anim/RevealOutlineAnimation.java
index c6b62fa..afb8875 100644
--- a/src/com/android/launcher3/anim/RevealOutlineAnimation.java
+++ b/src/com/android/launcher3/anim/RevealOutlineAnimation.java
@@ -80,4 +80,8 @@
public float getRadius() {
return mOutlineRadius;
}
+
+ public void getOutline(Rect out) {
+ out.set(mOutline);
+ }
}
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index 2d0e630..059b04e 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -44,8 +44,6 @@
public static final boolean QSB_ON_FIRST_SCREEN = true;
// When enabled the all-apps icon is not added to the hotseat.
public static final boolean NO_ALL_APPS_ICON = true;
- // When enabled, app discovery will be enabled if service is implemented
- public static final boolean DISCOVERY_ENABLED = false;
// When true, custom widgets are loaded using CustomWidgetParser.
public static final boolean ENABLE_CUSTOM_WIDGETS = false;
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java b/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java
deleted file mode 100644
index 26e5066..0000000
--- a/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-package com.android.launcher3.discovery;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.graphics.Color;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.android.launcher3.AppInfo;
-import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.ShortcutInfo;
-import com.android.launcher3.graphics.ColorExtractor;
-
-public class AppDiscoveryAppInfo extends AppInfo {
-
- public final boolean showAsDiscoveryItem;
- public final boolean isInstantApp;
- public final boolean isRecent;
- public final float rating;
- public final long reviewCount;
- public final @NonNull String publisher;
- public final @NonNull Intent installIntent;
- public final @NonNull Intent launchIntent;
- public final @Nullable String priceFormatted;
-
- public AppDiscoveryAppInfo(AppDiscoveryItem item) {
- this.intent = item.isInstantApp ? item.launchIntent : item.installIntent;
- this.title = item.title;
- this.iconBitmap = item.bitmap;
- this.iconColor = iconBitmap == null ? Color.TRANSPARENT :
- ColorExtractor.findDominantColorByHue(item.bitmap);
- this.usingLowResIcon = false;
- this.isInstantApp = item.isInstantApp;
- this.isRecent = item.isRecent;
- this.rating = item.starRating;
- this.showAsDiscoveryItem = true;
- this.publisher = item.publisher != null ? item.publisher : "";
- this.priceFormatted = item.price;
- this.componentName = new ComponentName(item.packageName, "");
- this.installIntent = item.installIntent;
- this.launchIntent = item.launchIntent;
- this.reviewCount = item.reviewCount;
- this.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
- }
-
- @Override
- public ShortcutInfo makeShortcut() {
- if (!isDragAndDropSupported()) {
- throw new RuntimeException("DnD is currently not supported for discovered store apps");
- }
- return super.makeShortcut();
- }
-
- public boolean isDragAndDropSupported() {
- return isInstantApp;
- }
-
-}
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryItem.java b/src/com/android/launcher3/discovery/AppDiscoveryItem.java
deleted file mode 100644
index 2e48b25..0000000
--- a/src/com/android/launcher3/discovery/AppDiscoveryItem.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-package com.android.launcher3.discovery;
-
-import android.content.Intent;
-import android.graphics.Bitmap;
-
-/**
- * This class represents the model for a discovered app via app discovery.
- * It holds all information for one result retrieved from an app discovery service.
- */
-public class AppDiscoveryItem {
-
- public final String packageName;
- public final boolean isInstantApp;
- public final boolean isRecent;
- public final float starRating;
- public final long reviewCount;
- public final Intent launchIntent;
- public final Intent installIntent;
- public final CharSequence title;
- public final String publisher;
- public final String price;
- public final Bitmap bitmap;
-
- public AppDiscoveryItem(String packageName,
- boolean isInstantApp,
- boolean isRecent,
- float starRating,
- long reviewCount,
- CharSequence title,
- String publisher,
- Bitmap bitmap,
- String price,
- Intent launchIntent,
- Intent installIntent) {
- this.packageName = packageName;
- this.isInstantApp = isInstantApp;
- this.isRecent = isRecent;
- this.starRating = starRating;
- this.reviewCount = reviewCount;
- this.launchIntent = launchIntent;
- this.installIntent = installIntent;
- this.title = title;
- this.publisher = publisher;
- this.price = price;
- this.bitmap = bitmap;
- }
-
-}
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
deleted file mode 100644
index 809d724..0000000
--- a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-package com.android.launcher3.discovery;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.android.launcher3.R;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-public class AppDiscoveryItemView extends RelativeLayout {
-
- private static boolean SHOW_REVIEW_COUNT = false;
-
- private ImageView mImage;
- private TextView mTitle;
- private TextView mRatingText;
- private RatingView mRatingView;
- private TextView mReviewCount;
- private TextView mPrice;
- private OnLongClickListener mOnLongClickListener;
-
- public AppDiscoveryItemView(Context context) {
- this(context, null);
- }
-
- public AppDiscoveryItemView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public AppDiscoveryItemView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- this.mImage = (ImageView) findViewById(R.id.image);
- this.mTitle = (TextView) findViewById(R.id.title);
- this.mRatingText = (TextView) findViewById(R.id.rating);
- this.mRatingView = (RatingView) findViewById(R.id.rating_view);
- this.mPrice = (TextView) findViewById(R.id.price);
- this.mReviewCount = (TextView) findViewById(R.id.review_count);
- }
-
- public void init(OnClickListener clickListener,
- AccessibilityDelegate accessibilityDelegate,
- OnLongClickListener onLongClickListener) {
- setOnClickListener(clickListener);
- mImage.setOnClickListener(clickListener);
- setAccessibilityDelegate(accessibilityDelegate);
- mOnLongClickListener = onLongClickListener;
- }
-
- public void apply(@NonNull AppDiscoveryAppInfo info) {
- setTag(info);
- mImage.setTag(info);
- mImage.setImageBitmap(info.iconBitmap);
- mImage.setOnLongClickListener(info.isDragAndDropSupported() ? mOnLongClickListener : null);
- mTitle.setText(info.title);
- mPrice.setText(info.priceFormatted != null ? info.priceFormatted : "");
- mReviewCount.setVisibility(SHOW_REVIEW_COUNT ? View.VISIBLE : View.GONE);
- if (info.rating >= 0) {
- mRatingText.setText(new DecimalFormat("#.0").format(info.rating));
- mRatingView.setRating(info.rating);
- mRatingView.setVisibility(View.VISIBLE);
- String reviewCountFormatted = NumberFormat.getInstance().format(info.reviewCount);
- mReviewCount.setText("(" + reviewCountFormatted + ")");
- } else {
- // if we don't have a rating
- mRatingView.setVisibility(View.GONE);
- mRatingText.setText("");
- mReviewCount.setText("");
- }
- }
-}
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryUpdateState.java b/src/com/android/launcher3/discovery/AppDiscoveryUpdateState.java
deleted file mode 100644
index 0700a10..0000000
--- a/src/com/android/launcher3/discovery/AppDiscoveryUpdateState.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-package com.android.launcher3.discovery;
-
-public enum AppDiscoveryUpdateState {
- START, UPDATE, END
-}
diff --git a/src/com/android/launcher3/discovery/RatingView.java b/src/com/android/launcher3/discovery/RatingView.java
deleted file mode 100644
index 8fe63d6..0000000
--- a/src/com/android/launcher3/discovery/RatingView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-
-package com.android.launcher3.discovery;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.ClipDrawable;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.View;
-
-import com.android.launcher3.R;
-
-/**
- * A simple rating view that shows stars with a rating from 0-5.
- */
-public class RatingView extends View {
-
- private static final float WIDTH_FACTOR = 0.9f;
- private static final int MAX_LEVEL = 10000;
- private static final int MAX_STARS = 5;
-
- private final Drawable mStarDrawable;
- private final int mColorGray;
- private final int mColorHighlight;
-
- private float rating;
-
- public RatingView(Context context) {
- this(context, null);
- }
-
- public RatingView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public RatingView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mStarDrawable = getResources().getDrawable(R.drawable.ic_star_rating, null);
- mColorGray = 0x1E000000;
- mColorHighlight = 0x8A000000;
- }
-
- public void setRating(float rating) {
- this.rating = Math.min(Math.max(rating, 0), MAX_STARS);
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- drawStars(canvas, MAX_STARS, mColorGray);
- drawStars(canvas, rating, mColorHighlight);
- }
-
- private void drawStars(Canvas canvas, float stars, int color) {
- int fullWidth = getLayoutParams().width;
- int cellWidth = fullWidth / MAX_STARS;
- int starWidth = (int) (cellWidth * WIDTH_FACTOR);
- int padding = cellWidth - starWidth;
- int fullStars = (int) stars;
- float partialStarFactor = stars - fullStars;
-
- for (int i = 0; i < fullStars; i++) {
- int x = i * cellWidth + padding;
- Drawable star = mStarDrawable.getConstantState().newDrawable().mutate();
- star.setTint(color);
- star.setBounds(x, padding, x + starWidth, padding + starWidth);
- star.draw(canvas);
- }
- if (partialStarFactor > 0f) {
- int x = fullStars * cellWidth + padding;
- ClipDrawable star = new ClipDrawable(mStarDrawable,
- Gravity.LEFT, ClipDrawable.HORIZONTAL);
- star.setTint(color);
- star.setLevel((int) (MAX_LEVEL * partialStarFactor));
- star.setBounds(x, padding, x + starWidth, padding + starWidth);
- star.draw(canvas);
- }
- }
-}
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 93a5679..677694f 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -366,6 +366,16 @@
}
@Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ ev.offsetLocation(getTranslationX(), 0);
+ try {
+ return super.dispatchTouchEvent(ev);
+ } finally {
+ ev.offsetLocation(-getTranslationX(), 0);
+ }
+ }
+
+ @Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new LayoutParams(getContext(), attrs);
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java b/src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java
deleted file mode 100644
index d76998a..0000000
--- a/src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-package com.android.launcher3.pageindicators;
-
-import static com.android.launcher3.LauncherState.ALL_APPS;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup.MarginLayoutParams;
-import android.widget.FrameLayout;
-
-import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.Insettable;
-import com.android.launcher3.Launcher;
-import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
-
-/**
- * Simply draws the caret drawable bottom-right aligned in the view. This ensures that we can have
- * a view with as large an area as we want (for touching) while maintaining a caret of size
- * all_apps_caret_size. Used only for the landscape layout.
- */
-public class PageIndicatorLandscape extends PageIndicator implements OnClickListener, Insettable {
- // all apps pull up handle drawable.
-
- private final Launcher mLauncher;
-
- public PageIndicatorLandscape(Context context) {
- this(context, null);
- }
-
- public PageIndicatorLandscape(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public PageIndicatorLandscape(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- setOnClickListener(this);
- mLauncher = Launcher.getLauncher(context);
- setOnFocusChangeListener(mLauncher.mFocusHandler);
- }
-
- @Override
- public void onClick(View view) {
- Launcher l = Launcher.getLauncher(getContext());
- if (!l.isInState(ALL_APPS)) {
- l.getUserEventDispatcher().logActionOnControl(
- Action.Touch.TAP, ControlType.ALL_APPS_BUTTON);
- l.getStateManager().goToState(ALL_APPS);
- }
- }
-
- @Override
- public void setInsets(Rect insets) {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
- DeviceProfile grid = mLauncher.getDeviceProfile();
- if (insets.left > insets.right) {
- lp.leftMargin = grid.hotseatBarSidePaddingPx;
- lp.rightMargin = insets.right;
- lp.gravity = Gravity.RIGHT | Gravity.BOTTOM;
- } else {
- lp.leftMargin = insets.left;
- lp.rightMargin = grid.hotseatBarSidePaddingPx;
- lp.gravity = Gravity.LEFT | Gravity.BOTTOM;
- }
- lp.bottomMargin = grid.workspacePadding.bottom;
- setLayoutParams(lp);
- }
-}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorLine.java b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
similarity index 66%
rename from src/com/android/launcher3/pageindicators/PageIndicatorLine.java
rename to src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
index 8c9642c..f3b0d61 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorLine.java
+++ b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
@@ -1,5 +1,9 @@
package com.android.launcher3.pageindicators;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+
+import static com.android.launcher3.LauncherState.ALL_APPS;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -15,6 +19,8 @@
import android.util.AttributeSet;
import android.util.Property;
import android.view.Gravity;
+import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.widget.FrameLayout;
@@ -24,13 +30,17 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.dynamicui.WallpaperColorInfo;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
/**
- * A PageIndicator that briefly shows a fraction of a line when moving between pages.
+ * A PageIndicator that briefly shows a fraction of a line when moving between pages in
+ * portrait mode. In Landscape simply draws the caret drawable bottom-corner aligned in
+ * the drag-layer.
*
* The fraction is 1 / number of pages and the position is based on the progress of the page scroll.
*/
-public class PageIndicatorLine extends PageIndicator implements Insettable {
+public class WorkspacePageIndicator extends PageIndicator implements Insettable, OnClickListener {
private static final int LINE_ANIMATE_DURATION = ViewConfiguration.getScrollBarFadeDuration();
private static final int LINE_FADE_DELAY = ViewConfiguration.getScrollDefaultDelay();
@@ -59,59 +69,61 @@
private Paint mLinePaint;
private final int mLineHeight;
- private static final Property<PageIndicatorLine, Integer> PAINT_ALPHA
- = new Property<PageIndicatorLine, Integer>(Integer.class, "paint_alpha") {
+ private boolean mIsLandscapeUi;
+
+ private static final Property<WorkspacePageIndicator, Integer> PAINT_ALPHA
+ = new Property<WorkspacePageIndicator, Integer>(Integer.class, "paint_alpha") {
@Override
- public Integer get(PageIndicatorLine obj) {
+ public Integer get(WorkspacePageIndicator obj) {
return obj.mLinePaint.getAlpha();
}
@Override
- public void set(PageIndicatorLine obj, Integer alpha) {
+ public void set(WorkspacePageIndicator obj, Integer alpha) {
obj.mLinePaint.setAlpha(alpha);
- obj.invalidate();
+ obj.invalidateIfPortrait();
}
};
- private static final Property<PageIndicatorLine, Float> NUM_PAGES
- = new Property<PageIndicatorLine, Float>(Float.class, "num_pages") {
+ private static final Property<WorkspacePageIndicator, Float> NUM_PAGES
+ = new Property<WorkspacePageIndicator, Float>(Float.class, "num_pages") {
@Override
- public Float get(PageIndicatorLine obj) {
+ public Float get(WorkspacePageIndicator obj) {
return obj.mNumPagesFloat;
}
@Override
- public void set(PageIndicatorLine obj, Float numPages) {
+ public void set(WorkspacePageIndicator obj, Float numPages) {
obj.mNumPagesFloat = numPages;
- obj.invalidate();
+ obj.invalidateIfPortrait();
}
};
- private static final Property<PageIndicatorLine, Integer> TOTAL_SCROLL
- = new Property<PageIndicatorLine, Integer>(Integer.class, "total_scroll") {
+ private static final Property<WorkspacePageIndicator, Integer> TOTAL_SCROLL
+ = new Property<WorkspacePageIndicator, Integer>(Integer.class, "total_scroll") {
@Override
- public Integer get(PageIndicatorLine obj) {
+ public Integer get(WorkspacePageIndicator obj) {
return obj.mTotalScroll;
}
@Override
- public void set(PageIndicatorLine obj, Integer totalScroll) {
+ public void set(WorkspacePageIndicator obj, Integer totalScroll) {
obj.mTotalScroll = totalScroll;
- obj.invalidate();
+ obj.invalidateIfPortrait();
}
};
private Runnable mHideLineRunnable = () -> animateLineToAlpha(0);
- public PageIndicatorLine(Context context) {
+ public WorkspacePageIndicator(Context context) {
this(context, null);
}
- public PageIndicatorLine(Context context, AttributeSet attrs) {
+ public WorkspacePageIndicator(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public PageIndicatorLine(Context context, AttributeSet attrs, int defStyle) {
+ public WorkspacePageIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
Resources res = context.getResources();
@@ -128,7 +140,7 @@
@Override
protected void onDraw(Canvas canvas) {
- if (mTotalScroll == 0 || mNumPagesFloat == 0) {
+ if (mTotalScroll == 0 || mNumPagesFloat == 0 || mIsLandscapeUi) {
return;
}
@@ -155,7 +167,7 @@
} else if (mTotalScroll != totalScroll) {
animateToTotalScroll(totalScroll);
} else {
- invalidate();
+ invalidateIfPortrait();
}
if (mShouldAutoHide) {
@@ -233,10 +245,53 @@
@Override
public void setInsets(Rect insets) {
DeviceProfile grid = mLauncher.getDeviceProfile();
+ mIsLandscapeUi = grid.isVerticalBarLayout();
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
- lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
- lp.height = grid.pageIndicatorSizePx;
- lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom;
+
+ if (mIsLandscapeUi) {
+ if (insets.left > insets.right) {
+ lp.leftMargin = grid.hotseatBarSidePaddingPx;
+ lp.rightMargin = insets.right;
+ lp.gravity = Gravity.RIGHT | Gravity.BOTTOM;
+ } else {
+ lp.leftMargin = insets.left;
+ lp.rightMargin = grid.hotseatBarSidePaddingPx;
+ lp.gravity = Gravity.LEFT | Gravity.BOTTOM;
+ }
+ lp.bottomMargin = grid.workspacePadding.bottom;
+ lp.width = lp.height = getResources()
+ .getDimensionPixelSize(R.dimen.dynamic_grid_min_page_indicator_size);
+
+ setBackgroundResource(R.drawable.all_apps_handle_landscape);
+ setOnFocusChangeListener(mLauncher.mFocusHandler);
+ setOnClickListener(this);
+
+ } else {
+ lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
+ lp.height = grid.pageIndicatorSizePx;
+ lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom;
+ lp.width = MATCH_PARENT;
+
+ setBackgroundResource(0);
+ setOnFocusChangeListener(null);
+ setOnClickListener(null);
+ }
+
setLayoutParams(lp);
}
+
+ private void invalidateIfPortrait() {
+ if (!mIsLandscapeUi) {
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (!mLauncher.isInState(ALL_APPS)) {
+ mLauncher.getUserEventDispatcher().logActionOnControl(
+ Action.Touch.TAP, ControlType.ALL_APPS_BUTTON);
+ mLauncher.getStateManager().goToState(ALL_APPS);
+ }
+ }
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index f90abb4..b3ef7bb 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -62,6 +62,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
+import com.android.launcher3.anim.RevealOutlineAnimation;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.badge.BadgeInfo;
import com.android.launcher3.dragndrop.DragController;
@@ -810,10 +811,10 @@
return;
}
mEndRect.setEmpty();
+ if (getOutlineProvider() instanceof RevealOutlineAnimation) {
+ ((RevealOutlineAnimation) getOutlineProvider()).getOutline(mEndRect);
+ }
if (mOpenCloseAnimator != null) {
- Outline outline = new Outline();
- getOutlineProvider().getOutline(this, outline);
- outline.getRect(mEndRect);
mOpenCloseAnimator.cancel();
}
mIsOpen = false;
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 83cbf59..d2bcd18 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -82,7 +82,7 @@
@Override
public void onClick(View view) {
Rect sourceBounds = launcher.getViewBounds(view);
- Bundle opts = launcher.getActivityLaunchOptions(view, true);
+ Bundle opts = launcher.getActivityLaunchOptions(view, false);
InfoDropTarget.startDetailsActivityForInfo(itemInfo, launcher, sourceBounds, opts);
launcher.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view);
@@ -115,8 +115,8 @@
public View.OnClickListener createOnClickListener(Launcher launcher, ItemInfo itemInfo) {
return view -> {
- Intent intent = PackageManagerHelper.getMarketIntent(itemInfo
- .getTargetComponent().getPackageName());
+ Intent intent = new PackageManagerHelper(view.getContext()).getMarketIntent(
+ itemInfo.getTargetComponent().getPackageName());
launcher.startActivitySafely(view, intent, itemInfo);
AbstractFloatingView.closeAllOpenViews(launcher);
};
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 13034dd..81df153 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -143,13 +143,15 @@
return false;
}
- public static Intent getMarketIntent(String packageName) {
+ public Intent getMarketIntent(String packageName) {
return new Intent(Intent.ACTION_VIEW)
.setData(new Uri.Builder()
.scheme("market")
.authority("details")
.appendQueryParameter("id", packageName)
- .build());
+ .build())
+ .putExtra(Intent.EXTRA_REFERRER, new Uri.Builder().scheme("android-app")
+ .authority(mContext.getPackageName()).build());
}
/**
diff --git a/src/com/android/launcher3/views/AllAppsScrim.java b/src/com/android/launcher3/views/AllAppsScrim.java
index 5d39adb..662f99c 100644
--- a/src/com/android/launcher3/views/AllAppsScrim.java
+++ b/src/com/android/launcher3/views/AllAppsScrim.java
@@ -23,6 +23,7 @@
import android.graphics.Rect;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
+import android.util.Property;
import android.view.View;
import com.android.launcher3.DeviceProfile;
@@ -46,6 +47,7 @@
protected final WallpaperColorInfo mWallpaperColorInfo;
private final Paint mFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ private final Rect mDrawRect = new Rect();
private final Rect mPadding = new Rect();
private final Rect mInsets = new Rect();
private final DeviceProfile mGrid;
@@ -62,7 +64,7 @@
private int mFillAlpha;
private float mDrawHeight;
- private float mTranslateY;
+ private float mDrawOffsetY;
public AllAppsScrim(Context context) {
this(context, null);
@@ -108,6 +110,10 @@
return result;
}
+ public Bitmap getShadowBitmap() {
+ return mShadowBitmap;
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -135,7 +141,7 @@
@Override
protected void onDraw(Canvas canvas) {
- float edgeTop = getHeight() + mTranslateY - mDrawHeight + mPadding.top;
+ float edgeTop = getHeight() + mDrawOffsetY - mDrawHeight + mPadding.top;
float edgeRight = getWidth() - mPadding.right;
if (mPadding.left > 0 || mPadding.right > 0) {
@@ -153,12 +159,29 @@
}
public void setProgress(float translateY, float alpha) {
- mFillAlpha = Math.round(alpha * mAlphaRange + mMinAlpha);
- mFillPaint.setAlpha(mFillAlpha);
+ int newAlpha = Math.round(alpha * mAlphaRange + mMinAlpha);
+ // Negative translation means the scrim is moving up. For negative translation, we change
+ // draw offset as it requires redraw (since more area of the scrim needs to be shown). For
+ // position translation, we simply translate the scrim down as it avoids invalidate and
+ // hence could be optimized by the platform.
+ float drawOffsetY = Math.min(translateY, 0);
- mTranslateY = translateY;
+ if (newAlpha != mFillAlpha || drawOffsetY != mDrawOffsetY) {
+ invalidateDrawRect();
- invalidate();
+ mFillAlpha = newAlpha;
+ mFillPaint.setAlpha(mFillAlpha);
+ mDrawOffsetY = drawOffsetY;
+ invalidateDrawRect();
+ }
+
+ setTranslationY(Math.max(translateY, 0));
+ }
+
+ private void invalidateDrawRect() {
+ mDrawRect.top = (int) (getHeight()
+ + mDrawOffsetY - mDrawHeight + mPadding.top - mShadowBlur - 0.5f);
+ invalidate(mDrawRect);
}
public void setDrawRegion(float height) {
@@ -178,6 +201,24 @@
float scrimMargin = getResources().getDimension(R.dimen.all_apps_scrim_margin);
setDrawRegion(mGrid.hotseatBarSizePx + insets.bottom + scrimMargin);
}
+ updateDrawRect();
invalidate();
}
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ updateDrawRect();
+ }
+
+ private void updateDrawRect() {
+ mDrawRect.bottom = getHeight();
+ if (mGrid.isVerticalBarLayout()) {
+ mDrawRect.left = (int) (mPadding.left - mShadowBlur - 0.5f);
+ mDrawRect.right = (int) (getWidth() - mPadding.right + 0.5f);
+ } else {
+ mDrawRect.left = 0;
+ mDrawRect.right = getWidth();
+ }
+ }
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
index 24236d8..fd33ee1 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/AllAppsState.java
@@ -62,6 +62,11 @@
}
@Override
+ public float getHoseatAlpha(Launcher launcher) {
+ return 0;
+ }
+
+ @Override
public View getFinalFocus(Launcher launcher) {
return launcher.getAppsView();
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
index 9a09c97..2d39505 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
@@ -37,6 +37,7 @@
import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter;
import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter;
import com.android.launcher3.anim.AnimatorSetBuilder;
+import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.widget.WidgetsFullSheet;
@@ -173,8 +174,7 @@
}
private void setState(LauncherState state, PropertySetter setter) {
- float hotseatAlpha = state.getHoseatAlpha(mLauncher);
- setter.setViewAlpha(null, this, 1f - hotseatAlpha);
+ setter.setViewAlpha(this, 1f - state.getHoseatAlpha(mLauncher), Interpolators.ACCEL);
}
public static int getButtonBarHeight(Launcher launcher) {
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 9819d71..c857bf6 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -18,20 +18,15 @@
import static com.android.launcher3.LauncherState.OVERVIEW;
-import android.app.ActivityOptions;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
+import android.graphics.PointF;
import android.os.Bundle;
import android.view.View;
import android.view.View.AccessibilityDelegate;
-import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
-import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.util.TouchController;
@@ -54,7 +49,7 @@
launcher.getAllAppsController(), launcher.getWorkspace() };
}
- public static void onWorkspaceLongPress(Launcher launcher) {
+ public static void onWorkspaceLongPress(Launcher launcher, PointF touchPoint) {
launcher.getStateManager().goToState(OVERVIEW);
}
@@ -70,4 +65,6 @@
public static Bundle getActivityLaunchOptions(Launcher launcher, View v) {
return launcher.getDefaultActivityLaunchOptions(v);
}
+
+ public static void registerRemoteAnimations(Launcher launcher) { }
}