use of io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener in project StylishMusicPlayer by ryanhoo.
the class PlayListFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
mAdapter = new PlayListAdapter(getActivity(), null);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
PlayList playList = mAdapter.getItem(position);
startActivity(PlayListDetailsActivity.launchIntentForPlayList(getActivity(), playList));
}
});
mAdapter.setAddPlayListCallback(this);
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DefaultDividerDecoration());
new PlayListPresenter(AppRepository.getInstance(), this).subscribe();
}
use of io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener in project StylishMusicPlayer by ryanhoo.
the class PlayListDetailsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Folder folder = getIntent().getParcelableExtra(EXTRA_FOLDER);
mPlayList = getIntent().getParcelableExtra(EXTRA_PLAY_LIST);
if (folder == null && mPlayList == null) {
Log.e(TAG, "onCreate: folder & play list can't be both null!");
finish();
}
if (folder != null) {
isFolder = true;
mPlayList = PlayList.fromFolder(folder);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_list_details);
ButterKnife.bind(this);
supportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(mPlayList.getName());
}
mAdapter = new SongAdapter(this, mPlayList.getSongs());
mAdapter.setActionCallback(this);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
RxBus.getInstance().post(new PlayListNowEvent(mPlayList, position));
}
});
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DefaultDividerDecoration());
emptyView.setVisibility(mPlayList.getNumOfSongs() > 0 ? View.GONE : View.VISIBLE);
new PlayListDetailsPresenter(AppRepository.getInstance(), this).subscribe();
}
use of io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener in project StylishMusicPlayer by ryanhoo.
the class AllLocalMusicFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
mAdapter = new LocalMusicAdapter(getActivity(), null);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
Song song = mAdapter.getItem(position);
RxBus.getInstance().post(new PlaySongEvent(song));
}
});
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DefaultDividerDecoration());
fastScroller.setRecyclerView(recyclerView);
new LocalMusicPresenter(AppRepository.getInstance(), this).subscribe();
}
use of io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener in project StylishMusicPlayer by ryanhoo.
the class FolderFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
mAdapter = new FolderAdapter(getActivity(), null);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
Folder folder = mAdapter.getItem(position);
startActivity(PlayListDetailsActivity.launchIntentForFolder(getActivity(), folder));
}
});
mAdapter.setAddFolderCallback(this);
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DefaultDividerDecoration());
new FolderPresenter(AppRepository.getInstance(), this).subscribe();
}
use of io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener in project StylishMusicPlayer by ryanhoo.
the class FileSystemActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_system);
ButterKnife.bind(this);
supportActionBar(toolbar);
DEFAULT_SDCARD_NAME = getString(R.string.mp_activity_title_file_system);
mFileTreeStack = new FileTreeStack();
mAdapter = new FileSystemAdapter(this, null);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
FileWrapper fileWrapper = mAdapter.getItem(position);
if (isInActionMode()) {
toggleItemView(fileWrapper, position, !fileWrapper.selected);
} else {
File file = fileWrapper.file;
if (file.isDirectory()) {
storeSnapshot();
toolbar.setTitle(getToolbarTitle(file));
loadFiles(file);
}
}
}
});
mAdapter.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public void onItemClick(int position) {
FileWrapper fileWrapper = mAdapter.getItem(position);
if (fileWrapper.file.isDirectory()) {
if (mActionModeCallback == null || !mActionModeCallback.isShowing()) {
startActionMode();
}
toggleItemView(fileWrapper, position, !fileWrapper.selected);
}
}
});
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DefaultDividerDecoration());
loadFiles(SDCARD);
}
Aggregations