merge in honeycomb-release history after reset to honeycomb
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index fd389ca..19e775b 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -625,6 +625,7 @@
child.setId(childId);
addView(child, index, lp);
+ child.setAlpha(getAlpha());
if (child instanceof VisibilityChangedBroadcaster) {
VisibilityChangedBroadcaster v = (VisibilityChangedBroadcaster) child;
v.setVisibilityChangedListener(this);
@@ -972,6 +973,7 @@
}
}
prepareCacheBitmap();
+ invalidateCache();
}
@Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 7faa520..d0f52cb 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -550,12 +550,12 @@
WallpaperManager wpm = (WallpaperManager)getSystemService(WALLPAPER_SERVICE);
Display display = getWindowManager().getDefaultDisplay();
- // TODO: Put back when we decide about scrolling the wallpaper
- // boolean isPortrait = display.getWidth() < display.getHeight();
- // final int width = isPortrait ? display.getWidth() : display.getHeight();
- // final int height = isPortrait ? display.getHeight() : display.getWidth();
- wpm.suggestDesiredDimensions(Math.max(display.getWidth(), display.getHeight()),
- Math.max(display.getWidth(), display.getHeight()));
+ boolean isPortrait = display.getWidth() < display.getHeight();
+ // find width and height when in portrait mode
+ final int width = isPortrait ? display.getWidth() : display.getHeight();
+ final int height = isPortrait ? display.getHeight() : display.getWidth();
+ wpm.suggestDesiredDimensions((int) (Math.max(width, height) * 1.5f),
+ Math.max(width, height));
}
// Note: This doesn't do all the client-id magic that BrowserProvider does
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 9fcd1b4..d65f692 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -394,7 +394,7 @@
@Override
void setCurrentPage(int currentPage) {
super.setCurrentPage(currentPage);
- updateWallpaperOffset(mScrollX);
+ updateWallpaperOffset();
}
/**
@@ -558,19 +558,25 @@
Launcher.setScreen(mCurrentPage);
};
- private void updateWallpaperOffset(int scrollRange) {
- final boolean isStaticWallpaper = (mWallpaperManager != null) &&
- (mWallpaperManager.getWallpaperInfo() == null);
- if (LauncherApplication.isScreenXLarge() && !isStaticWallpaper) {
+ private void updateWallpaperOffset() {
+ if (LauncherApplication.isScreenXLarge()) {
IBinder token = getWindowToken();
+ int scrollRange = getChildOffset(getChildCount() - 1) - getChildOffset(0);
if (token != null) {
- mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0 );
+ mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0);
+ float offset = mScrollX / (float) scrollRange;
mWallpaperManager.setWallpaperOffsets(getWindowToken(),
- Math.max(0.f, Math.min(mScrollX/(float)scrollRange, 1.f)), 0);
+ Math.max(0.f, Math.min(offset, 1.0f)), 0);
}
}
}
+ @Override
+ public void computeScroll() {
+ super.computeScroll();
+ updateWallpaperOffset();
+ }
+
public void showOutlines() {
if (!mIsSmall && !mIsInUnshrinkAnimation) {
if (mChildrenOutlineFadeOutAnimation != null) mChildrenOutlineFadeOutAnimation.cancel();
@@ -780,9 +786,6 @@
// Draw the background gradient if necessary
if (mBackground != null && mBackgroundAlpha > 0.0f) {
int alpha = (int) (mBackgroundAlpha * 255);
- mBackground.setAlpha(alpha);
- mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(), getMeasuredHeight());
- mBackground.draw(canvas);
if (mDrawCustomizeTrayBackground) {
// Find out where to offset the gradient for the customization tray content
mCustomizationDrawer.getLocationOnScreen(mCustomizationDrawerPos);
@@ -800,9 +803,15 @@
// Draw the bg gradient
final int offset = (int) (mCustomizationDrawerPos[1] +
mCustomizationDrawerTransformedPos[1]);
+ mBackground.setAlpha(alpha);
mBackground.setBounds(mScrollX, offset, mScrollX + getMeasuredWidth(),
offset + getMeasuredHeight());
mBackground.draw(canvas);
+ } else {
+ mBackground.setAlpha(alpha);
+ mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(),
+ getMeasuredHeight());
+ mBackground.draw(canvas);
}
}
super.onDraw(canvas);