diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-10-04 16:09:26 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-10-04 17:53:21 +0200 |
commit | dd8440a1c940e76626c23a40f62940aee5755e24 (patch) | |
tree | 04bee7c11a8d2b6a73a93b8c6603376ee4ddd5dd /android | |
parent | 488d19de01670c37b638e67bec99dc178d4792a5 (diff) |
android: move getDrawable to LayerView (Fennec import)
Change-Id: Idd15003939574963f836bfab1e0c5385957ab18b
Diffstat (limited to 'android')
4 files changed, 23 insertions, 18 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index 583773b46075..eba732fea95b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -52,7 +52,7 @@ public class MockTileProvider implements TileProvider { tileNumber += 1; // 0 to 1 based numbering String imageName = "d" + tileNumber; - Bitmap bitmap = layerController.getDrawable(imageName); + Bitmap bitmap = layerController.getView().getDrawable(imageName); CairoImage image = new BufferedCairoImage(bitmap); @@ -61,7 +61,7 @@ public class MockTileProvider implements TileProvider { @Override public Bitmap thumbnail(int size) { - return layerController.getDrawable("dummy_page"); + return layerController.getView().getDrawable("dummy_page"); } @Override diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerController.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerController.java index f35ee9df2599..c641c756eb47 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerController.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerController.java @@ -6,9 +6,6 @@ package org.mozilla.gecko.gfx; import android.content.Context; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.PointF; import android.graphics.RectF; @@ -104,9 +101,6 @@ public class LayerController implements PanZoomTarget { return mViewportMetrics.getSize(); } - public Bitmap getBackgroundPattern() { return getDrawable("background"); } - public Bitmap getShadowPattern() { return getDrawable("shadow"); } - public PanZoomController getPanZoomController() { return mPanZoomController; } public GestureDetector.OnGestureListener getGestureListener() { return mPanZoomController; } public SimpleScaleGestureDetector.SimpleScaleGestureListener getScaleGestureListener() { @@ -114,14 +108,6 @@ public class LayerController implements PanZoomTarget { } public GestureDetector.OnDoubleTapListener getDoubleTapListener() { return mPanZoomController; } - public Bitmap getDrawable(String name) { - Resources resources = mContext.getResources(); - int resourceID = resources.getIdentifier(name, "drawable", mContext.getPackageName()); - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inScaled = false; - return BitmapFactory.decodeResource(mContext.getResources(), resourceID, options); - } - /** * The view calls this function to indicate that the viewport changed size. It must hold the * monitor while calling it. diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java index dcedaae6c7b3..b4975dade8a5 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java @@ -160,12 +160,12 @@ public class LayerRenderer implements GLSurfaceView.Renderer { LayerController controller = view.getController(); - CairoImage backgroundImage = new BufferedCairoImage(controller.getBackgroundPattern()); + CairoImage backgroundImage = new BufferedCairoImage(view.getBackgroundPattern()); mBackgroundLayer = new SingleTileLayer(true, backgroundImage); mScreenshotLayer = ScreenshotLayer.create(); - CairoImage shadowImage = new BufferedCairoImage(controller.getShadowPattern()); + CairoImage shadowImage = new BufferedCairoImage(view.getShadowPattern()); mShadowLayer = new NinePatchTileLayer(shadowImage); mHorizScrollLayer = ScrollbarLayer.create(this, false); diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java index 505f933524a2..0a993a7ebe8e 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerView.java @@ -7,7 +7,9 @@ package org.mozilla.gecko.gfx; import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.PixelFormat; import android.graphics.SurfaceTexture; import android.os.Build; @@ -235,6 +237,23 @@ public class LayerView extends FrameLayout { return mGLController; } + public Bitmap getDrawable(String name) { + Context context = getContext(); + Resources resources = context.getResources(); + int resourceID = resources.getIdentifier(name, "drawable", context.getPackageName()); + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inScaled = false; + return BitmapFactory.decodeResource(context.getResources(), resourceID, options); + } + + Bitmap getBackgroundPattern() { + return getDrawable("background"); + } + + Bitmap getShadowPattern() { + return getDrawable("shadow"); + } + private void onSizeChanged(int width, int height) { mGLController.surfaceChanged(width, height); |