Proper fix for missing resource in other devices.

Change-Id: Ie164e42a4c5efce763160dae86b8fe3a9da51fd9
diff --git a/res/drawable/all_apps_bg_gradient.9.png b/res/drawable-xlarge/all_apps_bg_gradient.9.png
similarity index 100%
rename from res/drawable/all_apps_bg_gradient.9.png
rename to 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 a898177..7a264e3 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -245,8 +245,12 @@
         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 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 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 @@
     @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);