Search in sources :

Example 1 with ScriptList

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);
    });
}
Also used : Context(android.content.Context) GridLayoutManager(android.support.v7.widget.GridLayoutManager) PFiles(com.stardust.pio.PFiles) BindableViewHolder(com.stardust.scriptdroid.ui.widget.BindableViewHolder) ButterKnife(butterknife.ButterKnife) BuildActivity(com.stardust.scriptdroid.ui.build.BuildActivity) ImageView(android.widget.ImageView) ScriptList(com.stardust.scriptdroid.ui.viewmodel.ScriptList) R(com.stardust.scriptdroid.R) ScriptOperations(com.stardust.scriptdroid.ui.common.ScriptOperations) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) Scripts(com.stardust.scriptdroid.model.script.Scripts) OnClick(butterknife.OnClick) MenuItem(android.view.MenuItem) BindView(butterknife.BindView) AttributeSet(android.util.AttributeSet) GradientDrawable(android.graphics.drawable.GradientDrawable) PopupMenu(android.widget.PopupMenu) View(android.view.View) Observable(io.reactivex.Observable) Schedulers(io.reactivex.schedulers.Schedulers) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) ScriptFile(com.stardust.scriptdroid.model.script.ScriptFile) PFile(com.stardust.pio.PFile) ResourcesCompat(android.support.v4.content.res.ResourcesCompat) StorageFileProvider(com.stardust.scriptdroid.storage.file.StorageFileProvider) LayoutInflater(android.view.LayoutInflater) ThemeColorSwipeRefreshLayout(com.stardust.theme.widget.ThemeColorSwipeRefreshLayout) ViewGroup(android.view.ViewGroup) ScriptLoopDialog(com.stardust.scriptdroid.ui.common.ScriptLoopDialog) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Subscribe(org.greenrobot.eventbus.Subscribe) BuildActivity_(com.stardust.scriptdroid.ui.build.BuildActivity_) Function(io.reactivex.functions.Function) Nullable(android.support.annotation.Nullable) ScriptList(com.stardust.scriptdroid.ui.viewmodel.ScriptList) ScriptFile(com.stardust.scriptdroid.model.script.ScriptFile)

Aggregations

Context (android.content.Context)1 GradientDrawable (android.graphics.drawable.GradientDrawable)1 Nullable (android.support.annotation.Nullable)1 ResourcesCompat (android.support.v4.content.res.ResourcesCompat)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 AttributeSet (android.util.AttributeSet)1 LayoutInflater (android.view.LayoutInflater)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 PopupMenu (android.widget.PopupMenu)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 ButterKnife (butterknife.ButterKnife)1 OnClick (butterknife.OnClick)1 PFile (com.stardust.pio.PFile)1 PFiles (com.stardust.pio.PFiles)1