Fade album covers in the now playing screen in.
This commit is contained in:
parent
8943453a04
commit
9a73fcfee6
3 changed files with 41 additions and 31 deletions
|
|
@ -25,10 +25,18 @@
|
||||||
|
|
||||||
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
|
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
|
||||||
|
|
||||||
|
<h3>Version 0.9.46 beta 1</h3>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li><b>NEW:</b> Fade album covers in the now playing screen in.</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<h3>Version 0.9.45</h3>
|
<h3>Version 0.9.45</h3>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li><b>NEW:</b> Moved the stuff from the <i>about</i> dialog to a whole new screen and added useful links.</li>
|
<li><b>NEW:</b> Moved the stuff from the <i>about</i> dialog to a whole new screen and added
|
||||||
|
useful links.
|
||||||
|
</li>
|
||||||
<li><b>FIX:</b> Even though the Last.fm app and web page say something is scrobbling, the
|
<li><b>FIX:</b> Even though the Last.fm app and web page say something is scrobbling, the
|
||||||
scrobble doesn't actually get saved at the end. <i>Thanks to Tim Malseed for that.</i>
|
scrobble doesn't actually get saved at the end. <i>Thanks to Tim Malseed for that.</i>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -129,15 +129,10 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.displayer(new FadeInBitmapDisplayer(FADE_IN_TIME) {
|
.displayer(new FadeInBitmapDisplayer(FADE_IN_TIME, true, true, false) {
|
||||||
@Override
|
@Override
|
||||||
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
|
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
|
||||||
boolean loadedFromMemoryCache = loadedFrom == LoadedFrom.MEMORY_CACHE;
|
super.display(bitmap, imageAware, loadedFrom);
|
||||||
if (loadedFromMemoryCache) {
|
|
||||||
imageAware.setImageBitmap(bitmap);
|
|
||||||
} else {
|
|
||||||
super.display(bitmap, imageAware, loadedFrom);
|
|
||||||
}
|
|
||||||
if (usePalette)
|
if (usePalette)
|
||||||
setColors(holder.paletteColor, holder);
|
setColors(holder.paletteColor, holder);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
import android.support.v7.graphics.Palette;
|
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
@ -70,7 +69,11 @@ import com.kabouzeid.gramophone.views.SquareIfPlaceImageView;
|
||||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||||
|
import com.nostra13.universalimageloader.core.assist.LoadedFrom;
|
||||||
|
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||||
|
import com.nostra13.universalimageloader.core.imageaware.ImageAware;
|
||||||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||||
|
import com.nostra13.universalimageloader.core.process.BitmapProcessor;
|
||||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
@ -80,17 +83,17 @@ import butterknife.ButterKnife;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karim Abou Zeid (kabouzeid)
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
* <p>
|
* <p/>
|
||||||
* Do not use {@link #setContentView(int)} but wrap your layout with
|
* Do not use {@link #setContentView(int)} but wrap your layout with
|
||||||
* {@link #wrapSlidingMusicPanelAndFab(int)} first and then return it in {@link #createContentView()}
|
* {@link #wrapSlidingMusicPanelAndFab(int)} first and then return it in {@link #createContentView()}
|
||||||
*/
|
*/
|
||||||
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements SlidingUpPanelLayout.PanelSlideListener, SharedPreferences.OnSharedPreferenceChangeListener, Toolbar.OnMenuItemClickListener {
|
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements SlidingUpPanelLayout.PanelSlideListener, SharedPreferences.OnSharedPreferenceChangeListener, Toolbar.OnMenuItemClickListener {
|
||||||
public static final String TAG = AbsSlidingMusicPanelActivity.class.getSimpleName();
|
public static final String TAG = AbsSlidingMusicPanelActivity.class.getSimpleName();
|
||||||
|
|
||||||
private static final int FAB_CIRCULAR_REVEAL_ANIMATION_TIME = 1000;
|
|
||||||
private static final long DEFAULT_PROGRESS_VIEW_REFRESH_INTERVAL = 500;
|
|
||||||
private static final int CMD_REFRESH_PROGRESS_VIEWS = 1;
|
private static final int CMD_REFRESH_PROGRESS_VIEWS = 1;
|
||||||
|
|
||||||
|
private static final int FAB_CIRCULAR_REVEAL_ANIMATION_TIME = 1000;
|
||||||
|
|
||||||
@Bind(R.id.play_pause_fab)
|
@Bind(R.id.play_pause_fab)
|
||||||
FloatingActionButton playPauseButton;
|
FloatingActionButton playPauseButton;
|
||||||
@Bind(R.id.sliding_layout)
|
@Bind(R.id.sliding_layout)
|
||||||
|
|
@ -835,18 +838,39 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
miniPlayerTitle.setText(song.title);
|
miniPlayerTitle.setText(song.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ColorHolder {
|
||||||
|
@ColorInt
|
||||||
|
public int color;
|
||||||
|
}
|
||||||
|
|
||||||
private void setUpAlbumArtAndApplyPalette() {
|
private void setUpAlbumArtAndApplyPalette() {
|
||||||
|
final ColorHolder colorHolder = new ColorHolder();
|
||||||
ImageLoader.getInstance().displayImage(
|
ImageLoader.getInstance().displayImage(
|
||||||
MusicUtil.getSongImageLoaderString(song),
|
MusicUtil.getSongImageLoaderString(song),
|
||||||
albumArt,
|
albumArt,
|
||||||
new DisplayImageOptions.Builder()
|
new DisplayImageOptions.Builder()
|
||||||
.cacheInMemory(true)
|
.cacheInMemory(true)
|
||||||
.showImageOnFail(R.drawable.default_album_art)
|
.showImageOnFail(R.drawable.default_album_art)
|
||||||
|
.postProcessor(new BitmapProcessor() {
|
||||||
|
@Override
|
||||||
|
public Bitmap process(Bitmap bitmap) {
|
||||||
|
colorHolder.color = ColorUtil.generateColor(AbsSlidingMusicPanelActivity.this, bitmap);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.displayer(new FadeInBitmapDisplayer(ViewUtil.DEFAULT_COLOR_ANIMATION_DURATION) {
|
||||||
|
@Override
|
||||||
|
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
|
||||||
|
super.display(bitmap, imageAware, loadedFrom);
|
||||||
|
setColors(colorHolder.color);
|
||||||
|
}
|
||||||
|
})
|
||||||
.build(),
|
.build(),
|
||||||
new SimpleImageLoadingListener() {
|
new SimpleImageLoadingListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingFailed(String imageUri, View view, @Nullable FailReason failReason) {
|
public void onLoadingFailed(String imageUri, View view, @Nullable FailReason failReason) {
|
||||||
applyPalette(null);
|
FadeInBitmapDisplayer.animate(view, ViewUtil.DEFAULT_COLOR_ANIMATION_DURATION);
|
||||||
|
setColors(ColorUtil.resolveColor(AbsSlidingMusicPanelActivity.this, R.attr.default_bar_color));
|
||||||
|
|
||||||
ImageLoader.getInstance().displayImage(
|
ImageLoader.getInstance().displayImage(
|
||||||
"drawable://" + R.drawable.default_album_art,
|
"drawable://" + R.drawable.default_album_art,
|
||||||
|
|
@ -862,8 +886,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyPalette(loadedImage);
|
|
||||||
|
|
||||||
ImageLoader.getInstance().displayImage(
|
ImageLoader.getInstance().displayImage(
|
||||||
imageUri,
|
imageUri,
|
||||||
albumArtBackground,
|
albumArtBackground,
|
||||||
|
|
@ -874,21 +896,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyPalette(@Nullable Bitmap bitmap) {
|
|
||||||
if (bitmap != null) {
|
|
||||||
Palette.from(bitmap)
|
|
||||||
.resizeBitmapSize(ColorUtil.PALETTE_BITMAP_SIZE)
|
|
||||||
.generate(new Palette.PaletteAsyncListener() {
|
|
||||||
@Override
|
|
||||||
public void onGenerated(@NonNull Palette palette) {
|
|
||||||
setColors(ColorUtil.getColor(AbsSlidingMusicPanelActivity.this, palette));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setColors(ColorUtil.getColor(AbsSlidingMusicPanelActivity.this, null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setColors(int color) {
|
private void setColors(int color) {
|
||||||
animateColorChange(color);
|
animateColorChange(color);
|
||||||
|
|
||||||
|
|
@ -979,7 +986,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
songTotalTime.setText(MusicUtil.getReadableDurationString(totalMillis));
|
songTotalTime.setText(MusicUtil.getReadableDurationString(totalMillis));
|
||||||
|
|
||||||
if (!MusicPlayerRemote.isPlaying()) {
|
if (!MusicPlayerRemote.isPlaying()) {
|
||||||
return DEFAULT_PROGRESS_VIEW_REFRESH_INTERVAL;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the number of milliseconds until the next full second,
|
// calculate the number of milliseconds until the next full second,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue