diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-11-07 12:23:58 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-11-07 12:24:47 -0800 |
commit | c4fa8c312b98401f456a44067f87eff511162e2a (patch) | |
tree | b9d911b669d4cde7c9d9242476321deae030a805 /src_ui_overrides | |
parent | 16764588c9af2fe6222f76912567cf66b5a11d8a (diff) | |
download | android_packages_apps_Trebuchet-c4fa8c312b98401f456a44067f87eff511162e2a.tar.gz android_packages_apps_Trebuchet-c4fa8c312b98401f456a44067f87eff511162e2a.tar.bz2 android_packages_apps_Trebuchet-c4fa8c312b98401f456a44067f87eff511162e2a.zip |
Changing the state UI logic for normal build and quickStep build
> Creating ShareHandlers for managing UI
> In normal build, hotseat is hidden in overview, while in QuickStepBuild, it is visible
Change-Id: I5f8d35c75b861d912d93fce186b5dd74106184c3
Diffstat (limited to 'src_ui_overrides')
3 files changed, 39 insertions, 4 deletions
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() }; + } } |