summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-11-08 17:43:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-11-08 17:43:12 +0000
commit4d52411cea344ca3cdbf525c21696cf7e4193063 (patch)
tree5efbe478a2db5bc1f8431ac6a963974777e8cec3
parenta783400823349d3e535333585b89dcb2070e929a (diff)
parentc4fa8c312b98401f456a44067f87eff511162e2a (diff)
downloadandroid_packages_apps_Trebuchet-4d52411cea344ca3cdbf525c21696cf7e4193063.tar.gz
android_packages_apps_Trebuchet-4d52411cea344ca3cdbf525c21696cf7e4193063.tar.bz2
android_packages_apps_Trebuchet-4d52411cea344ca3cdbf525c21696cf7e4193063.zip
Merge "Changing the state UI logic for normal build and quickStep build" into ub-launcher3-master
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/OverviewState.java9
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java53
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/UiFactory.java7
-rw-r--r--quickstep/src/com/android/quickstep/RecentsView.java24
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/LauncherState.java7
-rw-r--r--src/com/android/launcher3/LauncherStateManager.java41
-rw-r--r--src/com/android/launcher3/Workspace.java4
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java17
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java34
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java34
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/OverviewState.java2
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java7
13 files changed, 187 insertions, 58 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 51a8a5e83..9bdd7a384 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -16,16 +16,11 @@
package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-import static com.android.launcher3.Utilities.isAccessibilityEnabled;
-import android.graphics.Rect;
import android.view.View;
-import android.view.accessibility.AccessibilityNodeInfo;
-import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.RecentsView;
@@ -37,7 +32,7 @@ public class OverviewState extends LauncherState {
// The percent to shrink the workspace during overview mode
public static final float SCALE_FACTOR = 0.7f;
- private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE | FLAG_HIDE_HOTSEAT;
+ private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE;
public OverviewState(int id) {
super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, 1f, STATE_FLAGS);
@@ -46,7 +41,7 @@ public class OverviewState extends LauncherState {
@Override
public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
// TODO: Find a better transition
- return new float[] {SCALE_FACTOR, 0};
+ return new float[] {0f, 0};
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
new file mode 100644
index 000000000..da1eff974
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.uioverrides;
+
+import static com.android.launcher3.WorkspaceStateTransitionAnimation.NO_ANIM_PROPERTY_SETTER;
+
+import android.animation.AnimatorSet;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager.AnimationConfig;
+import com.android.launcher3.LauncherStateManager.StateHandler;
+import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter;
+import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter;
+import com.android.launcher3.anim.AnimationLayerSet;
+
+public class RecentsViewStateController implements StateHandler {
+
+ private final Launcher mLauncher;
+
+ public RecentsViewStateController(Launcher launcher) {
+ mLauncher = launcher;
+ }
+
+ @Override
+ public void setState(LauncherState state) {
+ setState(state, NO_ANIM_PROPERTY_SETTER);
+ }
+
+ @Override
+ public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
+ AnimatorSet anim, AnimationConfig config) {
+ setState(toState, new AnimatedPropertySetter(config.duration, layerViews, anim));
+ }
+
+ private void setState(LauncherState state, PropertySetter setter) {
+ setter.setViewAlpha(null, mLauncher.getOverviewPanel(),
+ state == LauncherState.OVERVIEW ? 1 : 0);
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 540b20041..c490c3fa7 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides;
import android.view.View.AccessibilityDelegate;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.VerticalSwipeController;
import com.android.launcher3.util.TouchController;
@@ -31,4 +32,10 @@ public class UiFactory {
public static AccessibilityDelegate newPageIndicatorAccessibilityDelegate() {
return null;
}
+
+ public static StateHandler[] getStateHandler(Launcher launcher) {
+ return new StateHandler[] {
+ launcher.getAllAppsController(), launcher.getWorkspace(),
+ new RecentsViewStateController(launcher)};
+ }
}
diff --git a/quickstep/src/com/android/quickstep/RecentsView.java b/quickstep/src/com/android/quickstep/RecentsView.java
index e474ecba1..d85de8f40 100644
--- a/quickstep/src/com/android/quickstep/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/RecentsView.java
@@ -17,13 +17,19 @@
package com.android.quickstep;
import android.content.Context;
+import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.HorizontalScrollView;
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Insettable;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
+
/**
* A placeholder view for recents
*/
-public class RecentsView extends HorizontalScrollView {
+public class RecentsView extends HorizontalScrollView implements Insettable {
public RecentsView(Context context) {
this(context, null);
}
@@ -35,7 +41,23 @@ public class RecentsView extends HorizontalScrollView {
public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setAlpha(0);
+ setVisibility(INVISIBLE);
}
public void setViewVisible(boolean isVisible) { }
+
+ @Override
+ public void setInsets(Rect insets) {
+ MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
+ lp.topMargin = insets.top;
+ lp.bottomMargin = insets.bottom;
+ lp.leftMargin = insets.left;
+ lp.rightMargin = insets.right;
+
+ DeviceProfile dp = Launcher.getLauncher(getContext()).getDeviceProfile();
+ if (!dp.isVerticalBarLayout()) {
+ lp.bottomMargin += dp.hotseatBarSizePx + getResources().getDimensionPixelSize(
+ R.dimen.dynamic_grid_min_page_indicator_size);
+ }
+ }
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 75968ae2b..fa4a1c843 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -339,7 +339,7 @@ public class Launcher extends BaseActivity
mDragController = new DragController(this);
mAllAppsController = new AllAppsTransitionController(this);
- mStateManager = new LauncherStateManager(this, mAllAppsController);
+ mStateManager = new LauncherStateManager(this);
mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);
@@ -1287,6 +1287,10 @@ public class Launcher extends BaseActivity
}
}
+ public AllAppsTransitionController getAllAppsController() {
+ return mAllAppsController;
+ }
+
public DragLayer getDragLayer() {
return mDragLayer;
}
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index bb09a9f86..d6cd8a35c 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -36,9 +36,8 @@ public class LauncherState {
protected static final int FLAG_SHOW_SCRIM = 1 << 0;
protected static final int FLAG_MULTI_PAGE = 1 << 1;
- protected static final int FLAG_HIDE_HOTSEAT = 1 << 2;
- protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 3;
- protected static final int FLAG_DO_NOT_RESTORE = 1 << 4;
+ protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 2;
+ protected static final int FLAG_DO_NOT_RESTORE = 1 << 3;
private static final LauncherState[] sAllStates = new LauncherState[4];
@@ -80,7 +79,6 @@ public class LauncherState {
* @see WorkspaceStateTransitionAnimation
*/
public final boolean hasScrim;
- public final boolean hideHotseat;
public final int transitionDuration;
/**
@@ -97,7 +95,6 @@ public class LauncherState {
this.hasScrim = (flags & FLAG_SHOW_SCRIM) != 0;
this.hasMultipleVisiblePages = (flags & FLAG_MULTI_PAGE) != 0;
- this.hideHotseat = (flags & FLAG_HIDE_HOTSEAT) != 0;
this.workspaceAccessibilityFlag = (flags & FLAG_DISABLE_ACCESSIBILITY) != 0
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: IMPORTANT_FOR_ACCESSIBILITY_AUTO;
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index b99df717a..f016e8d2e 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -29,6 +29,7 @@ import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.uioverrides.UiFactory;
/**
* TODO: figure out what kind of tests we can write for this
@@ -78,21 +79,26 @@ public class LauncherStateManager {
private final AnimationConfig mConfig = new AnimationConfig();
private final Handler mUiHandler;
private final Launcher mLauncher;
- private final AllAppsTransitionController mAllAppsController;
+ private StateHandler[] mStateHandlers;
private LauncherState mState = NORMAL;
- public LauncherStateManager(
- Launcher l, AllAppsTransitionController allAppsController) {
+ public LauncherStateManager(Launcher l) {
mUiHandler = new Handler(Looper.getMainLooper());
mLauncher = l;
- mAllAppsController = allAppsController;
}
public LauncherState getState() {
return mState;
}
+ private StateHandler[] getStateHandlers() {
+ if (mStateHandlers == null) {
+ mStateHandlers = UiFactory.getStateHandler(mLauncher);
+ }
+ return mStateHandlers;
+ }
+
/**
* @see #goToState(LauncherState, boolean, Runnable)
*/
@@ -148,8 +154,9 @@ public class LauncherStateManager {
if (!animated) {
setState(state);
- mAllAppsController.setFinalProgress(state.verticalProgress);
- mLauncher.getWorkspace().setState(state);
+ for (StateHandler handler : getStateHandlers()) {
+ handler.setState(state);
+ }
mLauncher.getUserEventDispatcher().resetElapsedContainerMillis();
// Run any queued runnable
@@ -190,14 +197,12 @@ public class LauncherStateManager {
protected AnimatorSet createAnimationToNewWorkspaceInternal(final LauncherState state,
final Runnable onCompleteRunnable) {
-
final AnimatorSet animation = LauncherAnimUtils.createAnimatorSet();
final AnimationLayerSet layerViews = new AnimationLayerSet();
- mAllAppsController.animateToFinalProgress(state.verticalProgress, animation, mConfig);
- mLauncher.getWorkspace().setStateWithAnimation(state,
- layerViews, animation, mConfig);
-
+ for (StateHandler handler : getStateHandlers()) {
+ handler.setStateWithAnimation(state, layerViews, animation, mConfig);
+ }
animation.addListener(layerViews);
animation.addListener(new AnimationSuccessListener() {
@@ -285,4 +290,18 @@ public class LauncherStateManager {
mCurrentAnimation.addListener(this);
}
}
+
+ public interface StateHandler {
+
+ /**
+ * Updates the UI to {@param state} without any animations
+ */
+ void setState(LauncherState state);
+
+ /**
+ * Sets the UI to {@param state} by animating any changes.
+ */
+ void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
+ AnimatorSet anim, AnimationConfig config);
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index daa9bd011..685dcee4f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -105,7 +105,7 @@ import java.util.Set;
public class Workspace extends PagedView
implements DropTarget, DragSource, View.OnTouchListener,
DragController.DragListener, ViewGroup.OnHierarchyChangeListener,
- Insettable {
+ Insettable, LauncherStateManager.StateHandler {
private static final String TAG = "Launcher.Workspace";
/** The value that {@link #mTransitionProgress} must be greater than for
@@ -1558,6 +1558,7 @@ public class Workspace extends PagedView
/**
* Sets the current workspace {@link LauncherState} and updates the UI without any animations
*/
+ @Override
public void setState(LauncherState toState) {
onStartStateTransition(toState);
mStateTransitionAnimation.setState(toState);
@@ -1567,6 +1568,7 @@ public class Workspace extends PagedView
/**
* Sets the current workspace {@link LauncherState}, then animates the UI
*/
+ @Override
public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
AnimatorSet anim, AnimationConfig config) {
StateTransitionListener listener = new StateTransitionListener(toState);
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index e14461e85..8edec40d2 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -90,7 +90,7 @@ class AlphaUpdateListener extends AnimatorListenerAdapter implements ValueAnimat
*/
public class WorkspaceStateTransitionAnimation {
- private static final PropertySetter NO_ANIM_PROPERTY_SETTER = new PropertySetter();
+ public static final PropertySetter NO_ANIM_PROPERTY_SETTER = new PropertySetter();
public final int mWorkspaceScrimAlpha;
@@ -141,14 +141,6 @@ public class WorkspaceStateTransitionAnimation {
propertySetter);
}
- float finalHotseatAlpha = state.hideHotseat ? 0f : 1f;
-
- // This is true when transitioning between:
- // - Overview <-> Workspace
- propertySetter.setViewAlpha(null, mLauncher.getOverviewPanel(), 1 - finalHotseatAlpha);
- propertySetter.setViewAlpha(mWorkspace.createHotseatAlphaAnimator(finalHotseatAlpha),
- mLauncher.getHotseat(), finalHotseatAlpha);
-
propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, Interpolators.ZOOM_IN);
propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y,
finalWorkspaceTranslationY, Interpolators.ZOOM_IN);
@@ -176,7 +168,7 @@ public class WorkspaceStateTransitionAnimation {
}
}
- private static class PropertySetter {
+ public static class PropertySetter {
public void setViewAlpha(Animator anim, View view, float alpha) {
if (anim != null) {
@@ -204,13 +196,14 @@ public class WorkspaceStateTransitionAnimation {
}
}
- private static class AnimatedPropertySetter extends PropertySetter {
+ public static class AnimatedPropertySetter extends PropertySetter {
private final long mDuration;
private final AnimationLayerSet mLayerViews;
private final AnimatorSet mStateAnimator;
- AnimatedPropertySetter(long duration, AnimationLayerSet layerView, AnimatorSet anim) {
+ public AnimatedPropertySetter(
+ long duration, AnimationLayerSet layerView, AnimatorSet anim) {
mDuration = duration;
mLayerViews = layerView;
mStateAnimator = anim;
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 9b6404342..eb2670426 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -15,10 +15,12 @@ import android.view.animation.Interpolator;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
+import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.graphics.GradientView;
@@ -35,7 +37,8 @@ import com.android.launcher3.util.Themes;
* If release velocity < THRES1, snap according to either top or bottom depending on whether it's
* closer to top or closer to the page indicator.
*/
-public class AllAppsTransitionController implements SearchUiManager.OnScrollRangeChangeListener {
+public class AllAppsTransitionController
+ implements SearchUiManager.OnScrollRangeChangeListener, LauncherStateManager.StateHandler {
private static final Property<AllAppsTransitionController, Float> PROGRESS =
new Property<AllAppsTransitionController, Float>(Float.class, "progress") {
@@ -122,8 +125,8 @@ public class AllAppsTransitionController implements SearchUiManager.OnScrollRang
*
* @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace
*
- * @see #setFinalProgress(float)
- * @see #animateToFinalProgress(float, AnimatorSet, AnimationConfig)
+ * @see #setState(LauncherState)
+ * @see #setStateWithAnimation(LauncherState, AnimationLayerSet, AnimatorSet, AnimationConfig)
*/
public void setProgress(float progress) {
mProgress = progress;
@@ -161,33 +164,32 @@ public class AllAppsTransitionController implements SearchUiManager.OnScrollRang
}
/**
- * Sets the vertical transition progress to {@param progress} and updates all the dependent UI
+ * Sets the vertical transition progress to {@param state} and updates all the dependent UI
* accordingly.
*/
- public void setFinalProgress(float progress) {
- setProgress(progress);
+ @Override
+ public void setState(LauncherState state) {
+ setProgress(state.verticalProgress);
onProgressAnimationEnd();
}
/**
* Creates an animation which updates the vertical transition progress and updates all the
* dependent UI using various animation events
- *
- * @param progress the final vertical progress at the end of the animation
- * @param animationOut the target AnimatorSet where this animation should be added
- * @param outConfig an in/out configuration which can be shared with other animations
*/
- public void animateToFinalProgress(
- float progress, AnimatorSet animationOut, AnimationConfig outConfig) {
- if (Float.compare(mProgress, progress) == 0) {
+ @Override
+ public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
+ AnimatorSet animationOut, AnimationConfig config) {
+ if (Float.compare(mProgress, toState.verticalProgress) == 0) {
// Fail fast
onProgressAnimationEnd();
return;
}
- Interpolator interpolator = outConfig.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
- ObjectAnimator anim = ObjectAnimator.ofFloat(this, PROGRESS, mProgress, progress);
- anim.setDuration(outConfig.duration);
+ Interpolator interpolator = config.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
+ ObjectAnimator anim = ObjectAnimator.ofFloat(
+ this, PROGRESS, mProgress, toState.verticalProgress);
+ anim.setDuration(config.duration);
anim.setInterpolator(interpolator);
anim.addListener(new AnimationSuccessListener() {
@Override
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
index 1fb56e74f..3ce101414 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewPanel.java
@@ -15,12 +15,14 @@
*/
package com.android.launcher3.uioverrides;
+import static com.android.launcher3.WorkspaceStateTransitionAnimation.NO_ANIM_PROPERTY_SETTER;
+
+import android.animation.AnimatorSet;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Rect;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -28,14 +30,20 @@ import android.widget.Toast;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager;
+import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter;
+import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter;
+import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.widget.WidgetsFullSheet;
public class OverviewPanel extends LinearLayout implements Insettable, View.OnClickListener,
- View.OnLongClickListener {
+ View.OnLongClickListener, LauncherStateManager.StateHandler {
// Out of 100, the percent of space the overview bar should try and take vertically.
private static final float OVERVIEW_ICON_ZONE_RATIO = 0.22f;
@@ -154,10 +162,30 @@ public class OverviewPanel extends LinearLayout implements Insettable, View.OnCl
getContext().startActivity(intent, mLauncher.getActivityLaunchOptions(v));
}
+ @Override
+ public void setState(LauncherState state) {
+ setState(state, NO_ANIM_PROPERTY_SETTER);
+ }
+
+ @Override
+ public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
+ AnimatorSet anim, AnimationConfig config) {
+ setState(toState, new AnimatedPropertySetter(config.duration, layerViews, anim));
+ }
+
+ private void setState(LauncherState state, PropertySetter setter) {
+ boolean isOverview = state == LauncherState.OVERVIEW;
+ float finalHotseatAlpha = isOverview ? 0 : 1;
+
+ setter.setViewAlpha(null, this, isOverview ? 1 : 0);
+ setter.setViewAlpha(
+ mLauncher.getWorkspace().createHotseatAlphaAnimator(finalHotseatAlpha),
+ mLauncher.getHotseat(), finalHotseatAlpha);
+ }
public static int getButtonBarHeight(Launcher launcher) {
int zoneHeight = (int) (OVERVIEW_ICON_ZONE_RATIO *
- launcher.getDeviceProfile().availableWidthPx);
+ launcher.getDeviceProfile().availableHeightPx);
Resources res = launcher.getResources();
int overviewModeMinIconZoneHeightPx =
res.getDimensionPixelSize(R.dimen.dynamic_grid_overview_min_icon_zone_height);
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewState.java
index 9e2ad982f..c339634f2 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/OverviewState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/OverviewState.java
@@ -36,7 +36,7 @@ public class OverviewState extends LauncherState {
// The percent to shrink the workspace during overview mode
public static final float SCALE_FACTOR = 0.7f;
- private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE | FLAG_HIDE_HOTSEAT;
+ private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE;
public OverviewState(int id) {
super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, 1f, STATE_FLAGS);
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 6776150c9..8521334fc 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides;
import android.view.View.AccessibilityDelegate;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.VerticalSwipeController;
import com.android.launcher3.util.TouchController;
@@ -32,4 +33,10 @@ public class UiFactory {
public static AccessibilityDelegate newPageIndicatorAccessibilityDelegate() {
return new OverviewAccessibilityDelegate();
}
+
+ public static StateHandler[] getStateHandler(Launcher launcher) {
+ return new StateHandler[] {
+ (OverviewPanel) launcher.getOverviewPanel(),
+ launcher.getAllAppsController(), launcher.getWorkspace() };
+ }
}