summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3
diff options
context:
space:
mode:
authorTony <twickham@google.com>2019-03-25 10:23:39 -0500
committerTony <twickham@google.com>2019-03-28 15:09:25 -0500
commite4c2e2b86cf74013efc52f81ac8b1b6d85822646 (patch)
tree0d59a22b28e87caae6573b7348c0cbb6d341789b /src/com/android/launcher3
parent794a68e99850266d92b6daf25793b42308a66a8e (diff)
downloadandroid_packages_apps_Trebuchet-e4c2e2b86cf74013efc52f81ac8b1b6d85822646.tar.gz
android_packages_apps_Trebuchet-e4c2e2b86cf74013efc52f81ac8b1b6d85822646.tar.bz2
android_packages_apps_Trebuchet-e4c2e2b86cf74013efc52f81ac8b1b6d85822646.zip
Add QuickSwitchTouchController on home
- Added QuickSwitchState, which we animate to when swiping right on the nav bar from NORMAL state - Task launches when the state transition to QuickSwitchState ends Bug: 126596417 Change-Id: Id66650401d817703fc6d044fb26a25cccbc07e11
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r--src/com/android/launcher3/LauncherState.java7
-rw-r--r--src/com/android/launcher3/LauncherStateManager.java6
-rw-r--r--src/com/android/launcher3/TestProtocol.java5
-rw-r--r--src/com/android/launcher3/Utilities.java6
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java5
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java2
-rw-r--r--src/com/android/launcher3/anim/AnimatorSetBuilder.java12
7 files changed, 28 insertions, 15 deletions
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 182ed4bc8..c65a871b6 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -23,6 +23,7 @@ import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
+import static com.android.launcher3.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
import static com.android.launcher3.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
@@ -31,9 +32,9 @@ import android.view.animation.Interpolator;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.states.SpringLoadedState;
+import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.uioverrides.states.AllAppsState;
import com.android.launcher3.uioverrides.states.OverviewState;
-import com.android.launcher3.uioverrides.UiFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -77,7 +78,7 @@ public class LauncherState {
}
};
- private static final LauncherState[] sAllStates = new LauncherState[6];
+ private static final LauncherState[] sAllStates = new LauncherState[7];
/**
* TODO: Create a separate class for NORMAL state.
@@ -97,6 +98,8 @@ public class LauncherState {
public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL);
public static final LauncherState OVERVIEW_PEEK =
OverviewState.newPeekState(OVERVIEW_PEEK_STATE_ORDINAL);
+ public static final LauncherState QUICK_SWITCH =
+ OverviewState.newSwitchState(QUICK_SWITCH_STATE_ORDINAL);
public static final LauncherState BACKGROUND_APP =
OverviewState.newBackgroundState(BACKGROUND_APP_STATE_ORDINAL);
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 19c896fba..5f7538b40 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -22,7 +22,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
-import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE;
+import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X;
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.ACCEL;
@@ -296,7 +296,7 @@ public class LauncherStateManager {
builder.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);
builder.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
builder.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
- builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE, OVERSHOOT_1_7);
+ builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7);
builder.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
// Start from a higher overview scale, but only if we're invisible so we don't jump.
@@ -305,7 +305,7 @@ public class LauncherStateManager {
builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
builder.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
builder.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
- builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE, ACCEL);
+ builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL);
builder.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
Workspace workspace = mLauncher.getWorkspace();
diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/TestProtocol.java
index 0451ceb5f..49a736eed 100644
--- a/src/com/android/launcher3/TestProtocol.java
+++ b/src/com/android/launcher3/TestProtocol.java
@@ -29,8 +29,9 @@ public final class TestProtocol {
public static final int SPRING_LOADED_STATE_ORDINAL = 1;
public static final int OVERVIEW_STATE_ORDINAL = 2;
public static final int OVERVIEW_PEEK_STATE_ORDINAL = 3;
- public static final int ALL_APPS_STATE_ORDINAL = 4;
- public static final int BACKGROUND_APP_STATE_ORDINAL = 5;
+ public static final int QUICK_SWITCH_STATE_ORDINAL = 4;
+ public static final int ALL_APPS_STATE_ORDINAL = 5;
+ public static final int BACKGROUND_APP_STATE_ORDINAL = 6;
public static final String TEST_INFO_RESPONSE_FIELD = "response";
public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT =
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index dd755cb97..fd4b5086b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -308,10 +308,14 @@ public final class Utilities {
Log.e(TAG, "mapToRange: range has 0 length");
return toMin;
}
- float progress = Math.abs(t - fromMin) / Math.abs(fromMax - fromMin);
+ float progress = getProgress(t, fromMin, fromMax);
return mapRange(interpolator.getInterpolation(progress), toMin, toMax);
}
+ public static float getProgress(float current, float min, float max) {
+ return Math.abs(current - min) / Math.abs(max - min);
+ }
+
public static float mapRange(float value, float min, float max) {
return min + (value * (max - min));
}
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 21fdd3df0..99a880104 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -21,6 +21,7 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
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.AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.ZOOM_OUT;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
@@ -114,7 +115,9 @@ public class WorkspaceStateTransitionAnimation {
return;
}
- Interpolator translationInterpolator = !playAtomicComponent ? LINEAR : ZOOM_OUT;
+ Interpolator translationInterpolator = !playAtomicComponent
+ ? LINEAR
+ : builder.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
propertySetter.setFloat(mWorkspace, View.TRANSLATION_X,
scaleAndTranslation.translationX, translationInterpolator);
propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y,
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index a4ecec7b8..4a1d43206 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -205,7 +205,7 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade);
setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA,
- (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, LINEAR);
+ (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, allAppsFade);
}
public AnimatorListenerAdapter getProgressAnimatorListener() {
diff --git a/src/com/android/launcher3/anim/AnimatorSetBuilder.java b/src/com/android/launcher3/anim/AnimatorSetBuilder.java
index 3ac9d3c27..5c498f8bb 100644
--- a/src/com/android/launcher3/anim/AnimatorSetBuilder.java
+++ b/src/com/android/launcher3/anim/AnimatorSetBuilder.java
@@ -30,11 +30,13 @@ public class AnimatorSetBuilder {
public static final int ANIM_VERTICAL_PROGRESS = 0;
public static final int ANIM_WORKSPACE_SCALE = 1;
- public static final int ANIM_WORKSPACE_FADE = 2;
- public static final int ANIM_OVERVIEW_SCALE = 3;
- public static final int ANIM_OVERVIEW_TRANSLATE = 4;
- public static final int ANIM_OVERVIEW_FADE = 5;
- public static final int ANIM_ALL_APPS_FADE = 6;
+ public static final int ANIM_WORKSPACE_TRANSLATE = 2;
+ public static final int ANIM_WORKSPACE_FADE = 3;
+ public static final int ANIM_OVERVIEW_SCALE = 4;
+ public static final int ANIM_OVERVIEW_TRANSLATE_X = 5;
+ public static final int ANIM_OVERVIEW_TRANSLATE_Y = 6;
+ public static final int ANIM_OVERVIEW_FADE = 7;
+ public static final int ANIM_ALL_APPS_FADE = 8;
public static final int FLAG_DONT_ANIMATE_OVERVIEW = 1 << 0;