use of com.github.dedis.popstellar.ui.detail.event.election.adapters.ElectionResultPagerAdapter in project popstellar by dedis.
the class ElectionResultFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
ElectionResultFragmentBinding mElectionResultFragBinding = ElectionResultFragmentBinding.inflate(inflater, container, false);
mLaoDetailViewModel = LaoDetailActivity.obtainViewModel(requireActivity());
TextView laoNameView = mElectionResultFragBinding.electionResultLaoName;
TextView electionNameView = mElectionResultFragBinding.electionResultPresentationTitle;
// Getting election
Election election = mLaoDetailViewModel.getCurrentElection();
// Setting the Lao Name
laoNameView.setText(mLaoDetailViewModel.getCurrentLaoName().getValue());
// Setting election name
electionNameView.setText(election.getName());
ElectionResultPagerAdapter adapter = new ElectionResultPagerAdapter(mLaoDetailViewModel);
ViewPager2 viewPager2 = mElectionResultFragBinding.electionResultPager;
viewPager2.setAdapter(adapter);
// Setting the circle indicator
CircleIndicator3 circleIndicator = mElectionResultFragBinding.swipeIndicatorElectionResults;
circleIndicator.setViewPager(viewPager2);
mElectionResultFragBinding.setLifecycleOwner(getActivity());
return mElectionResultFragBinding.getRoot();
}
Aggregations