New artist details activity [biography missing yet]
This commit is contained in:
parent
346961a636
commit
ef48e9305b
26 changed files with 664 additions and 486 deletions
|
|
@ -42,11 +42,12 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:21.0.+'
|
compile 'com.android.support:appcompat-v7:21.0.0'
|
||||||
compile 'com.android.support:gridlayout-v7:21.0.+'
|
compile 'com.android.support:gridlayout-v7:21.0.0'
|
||||||
compile 'com.android.support:recyclerview-v7:21.0.+'
|
compile 'com.android.support:recyclerview-v7:21.0.0'
|
||||||
compile 'com.android.support:palette-v7:21.0.+'
|
compile 'com.android.support:palette-v7:21.0.0'
|
||||||
compile 'com.android.support:support-v13:21.0.+'
|
compile 'com.android.support:support-v13:21.0.0'
|
||||||
|
compile 'com.android.support:cardview-v7:21.0.0'
|
||||||
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
|
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
|
||||||
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
|
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
|
||||||
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
|
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
|
||||||
|
|
||||||
public ViewHolder(View itemView) {
|
public ViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
image = (SquareImageView) itemView.findViewById(R.id.album_art);
|
image = (ImageView) itemView.findViewById(R.id.album_art);
|
||||||
title = (TextView) itemView.findViewById(R.id.album_title);
|
title = (TextView) itemView.findViewById(R.id.album_title);
|
||||||
artist = (TextView) itemView.findViewById(R.id.album_interpret);
|
artist = (TextView) itemView.findViewById(R.id.album_interpret);
|
||||||
footer = itemView.findViewById(R.id.footer);
|
footer = itemView.findViewById(R.id.footer);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.kabouzeid.gramophone.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v4.util.Pair;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
|
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
||||||
|
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistThumbnailUrlLoader;
|
||||||
|
import com.kabouzeid.gramophone.loader.SongFilePathLoader;
|
||||||
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
|
import com.kabouzeid.gramophone.model.Artist;
|
||||||
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
|
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
||||||
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by karim on 29.12.14.
|
||||||
|
*/
|
||||||
|
public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder> {
|
||||||
|
protected Activity activity;
|
||||||
|
protected List<Artist> dataSet;
|
||||||
|
|
||||||
|
public ArtistAdapter(Activity activity, List<Artist> objects) {
|
||||||
|
this.activity = activity;
|
||||||
|
dataSet = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_artist_view, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
|
final Artist artist = dataSet.get(position);
|
||||||
|
|
||||||
|
holder.artistName.setText(artist.name);
|
||||||
|
holder.artistInfo.setText(artist.getSubTitle());
|
||||||
|
holder.artistImage.setImageResource(R.drawable.default_artist_image);
|
||||||
|
|
||||||
|
LastFMArtistThumbnailUrlLoader.loadArtistThumbnailUrl(activity, artist.name, false, new LastFMArtistThumbnailUrlLoader.ArtistThumbnailUrlLoaderCallback() {
|
||||||
|
@Override
|
||||||
|
public void onArtistThumbnailUrlLoaded(String url) {
|
||||||
|
Picasso.with(activity)
|
||||||
|
.load(url)
|
||||||
|
.placeholder(R.drawable.default_artist_image)
|
||||||
|
.into(holder.artistImage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return dataSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
TextView artistName;
|
||||||
|
TextView artistInfo;
|
||||||
|
ImageView artistImage;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
artistName = (TextView) itemView.findViewById(R.id.artist_name);
|
||||||
|
artistInfo = (TextView) itemView.findViewById(R.id.artist_info);
|
||||||
|
artistImage = (ImageView) itemView.findViewById(R.id.artist_image);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Pair[] artistPairs = new Pair[]{
|
||||||
|
Pair.create(artistImage,
|
||||||
|
activity.getResources().getString(R.string.transition_artist_image)
|
||||||
|
)};
|
||||||
|
if (activity instanceof AbsFabActivity)
|
||||||
|
artistPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(artistPairs);
|
||||||
|
NavigationUtil.goToArtist(activity, dataSet.get(getPosition()).id, artistPairs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.kabouzeid.gramophone.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.support.v4.util.Pair;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.model.Album;
|
||||||
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
|
import com.kabouzeid.gramophone.view.SquareImageView;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by karim on 24.11.14.
|
||||||
|
*/
|
||||||
|
public class ArtistAlbumAdapter extends RecyclerView.Adapter<ArtistAlbumAdapter.ViewHolder> {
|
||||||
|
public static final String TAG = AlbumAdapter.class.getSimpleName();
|
||||||
|
|
||||||
|
private static final int TYPE_FIRST = 1;
|
||||||
|
private static final int TYPE_MIDDLE = 2;
|
||||||
|
private static final int TYPE_LAST = 3;
|
||||||
|
|
||||||
|
private Activity activity;
|
||||||
|
private List<Album> dataSet;
|
||||||
|
private int listMargin;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_artist_album, parent, false);
|
||||||
|
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
||||||
|
if (viewType == TYPE_FIRST) {
|
||||||
|
params.leftMargin = listMargin;
|
||||||
|
} else if (viewType == TYPE_LAST) {
|
||||||
|
params.rightMargin = listMargin;
|
||||||
|
}
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
|
final Album album = dataSet.get(position);
|
||||||
|
|
||||||
|
Picasso.with(activity)
|
||||||
|
.load(MusicUtil.getAlbumArtUri(album.id))
|
||||||
|
.placeholder(R.drawable.default_album_art)
|
||||||
|
.into(holder.image);
|
||||||
|
|
||||||
|
holder.title.setText(album.title);
|
||||||
|
holder.year.setText(String.valueOf(album.year));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return dataSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if (position == 0) {
|
||||||
|
return TYPE_FIRST;
|
||||||
|
} else if (position == getItemCount() - 1) {
|
||||||
|
return TYPE_LAST;
|
||||||
|
} else return TYPE_MIDDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
ImageView image;
|
||||||
|
TextView title;
|
||||||
|
TextView year;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
image = (ImageView) itemView.findViewById(R.id.album_art);
|
||||||
|
title = (TextView) itemView.findViewById(R.id.album_title);
|
||||||
|
year = (TextView) itemView.findViewById(R.id.album_year);
|
||||||
|
itemView.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Pair[] albumPairs = new Pair[]{
|
||||||
|
Pair.create(image,
|
||||||
|
activity.getResources().getString(R.string.transition_album_cover)
|
||||||
|
)};
|
||||||
|
if (activity instanceof AbsFabActivity)
|
||||||
|
albumPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(albumPairs);
|
||||||
|
NavigationUtil.goToAlbum(activity, dataSet.get(getPosition()).id, albumPairs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtistAlbumAdapter(Activity activity, List<Album> objects) {
|
||||||
|
this.activity = activity;
|
||||||
|
dataSet = objects;
|
||||||
|
listMargin = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.adapter;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
|
||||||
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistThumbnailUrlLoader;
|
|
||||||
import com.kabouzeid.gramophone.model.Artist;
|
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by karim on 29.12.14.
|
|
||||||
*/
|
|
||||||
public class ArtistViewListAdapter extends ArrayAdapter<Artist> {
|
|
||||||
private Context context;
|
|
||||||
|
|
||||||
|
|
||||||
public ArtistViewListAdapter(Context context, List<Artist> objects) {
|
|
||||||
super(context, R.layout.item_artist_view, objects);
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
Artist artist = getItem(position);
|
|
||||||
if (convertView == null) {
|
|
||||||
convertView = LayoutInflater.from(context).inflate(R.layout.item_artist_view, parent, false);
|
|
||||||
}
|
|
||||||
final TextView artistName = (TextView) convertView.findViewById(R.id.artist_name);
|
|
||||||
final TextView artistInfo = (TextView) convertView.findViewById(R.id.artist_info);
|
|
||||||
final ImageView artistArt = (ImageView) convertView.findViewById(R.id.artist_image);
|
|
||||||
|
|
||||||
artistName.setText(artist.name);
|
|
||||||
artistInfo.setText(artist.getSubTitle());
|
|
||||||
|
|
||||||
artistArt.setImageResource(R.drawable.default_artist_image);
|
|
||||||
|
|
||||||
LastFMArtistThumbnailUrlLoader.loadArtistThumbnailUrl(context, artist.name, false, new LastFMArtistThumbnailUrlLoader.ArtistThumbnailUrlLoaderCallback() {
|
|
||||||
@Override
|
|
||||||
public void onArtistThumbnailUrlLoaded(String url) {
|
|
||||||
Picasso.with(getContext())
|
|
||||||
.load(url)
|
|
||||||
.placeholder(R.drawable.default_artist_image)
|
|
||||||
.into(artistArt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return convertView;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class AlbumSongAdapter extends RecyclerView.Adapter<AlbumSongAdapter.View
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(activity).inflate(R.layout.item_song, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_song_album, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.kabouzeid.gramophone.adapter.songadapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v4.util.Pair;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
||||||
|
import com.kabouzeid.gramophone.loader.SongFilePathLoader;
|
||||||
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
|
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
||||||
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by karim on 14.03.15.
|
||||||
|
*/
|
||||||
|
public class ArtistSongAdapter extends ArrayAdapter<Song> {
|
||||||
|
private Activity activity;
|
||||||
|
|
||||||
|
public ArtistSongAdapter(Activity activity, List<Song> songs) {
|
||||||
|
super(activity, R.layout.item_song, songs);
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
final Song song = getItem(position);
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_artist_song, parent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
final TextView songTitle = (TextView) convertView.findViewById(R.id.song_title);
|
||||||
|
final TextView songInfo = (TextView) convertView.findViewById(R.id.song_info);
|
||||||
|
final ImageView albumArt = (ImageView) convertView.findViewById(R.id.album_art);
|
||||||
|
|
||||||
|
songTitle.setText(song.title);
|
||||||
|
songInfo.setText(song.albumName);
|
||||||
|
|
||||||
|
Picasso.with(activity)
|
||||||
|
.load(MusicUtil.getAlbumArtUri(song.albumId))
|
||||||
|
.placeholder(R.drawable.default_album_art)
|
||||||
|
.into(albumArt);
|
||||||
|
|
||||||
|
final ImageView overflowButton = (ImageView) convertView.findViewById(R.id.menu);
|
||||||
|
overflowButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
PopupMenu popupMenu = new PopupMenu(activity, v);
|
||||||
|
popupMenu.inflate(R.menu.menu_song);
|
||||||
|
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_tag_editor:
|
||||||
|
Intent intent = new Intent(activity, SongTagEditorActivity.class);
|
||||||
|
intent.putExtra(AppKeys.E_ID, song.id);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
return true;
|
||||||
|
case R.id.action_details:
|
||||||
|
String songFilePath = SongFilePathLoader.getSongFilePath(activity, song.id);
|
||||||
|
File songFile = new File(songFilePath);
|
||||||
|
SongDetailDialogHelper.getDialog(activity, songFile).show();
|
||||||
|
return true;
|
||||||
|
case R.id.action_go_to_album:
|
||||||
|
Pair[] albumPairs = null;
|
||||||
|
if (activity instanceof AbsFabActivity)
|
||||||
|
albumPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(albumPairs);
|
||||||
|
NavigationUtil.goToAlbum(activity, song.albumId, albumPairs);
|
||||||
|
return true;
|
||||||
|
case R.id.action_go_to_artist:
|
||||||
|
Pair[] artistPairs = null;
|
||||||
|
if (activity instanceof AbsFabActivity)
|
||||||
|
artistPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(artistPairs);
|
||||||
|
NavigationUtil.goToArtist(activity, song.artistId, artistPairs);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popupMenu.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,7 +42,7 @@ public class SongAdapter extends RecyclerView.Adapter<SongAdapter.ViewHolder> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(activity).inflate(R.layout.item_song_view, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_song, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisableAble {
|
public class AlbumDetailActivity extends AbsFabActivity {
|
||||||
public static final String TAG = AlbumDetailActivity.class.getSimpleName();
|
public static final String TAG = AlbumDetailActivity.class.getSimpleName();
|
||||||
|
|
||||||
private App app;
|
private App app;
|
||||||
|
|
@ -152,7 +152,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
private void setUpViews() {
|
private void setUpViews() {
|
||||||
albumTitleView.setText(album.title);
|
albumTitleView.setText(album.title);
|
||||||
|
|
||||||
setUpAlbumArtAndApplyPalette();
|
ViewUtil.addOnGlobalLayoutListener(albumArtImageView, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
setUpAlbumArtAndApplyPalette();
|
||||||
|
}
|
||||||
|
});
|
||||||
setUpListView();
|
setUpListView();
|
||||||
setUpSongsAdapter();
|
setUpSongsAdapter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,47 @@
|
||||||
package com.kabouzeid.gramophone.ui.activities;
|
package com.kabouzeid.gramophone.ui.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v13.app.FragmentPagerAdapter;
|
|
||||||
import android.support.v4.view.ViewPager;
|
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.SparseArray;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.widget.AdapterView;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
|
||||||
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
||||||
|
import com.kabouzeid.gramophone.adapter.ArtistAlbumAdapter;
|
||||||
|
import com.kabouzeid.gramophone.adapter.songadapter.ArtistSongAdapter;
|
||||||
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistImageUrlLoader;
|
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistImageUrlLoader;
|
||||||
|
import com.kabouzeid.gramophone.loader.ArtistAlbumLoader;
|
||||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||||
|
import com.kabouzeid.gramophone.loader.ArtistSongLoader;
|
||||||
import com.kabouzeid.gramophone.misc.AppKeys;
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
|
import com.kabouzeid.gramophone.misc.SmallObservableScrollViewCallbacks;
|
||||||
|
import com.kabouzeid.gramophone.model.Album;
|
||||||
import com.kabouzeid.gramophone.model.Artist;
|
import com.kabouzeid.gramophone.model.Artist;
|
||||||
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.artistviewpager.AbsViewPagerTabArtistListFragment;
|
|
||||||
import com.kabouzeid.gramophone.ui.fragments.artistviewpager.ViewPagerTabArtistAlbumFragment;
|
|
||||||
import com.kabouzeid.gramophone.ui.fragments.artistviewpager.ViewPagerTabArtistBioFragment;
|
|
||||||
import com.kabouzeid.gramophone.ui.fragments.artistviewpager.ViewPagerTabArtistSongListFragment;
|
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.kabouzeid.gramophone.util.Util;
|
import com.kabouzeid.gramophone.util.Util;
|
||||||
import com.kabouzeid.gramophone.util.ViewUtil;
|
import com.kabouzeid.gramophone.util.ViewUtil;
|
||||||
import com.nineoldandroids.animation.Animator;
|
|
||||||
import com.nineoldandroids.view.ViewHelper;
|
import com.nineoldandroids.view.ViewHelper;
|
||||||
import com.nineoldandroids.view.ViewPropertyAnimator;
|
|
||||||
import com.squareup.picasso.Callback;
|
import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
||||||
|
|
@ -53,35 +50,59 @@ import com.squareup.picasso.Picasso;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisableAble, ObservableScrollViewCallbacks {
|
public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
public static final String TAG = ArtistDetailActivity.class.getSimpleName();
|
public static final String TAG = ArtistDetailActivity.class.getSimpleName();
|
||||||
|
|
||||||
public static final String ARG_ARTIST_ID = "com.kabouzeid.gramophone.artist.id";
|
public static final String ARG_ARTIST_ID = "com.kabouzeid.gramophone.artist.id";
|
||||||
public static final String ARG_ARTIST_NAME = "com.kabouzeid.gramophone.artist.name";
|
public static final String ARG_ARTIST_NAME = "com.kabouzeid.gramophone.artist.name";
|
||||||
|
|
||||||
private static final boolean TOOLBAR_IS_STICKY = true;
|
|
||||||
|
|
||||||
private boolean isAnimating;
|
|
||||||
|
|
||||||
private Artist artist;
|
private Artist artist;
|
||||||
|
|
||||||
private SlidingTabLayout slidingTabs;
|
private ObservableListView songListView;
|
||||||
private View statusBar;
|
private View statusBar;
|
||||||
private ImageView artistImageView;
|
private ImageView artistIv;
|
||||||
private View artistArtOverlayView;
|
private View songsBackgroundView;
|
||||||
private View absAlbumListBackgroundView;
|
private TextView artistNameTv;
|
||||||
private TextView artistTitleText;
|
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
private ViewPager viewPager;
|
|
||||||
private NavigationAdapter navigationAdapter;
|
|
||||||
private int toolbarHeight;
|
private int toolbarHeight;
|
||||||
private int headerOffset;
|
private int headerOffset;
|
||||||
private int titleViewHeight;
|
private int titleViewHeight;
|
||||||
private int artistImageViewHeight;
|
private int artistImageViewHeight;
|
||||||
private int toolbarColor;
|
private int toolbarColor;
|
||||||
private int tabHeight;
|
|
||||||
|
|
||||||
private Fragment currentFragment;
|
private View songListHeader;
|
||||||
|
private RecyclerView albumRecyclerView;
|
||||||
|
|
||||||
|
private SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
||||||
|
@Override
|
||||||
|
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
||||||
|
scrollY += artistImageViewHeight + titleViewHeight;
|
||||||
|
super.onScrollChanged(scrollY, b, b2);
|
||||||
|
float flexibleRange = artistImageViewHeight - headerOffset;
|
||||||
|
|
||||||
|
// Translate album cover
|
||||||
|
ViewHelper.setTranslationY(artistIv, Math.max(-artistImageViewHeight, -scrollY / 2));
|
||||||
|
|
||||||
|
// Translate list background
|
||||||
|
ViewHelper.setTranslationY(songsBackgroundView, Math.max(0, -scrollY + artistImageViewHeight));
|
||||||
|
|
||||||
|
// Change alpha of overlay
|
||||||
|
float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
|
||||||
|
ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor);
|
||||||
|
ViewUtil.setBackgroundAlpha(statusBar, alpha, toolbarColor);
|
||||||
|
|
||||||
|
// Translate name text
|
||||||
|
int maxTitleTranslationY = artistImageViewHeight;
|
||||||
|
int titleTranslationY = maxTitleTranslationY - scrollY;
|
||||||
|
titleTranslationY = Math.max(headerOffset, titleTranslationY);
|
||||||
|
|
||||||
|
ViewHelper.setTranslationY(artistNameTv, titleTranslationY);
|
||||||
|
|
||||||
|
// Translate FAB
|
||||||
|
int fabTranslationY = titleTranslationY + titleViewHeight - (getFab().getHeight() / 2);
|
||||||
|
ViewHelper.setTranslationY(getFab(), fabTranslationY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
|
|
@ -102,19 +123,14 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
artistImageView = (ImageView) findViewById(R.id.artist_image);
|
artistIv = (ImageView) findViewById(R.id.artist_image);
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
artistArtOverlayView = findViewById(R.id.overlay);
|
songListView = (ObservableListView) findViewById(R.id.list);
|
||||||
artistTitleText = (TextView) findViewById(R.id.artist_name);
|
artistNameTv = (TextView) findViewById(R.id.artist_name);
|
||||||
absAlbumListBackgroundView = findViewById(R.id.list_background);
|
songsBackgroundView = findViewById(R.id.list_background);
|
||||||
statusBar = findViewById(R.id.statusBar);
|
statusBar = findViewById(R.id.statusBar);
|
||||||
slidingTabs = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
|
songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpObservableListViewParams() {
|
private void setUpObservableListViewParams() {
|
||||||
|
|
@ -124,162 +140,71 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||||
headerOffset = toolbarHeight;
|
headerOffset = toolbarHeight;
|
||||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||||
tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag() {
|
||||||
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpViews() {
|
private void setUpViews() {
|
||||||
artistTitleText.setText(artist.name);
|
artistNameTv.setText(artist.name);
|
||||||
ViewHelper.setAlpha(artistArtOverlayView, 0);
|
|
||||||
|
|
||||||
setUpArtistImageAndApplyPalette(false);
|
ViewUtil.addOnGlobalLayoutListener(artistIv, new Runnable() {
|
||||||
setUpViewPatch();
|
@Override
|
||||||
setUpSlidingTabs();
|
public void run() {
|
||||||
|
setUpArtistImageAndApplyPalette(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setUpSongListView();
|
||||||
|
setUpAlbumRecyclerView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpSlidingTabs() {
|
private void setUpSongListView() {
|
||||||
navigationAdapter = new NavigationAdapter(this, artist);
|
songListView.setScrollViewCallbacks(observableScrollViewCallbacks);
|
||||||
viewPager = (ViewPager) findViewById(R.id.pager);
|
|
||||||
viewPager.setOffscreenPageLimit(2);
|
|
||||||
viewPager.setAdapter(navigationAdapter);
|
|
||||||
viewPager.setCurrentItem(1);
|
|
||||||
|
|
||||||
slidingTabs.setViewPager(viewPager);
|
setListViewPadding();
|
||||||
slidingTabs.setDistributeEvenly(true);
|
|
||||||
slidingTabs.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
|
|
||||||
slidingTabs.setSelectedIndicatorColors(Util.resolveColor(this, R.attr.colorAccent));
|
|
||||||
slidingTabs.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
||||||
|
|
||||||
|
songListView.addHeaderView(songListHeader);
|
||||||
|
|
||||||
|
final List<Song> songs = ArtistSongLoader.getArtistSongList(this, artist.id);
|
||||||
|
ArtistSongAdapter songAdapter = new ArtistSongAdapter(this, songs);
|
||||||
|
songListView.setAdapter(songAdapter);
|
||||||
|
|
||||||
|
final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
|
||||||
|
contentView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void run() {
|
||||||
|
songsBackgroundView.getLayoutParams().height = contentView.getHeight();
|
||||||
|
observableScrollViewCallbacks.onScrollChanged(-(artistImageViewHeight + titleViewHeight), false, false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
songListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
currentFragment = navigationAdapter.getItemAt(position);
|
// header view has position 0
|
||||||
if (currentFragment instanceof AbsViewPagerTabArtistListFragment) {
|
if(position == 0){
|
||||||
restoreY(((AbsViewPagerTabArtistListFragment) currentFragment).getY());
|
return;
|
||||||
}
|
}
|
||||||
}
|
MusicPlayerRemote.openQueue(songs, position - 1, true);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreY(final int scrollY) {
|
private void setUpAlbumRecyclerView(){
|
||||||
translateToolBar(scrollY);
|
albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view);
|
||||||
int animationTime = 1000;
|
albumRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||||
DecelerateInterpolator interpolator = new DecelerateInterpolator(4);
|
List<Album> albums = ArtistAlbumLoader.getArtistAlbumList(this, artist.id);
|
||||||
int titleTranslationY = getTitleTranslation(scrollY);
|
ArtistAlbumAdapter albumAdapter = new ArtistAlbumAdapter(this, albums);
|
||||||
ViewPropertyAnimator.animate(artistArtOverlayView).y(getOverlayTranslation(scrollY)).setDuration(animationTime).setInterpolator(interpolator).start();
|
albumRecyclerView.setAdapter(albumAdapter);
|
||||||
ViewPropertyAnimator.animate(artistImageView).y(getImageViewTranslation(scrollY)).setDuration(animationTime).setInterpolator(interpolator).start();
|
|
||||||
ViewPropertyAnimator.animate(absAlbumListBackgroundView).y(getListBackgroundTranslation(scrollY)).setDuration(animationTime).setInterpolator(interpolator).start();
|
|
||||||
ViewPropertyAnimator.animate(artistArtOverlayView).alpha(getOverlayAlpha(scrollY)).setDuration(animationTime).setInterpolator(interpolator).start();
|
|
||||||
ViewPropertyAnimator.animate(slidingTabs).y(titleTranslationY + titleViewHeight).setDuration(animationTime).setInterpolator(interpolator).start();
|
|
||||||
ViewPropertyAnimator.animate(artistTitleText).y(titleTranslationY).setDuration(animationTime).setInterpolator(interpolator).start();
|
|
||||||
ViewPropertyAnimator.animate(getFab()).y(getFabTranslation(scrollY)).setDuration(animationTime).setInterpolator(interpolator).setListener(new Animator.AnimatorListener() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animator animation) {
|
|
||||||
isAnimating = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
translateToolBar(scrollY);
|
|
||||||
isAnimating = false;
|
|
||||||
if (currentFragment instanceof AbsViewPagerTabArtistListFragment) {
|
|
||||||
onScrollChanged((((AbsViewPagerTabArtistListFragment) currentFragment).getY()), false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationCancel(Animator animation) {
|
|
||||||
isAnimating = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationRepeat(Animator animation) {
|
|
||||||
isAnimating = true;
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void setListViewPadding() {
|
||||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
if (Util.isInPortraitMode(this) || Util.isTablet(this)) {
|
||||||
if (!isAnimating) {
|
songListView.setPadding(0, artistImageViewHeight + titleViewHeight, 0, Util.getNavigationBarHeight(this));
|
||||||
int titleTranslationY = getTitleTranslation(scrollY);
|
|
||||||
ViewHelper.setTranslationY(artistArtOverlayView, getOverlayTranslation(scrollY));
|
|
||||||
ViewHelper.setTranslationY(artistImageView, getImageViewTranslation(scrollY));
|
|
||||||
ViewHelper.setTranslationY(absAlbumListBackgroundView, getListBackgroundTranslation(scrollY));
|
|
||||||
ViewHelper.setAlpha(artistArtOverlayView, getOverlayAlpha(scrollY));
|
|
||||||
ViewHelper.setTranslationY(artistTitleText, titleTranslationY);
|
|
||||||
ViewHelper.setTranslationY(slidingTabs, titleTranslationY);
|
|
||||||
ViewHelper.setTranslationY(getFab(), getFabTranslation(scrollY));
|
|
||||||
translateToolBar(scrollY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDownMotionEvent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getImageViewTranslation(int scrollY) {
|
|
||||||
int minOverlayTransitionY = headerOffset - artistArtOverlayView.getHeight();
|
|
||||||
return Math.max(minOverlayTransitionY, Math.min(0, -scrollY / 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getOverlayTranslation(int scrollY) {
|
|
||||||
int minOverlayTransitionY = headerOffset - artistArtOverlayView.getHeight();
|
|
||||||
return Math.max(minOverlayTransitionY, Math.min(0, -scrollY));
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getListBackgroundTranslation(int scrollY) {
|
|
||||||
return Math.max(0, -scrollY + artistImageViewHeight - 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getTitleTranslation(int scrollY) {
|
|
||||||
int maxTitleTranslationY = artistImageViewHeight;
|
|
||||||
int titleTranslationY = maxTitleTranslationY - scrollY;
|
|
||||||
if (TOOLBAR_IS_STICKY) {
|
|
||||||
titleTranslationY = Math.max(headerOffset, titleTranslationY);
|
|
||||||
}
|
|
||||||
return titleTranslationY;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getFabTranslation(int scrollY) {
|
|
||||||
return getTitleTranslation(scrollY) + titleViewHeight + tabHeight - (getFab().getHeight() / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getOverlayAlpha(int scrollY) {
|
|
||||||
float flexibleRange = artistImageViewHeight - headerOffset;
|
|
||||||
return Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void translateToolBar(int scrollY) {
|
|
||||||
if (TOOLBAR_IS_STICKY) {
|
|
||||||
// Change alpha of toolbar background
|
|
||||||
if (-scrollY + artistImageViewHeight <= headerOffset) {
|
|
||||||
ViewUtil.setBackgroundAlpha(toolbar, 1, toolbarColor);
|
|
||||||
ViewUtil.setBackgroundAlpha(statusBar, 1, toolbarColor);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ViewUtil.setBackgroundAlpha(toolbar, 0, toolbarColor);
|
|
||||||
ViewUtil.setBackgroundAlpha(statusBar, 0, toolbarColor);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Translate Toolbar
|
songListView.setPadding(0, artistImageViewHeight + titleViewHeight, 0, 0);
|
||||||
if (scrollY < artistImageViewHeight) {
|
|
||||||
ViewHelper.setTranslationY(toolbar, 0);
|
|
||||||
} else {
|
|
||||||
ViewHelper.setTranslationY(toolbar, -scrollY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,15 +215,13 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
Picasso.with(ArtistDetailActivity.this)
|
Picasso.with(ArtistDetailActivity.this)
|
||||||
.load(url)
|
.load(url)
|
||||||
.placeholder(R.drawable.default_artist_image)
|
.placeholder(R.drawable.default_artist_image)
|
||||||
.into(artistImageView, new Callback.EmptyCallback() {
|
.into(artistIv, new Callback.EmptyCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
super.onSuccess();
|
super.onSuccess();
|
||||||
final Bitmap bitmap = ((BitmapDrawable) artistImageView.getDrawable()).getBitmap();
|
final Bitmap bitmap = ((BitmapDrawable) artistIv.getDrawable()).getBitmap();
|
||||||
if (bitmap != null) applyPalette(bitmap);
|
if (bitmap != null) applyPalette(bitmap);
|
||||||
if (forceDownload) {
|
|
||||||
Toast.makeText(ArtistDetailActivity.this, getResources().getString(R.string.updated_artist_image_for) + " " + artist.name, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -312,10 +235,8 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
Palette.Swatch swatch = palette.getVibrantSwatch();
|
Palette.Swatch swatch = palette.getVibrantSwatch();
|
||||||
if (swatch != null) {
|
if (swatch != null) {
|
||||||
toolbarColor = swatch.getRgb();
|
toolbarColor = swatch.getRgb();
|
||||||
artistArtOverlayView.setBackgroundColor(swatch.getRgb());
|
artistNameTv.setBackgroundColor(swatch.getRgb());
|
||||||
artistTitleText.setBackgroundColor(swatch.getRgb());
|
artistNameTv.setTextColor(swatch.getTitleTextColor());
|
||||||
slidingTabs.setBackgroundColor(swatch.getRgb());
|
|
||||||
artistTitleText.setTextColor(swatch.getTitleTextColor());
|
|
||||||
} else {
|
} else {
|
||||||
setStandardColors();
|
setStandardColors();
|
||||||
}
|
}
|
||||||
|
|
@ -328,29 +249,14 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
int defaultBarColor = getResources().getColor(R.color.materialmusic_default_bar_color);
|
int defaultBarColor = getResources().getColor(R.color.materialmusic_default_bar_color);
|
||||||
|
|
||||||
toolbarColor = defaultBarColor;
|
toolbarColor = defaultBarColor;
|
||||||
artistArtOverlayView.setBackgroundColor(defaultBarColor);
|
artistNameTv.setBackgroundColor(defaultBarColor);
|
||||||
artistTitleText.setBackgroundColor(defaultBarColor);
|
artistNameTv.setTextColor(titleTextColor);
|
||||||
slidingTabs.setBackgroundColor(defaultBarColor);
|
|
||||||
artistTitleText.setTextColor(titleTextColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViewPatch() {
|
|
||||||
final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
|
|
||||||
contentView.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
absAlbumListBackgroundView.getLayoutParams().height = contentView.getHeight();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolBar() {
|
private void setUpToolBar() {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
if (!TOOLBAR_IS_STICKY) {
|
|
||||||
toolbar.setBackgroundColor(Color.TRANSPARENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIntentExtras() {
|
private void getIntentExtras() {
|
||||||
|
|
@ -390,88 +296,14 @@ public class ArtistDetailActivity extends AbsFabActivity implements KabViewsDisa
|
||||||
@Override
|
@Override
|
||||||
public void enableViews() {
|
public void enableViews() {
|
||||||
super.enableViews();
|
super.enableViews();
|
||||||
viewPager.setEnabled(true);
|
songListView.setEnabled(true);
|
||||||
toolbar.setEnabled(true);
|
toolbar.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableViews() {
|
public void disableViews() {
|
||||||
super.disableViews();
|
super.disableViews();
|
||||||
viewPager.setEnabled(false);
|
songListView.setEnabled(false);
|
||||||
toolbar.setEnabled(false);
|
toolbar.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class NavigationAdapter extends FragmentPagerAdapter {
|
|
||||||
|
|
||||||
private String[] titles;
|
|
||||||
|
|
||||||
private SparseArray<Fragment> pages;
|
|
||||||
private Artist artist;
|
|
||||||
private Context context;
|
|
||||||
|
|
||||||
public NavigationAdapter(Activity activity, Artist artist) {
|
|
||||||
super(activity.getFragmentManager());
|
|
||||||
this.artist = artist;
|
|
||||||
pages = new SparseArray<>();
|
|
||||||
context = activity;
|
|
||||||
titles = new String[]{
|
|
||||||
context.getResources().getString(R.string.tab_songs),
|
|
||||||
context.getResources().getString(R.string.tab_albums),
|
|
||||||
context.getResources().getString(R.string.tab_biography)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fragment getItem(int position) {
|
|
||||||
final Bundle args = new Bundle();
|
|
||||||
args.putInt(ARG_ARTIST_ID, artist.id);
|
|
||||||
args.putString(ARG_ARTIST_NAME, artist.name);
|
|
||||||
|
|
||||||
Fragment f = getOrCreateFragmentAt(position);
|
|
||||||
f.setArguments(args);
|
|
||||||
|
|
||||||
pages.put(position, f);
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
|
||||||
if (0 <= pages.indexOfKey(position)) {
|
|
||||||
pages.remove(position);
|
|
||||||
}
|
|
||||||
super.destroyItem(container, position, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Fragment getOrCreateFragmentAt(int position) {
|
|
||||||
switch (position) {
|
|
||||||
case 1:
|
|
||||||
return pages.get(position, new ViewPagerTabArtistAlbumFragment());
|
|
||||||
case 0:
|
|
||||||
return pages.get(position, new ViewPagerTabArtistSongListFragment());
|
|
||||||
case 2:
|
|
||||||
return pages.get(position, new ViewPagerTabArtistBioFragment());
|
|
||||||
default:
|
|
||||||
return pages.get(position, new MainActivity.PlaceholderFragmentAbs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Fragment getItemAt(int position) {
|
|
||||||
return pages.get(position, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCount() {
|
|
||||||
return titles.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CharSequence getPageTitle(int position) {
|
|
||||||
return titles[position];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
||||||
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
||||||
|
|
@ -25,13 +24,13 @@ public class AlbumViewFragment extends AbsMainActivityFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_albumview, container, false);
|
return inflater.inflate(R.layout.fragment_album_view, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
|
||||||
setUpRecyclerView();
|
setUpRecyclerView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,55 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
|
package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AbsListView;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.ArtistViewListAdapter;
|
import com.kabouzeid.gramophone.adapter.ArtistAdapter;
|
||||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||||
import com.kabouzeid.gramophone.model.Artist;
|
import com.kabouzeid.gramophone.model.Artist;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple {@link Fragment} subclass.
|
|
||||||
*/
|
|
||||||
public class ArtistViewFragment extends AbsMainActivityFragment {
|
public class ArtistViewFragment extends AbsMainActivityFragment {
|
||||||
public static final String TAG = ArtistViewFragment.class.getSimpleName();
|
public static final String TAG = ArtistViewFragment.class.getSimpleName();
|
||||||
|
|
||||||
private AbsListView absListView;
|
private RecyclerView recyclerView;
|
||||||
private View fragmentRootView;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_artist_view, container, false);
|
return inflater.inflate(R.layout.fragment_artist_view, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
fragmentRootView = view;
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
initViews();
|
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
|
||||||
setUpViews();
|
setUpRecyclerView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setUpRecyclerView() {
|
||||||
|
List<Artist> artists = ArtistLoader.getAllArtists(getActivity());
|
||||||
|
ArtistAdapter artistAdapter = new ArtistAdapter(getActivity(), artists);
|
||||||
|
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 1));
|
||||||
|
recyclerView.setAdapter(artistAdapter);
|
||||||
|
recyclerView.setPadding(0, getTopPadding(), 0, getBottomPadding());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enableViews() {
|
public void enableViews() {
|
||||||
super.enableViews();
|
super.enableViews();
|
||||||
absListView.setEnabled(true);
|
recyclerView.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableViews() {
|
public void disableViews() {
|
||||||
super.disableViews();
|
super.disableViews();
|
||||||
absListView.setEnabled(false);
|
recyclerView.setEnabled(false);
|
||||||
}
|
|
||||||
|
|
||||||
private void initViews() {
|
|
||||||
absListView = (AbsListView) fragmentRootView.findViewById(R.id.recyclerView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViews() {
|
|
||||||
setUpAbsListView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpAbsListView() {
|
|
||||||
List<Artist> artists = ArtistLoader.getAllArtists(getActivity());
|
|
||||||
fillAbsListView(artists);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillAbsListView(List<Artist> artists) {
|
|
||||||
ArtistViewListAdapter artistAdapter = new ArtistViewListAdapter(getActivity(), artists);
|
|
||||||
absListView.setAdapter(artistAdapter);
|
|
||||||
absListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
final Artist artist = (Artist) parent.getItemAtPosition(position);
|
|
||||||
final View artistImageView = view.findViewById(R.id.artist_image);
|
|
||||||
|
|
||||||
Pair[] sharedElements = {Pair.create(artistImageView, getString(R.string.transition_artist_image))};
|
|
||||||
NavigationUtil.goToArtist(getActivity(), artist.id, sharedElements);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
absListView.setPadding(0, getTopPadding(), 0, getBottomPadding());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class SongViewFragment extends AbsMainActivityFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
|
||||||
setUpRecyclerView();
|
setUpRecyclerView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:divider="@null"
|
android:divider="@null"
|
||||||
android:dividerHeight="0dp"
|
android:dividerHeight="0dp"
|
||||||
android:scrollbarStyle="outsideOverlay"/>
|
android:scrollbars="none"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -8,39 +8,30 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/artist_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/header_image_height"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/default_artist_image"
|
||||||
|
android:transitionName="@string/transition_artist_image"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/list_background"
|
android:id="@+id/list_background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/colorBackground"/>
|
android:background="?android:attr/colorBackground"/>
|
||||||
|
|
||||||
<FrameLayout
|
<com.github.ksoichiro.android.observablescrollview.ObservableListView
|
||||||
|
android:id="@+id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
<android.support.v4.view.ViewPager
|
android:divider="@null"
|
||||||
android:id="@+id/pager"
|
android:dividerHeight="0dp"
|
||||||
android:layout_width="match_parent"
|
android:scrollbars="none"/>
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/artist_image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/header_image_height"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/default_artist_image"
|
|
||||||
android:transitionName="@string/transition_artist_image"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/overlay"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/header_image_height"
|
|
||||||
android:background="@color/materialmusic_default_bar_color"/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/header"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
@ -60,22 +51,13 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
android:textColor="?attr/title_text_color"/>
|
android:textColor="?attr/title_text_color"/>
|
||||||
|
|
||||||
<com.google.samples.apps.iosched.ui.widget.SlidingTabLayout
|
|
||||||
android:id="@+id/sliding_tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/tab_height"
|
|
||||||
android:background="@color/materialmusic_default_bar_color"
|
|
||||||
android:elevation="@dimen/toolbar_elevation"
|
|
||||||
android:paddingRight="88dp"/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/transparent"/>
|
android:background="@android:color/transparent"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -91,8 +73,7 @@
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:elevation="@dimen/toolbar_elevation"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.melnykov.fab.FloatingActionButton
|
<com.melnykov.fab.FloatingActionButton
|
||||||
|
|
@ -100,7 +81,7 @@
|
||||||
style="@style/PlayPauseFab"
|
style="@style/PlayPauseFab"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"/>
|
android:layout_marginRight="16dp"
|
||||||
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:elevation="3dp"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
android:foreground="?rect_selector">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:descendantFocusability="blocksDescendants"
|
android:layout_margin="4dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:padding="4dp">
|
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.view.SquareImageView
|
<com.kabouzeid.gramophone.view.SquareImageView
|
||||||
android:id="@+id/album_art"
|
android:id="@+id/album_art"
|
||||||
|
|
@ -53,10 +54,4 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:background="?rect_selector"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
||||||
33
app/src/main/res/layout/artist_detail_header.xml
Normal file
33
app/src/main/res/layout/artist_detail_header.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginBottom="-8dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:text="@string/albums"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="164dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:scrollbars="none"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginTop="-8dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:text="@string/songs"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
android:padding="2dp">
|
android:padding="2dp">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/fragment_album_view"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:padding="2dp">
|
||||||
|
|
||||||
<ListView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:dividerHeight="0px"
|
android:padding="2dp"
|
||||||
android:divider="@null"
|
|
||||||
android:listSelector="?rect_selector"
|
|
||||||
android:scrollbars="vertical"/>
|
android:scrollbars="vertical"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:listSelector="?rect_selector"
|
android:listSelector="?rect_selector"
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
|
|
||||||
61
app/src/main/res/layout/item_artist_album.xml
Normal file
61
app/src/main/res/layout/item_artist_album.xml
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
<android.support.v7.widget.CardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="104dp"
|
||||||
|
android:layout_height="148dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:elevation="3dp"
|
||||||
|
android:foreground="?rect_selector">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/album_art"
|
||||||
|
android:layout_width="104dp"
|
||||||
|
android:layout_height="104dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:transitionName="@string/transition_album_cover"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/footer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/materialmusic_default_bar_color">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:transitionName="@string/transition_album_text">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/album_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
|
android:textColor="?attr/title_text_color"
|
||||||
|
android:textSize="12sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/album_year"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||||
|
android:textColor="?attr/caption_text_color"
|
||||||
|
android:textSize="10sp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</android.support.v7.widget.CardView>
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
android:background="?rect_selector"
|
|
||||||
android:descendantFocusability="blocksDescendants"
|
android:descendantFocusability="blocksDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp">
|
android:paddingLeft="16dp">
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:background="?rect_selector"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
|
|
|
||||||
|
|
@ -6,47 +6,49 @@
|
||||||
android:background="?rect_selector"
|
android:background="?rect_selector"
|
||||||
android:descendantFocusability="blocksDescendants"
|
android:descendantFocusability="blocksDescendants"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp">
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/track_number"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
|
<com.kabouzeid.gramophone.view.SquareImageView
|
||||||
|
android:id="@+id/album_art"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:fontFamily="sans-serif"
|
android:background="@drawable/image_background"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:singleLine="true"
|
android:scaleType="centerCrop"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/song_title"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:fontFamily="sans-serif"
|
android:orientation="vertical">
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/song_duration"
|
android:id="@+id/song_title"
|
||||||
android:layout_width="40dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
||||||
|
|
||||||
android:layout_gravity="center"
|
<TextView
|
||||||
android:fontFamily="sans-serif"
|
android:id="@+id/song_info"
|
||||||
android:gravity="center"
|
android:layout_width="wrap_content"
|
||||||
android:singleLine="true"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_marginLeft="2dp"
|
|
||||||
android:layout_marginRight="2dp"
|
|
||||||
android:id="@+id/menu"
|
android:id="@+id/menu"
|
||||||
style="@style/OverFlowButton"
|
style="@style/OverFlowButton"
|
||||||
android:layout_gravity="center_vertical"/>
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="2dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
52
app/src/main/res/layout/item_song_album.xml
Normal file
52
app/src/main/res/layout/item_song_album.xml
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:background="?rect_selector"
|
||||||
|
android:descendantFocusability="blocksDescendants"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/track_number"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/song_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/song_duration"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginRight="2dp"
|
||||||
|
android:id="@+id/menu"
|
||||||
|
style="@style/OverFlowButton"
|
||||||
|
android:layout_gravity="center_vertical"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="default_item_margin">16dp</dimen>
|
||||||
|
|
||||||
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
||||||
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
||||||
<dimen name="navigation_drawer_textsize">14sp</dimen>
|
<dimen name="navigation_drawer_textsize">14sp</dimen>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue