More recycler views
-artists detail activity not working yet
This commit is contained in:
parent
df0bbe29e3
commit
418b3a9e0f
21 changed files with 352 additions and 417 deletions
|
|
@ -52,7 +52,7 @@ dependencies {
|
||||||
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
|
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
|
||||||
compile 'com.nineoldandroids:library:2.4.0+'
|
compile 'com.nineoldandroids:library:2.4.0+'
|
||||||
compile 'com.melnykov:floatingactionbutton:1.2.0'
|
compile 'com.melnykov:floatingactionbutton:1.2.0'
|
||||||
compile 'com.github.ksoichiro:android-observablescrollview:1.3.0'
|
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
|
||||||
compile 'com.mcxiaoke.volley:library:1.0.+'
|
compile 'com.mcxiaoke.volley:library:1.0.+'
|
||||||
compile 'com.squareup.picasso:picasso:2.5.0'
|
compile 'com.squareup.picasso:picasso:2.5.0'
|
||||||
compile 'com.squareup:otto:1.3.6'
|
compile 'com.squareup:otto:1.3.6'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.kabouzeid.gramophone.adapter.songadapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
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.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 java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by karim on 27.11.14.
|
||||||
|
*/
|
||||||
|
public class AlbumSongAdapter extends RecyclerView.Adapter<AlbumSongAdapter.ViewHolder> {
|
||||||
|
public static final String TAG = AlbumSongAdapter.class.getSimpleName();
|
||||||
|
protected Activity activity;
|
||||||
|
protected List<Song> dataSet;
|
||||||
|
|
||||||
|
public AlbumSongAdapter(Activity activity, List<Song> objects) {
|
||||||
|
this.activity = activity;
|
||||||
|
dataSet = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_song, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
|
final Song song = dataSet.get(position);
|
||||||
|
|
||||||
|
holder.songTitle.setText(song.title);
|
||||||
|
holder.trackNumber.setText(String.valueOf(MusicUtil.getFixedTrackNumber(song.trackNumber)));
|
||||||
|
holder.songDuration.setText(MusicUtil.getReadableDurationString(song.duration));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return dataSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
TextView songTitle;
|
||||||
|
TextView trackNumber;
|
||||||
|
TextView songDuration;
|
||||||
|
ImageView overflowButton;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
songTitle = (TextView) itemView.findViewById(R.id.song_title);
|
||||||
|
trackNumber = (TextView) itemView.findViewById(R.id.track_number);
|
||||||
|
songDuration = (TextView) itemView.findViewById(R.id.song_duration);
|
||||||
|
overflowButton = (ImageView) itemView.findViewById(R.id.menu);
|
||||||
|
overflowButton.setOnClickListener(this);
|
||||||
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MusicPlayerRemote.openQueue(dataSet, getPosition(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@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, dataSet.get(getPosition()).id);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
return true;
|
||||||
|
case R.id.action_details:
|
||||||
|
String songFilePath = SongFilePathLoader.getSongFilePath(activity, dataSet.get(getPosition()).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, dataSet.get(getPosition()).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, dataSet.get(getPosition()).artistId, artistPairs);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popupMenu.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,16 +3,17 @@ package com.kabouzeid.gramophone.adapter.songadapter;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
||||||
import com.kabouzeid.gramophone.loader.SongFilePathLoader;
|
import com.kabouzeid.gramophone.loader.SongFilePathLoader;
|
||||||
import com.kabouzeid.gramophone.misc.AppKeys;
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
|
|
@ -21,6 +22,7 @@ import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
import com.kabouzeid.gramophone.ui.activities.tageditor.SongTagEditorActivity;
|
||||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -28,69 +30,96 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Created by karim on 27.11.14.
|
* Created by karim on 27.11.14.
|
||||||
*/
|
*/
|
||||||
public class SongAdapter extends ArrayAdapter<Song> {
|
public class SongAdapter extends RecyclerView.Adapter<SongAdapter.ViewHolder> {
|
||||||
public static final String TAG = SongAdapter.class.getSimpleName();
|
public static final String TAG = AlbumSongAdapter.class.getSimpleName();
|
||||||
protected Activity activity;
|
protected Activity activity;
|
||||||
|
protected List<Song> dataSet;
|
||||||
|
|
||||||
public SongAdapter(Activity activity, List<Song> objects) {
|
public SongAdapter(Activity activity, List<Song> objects) {
|
||||||
super(activity, R.layout.item_song, objects);
|
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
dataSet = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
final Song song = getItem(position);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_song_view, parent, false);
|
||||||
if (convertView == null) {
|
return new ViewHolder(view);
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_song, parent, false);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
|
final Song song = dataSet.get(position);
|
||||||
|
|
||||||
|
holder.songTitle.setText(song.title);
|
||||||
|
holder.songInfo.setText(song.artistName);
|
||||||
|
|
||||||
|
Picasso.with(activity)
|
||||||
|
.load(MusicUtil.getAlbumArtUri(song.albumId))
|
||||||
|
.placeholder(R.drawable.default_album_art)
|
||||||
|
.into(holder.albumArt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return dataSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||||
|
TextView songTitle;
|
||||||
|
TextView songInfo;
|
||||||
|
ImageView overflowButton;
|
||||||
|
ImageView albumArt;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
songTitle = (TextView) itemView.findViewById(R.id.song_title);
|
||||||
|
songInfo = (TextView) itemView.findViewById(R.id.song_info);
|
||||||
|
albumArt = (ImageView) itemView.findViewById(R.id.album_art);
|
||||||
|
overflowButton = (ImageView) itemView.findViewById(R.id.menu);
|
||||||
|
overflowButton.setOnClickListener(this);
|
||||||
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
MusicPlayerRemote.openQueue(dataSet, getPosition(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
TextView songTitle = (TextView) convertView.findViewById(R.id.song_title);
|
|
||||||
TextView trackNumber = (TextView) convertView.findViewById(R.id.track_number);
|
|
||||||
TextView songDuration = (TextView) convertView.findViewById(R.id.song_duration);
|
|
||||||
ImageView overflowButton = (ImageView) convertView.findViewById(R.id.menu);
|
|
||||||
|
|
||||||
overflowButton.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View v) {
|
||||||
public void onClick(final View v) {
|
PopupMenu popupMenu = new PopupMenu(activity, v);
|
||||||
PopupMenu popupMenu = new PopupMenu(activity, v);
|
popupMenu.inflate(R.menu.menu_song);
|
||||||
popupMenu.inflate(R.menu.menu_song);
|
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
@Override
|
||||||
@Override
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
switch (item.getItemId()) {
|
||||||
switch (item.getItemId()) {
|
case R.id.action_tag_editor:
|
||||||
case R.id.action_tag_editor:
|
Intent intent = new Intent(activity, SongTagEditorActivity.class);
|
||||||
Intent intent = new Intent(activity, SongTagEditorActivity.class);
|
intent.putExtra(AppKeys.E_ID, dataSet.get(getPosition()).id);
|
||||||
intent.putExtra(AppKeys.E_ID, song.id);
|
activity.startActivity(intent);
|
||||||
activity.startActivity(intent);
|
return true;
|
||||||
return true;
|
case R.id.action_details:
|
||||||
case R.id.action_details:
|
String songFilePath = SongFilePathLoader.getSongFilePath(activity, dataSet.get(getPosition()).id);
|
||||||
String songFilePath = SongFilePathLoader.getSongFilePath(activity, song.id);
|
File songFile = new File(songFilePath);
|
||||||
File songFile = new File(songFilePath);
|
SongDetailDialogHelper.getDialog(activity, songFile).show();
|
||||||
SongDetailDialogHelper.getDialog(activity, songFile).show();
|
return true;
|
||||||
return true;
|
case R.id.action_go_to_album:
|
||||||
case R.id.action_go_to_album:
|
Pair[] albumPairs = null;
|
||||||
Pair[] albumPairs = null;
|
if (activity instanceof AbsFabActivity)
|
||||||
if (activity instanceof AbsFabActivity)
|
albumPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(albumPairs);
|
||||||
albumPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(albumPairs);
|
NavigationUtil.goToAlbum(activity, dataSet.get(getPosition()).albumId, albumPairs);
|
||||||
NavigationUtil.goToAlbum(activity, song.albumId, albumPairs);
|
return true;
|
||||||
return true;
|
case R.id.action_go_to_artist:
|
||||||
case R.id.action_go_to_artist:
|
Pair[] artistPairs = null;
|
||||||
Pair[] artistPairs = null;
|
if (activity instanceof AbsFabActivity)
|
||||||
if (activity instanceof AbsFabActivity)
|
artistPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(artistPairs);
|
||||||
artistPairs = ((AbsFabActivity) activity).getSharedViewsWithFab(artistPairs);
|
NavigationUtil.goToArtist(activity, dataSet.get(getPosition()).artistId, artistPairs);
|
||||||
NavigationUtil.goToArtist(activity, song.artistId, artistPairs);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
return false;
|
||||||
popupMenu.show();
|
}
|
||||||
}
|
});
|
||||||
});
|
popupMenu.show();
|
||||||
|
}
|
||||||
songTitle.setText(song.title);
|
|
||||||
trackNumber.setText(String.valueOf(MusicUtil.getFixedTrackNumber(song.trackNumber)));
|
|
||||||
songDuration.setText(MusicUtil.getReadableDurationString(song.duration));
|
|
||||||
|
|
||||||
return convertView;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
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.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 27.11.14.
|
|
||||||
*/
|
|
||||||
public class SongViewListAdapter extends SongAdapter {
|
|
||||||
public static final String TAG = SongViewListAdapter.class.getSimpleName();
|
|
||||||
|
|
||||||
public SongViewListAdapter(Activity activity, List<Song> objects) {
|
|
||||||
super(activity, objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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_song_view, parent, false);
|
|
||||||
}
|
|
||||||
TextView songTitle = (TextView) convertView.findViewById(R.id.song_title);
|
|
||||||
TextView songInfo = (TextView) convertView.findViewById(R.id.song_info);
|
|
||||||
final ImageView albumArt = (ImageView) convertView.findViewById(R.id.album_art);
|
|
||||||
ImageView overflowButton = (ImageView) convertView.findViewById(R.id.menu);
|
|
||||||
|
|
||||||
overflowButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(final 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 = new Pair[]{Pair.create(albumArt, getContext().getResources().getString(R.string.transition_album_cover))};
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
songTitle.setText(song.title);
|
|
||||||
songInfo.setText(song.getSubTitle());
|
|
||||||
|
|
||||||
Picasso.with(getContext())
|
|
||||||
.load(MusicUtil.getAlbumArtUri(song.albumId))
|
|
||||||
.placeholder(R.drawable.default_album_art)
|
|
||||||
.into(albumArt);
|
|
||||||
|
|
||||||
return convertView;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
package com.kabouzeid.gramophone.helper;
|
package com.kabouzeid.gramophone.helper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.kabouzeid.gramophone.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.PlayingQueueAdapter;
|
import com.kabouzeid.gramophone.adapter.PlayingQueueAdapter;
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.SongAdapter;
|
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.mobeta.android.dslv.DragSortListView;
|
import com.mobeta.android.dslv.DragSortListView;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -18,9 +20,10 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
|
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
|
||||||
|
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView;
|
||||||
import com.kabouzeid.gramophone.App;
|
import com.kabouzeid.gramophone.App;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.SongAdapter;
|
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
|
||||||
import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator;
|
import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
||||||
|
|
@ -59,7 +62,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
|
|
||||||
private Album album;
|
private Album album;
|
||||||
|
|
||||||
private ObservableListView absSongListView;
|
private ObservableRecyclerView recyclerView;
|
||||||
private View statusBar;
|
private View statusBar;
|
||||||
private ImageView albumArtImageView;
|
private ImageView albumArtImageView;
|
||||||
private View albumArtOverlayView;
|
private View albumArtOverlayView;
|
||||||
|
|
@ -74,6 +77,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
private SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
private SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
||||||
|
scrollY += albumArtViewHeight + titleViewHeight;
|
||||||
super.onScrollChanged(scrollY, b, b2);
|
super.onScrollChanged(scrollY, b, b2);
|
||||||
// Translate overlay and image
|
// Translate overlay and image
|
||||||
float flexibleRange = albumArtViewHeight - headerOffset;
|
float flexibleRange = albumArtViewHeight - headerOffset;
|
||||||
|
|
@ -81,6 +85,8 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
ViewHelper.setTranslationY(albumArtOverlayView, Math.max(minOverlayTransitionY, Math.min(0, -scrollY)));
|
ViewHelper.setTranslationY(albumArtOverlayView, Math.max(minOverlayTransitionY, Math.min(0, -scrollY)));
|
||||||
ViewHelper.setTranslationY(albumArtImageView, Math.max(minOverlayTransitionY, Math.min(0, -scrollY / 2)));
|
ViewHelper.setTranslationY(albumArtImageView, Math.max(minOverlayTransitionY, Math.min(0, -scrollY / 2)));
|
||||||
|
|
||||||
|
Log.i(TAG, "image t " + Math.max(0, Math.min(0, -scrollY / 2)));
|
||||||
|
|
||||||
// Translate list background
|
// Translate list background
|
||||||
ViewHelper.setTranslationY(songsBackgroundView, Math.max(0, -scrollY + albumArtViewHeight));
|
ViewHelper.setTranslationY(songsBackgroundView, Math.max(0, -scrollY + albumArtViewHeight));
|
||||||
|
|
||||||
|
|
@ -117,6 +123,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
ViewHelper.setTranslationY(toolbar, -scrollY);
|
ViewHelper.setTranslationY(toolbar, -scrollY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "scrollY " +scrollY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -159,7 +166,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
albumArtImageView = (ImageView) findViewById(R.id.album_art);
|
albumArtImageView = (ImageView) findViewById(R.id.album_art);
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
albumArtOverlayView = findViewById(R.id.overlay);
|
albumArtOverlayView = findViewById(R.id.overlay);
|
||||||
absSongListView = (ObservableListView) findViewById(R.id.list);
|
recyclerView = (ObservableRecyclerView) findViewById(R.id.list);
|
||||||
albumTitleView = (TextView) findViewById(R.id.album_title);
|
albumTitleView = (TextView) findViewById(R.id.album_title);
|
||||||
songsBackgroundView = findViewById(R.id.list_background);
|
songsBackgroundView = findViewById(R.id.list_background);
|
||||||
statusBar = findViewById(R.id.statusBar);
|
statusBar = findViewById(R.id.statusBar);
|
||||||
|
|
@ -212,43 +219,26 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpListView() {
|
private void setUpListView() {
|
||||||
absSongListView.setScrollViewCallbacks(observableScrollViewCallbacks);
|
recyclerView.setScrollViewCallbacks(observableScrollViewCallbacks);
|
||||||
setListViewPadding();
|
setListViewPadding();
|
||||||
final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
|
final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
|
||||||
contentView.post(new Runnable() {
|
contentView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
songsBackgroundView.getLayoutParams().height = contentView.getHeight();
|
songsBackgroundView.getLayoutParams().height = contentView.getHeight();
|
||||||
observableScrollViewCallbacks.onScrollChanged(0, false, false);
|
observableScrollViewCallbacks.onScrollChanged(-(albumArtViewHeight + titleViewHeight), false, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListViewPadding() {
|
private void setListViewPadding() {
|
||||||
setListViewPaddingTop();
|
|
||||||
if (Util.isInPortraitMode(this) || Util.isTablet(this)) {
|
if (Util.isInPortraitMode(this) || Util.isTablet(this)) {
|
||||||
setListViewPaddingBottom();
|
recyclerView.setPadding(0, albumArtViewHeight + titleViewHeight, 0, Util.getNavigationBarHeight(this));
|
||||||
|
} else {
|
||||||
|
recyclerView.setPadding(0, albumArtViewHeight + titleViewHeight, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListViewPaddingTop() {
|
|
||||||
final View paddingView = new View(AlbumDetailActivity.this);
|
|
||||||
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
|
|
||||||
albumArtViewHeight + titleViewHeight);
|
|
||||||
paddingView.setLayoutParams(lp);
|
|
||||||
paddingView.setClickable(true);
|
|
||||||
absSongListView.addHeaderView(paddingView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setListViewPaddingBottom() {
|
|
||||||
final View paddingView = new View(AlbumDetailActivity.this);
|
|
||||||
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
|
|
||||||
Util.getNavigationBarHeight(this));
|
|
||||||
paddingView.setLayoutParams(lp);
|
|
||||||
paddingView.setClickable(true);
|
|
||||||
absSongListView.addFooterView(paddingView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpToolBar() {
|
private void setUpToolBar() {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
|
|
@ -269,30 +259,22 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
|
|
||||||
private void setUpSongsAdapter() {
|
private void setUpSongsAdapter() {
|
||||||
final List<Song> songs = AlbumSongLoader.getAlbumSongList(this, album.id, new SongTrackNumberComparator());
|
final List<Song> songs = AlbumSongLoader.getAlbumSongList(this, album.id, new SongTrackNumberComparator());
|
||||||
final SongAdapter songAdapter = new SongAdapter(this, songs);
|
final AlbumSongAdapter albumSongAdapter = new AlbumSongAdapter(this, songs);
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
||||||
absSongListView.setAdapter(songAdapter);
|
recyclerView.setAdapter(albumSongAdapter);
|
||||||
absSongListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
if (position > 0) {
|
|
||||||
MusicPlayerRemote.openQueue(songs, position - 1, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enableViews() {
|
public void enableViews() {
|
||||||
super.enableViews();
|
super.enableViews();
|
||||||
absSongListView.setEnabled(true);
|
recyclerView.setEnabled(true);
|
||||||
toolbar.setEnabled(true);
|
toolbar.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableViews() {
|
public void disableViews() {
|
||||||
super.disableViews();
|
super.disableViews();
|
||||||
absSongListView.setEnabled(false);
|
recyclerView.setEnabled(false);
|
||||||
toolbar.setEnabled(false);
|
toolbar.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +294,8 @@ public class AlbumDetailActivity extends AbsFabActivity implements KabViewsDisab
|
||||||
case R.id.action_settings:
|
case R.id.action_settings:
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_current_playing:
|
case R.id.action_current_playing:
|
||||||
return NavigationUtil.openCurrentPlayingIfPossible(this, null);
|
NavigationUtil.openCurrentPlayingIfPossible(this, null);
|
||||||
|
return true;
|
||||||
case R.id.action_tag_editor:
|
case R.id.action_tag_editor:
|
||||||
Intent intent = new Intent(this, AlbumTagEditorActivity.class);
|
Intent intent = new Intent(this, AlbumTagEditorActivity.class);
|
||||||
intent.putExtra(AppKeys.E_ID, album.id);
|
intent.putExtra(AppKeys.E_ID, album.id);
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.Log;
|
||||||
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.AdapterView;
|
|
||||||
import android.widget.ListAdapter;
|
|
||||||
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableGridView;
|
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
||||||
|
import com.github.ksoichiro.android.observablescrollview.ScrollUtils;
|
||||||
import com.kabouzeid.gramophone.App;
|
import com.kabouzeid.gramophone.App;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
||||||
|
|
@ -21,10 +22,10 @@ import com.kabouzeid.gramophone.util.Util;
|
||||||
public abstract class AbsViewPagerTabArtistListFragment extends Fragment implements ObservableScrollViewCallbacks, KabViewsDisableAble {
|
public abstract class AbsViewPagerTabArtistListFragment extends Fragment implements ObservableScrollViewCallbacks, KabViewsDisableAble {
|
||||||
public static final String TAG = AbsViewPagerTabArtistListFragment.class.getSimpleName();
|
public static final String TAG = AbsViewPagerTabArtistListFragment.class.getSimpleName();
|
||||||
protected App app;
|
protected App app;
|
||||||
private ObservableGridView observableGridView;
|
private ObservableRecyclerView observableRecyclerView;
|
||||||
private int artistId = -1;
|
private int artistId = -1;
|
||||||
private String artistName = "";
|
private String artistName = "";
|
||||||
private int paddingViewHeight;
|
private int recyclerViewPaddingTop;
|
||||||
private boolean areViewsEnabled;
|
private boolean areViewsEnabled;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -32,29 +33,29 @@ public abstract class AbsViewPagerTabArtistListFragment extends Fragment impleme
|
||||||
app = (App) getActivity().getApplicationContext();
|
app = (App) getActivity().getApplicationContext();
|
||||||
getArgs();
|
getArgs();
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.fragment_gridview, container, false);
|
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||||
observableGridView = (ObservableGridView) view.findViewById(R.id.scroll);
|
observableRecyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
|
||||||
setGridViewPadding();
|
setRecyclerViewPadding();
|
||||||
observableGridView.setScrollViewCallbacks(this);
|
setNumColumns(getNumColumns());
|
||||||
ListAdapter adapter = getAdapter();
|
RecyclerView.Adapter adapter = getAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
observableGridView.setAdapter(adapter);
|
observableRecyclerView.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
observableRecyclerView.setScrollViewCallbacks(this);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGridViewPadding() {
|
private void setRecyclerViewPadding() {
|
||||||
final int artistImageViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height);
|
final int artistImageViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height);
|
||||||
final int titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
final int titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||||
final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
|
final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
|
||||||
|
|
||||||
paddingViewHeight = artistImageViewHeight + titleViewHeight + tabHeight;
|
recyclerViewPaddingTop = artistImageViewHeight + titleViewHeight + tabHeight;
|
||||||
|
|
||||||
if (Util.isInPortraitMode(getActivity()) || Util.isTablet(getActivity())) {
|
if (Util.isInPortraitMode(getActivity()) || Util.isTablet(getActivity())) {
|
||||||
observableGridView.setPadding(0, paddingViewHeight, 0, Util.getNavigationBarHeight(getActivity()));
|
observableRecyclerView.setPadding(0, recyclerViewPaddingTop, 0, Util.getNavigationBarHeight(getActivity()));
|
||||||
} else {
|
} else {
|
||||||
observableGridView.setPadding(0, paddingViewHeight, 0, 0);
|
observableRecyclerView.setPadding(0, recyclerViewPaddingTop, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,13 +73,19 @@ public abstract class AbsViewPagerTabArtistListFragment extends Fragment impleme
|
||||||
*
|
*
|
||||||
* You CAN return null here and use setAdapter(ListAdapter adapter) inside getAdapter() to manually set the adapter.
|
* You CAN return null here and use setAdapter(ListAdapter adapter) inside getAdapter() to manually set the adapter.
|
||||||
*
|
*
|
||||||
* (i.e. if you must set the adapter async).
|
* (use only in case you must set the adapter async).
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
protected abstract ListAdapter getAdapter();
|
protected abstract RecyclerView.Adapter getAdapter();
|
||||||
|
|
||||||
protected void setAdapter(ListAdapter adapter) {
|
protected abstract int getNumColumns();
|
||||||
observableGridView.setAdapter(adapter);
|
|
||||||
|
protected void setNumColumns(int columns) {
|
||||||
|
observableRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), columns));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAdapter(RecyclerView.Adapter adapter) {
|
||||||
|
observableRecyclerView.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -90,13 +97,13 @@ public abstract class AbsViewPagerTabArtistListFragment extends Fragment impleme
|
||||||
@Override
|
@Override
|
||||||
public void enableViews() {
|
public void enableViews() {
|
||||||
areViewsEnabled = true;
|
areViewsEnabled = true;
|
||||||
observableGridView.setEnabled(true);
|
observableRecyclerView.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableViews() {
|
public void disableViews() {
|
||||||
areViewsEnabled = false;
|
areViewsEnabled = false;
|
||||||
observableGridView.setEnabled(false);
|
observableRecyclerView.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -105,7 +112,7 @@ public abstract class AbsViewPagerTabArtistListFragment extends Fragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return observableGridView.getCurrentScrollY() + paddingViewHeight;
|
return observableRecyclerView.getCurrentScrollY() + recyclerViewPaddingTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getArtistId() {
|
protected int getArtistId() {
|
||||||
|
|
@ -116,19 +123,11 @@ public abstract class AbsViewPagerTabArtistListFragment extends Fragment impleme
|
||||||
return artistName;
|
return artistName;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
|
|
||||||
observableGridView.setOnItemClickListener(onItemClickListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setColumns(int columns) {
|
|
||||||
observableGridView.setNumColumns(columns);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
||||||
if (getActivity() instanceof ObservableScrollViewCallbacks) {
|
if (getActivity() instanceof ObservableScrollViewCallbacks) {
|
||||||
if (getUserVisibleHint()) {
|
if (getUserVisibleHint()) {
|
||||||
((ObservableScrollViewCallbacks) getActivity()).onScrollChanged(scrollY + paddingViewHeight, b, b2);
|
((ObservableScrollViewCallbacks) getActivity()).onScrollChanged(scrollY + recyclerViewPaddingTop, b, b2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,87 +1,26 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.ActivityCompat;
|
|
||||||
import android.support.v4.app.ActivityOptionsCompat;
|
|
||||||
import android.support.v4.util.Pair;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ListAdapter;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
|
||||||
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
||||||
import com.kabouzeid.gramophone.comparator.AlbumAlphabeticComparator;
|
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
|
||||||
import com.kabouzeid.gramophone.loader.ArtistAlbumLoader;
|
import com.kabouzeid.gramophone.loader.ArtistAlbumLoader;
|
||||||
import com.kabouzeid.gramophone.misc.AppKeys;
|
|
||||||
import com.kabouzeid.gramophone.model.Album;
|
import com.kabouzeid.gramophone.model.Album;
|
||||||
import com.kabouzeid.gramophone.ui.activities.AlbumDetailActivity;
|
|
||||||
import com.melnykov.fab.FloatingActionButton;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by karim on 04.01.15.
|
* Created by karim on 04.01.15.
|
||||||
*/
|
*/
|
||||||
public class ViewPagerTabArtistAlbumFragment extends AbsViewPagerTabArtistListFragment {
|
public class ViewPagerTabArtistAlbumFragment extends AbsViewPagerTabArtistListFragment {
|
||||||
private FloatingActionButton fab;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ListAdapter getAdapter() {
|
protected RecyclerView.Adapter getAdapter() {
|
||||||
List<Album> albums = ArtistAlbumLoader.getArtistAlbumList(getActivity(), getArtistId());
|
List<Album> albums = ArtistAlbumLoader.getArtistAlbumList(getActivity(), getArtistId());
|
||||||
Collections.sort(albums, new AlbumAlphabeticComparator());
|
return new AlbumAdapter(getActivity(), albums);
|
||||||
//ListAdapter adapter = new AlbumAdapter(getActivity(), albums);
|
|
||||||
setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
Album album = (Album) parent.getItemAtPosition(position);
|
|
||||||
View albumArtView = view.findViewById(R.id.album_art);
|
|
||||||
|
|
||||||
openAlbumDetailsActivityIfPossible(album, albumArtView);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setColumns(getResources().getInteger(R.integer.grid_columns));
|
|
||||||
//return adapter;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void openAlbumDetailsActivityIfPossible(Album album, View albumArtForTransition) {
|
|
||||||
if (areParentActivitiesViewsEnabled()) {
|
|
||||||
disableViews();
|
|
||||||
disableParentActivitiesViews();
|
|
||||||
|
|
||||||
final Intent intent = new Intent(getActivity(), AlbumDetailActivity.class);
|
|
||||||
intent.putExtra(AppKeys.E_ALBUM, album.id);
|
|
||||||
|
|
||||||
final ActivityOptionsCompat activityOptions;
|
|
||||||
if (fab != null && albumArtForTransition != null) {
|
|
||||||
activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
|
|
||||||
Pair.create(albumArtForTransition, getString(R.string.transition_album_cover)),
|
|
||||||
Pair.create((View) fab, getString(R.string.transition_fab))
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
|
|
||||||
}
|
|
||||||
ActivityCompat.startActivity(getActivity(), intent, activityOptions.toBundle());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disableParentActivitiesViews() {
|
|
||||||
if (getActivity() instanceof KabViewsDisableAble) {
|
|
||||||
((KabViewsDisableAble) getActivity()).disableViews();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean areParentActivitiesViewsEnabled() {
|
|
||||||
return !(getActivity() instanceof KabViewsDisableAble) || ((KabViewsDisableAble) getActivity()).areViewsEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
protected int getNumColumns() {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
return 2;
|
||||||
fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
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.ArrayAdapter;
|
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
@ -22,10 +22,8 @@ public class ViewPagerTabArtistBioFragment extends AbsViewPagerTabArtistListFrag
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ListAdapter getAdapter() {
|
protected RecyclerView.Adapter getAdapter() {
|
||||||
final List<String> strings = new ArrayList<>();
|
final SimpleTextAdapter adapter = new SimpleTextAdapter(getActivity(), "loading");
|
||||||
strings.add("loading");
|
|
||||||
ListAdapter adapter = new SimpleTextAdapter(getActivity(), strings);
|
|
||||||
setAdapter(adapter);
|
setAdapter(adapter);
|
||||||
|
|
||||||
LastFMArtistBiographyLoader.loadArtistBio(getActivity(), getArtistName(), new LastFMArtistBiographyLoader.ArtistBioLoaderCallback() {
|
LastFMArtistBiographyLoader.loadArtistBio(getActivity(), getArtistName(), new LastFMArtistBiographyLoader.ArtistBioLoaderCallback() {
|
||||||
|
|
@ -35,37 +33,58 @@ public class ViewPagerTabArtistBioFragment extends AbsViewPagerTabArtistListFrag
|
||||||
try {
|
try {
|
||||||
biography = getResources().getString(R.string.biography_unavailable);
|
biography = getResources().getString(R.string.biography_unavailable);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
Log.e(TAG, "error while trying to access resources", e);
|
|
||||||
biography = "Error";
|
biography = "Error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strings.clear();
|
adapter.setText(biography);
|
||||||
strings.add(biography);
|
|
||||||
ListAdapter adapter = new SimpleTextAdapter(getActivity(), strings);
|
|
||||||
setAdapter(adapter);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SimpleTextAdapter extends ArrayAdapter<String> {
|
@Override
|
||||||
private Context context;
|
protected int getNumColumns() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
public SimpleTextAdapter(Context context, List<String> objects) {
|
private static class SimpleTextAdapter extends RecyclerView.Adapter<SimpleTextAdapter.ViewHolder> {
|
||||||
super(context, R.layout.item_artist_details_biography, objects);
|
private Context context;
|
||||||
this.context = context;
|
private String text;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.item_artist_details_biography, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
String string = getItem(position);
|
holder.textView.setText(Html.fromHtml(text));
|
||||||
if (convertView == null) {
|
holder.textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
convertView = LayoutInflater.from(context).inflate(R.layout.item_artist_details_biography, parent, false);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
TextView textView;
|
||||||
|
|
||||||
|
public ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
textView = (TextView) itemView.findViewById(R.id.text);
|
||||||
}
|
}
|
||||||
TextView text = (TextView) convertView.findViewById(R.id.text);
|
}
|
||||||
text.setText(Html.fromHtml(string));
|
|
||||||
text.setMovementMethod(LinkMovementMethod.getInstance());
|
public SimpleTextAdapter(Context context, String text) {
|
||||||
return convertView;
|
this.context = context;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text){
|
||||||
|
this.text = text;
|
||||||
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,15 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
||||||
|
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.SongAdapter;
|
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
|
||||||
import com.kabouzeid.gramophone.comparator.SongAlphabeticComparator;
|
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.loader.ArtistSongLoader;
|
import com.kabouzeid.gramophone.loader.ArtistSongLoader;
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,16 +17,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class ViewPagerTabArtistSongListFragment extends AbsViewPagerTabArtistListFragment {
|
public class ViewPagerTabArtistSongListFragment extends AbsViewPagerTabArtistListFragment {
|
||||||
@Override
|
@Override
|
||||||
protected ListAdapter getAdapter() {
|
protected RecyclerView.Adapter getAdapter() {
|
||||||
final List<Song> songs = ArtistSongLoader.getArtistSongList(getActivity(), getArtistId());
|
final List<Song> songs = ArtistSongLoader.getArtistSongList(getActivity(), getArtistId());
|
||||||
|
return new AlbumSongAdapter(getActivity(), songs);
|
||||||
|
}
|
||||||
|
|
||||||
ListAdapter adapter = new SongAdapter(getActivity(), songs);
|
@Override
|
||||||
setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
protected int getNumColumns() {
|
||||||
@Override
|
return 1;
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
MusicPlayerRemote.openQueue(songs, position, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return adapter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,7 @@ import java.util.List;
|
||||||
public class AlbumViewFragment extends AbsMainActivityFragment {
|
public class AlbumViewFragment extends AbsMainActivityFragment {
|
||||||
public static final String TAG = AlbumViewFragment.class.getSimpleName();
|
public static final String TAG = AlbumViewFragment.class.getSimpleName();
|
||||||
|
|
||||||
private App app;
|
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
private View fragmentRootView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
app = (App) getActivity().getApplicationContext();
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
@ -38,12 +30,18 @@ public class AlbumViewFragment extends AbsMainActivityFragment {
|
||||||
|
|
||||||
@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);
|
||||||
|
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||||
|
setUpRecyclerView();
|
||||||
|
}
|
||||||
|
|
||||||
initViews();
|
private void setUpRecyclerView() {
|
||||||
setUpViews();
|
List<Album> albums = AlbumLoader.getAllAlbums(getActivity());
|
||||||
|
AlbumAdapter albumAdapter = new AlbumAdapter(getActivity(), albums);
|
||||||
|
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
|
||||||
|
recyclerView.setAdapter(albumAdapter);
|
||||||
|
recyclerView.setPadding(0, getTopPadding(), 0, getBottomPadding());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -57,24 +55,4 @@ public class AlbumViewFragment extends AbsMainActivityFragment {
|
||||||
super.disableViews();
|
super.disableViews();
|
||||||
recyclerView.setEnabled(false);
|
recyclerView.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews() {
|
|
||||||
recyclerView = (RecyclerView) fragmentRootView.findViewById(R.id.absList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViews() {
|
|
||||||
setUpAbsListView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpAbsListView() {
|
|
||||||
List<Album> albums = AlbumLoader.getAllAlbums(getActivity());
|
|
||||||
fillAbsListView(albums);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillAbsListView(List<Album> albums) {
|
|
||||||
AlbumAdapter albumAdapter = new AlbumAdapter(getActivity(), albums);
|
|
||||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
|
|
||||||
recyclerView.setAdapter(albumAdapter);
|
|
||||||
recyclerView.setPadding(0, getTopPadding(), 0, getBottomPadding());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.AbsListView;
|
import android.widget.AbsListView;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.ArtistViewListAdapter;
|
import com.kabouzeid.gramophone.adapter.ArtistViewListAdapter;
|
||||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||||
|
|
@ -56,7 +55,7 @@ public class ArtistViewFragment extends AbsMainActivityFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
absListView = (AbsListView) fragmentRootView.findViewById(R.id.absList);
|
absListView = (AbsListView) fragmentRootView.findViewById(R.id.recyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpViews() {
|
private void setUpViews() {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,16 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
|
package com.kabouzeid.gramophone.ui.fragments.mainactivityfragments;
|
||||||
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
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.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.SongViewListAdapter;
|
import com.kabouzeid.gramophone.adapter.songadapter.SongAdapter;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
|
||||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -24,58 +20,38 @@ import java.util.List;
|
||||||
public class SongViewFragment extends AbsMainActivityFragment {
|
public class SongViewFragment extends AbsMainActivityFragment {
|
||||||
public static final String TAG = SongViewFragment.class.getSimpleName();
|
public static final String TAG = SongViewFragment.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_songview, container, false);
|
return inflater.inflate(R.layout.fragment_songview, 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.recyclerView);
|
||||||
setUpViews();
|
setUpRecyclerView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews() {
|
private void setUpRecyclerView() {
|
||||||
absListView = (AbsListView) fragmentRootView.findViewById(R.id.absList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpViews() {
|
|
||||||
setUpAbsListView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUpAbsListView() {
|
|
||||||
List<Song> songs = SongLoader.getAllSongs(getActivity());
|
List<Song> songs = SongLoader.getAllSongs(getActivity());
|
||||||
fillAbsListView(songs);
|
SongAdapter songAdapter = new SongAdapter(getActivity(), songs);
|
||||||
}
|
|
||||||
|
|
||||||
private void fillAbsListView(final List<Song> songs) {
|
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 1));
|
||||||
SongViewListAdapter songAdapter = new SongViewListAdapter(getActivity(), songs);
|
recyclerView.setAdapter(songAdapter);
|
||||||
absListView.setAdapter(songAdapter);
|
recyclerView.setPadding(0, getTopPadding(), 0, getBottomPadding());
|
||||||
absListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
MusicPlayerRemote.openQueue(songs, position, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
absListView.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,10 @@ public class NavigationUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean openCurrentPlayingIfPossible(final Activity activity, final Pair[] sharedViews) {
|
public static void openCurrentPlayingIfPossible(final Activity activity, final Pair[] sharedViews) {
|
||||||
if (activity instanceof MusicControllerActivity){
|
if (activity instanceof MusicControllerActivity){
|
||||||
return true;
|
activity.onBackPressed();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (MusicPlayerRemote.getPosition() != -1) {
|
if (MusicPlayerRemote.getPosition() != -1) {
|
||||||
if ((activity instanceof KabViewsDisableAble && ((KabViewsDisableAble) activity).areViewsEnabled()) || !(activity instanceof KabViewsDisableAble)) {
|
if ((activity instanceof KabViewsDisableAble && ((KabViewsDisableAble) activity).areViewsEnabled()) || !(activity instanceof KabViewsDisableAble)) {
|
||||||
|
|
@ -76,11 +77,9 @@ public class NavigationUtil {
|
||||||
} else {
|
} else {
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activity, activity.getResources().getString(R.string.nothing_playing), Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, activity.getResources().getString(R.string.nothing_playing), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/colorBackground"/>
|
android:background="?android:attr/colorBackground"/>
|
||||||
|
|
||||||
<com.github.ksoichiro.android.observablescrollview.ObservableListView
|
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
|
||||||
android:id="@+id/list"
|
android:id="@+id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fragment_albumview"
|
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">
|
android:padding="2dp">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/absList"
|
android:id="@+id/recyclerView"
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/absList"
|
android:id="@+id/recyclerView"
|
||||||
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,10 +1,8 @@
|
||||||
<com.github.ksoichiro.android.observablescrollview.ObservableGridView
|
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
|
||||||
android:id="@+id/scroll"
|
android:id="@+id/scroll"
|
||||||
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:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:divider="@null"
|
android:divider="@null"
|
||||||
android:dividerHeight="0dp"
|
android:dividerHeight="0dp"/>
|
||||||
android:listSelector="?rect_selector"
|
|
||||||
android:scrollbars="none"/>
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fragment_songview"
|
android:id="@+id/fragment_song_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">
|
||||||
|
|
||||||
<ListView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:listSelector="?rect_selector"
|
android:listSelector="?rect_selector"
|
||||||
android:id="@+id/absList"
|
android:id="@+id/recyclerView"
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
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">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue