fixed artist download option
This commit is contained in:
parent
4910b3fdc6
commit
8a731b5073
1 changed files with 315 additions and 321 deletions
|
@ -8,7 +8,7 @@ import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.design.widget.CollapsingToolbarLayout;
|
import android.support.design.widget.CollapsingToolbarLayout;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.NestedScrollView;
|
import android.support.v4.util.Pair;
|
||||||
import android.support.v7.widget.AppCompatTextView;
|
import android.support.v7.widget.AppCompatTextView;
|
||||||
import android.support.v7.widget.DefaultItemAnimator;
|
import android.support.v7.widget.DefaultItemAnimator;
|
||||||
import android.support.v7.widget.GridLayoutManager;
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
|
@ -21,15 +21,7 @@ import android.view.SubMenu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
@ -63,6 +55,10 @@ import code.name.monkey.retromusic.util.MusicUtil;
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil;
|
import code.name.monkey.retromusic.util.NavigationUtil;
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
import code.name.monkey.retromusic.util.RetroUtil;
|
import code.name.monkey.retromusic.util.RetroUtil;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.RequestListener;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implements
|
public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
AlbumDetailsContract.AlbumDetailsView {
|
AlbumDetailsContract.AlbumDetailsView {
|
||||||
|
@ -141,7 +137,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
|
|
||||||
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
|
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
|
||||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
|
||||||
|
.getLayoutParams();
|
||||||
params.topMargin = RetroUtil.getStatusBarHeight(this);
|
params.topMargin = RetroUtil.getStatusBarHeight(this);
|
||||||
toolbar.setLayoutParams(params);
|
toolbar.setLayoutParams(params);
|
||||||
}
|
}
|
||||||
|
@ -170,19 +167,13 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.action_shuffle_all})
|
@OnClick({R.id.action_shuffle_all, R.id.artist_image})
|
||||||
public void onViewClicked(View view) {
|
public void onViewClicked(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.menu_close:
|
case R.id.artist_image:
|
||||||
onBackPressed();
|
Pair<View, String> pair = new Pair<>(artistImage,
|
||||||
break;
|
getString(R.string.transition_artist_image));
|
||||||
case R.id.menu:
|
NavigationUtil.goToArtist(this, getAlbum().getArtistId(), pair);
|
||||||
PopupMenu popupMenu = new PopupMenu(this, view);
|
|
||||||
popupMenu.inflate(R.menu.menu_album_detail);
|
|
||||||
MenuItem sortOrder = popupMenu.getMenu().findItem(R.id.action_sort_order);
|
|
||||||
setUpSortOrderMenu(sortOrder.getSubMenu());
|
|
||||||
popupMenu.setOnMenuItemClickListener(this::onOptionsItemSelected);
|
|
||||||
popupMenu.show();
|
|
||||||
break;
|
break;
|
||||||
case R.id.action_shuffle_all:
|
case R.id.action_shuffle_all:
|
||||||
MusicPlayerRemote.openAndShuffleQueue(album.songs, true);
|
MusicPlayerRemote.openAndShuffleQueue(album.songs, true);
|
||||||
|
@ -226,7 +217,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
this.album = album;
|
this.album = album;
|
||||||
|
|
||||||
title.setText(album.getTitle());
|
title.setText(album.getTitle());
|
||||||
text.setText(String.format("%s%s • %s", album.getArtistName(), " • " + MusicUtil.getYearString(album.getYear()),
|
text.setText(String.format("%s%s • %s", album.getArtistName(),
|
||||||
|
" • " + MusicUtil.getYearString(album.getYear()),
|
||||||
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs))));
|
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs))));
|
||||||
|
|
||||||
loadAlbumCover();
|
loadAlbumCover();
|
||||||
|
@ -246,7 +238,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
|
|
||||||
ArtistGlideRequest.Builder.from(Glide.with(this),
|
ArtistGlideRequest.Builder.from(Glide.with(this),
|
||||||
ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst())
|
ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst())
|
||||||
.forceDownload(true)
|
.forceDownload(false)
|
||||||
.generatePalette(this).build()
|
.generatePalette(this).build()
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new RetroMusicColoredTarget(artistImage) {
|
.into(new RetroMusicColoredTarget(artistImage) {
|
||||||
|
@ -256,8 +248,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ArrayList<Album> albums = ArtistLoader.getArtist(this, album.getArtistId())
|
||||||
ArrayList<Album> albums = ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst().albums;
|
.blockingFirst().albums;
|
||||||
albums.remove(album);
|
albums.remove(album);
|
||||||
if (!albums.isEmpty()) {
|
if (!albums.isEmpty()) {
|
||||||
moreTitle.setVisibility(View.VISIBLE);
|
moreTitle.setVisibility(View.VISIBLE);
|
||||||
|
@ -269,7 +261,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
|
|
||||||
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums,
|
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums,
|
||||||
false, null);
|
false, null);
|
||||||
moreRecyclerView.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
|
moreRecyclerView
|
||||||
|
.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
|
||||||
moreRecyclerView.setAdapter(albumAdapter);
|
moreRecyclerView.setAdapter(albumAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +300,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setColors(int color) {
|
private void setColors(int color) {
|
||||||
int themeColor = PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
|
int themeColor =
|
||||||
|
PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
|
||||||
songTitle.setTextColor(themeColor);
|
songTitle.setTextColor(themeColor);
|
||||||
moreTitle.setTextColor(themeColor);
|
moreTitle.setTextColor(themeColor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue