Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding a constructor to CacheableBitmapDrawable.java to let it implement the default (non deprecated) constructor with Bitmap parameter. #11

Closed
wants to merge 1 commit into from

2 participants

@eyal-lezmy

This constructor is needed because the only one implemented for now is based on a deprecated one. The current constructor does not handle the screen/bitmap density scaling (Resources parameter). That can cause differences on bitmap rendering for this drawable.

Side effect, by using an init method to initialize the variables, I had to remove the final attribute to mUrl and mRecyclePolicy.

@eyal-lezmy eyal-lezmy Adding a constructor to CacheableBitmapDrawable.java to let it implem…
…ent the default (non deprecated) constructor with Bitmap parameter.
f1c0e27
@chrisbanes chrisbanes referenced this pull request from a commit
@chrisbanes [library] Fix #11: Adding a constructor to CacheableBitmapDrawable.ja…
…va to let it implement the default (non deprecated) constructor with Bitmap parameter.
bda38ef
@chrisbanes chrisbanes closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2013
  1. @eyal-lezmy

    Adding a constructor to CacheableBitmapDrawable.java to let it implem…

    eyal-lezmy authored
    …ent the default (non deprecated) constructor with Bitmap parameter.
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +11 −2 library/src/uk/co/senab/bitmapcache/CacheableBitmapDrawable.java
View
13 library/src/uk/co/senab/bitmapcache/CacheableBitmapDrawable.java
@@ -26,9 +26,9 @@
static final String LOG_TAG = "CacheableBitmapDrawable";
// URL Associated with this Bitmap
- private final String mUrl;
+ private String mUrl;
- private final BitmapLruCache.RecyclePolicy mRecyclePolicy;
+ private BitmapLruCache.RecyclePolicy mRecyclePolicy;
// Number of Views currently displaying bitmap
private int mDisplayingCount;
@@ -45,10 +45,19 @@
// Handler which may be used later
private static final Handler sHandler = new Handler(Looper.getMainLooper());
+
@SuppressWarnings("deprecation")
CacheableBitmapDrawable(String url, Bitmap bitmap, BitmapLruCache.RecyclePolicy recyclePolicy) {
super(bitmap);
+ init(url, recyclePolicy);
+ }
+
+ CacheableBitmapDrawable(Resources resources, String url, Bitmap bitmap, BitmapLruCache.RecyclePolicy recyclePolicy) {
+ super(resources, bitmap);
+ init(url, recyclePolicy);
+ }
+ private void init(String url, RecyclePolicy recyclePolicy) {
mUrl = url;
mRecyclePolicy = recyclePolicy;
mDisplayingCount = 0;
Something went wrong with that request. Please try again.