|
1 | 1 | /* |
2 | | - Copyright 2011 Harri Smått |
| 2 | + Copyright 2012 Harri Smatt |
3 | 3 |
|
4 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | you may not use this file except in compliance with the License. |
|
12 | 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | 13 | See the License for the specific language governing permissions and |
14 | 14 | limitations under the License. |
15 | | -*/ |
| 15 | + */ |
16 | 16 |
|
17 | 17 | package fi.harism.curl; |
18 | 18 |
|
@@ -50,10 +50,7 @@ public void onCreate(Bundle savedInstanceState) { |
50 | 50 |
|
51 | 51 | // This is something somewhat experimental. Before uncommenting next |
52 | 52 | // line, please see method comments in CurlView. |
53 | | - mCurlView.setEnableTouchPressure(true); |
54 | | - |
55 | | - // CAGS: This is to allow 2 pages landscape mode, set to false for legacy mode |
56 | | - mCurlView.set2PagesLandscape(true); |
| 53 | + // mCurlView.setEnableTouchPressure(true); |
57 | 54 | } |
58 | 55 |
|
59 | 56 | @Override |
@@ -83,6 +80,21 @@ private class BitmapProvider implements CurlView.BitmapProvider { |
83 | 80 |
|
84 | 81 | @Override |
85 | 82 | public Bitmap getBitmap(int width, int height, int index) { |
| 83 | + |
| 84 | + // For every "odd" bitmap (back-facing ones); 1, 3, 5, 7... Return a |
| 85 | + // static few pixel default bitmap only. |
| 86 | + if ((index & 0x01) == 0x01) { |
| 87 | + final int colors[] = { 0xFF808080, 0xFFA0A0A0, 0xFFA0A0A0, |
| 88 | + 0xFF808080 }; |
| 89 | + Bitmap bitmap = Bitmap.createBitmap(colors, 2, 2, |
| 90 | + Bitmap.Config.ARGB_8888); |
| 91 | + return bitmap; |
| 92 | + } |
| 93 | + |
| 94 | + // For front facing bitmaps (even ones) change index --> index / 2 |
| 95 | + // --> 0, 1, 2, 3... |
| 96 | + index >>= 1; |
| 97 | + |
86 | 98 | Bitmap b = Bitmap.createBitmap(width, height, |
87 | 99 | Bitmap.Config.ARGB_8888); |
88 | 100 | b.eraseColor(0xFFFFFFFF); |
@@ -122,7 +134,9 @@ public Bitmap getBitmap(int width, int height, int index) { |
122 | 134 |
|
123 | 135 | @Override |
124 | 136 | public int getBitmapCount() { |
125 | | - return mBitmapIds.length; |
| 137 | + // Number of bitmaps * 2 for we have mBitmapIds.length bitmaps + |
| 138 | + // same amount of static "back-facing" bitmaps. |
| 139 | + return mBitmapIds.length * 2; |
126 | 140 | } |
127 | 141 | } |
128 | 142 |
|
|
0 commit comments