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.FloatingActionButton;
|
||||
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.DefaultItemAnimator;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
|
@ -21,15 +21,7 @@ import android.view.SubMenu;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupMenu;
|
||||
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.ButterKnife;
|
||||
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.PreferenceUtil;
|
||||
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
|
||||
AlbumDetailsContract.AlbumDetailsView {
|
||||
|
@ -141,7 +137,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
getSupportActionBar().setTitle(null);
|
||||
|
||||
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);
|
||||
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) {
|
||||
switch (view.getId()) {
|
||||
case R.id.menu_close:
|
||||
onBackPressed();
|
||||
break;
|
||||
case R.id.menu:
|
||||
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();
|
||||
case R.id.artist_image:
|
||||
Pair<View, String> pair = new Pair<>(artistImage,
|
||||
getString(R.string.transition_artist_image));
|
||||
NavigationUtil.goToArtist(this, getAlbum().getArtistId(), pair);
|
||||
break;
|
||||
case R.id.action_shuffle_all:
|
||||
MusicPlayerRemote.openAndShuffleQueue(album.songs, true);
|
||||
|
@ -226,7 +217,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
this.album = album;
|
||||
|
||||
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))));
|
||||
|
||||
loadAlbumCover();
|
||||
|
@ -246,7 +238,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
|
||||
ArtistGlideRequest.Builder.from(Glide.with(this),
|
||||
ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst())
|
||||
.forceDownload(true)
|
||||
.forceDownload(false)
|
||||
.generatePalette(this).build()
|
||||
.dontAnimate()
|
||||
.into(new RetroMusicColoredTarget(artistImage) {
|
||||
|
@ -256,8 +248,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
ArrayList<Album> albums = ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst().albums;
|
||||
ArrayList<Album> albums = ArtistLoader.getArtist(this, album.getArtistId())
|
||||
.blockingFirst().albums;
|
||||
albums.remove(album);
|
||||
if (!albums.isEmpty()) {
|
||||
moreTitle.setVisibility(View.VISIBLE);
|
||||
|
@ -269,7 +261,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
|
||||
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums,
|
||||
false, null);
|
||||
moreRecyclerView.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
|
||||
moreRecyclerView
|
||||
.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
|
||||
moreRecyclerView.setAdapter(albumAdapter);
|
||||
}
|
||||
|
||||
|
@ -307,7 +300,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
}
|
||||
|
||||
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);
|
||||
moreTitle.setTextColor(themeColor);
|
||||
|
||||
|
|
Loading…
Reference in a new issue