use of com.stardust.scriptdroid.ui.viewmodel.ScriptList in project Auto.js by hyb1996.
the class ScriptListView method loadScriptList.
private void loadScriptList() {
setRefreshing(true);
mStorageFileProvider.getDirectoryFiles(mCurrentDirectory).subscribeOn(Schedulers.io()).filter(f -> mFilter == null ? true : mFilter.apply(f)).collectInto(mScriptList.cloneConfig(), (list, file) -> {
if (file instanceof ScriptFile) {
list.add((ScriptFile) file);
} else {
list.add(new ScriptFile(file));
}
}).observeOn(Schedulers.computation()).doOnSuccess(ScriptList::sort).observeOn(AndroidSchedulers.mainThread()).subscribe(list -> {
mScriptList = list;
mScriptListAdapter.notifyDataSetChanged();
setRefreshing(false);
});
}
Aggregations