diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-04-05 18:49:28 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-04-05 18:52:10 +0200 |
commit | e9b7dd6faf191111a071ffeb0367f7e12a2aa7e1 (patch) | |
tree | 922a86c03ec5cd9fa7018fb1c1a9dd9a786f2750 /android | |
parent | 45130a1b673a930f8607cd86e655a4b4cc2b89e2 (diff) |
android: getDrawable(int) is deprecated
additionally reduce scope of to package-private
Change-Id: I46ca55c5ef7daf992407beef53f5da939bf9066a
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/canvas/BitmapHandle.java | 14 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/canvas/ImageUtils.java | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java b/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java index d450b7cc0f68..e46173db518f 100644 --- a/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java +++ b/android/source/src/java/org/libreoffice/canvas/BitmapHandle.java @@ -2,10 +2,10 @@ package org.libreoffice.canvas; import android.content.Context; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.RectF; import android.graphics.drawable.Drawable; +import android.support.v4.content.ContextCompat; /** * Bitmap handle canvas element is used to show a handle on the screen. @@ -14,10 +14,10 @@ import android.graphics.drawable.Drawable; */ public abstract class BitmapHandle extends CommonCanvasElement { public final RectF mDocumentPosition; - protected final Bitmap mBitmap; - protected final RectF mScreenPosition; + private final Bitmap mBitmap; + final RectF mScreenPosition; - public BitmapHandle(Bitmap bitmap) { + BitmapHandle(Bitmap bitmap) { mBitmap = bitmap; mScreenPosition = new RectF(0, 0, mBitmap.getWidth(), mBitmap.getHeight()); mDocumentPosition = new RectF(); @@ -26,8 +26,8 @@ public abstract class BitmapHandle extends CommonCanvasElement { /** * Return a bitmap for a drawable id. */ - protected static Bitmap getBitmapForDrawable(Context context, int drawableId) { - Drawable drawable = context.getResources().getDrawable(drawableId); + static Bitmap getBitmapForDrawable(Context context, int drawableId) { + Drawable drawable = ContextCompat.getDrawable(context, drawableId); return ImageUtils.getBitmapForDrawable(drawable); } @@ -45,7 +45,7 @@ public abstract class BitmapHandle extends CommonCanvasElement { * Test if the bitmap has been hit. * @param x - x coordinate * @param y - y coordinate - * @return + * @return true if the bitmap has been hit */ @Override public boolean onHitTest(float x, float y) { diff --git a/android/source/src/java/org/libreoffice/canvas/ImageUtils.java b/android/source/src/java/org/libreoffice/canvas/ImageUtils.java index e41e6ebe2101..ecda9b77c597 100644 --- a/android/source/src/java/org/libreoffice/canvas/ImageUtils.java +++ b/android/source/src/java/org/libreoffice/canvas/ImageUtils.java @@ -4,8 +4,8 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -public class ImageUtils { - public static Bitmap getBitmapForDrawable(Drawable drawable) { +class ImageUtils { + static Bitmap getBitmapForDrawable(Drawable drawable) { drawable = drawable.mutate(); int width = !drawable.getBounds().isEmpty() ? |