summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Launcher.java60
-rw-r--r--src/com/android/launcher3/LauncherProvider.java3
-rw-r--r--src/com/android/launcher3/Workspace.java35
3 files changed, 61 insertions, 37 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 84476b7cc..eb2b5b803 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -309,6 +309,9 @@ public class Launcher extends Activity
private View.OnTouchListener mHapticFeedbackTouchListener;
+ public static final int BUILD_LAYER = 0;
+ public static final int BUILD_AND_SET_LAYER = 1;
+
// Related to the auto-advancing of widgets
private final int ADVANCE_MSG = 1;
private final int mAdvanceInterval = 20000;
@@ -3315,7 +3318,7 @@ public class Launcher extends Activity
final View fromView = mWorkspace;
final AppsCustomizeTabHost toView = mAppsCustomizeTabHost;
- final ArrayList<View> layerViews = new ArrayList<View>();
+ final HashMap<View, Integer> layerViews = new HashMap<View, Integer>();
Workspace.State workspaceState = contentType == AppsCustomizePagedView.ContentType.Widgets ?
Workspace.State.OVERVIEW_HIDDEN : Workspace.State.NORMAL_HIDDEN;
@@ -3375,8 +3378,7 @@ public class Launcher extends Activity
}
final float initAlpha = alpha;
- revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- layerViews.add(revealView);
+ layerViews.put(revealView, BUILD_AND_SET_LAYER);
PropertyValuesHolder panelAlpha = PropertyValuesHolder.ofFloat("alpha", initAlpha, 1f);
PropertyValuesHolder panelDriftY =
PropertyValuesHolder.ofFloat("translationY", yDrift, 0);
@@ -3393,8 +3395,7 @@ public class Launcher extends Activity
if (page != null) {
page.setVisibility(View.VISIBLE);
- page.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- layerViews.add(page);
+ layerViews.put(page, BUILD_AND_SET_LAYER);
ObjectAnimator pageDrift = ObjectAnimator.ofFloat(page, "translationY", yDrift, 0);
page.setTranslationY(yDrift);
@@ -3450,9 +3451,11 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionEnd(toView, animated, false);
revealView.setVisibility(View.INVISIBLE);
- revealView.setLayerType(View.LAYER_TYPE_NONE, null);
- if (page != null) {
- page.setLayerType(View.LAYER_TYPE_NONE, null);
+
+ for (View v : layerViews.keySet()) {
+ if (layerViews.get(v) == BUILD_AND_SET_LAYER) {
+ v.setLayerType(View.LAYER_TYPE_NONE, null);
+ }
}
content.setPageBackgroundsVisible(true);
@@ -3484,12 +3487,16 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionStart(toView, animated, false);
revealView.setAlpha(initAlpha);
+
+ for (View v : layerViews.keySet()) {
+ if (layerViews.get(v) == BUILD_AND_SET_LAYER) {
+ v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ }
+ }
+
if (Utilities.isLmpOrAbove()) {
- for (int i = 0; i < layerViews.size(); i++) {
- View v = layerViews.get(i);
- if (v != null) {
- if (Utilities.isViewAttachedToWindow(v)) v.buildLayer();
- }
+ for (View v : layerViews.keySet()) {
+ if (Utilities.isViewAttachedToWindow(v)) v.buildLayer();
}
}
mStateAnimation.start();
@@ -3545,7 +3552,7 @@ public class Launcher extends Activity
final View fromView = mAppsCustomizeTabHost;
final View toView = mWorkspace;
Animator workspaceAnim = null;
- final ArrayList<View> layerViews = new ArrayList<View>();
+ final HashMap<View, Integer> layerViews = new HashMap<View, Integer>();
if (toState == Workspace.State.NORMAL) {
workspaceAnim = mWorkspace.getChangeStateAnimation(
@@ -3617,7 +3624,7 @@ public class Launcher extends Activity
xDrift = 0;
}
- revealView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ layerViews.put(revealView, BUILD_AND_SET_LAYER);
TimeInterpolator decelerateInterpolator = material ?
new LogDecelerateInterpolator(100, 0) :
new DecelerateInterpolator(1f);
@@ -3651,7 +3658,7 @@ public class Launcher extends Activity
}
if (page != null) {
- page.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ layerViews.put(page, BUILD_AND_SET_LAYER);
ObjectAnimator pageDrift = LauncherAnimUtils.ofFloat(page, "translationY",
0, yDrift);
@@ -3719,10 +3726,12 @@ public class Launcher extends Activity
onCompleteRunnable.run();
}
- revealView.setLayerType(View.LAYER_TYPE_NONE, null);
- if (page != null) {
- page.setLayerType(View.LAYER_TYPE_NONE, null);
+ for (View v : layerViews.keySet()) {
+ if (layerViews.get(v) == BUILD_AND_SET_LAYER) {
+ v.setLayerType(View.LAYER_TYPE_NONE, null);
+ }
}
+
content.setPageBackgroundsVisible(true);
// Unhide side pages
int count = content.getChildCount();
@@ -3756,12 +3765,15 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionStart(fromView, animated, false);
dispatchOnLauncherTransitionStart(toView, animated, false);
+ for (View v : layerViews.keySet()) {
+ if (layerViews.get(v) == BUILD_AND_SET_LAYER) {
+ v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ }
+ }
+
if (Utilities.isLmpOrAbove()) {
- for (int i = 0; i < layerViews.size(); i++) {
- View v = layerViews.get(i);
- if (v != null) {
- if (Utilities.isViewAttachedToWindow(v)) v.buildLayer();
- }
+ for (View v : layerViews.keySet()) {
+ if (Utilities.isViewAttachedToWindow(v)) v.buildLayer();
}
}
mStateAnimation.start();
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index bb6e8c8af..0088f26cf 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -638,7 +638,8 @@ public class LauncherProvider extends ContentProvider {
new String[] {Integer.toString(LauncherSettings.Favorites.ITEM_TYPE_FOLDER)});
while (c.moveToNext()) {
- db.execSQL("UPDATE favorites SET rank=cellX+(cellY*?) WHERE container=?;",
+ db.execSQL("UPDATE favorites SET rank=cellX+(cellY*?) WHERE "
+ + "container=? AND cellX IS NOT NULL AND cellY IS NOT NULL;",
new Object[] {c.getLong(1) + 1, c.getLong(0)});
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 69fa457ab..6cfb6b29b 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2091,7 +2091,7 @@ public class Workspace extends SmoothPagedView
}
Animator getChangeStateAnimation(final State state, boolean animated,
- ArrayList<View> layerViews) {
+ HashMap<View, Integer> layerViews) {
return getChangeStateAnimation(state, animated, 0, -1, layerViews);
}
@@ -2222,7 +2222,7 @@ public class Workspace extends SmoothPagedView
}
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage,
- ArrayList<View> layerViews) {
+ HashMap<View, Integer> layerViews) {
if (mState == state) {
return null;
}
@@ -2352,7 +2352,7 @@ public class Workspace extends SmoothPagedView
cl.setShortcutAndWidgetAlpha(mNewAlphas[i]);
} else {
if (layerViews != null) {
- layerViews.add(cl);
+ layerViews.put(cl, Launcher.BUILD_LAYER);
}
if (mOldAlphas[i] != mNewAlphas[i] || currentAlpha != mNewAlphas[i]) {
LauncherViewPropertyAnimator alphaAnim =
@@ -2389,12 +2389,12 @@ public class Workspace extends SmoothPagedView
pageIndicatorAlpha = ValueAnimator.ofFloat(0, 0);
}
- Animator hotseatAlpha = new LauncherViewPropertyAnimator(hotseat)
- .alpha(finalHotseatAndPageIndicatorAlpha).withLayer();
+ LauncherViewPropertyAnimator hotseatAlpha = new LauncherViewPropertyAnimator(hotseat)
+ .alpha(finalHotseatAndPageIndicatorAlpha);
hotseatAlpha.addListener(new AlphaUpdateListener(hotseat));
- Animator overviewPanelAlpha = new LauncherViewPropertyAnimator(overviewPanel)
- .alpha(finalOverviewPanelAlpha).withLayer();
+ LauncherViewPropertyAnimator overviewPanelAlpha =
+ new LauncherViewPropertyAnimator(overviewPanel).alpha(finalOverviewPanelAlpha);
overviewPanelAlpha.addListener(new AlphaUpdateListener(overviewPanel));
// For animation optimations, we may need to provide the Launcher transition
@@ -2402,8 +2402,14 @@ public class Workspace extends SmoothPagedView
hotseat.setLayerType(View.LAYER_TYPE_HARDWARE, null);
overviewPanel.setLayerType(View.LAYER_TYPE_HARDWARE, null);
if (layerViews != null) {
- layerViews.add(hotseat);
- layerViews.add(overviewPanel);
+ // If layerViews is not null, we add these views, and indicate that
+ // the caller can manage layer state.
+ layerViews.put(hotseat, Launcher.BUILD_AND_SET_LAYER);
+ layerViews.put(overviewPanel, Launcher.BUILD_AND_SET_LAYER);
+ } else {
+ // Otherwise let the animator handle layer management.
+ hotseatAlpha.withLayer();
+ overviewPanelAlpha.withLayer();
}
if (workspaceToOverview) {
@@ -2421,12 +2427,17 @@ public class Workspace extends SmoothPagedView
hotseatAlpha.setDuration(duration);
if (searchBar != null) {
- Animator searchBarAlpha = new LauncherViewPropertyAnimator(searchBar)
- .alpha(finalSearchBarAlpha).withLayer();
+ LauncherViewPropertyAnimator searchBarAlpha = new LauncherViewPropertyAnimator(searchBar)
+ .alpha(finalSearchBarAlpha);
searchBarAlpha.addListener(new AlphaUpdateListener(searchBar));
searchBar.setLayerType(View.LAYER_TYPE_HARDWARE, null);
if (layerViews != null) {
- layerViews.add(searchBar);
+ // If layerViews is not null, we add these views, and indicate that
+ // the caller can manage layer state.
+ layerViews.put(searchBar, Launcher.BUILD_AND_SET_LAYER);
+ } else {
+ // Otherwise let the animator handle layer management.
+ searchBarAlpha.withLayer();
}
searchBarAlpha.setDuration(duration);
anim.play(searchBarAlpha);