summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-05-22 23:08:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-05-22 23:08:42 +0000
commit5454fa1f6e53a7babb8300954786aa11f24fe917 (patch)
treee8d17894e9ac21905e203afcbe89d31ef74a8d89
parent36b2fca3bd855ba6cdc4e73b320d5e431956145f (diff)
parent56e1019e95a502fbc8144a6ba651095c0e12def1 (diff)
downloadandroid_packages_apps_Trebuchet-5454fa1f6e53a7babb8300954786aa11f24fe917.tar.gz
android_packages_apps_Trebuchet-5454fa1f6e53a7babb8300954786aa11f24fe917.tar.bz2
android_packages_apps_Trebuchet-5454fa1f6e53a7babb8300954786aa11f24fe917.zip
Merge "Making caret visibility part of state definition" into ub-launcher3-edmonton
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/OverviewState.java4
-rw-r--r--quickstep/src/com/android/quickstep/views/LauncherRecentsView.java11
-rw-r--r--quickstep/src/com/android/quickstep/views/ShelfScrimView.java9
-rw-r--r--src/com/android/launcher3/LauncherState.java5
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java4
-rw-r--r--src/com/android/launcher3/views/ScrimView.java28
6 files changed, 46 insertions, 15 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 3a49294c5..0116a8e0e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -100,9 +100,9 @@ public class OverviewState extends LauncherState {
@Override
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
- return 0;
+ return VERTICAL_SWIPE_INDICATOR;
} else {
- return HOTSEAT_SEARCH_BOX |
+ return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR |
(launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
}
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 950f7fb99..5aca4f326 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -35,6 +35,9 @@ import android.view.ViewDebug;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.R;
+import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.views.ScrimView;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.LayoutUtils;
@@ -136,6 +139,12 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
}
anim.play(ObjectAnimator.ofFloat(
mActivity.getAllAppsController(), ALL_APPS_PROGRESS, allAppsProgressOffscreen));
+
+ ObjectAnimator dragHandleAnim = ObjectAnimator.ofInt(
+ mActivity.findViewById(R.id.scrim_view), ScrimView.DRAG_HANDLE_ALPHA, 0);
+ dragHandleAnim.setInterpolator(Interpolators.ACCEL_2);
+ anim.play(dragHandleAnim);
+
return anim;
}
@@ -150,7 +159,7 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
mActivity.getStateManager().goToState(NORMAL, false /* animate */);
} else {
LauncherState state = mActivity.getStateManager().getState();
- mActivity.getAllAppsController().setProgress(state.getVerticalProgress(mActivity));
+ mActivity.getAllAppsController().setState(state);
}
super.onTaskLaunched(success);
}
diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
index 24afd4868..aca8351a0 100644
--- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
+++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
@@ -154,15 +154,6 @@ public class ShelfScrimView extends ScrimView {
}
@Override
- protected void updateDragHandleAlpha() {
- if (mDrawingFlatColor) {
- super.updateDragHandleAlpha();
- } else if (mDragHandle != null) {
- mDragHandle.setAlpha(255);
- }
- }
-
- @Override
protected void onDraw(Canvas canvas) {
float translate = drawBackground(canvas);
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index fbe27b0ac..76681f280 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -51,6 +51,7 @@ public class LauncherState {
public static final int ALL_APPS_HEADER = 1 << 2;
public static final int ALL_APPS_HEADER_EXTRA = 1 << 3; // e.g. app predictions
public static final int ALL_APPS_CONTENT = 1 << 4;
+ public static final int VERTICAL_SWIPE_INDICATOR = 1 << 5;
protected static final int FLAG_MULTI_PAGE = 1 << 0;
protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 1;
@@ -201,9 +202,9 @@ public class LauncherState {
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
- return HOTSEAT_ICONS;
+ return HOTSEAT_ICONS | VERTICAL_SWIPE_INDICATOR;
}
- return HOTSEAT_ICONS | HOTSEAT_SEARCH_BOX;
+ return HOTSEAT_ICONS | HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR;
}
/**
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 2c3e3ee7b..ccd55863c 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -4,6 +4,7 @@ import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER;
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
@@ -198,6 +199,9 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, LINEAR);
setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, LINEAR);
mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter);
+
+ setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA,
+ (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, LINEAR);
}
public AnimatorListenerAdapter getProgressAnimatorListener() {
diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index ea05cdc5c..6e3ef0705 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -45,6 +45,7 @@ import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import android.support.v4.widget.ExploreByTouchHelper;
import android.util.AttributeSet;
+import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -73,6 +74,19 @@ import java.util.List;
public class ScrimView extends View implements Insettable, OnChangeListener,
AccessibilityStateChangeListener, StateListener {
+ public static final Property<ScrimView, Integer> DRAG_HANDLE_ALPHA =
+ new Property<ScrimView, Integer>(Integer.TYPE, "dragHandleAlpha") {
+
+ @Override
+ public Integer get(ScrimView scrimView) {
+ return scrimView.mDragHandleAlpha;
+ }
+
+ @Override
+ public void set(ScrimView scrimView, Integer value) {
+ scrimView.setDragHandleAlpha(value);
+ }
+ };
private static final int WALLPAPERS = R.string.wallpaper_button_text;
private static final int WIDGETS = R.string.widget_button_text;
private static final int SETTINGS = R.string.settings_button_text;
@@ -102,6 +116,8 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
@Nullable
protected Drawable mDragHandle;
+ private int mDragHandleAlpha = 255;
+
public ScrimView(Context context, AttributeSet attrs) {
super(context, attrs);
mLauncher = Launcher.getLauncher(context);
@@ -188,7 +204,17 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
protected void updateDragHandleAlpha() {
if (mDragHandle != null) {
- mDragHandle.setAlpha(Math.round(255 * Utilities.boundToRange(mProgress, 0, 1)));
+ mDragHandle.setAlpha(mDragHandleAlpha);
+ }
+ }
+
+ private void setDragHandleAlpha(int alpha) {
+ if (alpha != mDragHandleAlpha) {
+ mDragHandleAlpha = alpha;
+ if (mDragHandle != null) {
+ mDragHandle.setAlpha(mDragHandleAlpha);
+ invalidate();
+ }
}
}