use of io.github.ryanhoo.music.ui.common.DefaultDividerDecoration 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