com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader Java Examples
The following examples show how to use
com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoSelectActivity.java From SimpleVideoEdit with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<ArrayList<VideoInfo>> loader, ArrayList<VideoInfo> allVideos) { RequestManager requestManager = Glide.with(this); VideoGridViewAdapter adapter = new VideoGridViewAdapter(this, allVideos, requestManager); RecyclerViewPreloader<VideoInfo> preloader = new RecyclerViewPreloader<>(requestManager, adapter, adapter, 3); binding.videoSelectRecyclerview.addOnScrollListener(preloader); binding.videoSelectRecyclerview.setAdapter(adapter); adapter.setItemClickCallback(new VideoGridViewAdapter.ItemClickCallback<Boolean, VideoInfo>() { @Override public void onItemClickCallback(Boolean isSelected, VideoInfo video) { if (video != null) videoPath = video.getVideoPath(); binding.nextStep.setEnabled(isSelected); binding.nextStep.setTextAppearance(VideoSelectActivity.this, isSelected ? R.style.blue_text_18_style : R.style.gray_text_18_style); } }); }
Example #2
Source File: EntryListView.java From Aegis with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_entry_list_view, container, false); _progressBar = view.findViewById(R.id.progressBar); // set up the recycler view _recyclerView = view.findViewById(R.id.rvKeyProfiles); _recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); _listener.onScroll(dx, dy); } }); // set up icon preloading _preloadSizeProvider = new ViewPreloadSizeProvider<>(); IconPreloadProvider modelProvider = new IconPreloadProvider(); RecyclerViewPreloader<VaultEntry> preloader = new RecyclerViewPreloader<>(Glide.with(this), modelProvider, _preloadSizeProvider, 10); _recyclerView.addOnScrollListener(preloader); LinearLayoutManager layoutManager = new LinearLayoutManager(view.getContext()); _recyclerView.setLayoutManager(layoutManager); _touchCallback = new SimpleItemTouchHelperCallback(_adapter); ItemTouchHelper touchHelper = new ItemTouchHelper(_touchCallback); touchHelper.attachToRecyclerView(_recyclerView); _recyclerView.setAdapter(_adapter); int resId = R.anim.layout_animation_fall_down; LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId); _recyclerView.setLayoutAnimation(animation); _refresher = new UiRefresher(new UiRefresher.Listener() { @Override public void onRefresh() { refresh(false); } @Override public long getMillisTillNextRefresh() { return TotpInfo.getMillisTillNextRotation(_adapter.getMostFrequentPeriod()); } }); _emptyStateView = view.findViewById(R.id.vEmptyList); return view; }
Example #3
Source File: TestFragment.java From glide-support with The Unlicense | 4 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); PreloadingAdapter adapter = new PreloadingAdapter(Glide.with(this), generateImages()); listView.setAdapter(adapter); listView.addOnScrollListener(new RecyclerViewPreloader<>(adapter, adapter, 5)); }