Search in sources :

Example 1 with ListPreloader

use of com.bumptech.glide.ListPreloader in project AmazeFileManager by TeamAmaze.

the class AppsListFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);
    MainActivity mainActivity = (MainActivity) getActivity();
    mainActivity.getAppbar().setTitle(R.string.apps);
    mainActivity.floatingActionButton.getMenuButton().hide();
    mainActivity.getAppbar().getBottomBar().setVisibility(View.GONE);
    mainActivity.supportInvalidateOptionsMenu();
    vl = getListView();
    Sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    getSortModes();
    ListView vl = getListView();
    vl.setDivider(null);
    if (utilsProvider.getAppTheme().equals(AppTheme.DARK))
        getActivity().getWindow().getDecorView().setBackgroundColor(Utils.getColor(getContext(), R.color.holo_dark_background));
    else if (utilsProvider.getAppTheme().equals(AppTheme.BLACK))
        getActivity().getWindow().getDecorView().setBackgroundColor(Utils.getColor(getContext(), android.R.color.black));
    modelProvider = new AppsAdapterPreloadModel(app);
    ViewPreloadSizeProvider<String> sizeProvider = new ViewPreloadSizeProvider<>();
    ListPreloader<String> preloader = new ListPreloader<>(GlideApp.with(app), modelProvider, sizeProvider, GlideConstants.MAX_PRELOAD_APPSADAPTER);
    adapter = new AppsAdapter(getContext(), (ThemedActivity) getActivity(), utilsProvider, modelProvider, sizeProvider, R.layout.rowlayout, app);
    getListView().setOnScrollListener(preloader);
    setListAdapter(adapter);
    setListShown(false);
    setEmptyText(getResources().getString(R.string.no_applications));
    getLoaderManager().initLoader(ID_LOADER_APP_LIST, null, this);
    if (savedInstanceState != null) {
        index = savedInstanceState.getInt(KEY_INDEX);
        top = savedInstanceState.getInt(KEY_TOP);
    }
}
Also used : ListPreloader(com.bumptech.glide.ListPreloader) AppsAdapter(com.amaze.filemanager.adapters.AppsAdapter) ListView(android.widget.ListView) ThemedActivity(com.amaze.filemanager.activities.superclasses.ThemedActivity) MainActivity(com.amaze.filemanager.activities.MainActivity) AppsAdapterPreloadModel(com.amaze.filemanager.adapters.glide.AppsAdapterPreloadModel) ViewPreloadSizeProvider(com.bumptech.glide.util.ViewPreloadSizeProvider)

Aggregations

ListView (android.widget.ListView)1 MainActivity (com.amaze.filemanager.activities.MainActivity)1 ThemedActivity (com.amaze.filemanager.activities.superclasses.ThemedActivity)1 AppsAdapter (com.amaze.filemanager.adapters.AppsAdapter)1 AppsAdapterPreloadModel (com.amaze.filemanager.adapters.glide.AppsAdapterPreloadModel)1 ListPreloader (com.bumptech.glide.ListPreloader)1 ViewPreloadSizeProvider (com.bumptech.glide.util.ViewPreloadSizeProvider)1