diff --git a/views/src/main/java/com/cooltechworks/views/ScratchImageView.java b/views/src/main/java/com/cooltechworks/views/ScratchImageView.java index c0bc04f..c3ea167 100644 --- a/views/src/main/java/com/cooltechworks/views/ScratchImageView.java +++ b/views/src/main/java/com/cooltechworks/views/ScratchImageView.java @@ -375,7 +375,7 @@ public void onPostExecute(Float percentRevealed) { } } } - }.execute(left, top, width, height); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, left, top, width, height); } } @@ -395,6 +395,13 @@ public int[] getImageBounds() { Drawable drawable = getDrawable(); + + // if user has not provided the src or image resource + // we will use the frame drawable to get the height and width. + if (drawable == null) { + drawable = mDrawable; + } + Rect bounds = drawable.getBounds(); int width = drawable.getIntrinsicWidth();