|
4 | 4 | import android.graphics.Bitmap;
|
5 | 5 | import android.graphics.BitmapFactory;
|
6 | 6 | import android.graphics.Canvas;
|
7 |
| -import android.graphics.ColorFilter; |
8 | 7 | import android.graphics.Matrix;
|
9 |
| -import android.graphics.PixelFormat; |
10 | 8 | import android.graphics.Rect;
|
11 | 9 | import android.graphics.drawable.Animatable;
|
12 | 10 | import android.view.animation.Animation;
|
@@ -105,11 +103,14 @@ public void initiateDimens(int viewWidth) {
|
105 | 103 | }
|
106 | 104 |
|
107 | 105 | private void createBitmaps() {
|
108 |
| - mSky = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.sky); |
| 106 | + final BitmapFactory.Options options = new BitmapFactory.Options(); |
| 107 | + options.inPreferredConfig = Bitmap.Config.RGB_565; |
| 108 | + |
| 109 | + mSky = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.sky, options); |
109 | 110 | mSky = Bitmap.createScaledBitmap(mSky, mScreenWidth, mSkyHeight, true);
|
110 |
| - mTown = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.buildings); |
| 111 | + mTown = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.buildings, options); |
111 | 112 | mTown = Bitmap.createScaledBitmap(mTown, mScreenWidth, (int) (mScreenWidth * TOWN_RATIO), true);
|
112 |
| - mSun = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.sun); |
| 113 | + mSun = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.sun, options); |
113 | 114 | mSun = Bitmap.createScaledBitmap(mSun, mSunSize, mSunSize, true);
|
114 | 115 | }
|
115 | 116 |
|
@@ -272,21 +273,6 @@ public void setBounds(int left, int top, int right, int bottom) {
|
272 | 273 | super.setBounds(left, top, right, mSkyHeight + top);
|
273 | 274 | }
|
274 | 275 |
|
275 |
| - @Override |
276 |
| - public void setAlpha(int alpha) { |
277 |
| - |
278 |
| - } |
279 |
| - |
280 |
| - @Override |
281 |
| - public void setColorFilter(ColorFilter colorFilter) { |
282 |
| - |
283 |
| - } |
284 |
| - |
285 |
| - @Override |
286 |
| - public int getOpacity() { |
287 |
| - return PixelFormat.TRANSLUCENT; |
288 |
| - } |
289 |
| - |
290 | 276 | @Override
|
291 | 277 | public boolean isRunning() {
|
292 | 278 | return false;
|
|
0 commit comments