summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-11-18 14:38:53 -0800
committerWinson Chung <winsonc@google.com>2010-11-18 14:39:11 -0800
commitb4b7fa7c0383b6af58d73d3e024b91d586148cf8 (patch)
tree41f32eb4c961efe5e8a2c3e5ca674abae521a74e
parent6c807958bc3ba78061152993bd96bde5984c63df (diff)
downloadandroid_packages_apps_Trebuchet-b4b7fa7c0383b6af58d73d3e024b91d586148cf8.tar.gz
android_packages_apps_Trebuchet-b4b7fa7c0383b6af58d73d3e024b91d586148cf8.tar.bz2
android_packages_apps_Trebuchet-b4b7fa7c0383b6af58d73d3e024b91d586148cf8.zip
Proper fix for missing resource in other devices.
Change-Id: Ie164e42a4c5efce763160dae86b8fe3a9da51fd9
-rw-r--r--res/drawable-xlarge/all_apps_bg_gradient.9.png (renamed from res/drawable/all_apps_bg_gradient.9.png)bin268 -> 268 bytes
-rw-r--r--src/com/android/launcher2/Workspace.java12
2 files changed, 9 insertions, 3 deletions
diff --git a/res/drawable/all_apps_bg_gradient.9.png b/res/drawable-xlarge/all_apps_bg_gradient.9.png
index 8d88a7ec5..8d88a7ec5 100644
--- a/res/drawable/all_apps_bg_gradient.9.png
+++ b/res/drawable-xlarge/all_apps_bg_gradient.9.png
Binary files differ
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index a8981775b..7a264e35a 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -245,8 +245,12 @@ public class Workspace extends SmoothPagedView
mExternalDragOutlinePaint.setAntiAlias(true);
setWillNotDraw(false);
- final Resources res = getResources();
- mBackground = res.getDrawable(R.drawable.all_apps_bg_gradient);
+ try {
+ final Resources res = getResources();
+ mBackground = res.getDrawable(R.drawable.all_apps_bg_gradient);
+ } catch (Resources.NotFoundException e) {
+ // In this case, we will skip drawing background protection
+ }
mUnshrinkAnimationListener = new LauncherAnimatorListenerAdapter() {
@Override
@@ -583,6 +587,7 @@ public class Workspace extends SmoothPagedView
}
public void showBackgroundGradient() {
+ if (mBackground == null) return;
if (mBackgroundFadeOutAnimation != null) mBackgroundFadeOutAnimation.cancel();
if (mBackgroundFadeInAnimation != null) mBackgroundFadeInAnimation.cancel();
mBackgroundFadeInAnimation = ObjectAnimator.ofFloat(this, "backgroundAlpha", 1.0f);
@@ -591,6 +596,7 @@ public class Workspace extends SmoothPagedView
}
public void hideBackgroundGradient() {
+ if (mBackground == null) return;
if (mBackgroundFadeInAnimation != null) mBackgroundFadeInAnimation.cancel();
if (mBackgroundFadeOutAnimation != null) mBackgroundFadeOutAnimation.cancel();
mBackgroundFadeOutAnimation = ObjectAnimator.ofFloat(this, "backgroundAlpha", 0.0f);
@@ -683,7 +689,7 @@ public class Workspace extends SmoothPagedView
@Override
protected void onDraw(Canvas canvas) {
// Draw the background gradient if necessary
- if (mBackgroundAlpha > 0.0f) {
+ if (mBackground != null && mBackgroundAlpha > 0.0f) {
mBackground.setAlpha((int) (mBackgroundAlpha * 255));
mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(), getMeasuredHeight());
mBackground.draw(canvas);