use of androidx.core.widget.ContentLoadingProgressBar in project Signal-Android by WhisperSystems.
the class GiphyMp4Fragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
boolean isForMms = requireArguments().getBoolean(IS_FOR_MMS, false);
FrameLayout frameLayout = view.findViewById(R.id.giphy_parent);
RecyclerView recycler = view.findViewById(R.id.giphy_recycler);
ContentLoadingProgressBar progressBar = view.findViewById(R.id.content_loading);
TextView nothingFound = view.findViewById(R.id.nothing_found);
GiphyMp4ViewModel viewModel = ViewModelProviders.of(requireActivity(), new GiphyMp4ViewModel.Factory(isForMms)).get(GiphyMp4ViewModel.class);
GiphyMp4Adapter adapter = new GiphyMp4Adapter(viewModel::saveToBlob);
List<GiphyMp4ProjectionPlayerHolder> holders = GiphyMp4ProjectionPlayerHolder.injectVideoViews(requireContext(), getViewLifecycleOwner().getLifecycle(), frameLayout, GiphyMp4PlaybackPolicy.maxSimultaneousPlaybackInSearchResults());
GiphyMp4ProjectionRecycler callback = new GiphyMp4ProjectionRecycler(holders);
recycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
recycler.setAdapter(adapter);
recycler.setItemAnimator(null);
progressBar.show();
GiphyMp4PlaybackController.attach(recycler, callback, GiphyMp4PlaybackPolicy.maxSimultaneousPlaybackInSearchResults());
viewModel.getImages().observe(getViewLifecycleOwner(), images -> {
nothingFound.setVisibility(images.isEmpty() ? View.VISIBLE : View.INVISIBLE);
adapter.submitList(images, progressBar::hide);
});
viewModel.getPagingController().observe(getViewLifecycleOwner(), adapter::setPagingController);
viewModel.getPagedData().observe(getViewLifecycleOwner(), unused -> recycler.scrollToPosition(0));
}
use of androidx.core.widget.ContentLoadingProgressBar in project Signal-Android by signalapp.
the class GiphyMp4Fragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
boolean isForMms = requireArguments().getBoolean(IS_FOR_MMS, false);
FrameLayout frameLayout = view.findViewById(R.id.giphy_parent);
RecyclerView recycler = view.findViewById(R.id.giphy_recycler);
ContentLoadingProgressBar progressBar = view.findViewById(R.id.content_loading);
TextView nothingFound = view.findViewById(R.id.nothing_found);
GiphyMp4ViewModel viewModel = ViewModelProviders.of(requireActivity(), new GiphyMp4ViewModel.Factory(isForMms)).get(GiphyMp4ViewModel.class);
GiphyMp4Adapter adapter = new GiphyMp4Adapter(viewModel::saveToBlob);
List<GiphyMp4ProjectionPlayerHolder> holders = GiphyMp4ProjectionPlayerHolder.injectVideoViews(requireContext(), getViewLifecycleOwner().getLifecycle(), frameLayout, GiphyMp4PlaybackPolicy.maxSimultaneousPlaybackInSearchResults());
GiphyMp4ProjectionRecycler callback = new GiphyMp4ProjectionRecycler(holders);
recycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
recycler.setAdapter(adapter);
recycler.setItemAnimator(null);
progressBar.show();
GiphyMp4PlaybackController.attach(recycler, callback, GiphyMp4PlaybackPolicy.maxSimultaneousPlaybackInSearchResults());
viewModel.getImages().observe(getViewLifecycleOwner(), images -> {
nothingFound.setVisibility(images.isEmpty() ? View.VISIBLE : View.INVISIBLE);
adapter.submitList(images, progressBar::hide);
});
viewModel.getPagingController().observe(getViewLifecycleOwner(), adapter::setPagingController);
viewModel.getPagedData().observe(getViewLifecycleOwner(), unused -> recycler.scrollToPosition(0));
}
Aggregations