use of io.hefuyi.listener.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.
the class PlayqueueDialog method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
if (mSwatch != null) {
root.setBackgroundColor(mSwatch.getRgb());
mAdapter.setPaletteSwatch(mSwatch);
int blackWhiteColor = ColorUtil.getBlackWhiteColor(mSwatch.getRgb());
tvPlayMode.setTextColor(blackWhiteColor);
ivPlayMode.setColorFilter(blackWhiteColor);
clearAll.setColorFilter(blackWhiteColor);
}
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false));
int shuffleMode = MusicPlayer.getShuffleMode();
int repeatMode = MusicPlayer.getRepeatMode();
if (shuffleMode == MusicService.SHUFFLE_NONE) {
if (repeatMode == MusicService.REPEAT_CURRENT) {
//单曲播放模式
ivPlayMode.setImageDrawable(getResources().getDrawable(R.drawable.ic_one_shot));
tvPlayMode.setText(R.string.repeat_current);
mPlayMode = PlayMode.CURRENT;
} else {
//顺序播放模式
ivPlayMode.setImageDrawable(getResources().getDrawable(R.drawable.ic_list_repeat));
tvPlayMode.setText(R.string.repeat_all);
mPlayMode = PlayMode.REPEATALL;
}
} else if (shuffleMode == MusicService.SHUFFLE_NORMAL || shuffleMode == MusicService.SHUFFLE_AUTO) {
//随机播放模式
ivPlayMode.setImageDrawable(getResources().getDrawable(R.drawable.ic_list_shuffle));
tvPlayMode.setText(R.string.shuffle_all);
mPlayMode = PlayMode.SHUFFLE;
}
mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
if (mAdapter.getItemCount() == 0) {
dismiss();
}
}
});
mPresenter.subscribe();
}
use of io.hefuyi.listener.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.
the class ArtistMusicFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
songsRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
songsRecyclerview.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, true));
mSongAdapter = new ArtistSongAdapter(getActivity(), null, artistID);
songsRecyclerview.setAdapter(mSongAdapter);
mPresenter.subscribe(artistID);
subscribeMetaChangedEvent();
}
use of io.hefuyi.listener.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistDetailFragment method onViewCreated.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
if (getArguments().getBoolean("transition")) {
playlistArt.setTransitionName(getArguments().getString("transition_name"));
}
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false));
setupToolbar();
mPresenter.loadPlaylistSongs(playlistID);
mPresenter.loadPlaylistArt(firstAlbumID);
//监听歌曲删除事件,修改歌单封面
mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
super.onItemRangeRemoved(positionStart, itemCount);
RxBus.getInstance().post(new PlaylistUpdateEvent());
if (positionStart == 0) {
List<Song> songs = mAdapter.getSongList();
if (songs.size() == 0) {
firstAlbumID = -1;
} else {
firstAlbumID = songs.get(0).albumId;
}
mPresenter.loadPlaylistArt(firstAlbumID);
}
}
});
subscribeMetaChangedEvent();
}
use of io.hefuyi.listener.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistFragment method setItemDecoration.
private void setItemDecoration() {
if (isGrid) {
int spacingInPixels = getActivity().getResources().getDimensionPixelSize(R.dimen.spacing_card_album_grid);
itemDecoration = new PlaylistFragment.SpacesItemDecoration(spacingInPixels);
} else {
itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false);
}
recyclerView.addItemDecoration(itemDecoration);
}
use of io.hefuyi.listener.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.
the class FoldersFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
if (Build.VERSION.SDK_INT >= 19) {
int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
view.findViewById(R.id.toolbar).setPadding(0, statusBarHeight, 0, 0);
}
}
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.folders);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false));
mPresenter.subscribe();
subscribeMetaChangedEvent();
}
Aggregations