Merge "Scale and translate hotseat with workspace instead of all apps" into ub-launcher3-master
This commit is contained in:
@@ -38,6 +38,15 @@
|
||||
android:theme="@style/HomeScreenElementTheme"
|
||||
launcher:pageIndicator="@+id/page_indicator" />
|
||||
|
||||
<!-- DO NOT CHANGE THE ID -->
|
||||
<com.android.launcher3.Hotseat
|
||||
android:id="@+id/hotseat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:theme="@style/HomeScreenElementTheme"
|
||||
android:importantForAccessibility="no"
|
||||
launcher:containerType="hotseat" />
|
||||
|
||||
<include
|
||||
android:id="@+id/overview_panel"
|
||||
layout="@layout/overview_panel"
|
||||
@@ -71,15 +80,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- DO NOT CHANGE THE ID -->
|
||||
<com.android.launcher3.Hotseat
|
||||
android:id="@+id/hotseat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:theme="@style/HomeScreenElementTheme"
|
||||
android:importantForAccessibility="no"
|
||||
launcher:containerType="hotseat" />
|
||||
|
||||
</com.android.launcher3.dragndrop.DragLayer>
|
||||
|
||||
</com.android.launcher3.LauncherRootView>
|
||||
|
||||
@@ -187,6 +187,13 @@ public class LauncherState {
|
||||
return new float[] {1, 0, 0};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether we should scale the hotseat as if it were part of the workspace.
|
||||
*/
|
||||
public boolean scaleHotseatWithWorkspace() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 2 floats designating how to transition overview:
|
||||
* scale for the current and adjacent pages
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
|
||||
@@ -298,6 +297,8 @@ public class LauncherStateManager {
|
||||
if (!isWorkspaceVisible) {
|
||||
workspace.setScaleX(0.92f);
|
||||
workspace.setScaleY(0.92f);
|
||||
workspace.getHotseat().setScaleX(0.92f);
|
||||
workspace.getHotseat().setScaleY(0.92f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.launcher3;
|
||||
import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
|
||||
import static com.android.launcher3.LauncherState.HOTSEAT_SEARCH_BOX;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
@@ -35,6 +34,7 @@ import com.android.launcher3.LauncherState.PageAlphaProvider;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.graphics.WorkspaceAndHotseatScrim;
|
||||
|
||||
/**
|
||||
@@ -84,12 +84,24 @@ public class WorkspaceStateTransitionAnimation {
|
||||
Interpolator fadeInterpolator = builder.getInterpolator(ANIM_WORKSPACE_FADE,
|
||||
pageAlphaProvider.interpolator);
|
||||
boolean playAtomicComponent = config.playAtomicComponent();
|
||||
Hotseat hotseat = mWorkspace.getHotseat();
|
||||
if (playAtomicComponent) {
|
||||
Interpolator scaleInterpolator = builder.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
|
||||
propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
|
||||
|
||||
if (state.scaleHotseatWithWorkspace()) {
|
||||
DragLayer dragLayer = mLauncher.getDragLayer();
|
||||
int[] workspacePivot = new int[]{(int) mWorkspace.getPivotX(),
|
||||
(int) mWorkspace.getPivotY()};
|
||||
dragLayer.getDescendantCoordRelativeToSelf(mWorkspace, workspacePivot);
|
||||
dragLayer.mapCoordInSelfToDescendant(hotseat, workspacePivot);
|
||||
hotseat.setPivotX(workspacePivot[0]);
|
||||
hotseat.setPivotY(workspacePivot[1]);
|
||||
propertySetter.setFloat(hotseat, SCALE_PROPERTY, mNewScale, scaleInterpolator);
|
||||
}
|
||||
|
||||
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
|
||||
propertySetter.setViewAlpha(mLauncher.getHotseat(), hotseatIconsAlpha,
|
||||
fadeInterpolator);
|
||||
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, fadeInterpolator);
|
||||
propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(),
|
||||
hotseatIconsAlpha, fadeInterpolator);
|
||||
}
|
||||
@@ -104,6 +116,12 @@ public class WorkspaceStateTransitionAnimation {
|
||||
scaleAndTranslation[1], translationInterpolator);
|
||||
propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y,
|
||||
scaleAndTranslation[2], translationInterpolator);
|
||||
if (state.scaleHotseatWithWorkspace()) {
|
||||
propertySetter.setFloat(hotseat, View.TRANSLATION_Y,
|
||||
scaleAndTranslation[2], translationInterpolator);
|
||||
propertySetter.setFloat(mWorkspace.getPageIndicator(), View.TRANSLATION_Y,
|
||||
scaleAndTranslation[2], translationInterpolator);
|
||||
}
|
||||
|
||||
// Set scrim
|
||||
WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
|
||||
|
||||
@@ -124,12 +124,6 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
|
||||
float shiftCurrent = progress * mShiftRange;
|
||||
|
||||
mAppsView.setTranslationY(shiftCurrent);
|
||||
float hotseatTranslation = -mShiftRange + shiftCurrent;
|
||||
|
||||
if (!mIsVerticalLayout) {
|
||||
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.
|
||||
|
||||
@@ -72,6 +72,11 @@ public class SpringLoadedState extends LauncherState {
|
||||
return new float[] { scale, 0, (desiredCellTop - actualCellTop) / scale};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scaleHotseatWithWorkspace() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateEnabled(Launcher launcher) {
|
||||
Workspace ws = launcher.getWorkspace();
|
||||
|
||||
Reference in New Issue
Block a user