Hopefully fixed OOM when bluring an image.
This commit is contained in:
parent
8ba3ed3b4b
commit
bfa800bce6
5 changed files with 34 additions and 19 deletions
|
|
@ -213,11 +213,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
.resetViewBeforeLoading(true)
|
||||
.build(),
|
||||
new SimpleImageLoadingListener() {
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
|
||||
applyPalette(null);
|
||||
albumArtBackground.setImageBitmap(new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art)).process(10));
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inSampleSize = 2;
|
||||
albumArtBackground.setImageBitmap(new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art, options)).process(10));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
startPostponedEnterTransition();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ import butterknife.InjectView;
|
|||
|
||||
/**
|
||||
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
||||
* <p>
|
||||
* <p/>
|
||||
* Should be kinda stable ONLY AS IT IS!!!
|
||||
*/
|
||||
public class ArtistDetailActivity extends AbsFabActivity implements PaletteColorHolder, CabHolder {
|
||||
|
|
@ -282,8 +282,9 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
}
|
||||
|
||||
private void setUpArtistImageAndApplyPalette(final boolean forceDownload) {
|
||||
final StackBlurManager defaultArtistImageBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_artist_image));
|
||||
artistImageBackground.setImageBitmap(defaultArtistImageBlurManager.process(10));
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inSampleSize = 2;
|
||||
final StackBlurManager defaultArtistImageBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_artist_image, options));
|
||||
LastFMArtistImageUrlLoader.loadArtistImageUrl(this, artist.name, forceDownload, new LastFMArtistImageUrlLoader.ArtistImageUrlLoaderCallback() {
|
||||
@Override
|
||||
public void onArtistImageUrlLoaded(final String url) {
|
||||
|
|
@ -299,7 +300,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
@Override
|
||||
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
|
||||
applyPalette(null);
|
||||
artistImageBackground.setImageBitmap(defaultArtistImageBlurManager.returnBlurredImage());
|
||||
artistImageBackground.setImageBitmap(defaultArtistImageBlurManager.process(10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -435,7 +435,9 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
applyPalette(null);
|
||||
// to gain some performance cache the blurred bitmap
|
||||
if (defaultAlbumArtStackBlurManager == null) {
|
||||
defaultAlbumArtStackBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art));
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inSampleSize = 2;
|
||||
defaultAlbumArtStackBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_album_art, options));
|
||||
defaultAlbumArtStackBlurManager.process(10);
|
||||
}
|
||||
albumArtBackground.setImageBitmap(defaultAlbumArtStackBlurManager.returnBlurredImage());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue