Search in sources :

Example 1 with DataFetcher

use of com.bumptech.glide.load.data.DataFetcher in project glide by bumptech.

the class MultiModelLoader method buildLoadData.

@Override
public LoadData<Data> buildLoadData(Model model, int width, int height, Options options) {
    Key sourceKey = null;
    int size = modelLoaders.size();
    List<DataFetcher<Data>> fetchers = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        ModelLoader<Model, Data> modelLoader = modelLoaders.get(i);
        if (modelLoader.handles(model)) {
            LoadData<Data> loadData = modelLoader.buildLoadData(model, width, height, options);
            if (loadData != null) {
                sourceKey = loadData.sourceKey;
                fetchers.add(loadData.fetcher);
            }
        }
    }
    return !fetchers.isEmpty() ? new LoadData<>(sourceKey, new MultiFetcher<>(fetchers, exceptionListPool)) : null;
}
Also used : ArrayList(java.util.ArrayList) DataFetcher(com.bumptech.glide.load.data.DataFetcher) Key(com.bumptech.glide.load.Key)

Aggregations

Key (com.bumptech.glide.load.Key)1 DataFetcher (com.bumptech.glide.load.data.DataFetcher)1 ArrayList (java.util.ArrayList)1