use of com.github.dedis.popstellar.databinding.HomeLaoLayoutBinding in project popstellar by dedis.
the class LAOListAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
HomeLaoLayoutBinding binding;
if (view == null) {
// inflate
LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
binding = HomeLaoLayoutBinding.inflate(inflater, viewGroup, false);
} else {
binding = DataBindingUtil.getBinding(view);
}
if (binding == null)
throw new IllegalStateException("Binding could not be find in the view");
LAOItemUserActionsListener userActionsListener = lao -> {
if (openLaoDetail) {
homeViewModel.openLAO(lao.getId());
} else {
homeViewModel.openLaoWallet(lao.getId());
}
};
binding.setLao(laos.get(position));
binding.setLifecycleOwner(lifecycleOwner);
binding.setListener(userActionsListener);
binding.executePendingBindings();
return binding.getRoot();
}
Aggregations