View as function now working in all fragments. (Except playlist fragment because it makes no sense there.)
This commit is contained in:
parent
5c513115e7
commit
cee223cdbb
11 changed files with 203 additions and 30 deletions
|
|
@ -294,7 +294,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
}
|
||||
|
||||
private void setUpSongsAdapter() {
|
||||
adapter = new AlbumSongAdapter(this, loadSongDataSet(), R.layout.item_list, this);
|
||||
adapter = new AlbumSongAdapter(this, loadSongDataSet(), R.layout.item_list, false, this);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
||||
recyclerView.setAdapter(adapter);
|
||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
private void setUpRecyclerView() {
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
||||
if (playlist instanceof AbsSmartPlaylist) {
|
||||
adapter = new SmartPlaylistSongAdapter(this, loadSmartPlaylistDataSet(), R.layout.item_list, this);
|
||||
adapter = new SmartPlaylistSongAdapter(this, loadSmartPlaylistDataSet(), R.layout.item_list, false, this);
|
||||
} else {
|
||||
adapter = new PlaylistSongAdapter(this, loadPlaylistDataSet(), R.layout.item_list, this);
|
||||
adapter = new PlaylistSongAdapter(this, loadPlaylistDataSet(), R.layout.item_list, false, this);
|
||||
|
||||
DragSortRecycler dragSortRecycler = new DragSortRecycler();
|
||||
dragSortRecycler.setViewHandleId(R.id.image);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class AlbumViewFragment extends AbsMainActivityRecyclerViewLayoutModeFrag
|
|||
getMainActivity(),
|
||||
AlbumLoader.getAllAlbums(getActivity()),
|
||||
getItemLayout(),
|
||||
PreferenceUtil.getInstance(getActivity()).albumColoredFooters(),
|
||||
loadUsePalette(),
|
||||
getMainActivity());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,19 @@ import android.support.v7.widget.GridLayoutManager;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.artist.ArtistAdapter;
|
||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class ArtistViewFragment extends AbsMainActivityRecyclerViewFragment<ArtistAdapter, GridLayoutManager> {
|
||||
public class ArtistViewFragment extends AbsMainActivityRecyclerViewLayoutModeFragment<ArtistAdapter, GridLayoutManager> {
|
||||
|
||||
public static final String TAG = ArtistViewFragment.class.getSimpleName();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected GridLayoutManager createLayoutManager() {
|
||||
return new GridLayoutManager(getActivity(), 2);
|
||||
return new GridLayoutManager(getActivity(), getColumnNumber());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
@ -26,7 +27,8 @@ public class ArtistViewFragment extends AbsMainActivityRecyclerViewFragment<Arti
|
|||
return new ArtistAdapter(
|
||||
getMainActivity(),
|
||||
ArtistLoader.getAllArtists(getActivity()),
|
||||
R.layout.item_grid,
|
||||
getItemLayout(),
|
||||
loadUsePalette(),
|
||||
getMainActivity());
|
||||
}
|
||||
|
||||
|
|
@ -39,4 +41,25 @@ public class ArtistViewFragment extends AbsMainActivityRecyclerViewFragment<Arti
|
|||
public void onMediaStoreChanged() {
|
||||
getAdapter().swapDataSet(ArtistLoader.getAllArtists(getActivity()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int loadLayoutMode() {
|
||||
return PreferenceUtil.getInstance(getActivity()).getArtistLayoutMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveLayoutMode(int layoutMode) {
|
||||
PreferenceUtil.getInstance(getActivity()).setArtistLayoutMode(layoutMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUsePaletteAndSaveValue(boolean usePalette) {
|
||||
getAdapter().usePalette(usePalette);
|
||||
PreferenceUtil.getInstance(getActivity()).setArtistColoredFooters(usePalette);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadUsePalette() {
|
||||
return PreferenceUtil.getInstance(getActivity()).artistColoredFooters();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,24 +6,30 @@ import android.support.v7.widget.GridLayoutManager;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.song.SongAdapter;
|
||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SongViewFragment extends AbsMainActivityRecyclerViewFragment<SongAdapter, GridLayoutManager> {
|
||||
public class SongViewFragment extends AbsMainActivityRecyclerViewLayoutModeFragment<SongAdapter, GridLayoutManager> {
|
||||
|
||||
public static final String TAG = SongViewFragment.class.getSimpleName();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected GridLayoutManager createLayoutManager() {
|
||||
return new GridLayoutManager(getActivity(), 1);
|
||||
return new GridLayoutManager(getActivity(), getColumnNumber());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected SongAdapter createAdapter() {
|
||||
return new SongAdapter(getMainActivity(), SongLoader.getAllSongs(getActivity()), R.layout.item_list, getMainActivity());
|
||||
return new SongAdapter(
|
||||
getMainActivity(),
|
||||
SongLoader.getAllSongs(getActivity()),
|
||||
getItemLayout(),
|
||||
loadUsePalette(),
|
||||
getMainActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -35,4 +41,25 @@ public class SongViewFragment extends AbsMainActivityRecyclerViewFragment<SongAd
|
|||
public void onMediaStoreChanged() {
|
||||
getAdapter().swapDataSet(SongLoader.getAllSongs(getActivity()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int loadLayoutMode() {
|
||||
return PreferenceUtil.getInstance(getActivity()).getSongLayoutMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveLayoutMode(int layoutMode) {
|
||||
PreferenceUtil.getInstance(getActivity()).setSongLayoutMode(layoutMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUsePaletteAndSaveValue(boolean usePalette) {
|
||||
getAdapter().usePalette(usePalette);
|
||||
PreferenceUtil.getInstance(getActivity()).setSongColoredFooters(usePalette);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadUsePalette() {
|
||||
return PreferenceUtil.getInstance(getActivity()).songColoredFooters();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue