-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from MisterRager/expose-bitmap-recycle
Feature Request: Expose API For Capturing Bitmaps On Tile#reset
- Loading branch information
Showing
6 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tileview/src/main/java/com/qozix/tileview/graphics/BitmapRecycler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.qozix.tileview.graphics; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
/** | ||
* This interface represents the final operations applied to a {@link Bitmap} owned by a | ||
* {@link com.qozix.tileview.tiles.Tile} after it is no longer being used. Generally, this only | ||
* entails a call to {@link Bitmap#recycle()}, but it also provides a place to catch {@link Bitmap} | ||
* instances for reuse in a cache or an object pool. | ||
*/ | ||
public interface BitmapRecycler { | ||
void recycleBitmap( Bitmap bitmap ); | ||
} |
12 changes: 12 additions & 0 deletions
12
tileview/src/main/java/com/qozix/tileview/graphics/BitmapRecyclerDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.qozix.tileview.graphics; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
public class BitmapRecyclerDefault implements BitmapRecycler { | ||
@Override | ||
public void recycleBitmap( Bitmap bitmap ) { | ||
if( !bitmap.isRecycled() ) { | ||
bitmap.recycle(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters