Renamed layout files (cleanup)
This commit is contained in:
parent
ef48e9305b
commit
1bf584e638
22 changed files with 50 additions and 339 deletions
|
|
@ -19,7 +19,6 @@ import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
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.kabouzeid.gramophone.view.SquareImageView;
|
|
||||||
import com.squareup.picasso.Callback;
|
import com.squareup.picasso.Callback;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
|
|
@ -36,7 +35,7 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.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.album_tile, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_grid_album, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,21 @@
|
||||||
package com.kabouzeid.gramophone.adapter;
|
package com.kabouzeid.gramophone.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
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.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.model.Artist;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
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.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -43,7 +32,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.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_artist_view, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_list_artist, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.kabouzeid.gramophone.model.Album;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
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.kabouzeid.gramophone.view.SquareImageView;
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -35,7 +34,7 @@ public class ArtistAlbumAdapter extends RecyclerView.Adapter<ArtistAlbumAdapter.
|
||||||
|
|
||||||
@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_artist_album, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_grid_artist_album, parent, false);
|
||||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
||||||
if (viewType == TYPE_FIRST) {
|
if (viewType == TYPE_FIRST) {
|
||||||
params.leftMargin = listMargin;
|
params.leftMargin = listMargin;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.kabouzeid.gramophone.adapter;
|
package com.kabouzeid.gramophone.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
@ -12,7 +11,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
import com.kabouzeid.gramophone.helper.SongDetailDialogHelper;
|
||||||
|
|
@ -32,7 +30,7 @@ public class PlayingQueueAdapter extends ArrayAdapter<Song> {
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
|
||||||
public PlayingQueueAdapter(Activity activity, List<Song> playList) {
|
public PlayingQueueAdapter(Activity activity, List<Song> playList) {
|
||||||
super(activity, R.layout.item_playlist, playList);
|
super(activity, R.layout.item_list_playlist, playList);
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +38,7 @@ public class PlayingQueueAdapter extends ArrayAdapter<Song> {
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
final Song song = getItem(position);
|
final Song song = getItem(position);
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = LayoutInflater.from(activity).inflate(R.layout.item_playlist, parent, false);
|
convertView = LayoutInflater.from(activity).inflate(R.layout.item_list_playlist, parent, false);
|
||||||
}
|
}
|
||||||
final TextView title = (TextView) convertView.findViewById(R.id.song_title);
|
final TextView title = (TextView) convertView.findViewById(R.id.song_title);
|
||||||
final ImageView playingIndicator = (ImageView) convertView.findViewById(R.id.playing_indicator);
|
final ImageView playingIndicator = (ImageView) convertView.findViewById(R.id.playing_indicator);
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@ import java.util.List;
|
||||||
public class SearchAdapter extends ArrayAdapter<SearchEntry> {
|
public class SearchAdapter extends ArrayAdapter<SearchEntry> {
|
||||||
|
|
||||||
public SearchAdapter(Context context, List<SearchEntry> objects) {
|
public SearchAdapter(Context context, List<SearchEntry> objects) {
|
||||||
super(context, R.layout.item_search, objects);
|
super(context, R.layout.item_list_search, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_search, parent, false);
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_list_search, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchEntry item = getItem(position);
|
SearchEntry item = getItem(position);
|
||||||
|
|
|
||||||
|
|
@ -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_album, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_list_album_song, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class ArtistSongAdapter extends ArrayAdapter<Song> {
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
|
||||||
public ArtistSongAdapter(Activity activity, List<Song> songs) {
|
public ArtistSongAdapter(Activity activity, List<Song> songs) {
|
||||||
super(activity, R.layout.item_song, songs);
|
super(activity, R.layout.item_list_song, songs);
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class ArtistSongAdapter extends ArrayAdapter<Song> {
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
final Song song = getItem(position);
|
final Song song = getItem(position);
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_artist_song, parent, false);
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_list_artist_song, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextView songTitle = (TextView) convertView.findViewById(R.id.song_title);
|
final TextView songTitle = (TextView) convertView.findViewById(R.id.song_title);
|
||||||
|
|
|
||||||
|
|
@ -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, parent, false);
|
View view = LayoutInflater.from(activity).inflate(R.layout.item_list_song, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
package com.kabouzeid.gramophone.ui.activities;
|
package com.kabouzeid.gramophone.ui.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
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.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.transition.Transition;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
@ -120,6 +123,7 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
setUpToolBar();
|
setUpToolBar();
|
||||||
setUpViews();
|
setUpViews();
|
||||||
|
|
||||||
|
if (Util.hasLollipopSDK()) fixLollipopTransitionImageWrongSize();
|
||||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,4 +310,34 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
songListView.setEnabled(false);
|
songListView.setEnabled(false);
|
||||||
toolbar.setEnabled(false);
|
toolbar.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
private void fixLollipopTransitionImageWrongSize(){
|
||||||
|
getWindow().getSharedElementEnterTransition().addListener(new Transition.TransitionListener() {
|
||||||
|
@Override
|
||||||
|
public void onTransitionStart(Transition transition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionEnd(Transition transition) {
|
||||||
|
setUpArtistImageAndApplyPalette(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionCancel(Transition transition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionPause(Transition transition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransitionResume(Transition transition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
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.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView;
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
|
||||||
import com.github.ksoichiro.android.observablescrollview.ScrollUtils;
|
|
||||||
import com.kabouzeid.gramophone.App;
|
|
||||||
import com.kabouzeid.gramophone.R;
|
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
|
||||||
import com.kabouzeid.gramophone.ui.activities.ArtistDetailActivity;
|
|
||||||
import com.kabouzeid.gramophone.util.Util;
|
|
||||||
|
|
||||||
public abstract class AbsViewPagerTabArtistListFragment extends Fragment implements ObservableScrollViewCallbacks, KabViewsDisableAble {
|
|
||||||
public static final String TAG = AbsViewPagerTabArtistListFragment.class.getSimpleName();
|
|
||||||
protected App app;
|
|
||||||
private ObservableRecyclerView observableRecyclerView;
|
|
||||||
private int artistId = -1;
|
|
||||||
private String artistName = "";
|
|
||||||
private int recyclerViewPaddingTop;
|
|
||||||
private boolean areViewsEnabled;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
app = (App) getActivity().getApplicationContext();
|
|
||||||
getArgs();
|
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
|
||||||
observableRecyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
|
|
||||||
setRecyclerViewPadding();
|
|
||||||
setNumColumns(getNumColumns());
|
|
||||||
RecyclerView.Adapter adapter = getAdapter();
|
|
||||||
if (adapter != null) {
|
|
||||||
observableRecyclerView.setAdapter(adapter);
|
|
||||||
}
|
|
||||||
observableRecyclerView.setScrollViewCallbacks(this);
|
|
||||||
|
|
||||||
ScrollUtils.addOnGlobalLayoutListener(observableRecyclerView, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
observableRecyclerView.smoothScrollBy(0,1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRecyclerViewPadding() {
|
|
||||||
final int artistImageViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height);
|
|
||||||
final int titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
|
||||||
final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
|
|
||||||
|
|
||||||
recyclerViewPaddingTop = artistImageViewHeight + titleViewHeight + tabHeight;
|
|
||||||
|
|
||||||
if (Util.isInPortraitMode(getActivity()) || Util.isTablet(getActivity())) {
|
|
||||||
observableRecyclerView.setPadding(0, recyclerViewPaddingTop, 0, Util.getNavigationBarHeight(getActivity()));
|
|
||||||
} else {
|
|
||||||
observableRecyclerView.setPadding(0, recyclerViewPaddingTop, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getArgs() {
|
|
||||||
Bundle args = getArguments();
|
|
||||||
if (args != null) {
|
|
||||||
artistId = args.getInt(ArtistDetailActivity.ARG_ARTIST_ID, -1);
|
|
||||||
artistName = args.getString(ArtistDetailActivity.ARG_ARTIST_NAME, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* IMPORTANT:
|
|
||||||
*
|
|
||||||
* You CAN return null here and use setAdapter(ListAdapter adapter) inside getAdapter() to manually set the adapter.
|
|
||||||
*
|
|
||||||
* (use only in case you must set the adapter async).
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
protected abstract RecyclerView.Adapter getAdapter();
|
|
||||||
|
|
||||||
protected abstract int getNumColumns();
|
|
||||||
|
|
||||||
protected void setNumColumns(int columns) {
|
|
||||||
observableRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), columns));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setAdapter(RecyclerView.Adapter adapter) {
|
|
||||||
observableRecyclerView.setAdapter(adapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
enableViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void enableViews() {
|
|
||||||
areViewsEnabled = true;
|
|
||||||
observableRecyclerView.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableViews() {
|
|
||||||
areViewsEnabled = false;
|
|
||||||
observableRecyclerView.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean areViewsEnabled() {
|
|
||||||
return areViewsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getY() {
|
|
||||||
return observableRecyclerView.getCurrentScrollY() + recyclerViewPaddingTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getArtistId() {
|
|
||||||
return artistId;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getArtistName() {
|
|
||||||
return artistName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
|
||||||
if (getActivity() instanceof ObservableScrollViewCallbacks) {
|
|
||||||
if (getUserVisibleHint()) {
|
|
||||||
((ObservableScrollViewCallbacks) getActivity()).onScrollChanged(scrollY + recyclerViewPaddingTop, b, b2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDownMotionEvent() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.adapter.AlbumAdapter;
|
|
||||||
import com.kabouzeid.gramophone.loader.ArtistAlbumLoader;
|
|
||||||
import com.kabouzeid.gramophone.model.Album;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by karim on 04.01.15.
|
|
||||||
*/
|
|
||||||
public class ViewPagerTabArtistAlbumFragment extends AbsViewPagerTabArtistListFragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected RecyclerView.Adapter getAdapter() {
|
|
||||||
List<Album> albums = ArtistAlbumLoader.getArtistAlbumList(getActivity(), getArtistId());
|
|
||||||
return new AlbumAdapter(getActivity(), albums);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getNumColumns() {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.text.Html;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ListAdapter;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
|
||||||
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistBiographyLoader;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ViewPagerTabArtistBioFragment extends AbsViewPagerTabArtistListFragment {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected RecyclerView.Adapter getAdapter() {
|
|
||||||
final SimpleTextAdapter adapter = new SimpleTextAdapter(getActivity(), "loading");
|
|
||||||
setAdapter(adapter);
|
|
||||||
|
|
||||||
LastFMArtistBiographyLoader.loadArtistBio(getActivity(), getArtistName(), new LastFMArtistBiographyLoader.ArtistBioLoaderCallback() {
|
|
||||||
@Override
|
|
||||||
public void onArtistBioLoaded(String biography) {
|
|
||||||
if (biography == null || biography.trim().equals("")) {
|
|
||||||
try {
|
|
||||||
biography = getResources().getString(R.string.biography_unavailable);
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
biography = "Error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
adapter.setText(biography);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getNumColumns() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class SimpleTextAdapter extends RecyclerView.Adapter<SimpleTextAdapter.ViewHolder> {
|
|
||||||
private 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
|
|
||||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
|
||||||
holder.textView.setText(Html.fromHtml(text));
|
|
||||||
holder.textView.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleTextAdapter(Context context, String text) {
|
|
||||||
this.context = context;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text){
|
|
||||||
this.text = text;
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.ui.fragments.artistviewpager;
|
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ListAdapter;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
|
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
|
||||||
import com.kabouzeid.gramophone.loader.ArtistSongLoader;
|
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by karim on 04.01.15.
|
|
||||||
*/
|
|
||||||
public class ViewPagerTabArtistSongListFragment extends AbsViewPagerTabArtistListFragment {
|
|
||||||
@Override
|
|
||||||
protected RecyclerView.Adapter getAdapter() {
|
|
||||||
final List<Song> songs = ArtistSongLoader.getArtistSongList(getActivity(), getArtistId());
|
|
||||||
return new AlbumSongAdapter(getActivity(), songs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getNumColumns() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fontFamily="sans-serif"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
android:id="@+id/track_number"
|
android:id="@+id/track_number"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
|
@ -44,9 +43,9 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
|
||||||
|
|
||||||
<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_marginLeft="2dp"
|
||||||
|
android:layout_marginRight="2dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?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"
|
||||||
|
android:background="?rect_selector"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingRight="16dp">
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@drawable/image_background"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
/>
|
/>
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@drawable/image_background"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
/>
|
/>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue