Commit Graph

13 Commits

Author SHA1 Message Date
Adam Koch
7165109e6d Bitmapfun Sample: Cleanup gradle files to import into Studio properly.
Change-Id: I5578216d47b22ed6dcc5a33a80f7a4f6e39d810d
2013-10-22 14:16:35 -04:00
Adam Koch
da23e7a006 Bitmapfun Sample: Update for KitKat and clean up some minor bugs.
Change-Id: Iceb1c03a08193dc03747ab7946e9c19cf32ae7c7
2013-10-17 14:32:33 -04:00
Adam Koch
d308f86f33 Bitmapfun Sample: Migrate to Android Studio/gradle project.
Change-Id: I74dd29d607f066d331ffa309dba1bc6cbb30d93f
2013-10-17 11:05:13 -04:00
Adam Koch
5f51b7fb0c Bitmapfun Sample: Add some docs and clean up some method naming.
Change-Id: I12dc039b1084a8f1a27b47a5a516773ab4e1c2cb
2013-02-21 11:00:19 -05:00
Adam Koch
e826ee24ec Merge "Bitmapfun Sample: Add additional sample images." into jb-mr1-dev 2013-02-21 14:03:07 +00:00
Adam Koch
ec4b4c4188 Bitmapfun Sample: Add additional sample images.
Add a larger number of sample images so it's easier to see the result
of the various bitmap optimizations.

Change-Id: Ieef04a1cd4dc6cf1fa165baa0a6f8d4750b58d71
2013-02-20 15:08:06 -05:00
Chris Banes
3b7f23f881 bitmapfun: Add support to use inBitmap option
This adds support for devices running Honeycomb or newer
to use the inBitmap BitmapFactory option when decoding images. The way
it accomplishes this is by adding a second level 'memory cache' using
SoftReferences. When an item is removed from the LruCache it is added
to this SoftReference Set. The next time an image is decoded, the Set
is searched to see if it contains a bitmap that can be re-used.

Change-Id: I8f980160ddc7116731b25e6f3f110c38f207f286
Signed-off-by: Chris Banes <chrisbanes@google.com>
2013-02-13 13:19:09 +00:00
Chris Banes
4d6574e878 Update bitmapfun sample to call recycle()
A new sub-class of BitmapDrawable has been created which tracks
when it is being used or cached when running on Gingerbread or
older. A new ImageView subclass has been added to accomplish this,
as well as changes to the LruCache.

Change-Id: I95d3334684703aebb6b09fcd56194cf73e3c2dcf
Signed-off-by: Chris Banes <chrisbanes@google.com>
2013-02-06 16:21:21 +00:00
Adam Koch
2e5555e04b Bitmapfun Sample: Fix bug where background image loading could hang
Background image loading is paused when the GridView is scrolling,
if the activity is destroyed during a scroll the image loading was
not unpaused causing it to remain running indefinitely. This change
makes sure the background image loading is unpaused.

Change-Id: Iad8093fc2af50fcfc1416c5d9089db0c064711cf
2013-01-28 12:20:42 -05:00
Adam Koch
b8a61acb07 Bitmapfun Sample: Change cache memory calculation to use maxMemory()
When calculating memory cache size, use Runtime.maxMemory() instead
of getMemoryClass() which is a more accurate value of available VM
heap size.

Also bump target and build SDK to 17.

Bug: 7988323
Change-Id: I4b94688b3800d958ffbe03ee9a2a620982483d3d
2013-01-11 16:51:09 -05:00
Adam Koch
6acfaccc50 Bitmapfun Sample: Fix inSampleSize selection and update dependencies
When computing inSampleSize, calculateInSampleSize() needs to compare
height/width ratios, rather than raw values.

Also updating support library JAR to latest version.

Bug: 7951398
Change-Id: Id15dbcc105bbd2bbf8e03883aeba780da6f807eb
2013-01-09 16:12:52 -05:00
Adam Koch
03ceb37f79 Updating code sample for "displaying bitmaps efficiently" training class.
Changes:
 -Use updated versions of ImageWorker & ImageCache from I/O 2012 app
 -Use copied DiskLruCache from system (rather than custom)
 -Use copied AsyncTask from system (to keep behavior consistent)
 -Ensure no strict mode violations or lint errors
 -Other misc bug fixes
 -Move single-use static methods in Utils to corresponding class

Change-Id: If21e045db1e1a80391169f3c9c9258d48345ab6b
2012-08-23 16:41:05 -04:00
Adam Koch
2bab0137e0 Sample app for Android U class: Displaying Bitmaps Efficiently
Change-Id: I21da4e60f719b7159ada83894cca8d108bedd3d5
2012-04-03 23:15:18 -04:00