summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java5
-rw-r--r--src/com/android/launcher3/allapps/AllAppsGridAdapter.java17
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java11
-rw-r--r--src/com/android/launcher3/allapps/AlphabeticalAppsList.java33
-rw-r--r--src/com/android/launcher3/allapps/SearchUiManager.java7
-rw-r--r--src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java13
6 files changed, 61 insertions, 25 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 97a87c16c..4eba5c6df 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -50,6 +50,7 @@ import com.android.launcher3.folder.Folder;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.ComponentKeyMapper;
import com.android.launcher3.util.PackageUserKey;
import java.util.List;
@@ -116,7 +117,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
/**
* Sets the current set of predicted apps.
*/
- public void setPredictedApps(List<ComponentKey> apps) {
+ public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
mApps.setPredictedApps(apps);
}
@@ -349,8 +350,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams();
navBarBgLp.height = insets.bottom;
navBarBg.setLayoutParams(navBarBgLp);
- navBarBg.setVisibility(FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS
- ? View.INVISIBLE : View.VISIBLE);
}
}
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index ba4fbe061..1f60fcc73 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -448,9 +448,20 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
row = Math.abs(numTotalRows - row);
}
- // We manipulate the stiffness, min, and max values based on the items distance to the
- // first row and the items distance to the center column to create the ^-shaped motion
- // effect.
+ calculateSpringValues(spring, row, col);
+ }
+
+ @Override
+ public void setDefaultValues(SpringAnimation spring) {
+ calculateSpringValues(spring, 0, mAppsPerRow / 2);
+ }
+
+ /**
+ * We manipulate the stiffness, min, and max values based on the items distance to the
+ * first row and the items distance to the center column to create the ^-shaped motion
+ * effect.
+ */
+ private void calculateSpringValues(SpringAnimation spring, int row, int col) {
float rowFactor = (1 + row) * 0.5f;
float colFactor = getColumnFactor(col, mAppsPerRow);
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index edfe0c15e..743b16ef1 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -7,6 +7,7 @@ import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.graphics.Color;
+import android.support.animation.SpringAnimation;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.view.MotionEvent;
@@ -98,9 +99,10 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
// Used in discovery bounce animation to provide the transition without workspace changing.
private boolean mIsTranslateWithoutWorkspace = false;
- private AnimatorSet mDiscoBounceAnimation;
+ private Animator mDiscoBounceAnimation;
private GradientView mGradientView;
+ private SpringAnimation mSearchSpring;
private SpringAnimationHandler mSpringAnimationHandler;
public AllAppsTransitionController(Launcher l) {
@@ -226,6 +228,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
}
mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */);
if (hasSpringAnimationHandler()) {
+ mSpringAnimationHandler.add(mSearchSpring, true /* setDefaultValues */);
// The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.)
mSpringAnimationHandler.animateToFinalPosition(0 /* pos */, 1 /* startValue */);
}
@@ -418,8 +421,8 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
cancelDiscoveryAnimation();
// assumption is that this variable is always null
- mDiscoBounceAnimation = (AnimatorSet) AnimatorInflater.loadAnimator(mLauncher,
- R.anim.discovery_bounce);
+ mDiscoBounceAnimation = AnimatorInflater.loadAnimator(mLauncher,
+ R.animator.discovery_bounce);
mDiscoBounceAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
@@ -499,6 +502,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
public void finishPullUp() {
mHotseat.setVisibility(View.INVISIBLE);
if (hasSpringAnimationHandler()) {
+ mSpringAnimationHandler.remove(mSearchSpring);
mSpringAnimationHandler.reset();
}
setProgress(0f);
@@ -544,6 +548,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
mWorkspace.getPageIndicator().getCaretDrawable(), mLauncher);
mAppsView.getSearchUiManager().addOnScrollRangeChangeListener(this);
mSpringAnimationHandler = mAppsView.getSpringAnimationHandler();
+ mSearchSpring = mAppsView.getSearchUiManager().getSpringForFling();
}
private boolean hasSpringAnimationHandler() {
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 5e7a5cac5..6bbe3ea55 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -29,6 +29,7 @@ import com.android.launcher3.discovery.AppDiscoveryAppInfo;
import com.android.launcher3.discovery.AppDiscoveryItem;
import com.android.launcher3.discovery.AppDiscoveryUpdateState;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.ComponentKeyMapper;
import com.android.launcher3.util.LabelComparator;
import java.util.ArrayList;
@@ -173,7 +174,7 @@ public class AlphabeticalAppsList {
// The set of sections that we allow fast-scrolling to (includes non-merged sections)
private final List<FastScrollSectionInfo> mFastScrollerSections = new ArrayList<>();
// The set of predicted app component names
- private final List<ComponentKey> mPredictedAppComponents = new ArrayList<>();
+ private final List<ComponentKeyMapper<AppInfo>> mPredictedAppComponents = new ArrayList<>();
// The set of predicted apps resolved from the component names and the current set of apps
private final List<AppInfo> mPredictedApps = new ArrayList<>();
private final List<AppDiscoveryAppInfo> mDiscoveredApps = new ArrayList<>();
@@ -298,20 +299,20 @@ public class AlphabeticalAppsList {
updateAdapterItems();
}
- private List<AppInfo> processPredictedAppComponents(List<ComponentKey> components) {
+ private List<AppInfo> processPredictedAppComponents(List<ComponentKeyMapper<AppInfo>> components) {
if (mComponentToAppMap.isEmpty()) {
// Apps have not been bound yet.
return Collections.emptyList();
}
List<AppInfo> predictedApps = new ArrayList<>();
- for (ComponentKey ck : components) {
- AppInfo info = mComponentToAppMap.get(ck);
+ for (ComponentKeyMapper<AppInfo> mapper : components) {
+ AppInfo info = mapper.getItem(mComponentToAppMap);
if (info != null) {
predictedApps.add(info);
} else {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
- Log.e(TAG, "Predicted app not found: " + ck);
+ Log.e(TAG, "Predicted app not found: " + mapper);
}
}
// Stop at the number of predicted apps
@@ -331,7 +332,7 @@ public class AlphabeticalAppsList {
* If the number of predicted apps is the same as the previous list of predicted apps,
* we can optimize by swapping them in place.
*/
- public void setPredictedApps(List<ComponentKey> apps) {
+ public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
mPredictedAppComponents.clear();
mPredictedAppComponents.addAll(apps);
@@ -472,14 +473,14 @@ public class AlphabeticalAppsList {
if (DEBUG_PREDICTIONS) {
if (mPredictedAppComponents.isEmpty() && !mApps.isEmpty()) {
- mPredictedAppComponents.add(new ComponentKey(mApps.get(0).componentName,
- Process.myUserHandle()));
- mPredictedAppComponents.add(new ComponentKey(mApps.get(0).componentName,
- Process.myUserHandle()));
- mPredictedAppComponents.add(new ComponentKey(mApps.get(0).componentName,
- Process.myUserHandle()));
- mPredictedAppComponents.add(new ComponentKey(mApps.get(0).componentName,
- Process.myUserHandle()));
+ mPredictedAppComponents.add(new ComponentKeyMapper<AppInfo>(new ComponentKey(mApps.get(0).componentName,
+ Process.myUserHandle())));
+ mPredictedAppComponents.add(new ComponentKeyMapper<AppInfo>(new ComponentKey(mApps.get(0).componentName,
+ Process.myUserHandle())));
+ mPredictedAppComponents.add(new ComponentKeyMapper<AppInfo>(new ComponentKey(mApps.get(0).componentName,
+ Process.myUserHandle())));
+ mPredictedAppComponents.add(new ComponentKeyMapper<AppInfo>(new ComponentKey(mApps.get(0).componentName,
+ Process.myUserHandle())));
}
}
@@ -644,8 +645,8 @@ public class AlphabeticalAppsList {
return result;
}
- public AppInfo findApp(ComponentKey key) {
- return mComponentToAppMap.get(key);
+ public AppInfo findApp(ComponentKeyMapper<AppInfo> mapper) {
+ return mapper.getItem(mComponentToAppMap);
}
/**
diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java
index c0d78508f..34230e046 100644
--- a/src/com/android/launcher3/allapps/SearchUiManager.java
+++ b/src/com/android/launcher3/allapps/SearchUiManager.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.allapps;
+import android.support.animation.SpringAnimation;
+import android.support.annotation.NonNull;
import android.view.KeyEvent;
/**
@@ -28,6 +30,11 @@ public interface SearchUiManager {
void initialize(AlphabeticalAppsList appsList, AllAppsRecyclerView recyclerView);
/**
+ * A {@link SpringAnimation} that will be used when the user flings.
+ */
+ @NonNull SpringAnimation getSpringForFling();
+
+ /**
* Notifies the search manager that the apps-list has changed and the search UI should be
* updated accordingly.
*/
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index d50455171..ddf6e5849 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -17,6 +17,9 @@ package com.android.launcher3.allapps.search;
import android.content.Context;
import android.graphics.Rect;
+import android.support.animation.FloatValueHolder;
+import android.support.animation.SpringAnimation;
+import android.support.animation.SpringForce;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Selection;
@@ -62,6 +65,8 @@ public class AppsSearchContainerLayout extends FrameLayout
private View mDivider;
private HeaderElevationController mElevationController;
+ private SpringAnimation mSpring;
+
public AppsSearchContainerLayout(Context context) {
this(context, null);
}
@@ -81,6 +86,9 @@ public class AppsSearchContainerLayout extends FrameLayout
mSearchQueryBuilder = new SpannableStringBuilder();
Selection.setSelection(mSearchQueryBuilder, 0);
+
+ // Note: This spring does nothing.
+ mSpring = new SpringAnimation(new FloatValueHolder()).setSpring(new SpringForce(0));
}
@Override
@@ -127,6 +135,11 @@ public class AppsSearchContainerLayout extends FrameLayout
}
@Override
+ public @NonNull SpringAnimation getSpringForFling() {
+ return mSpring;
+ }
+
+ @Override
public void refreshSearchResult() {
mSearchBarController.refreshSearchResult();
}