Java Code Examples for androidx.databinding.ViewDataBinding#getRoot()
The following examples show how to use
androidx.databinding.ViewDataBinding#getRoot() .
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: FormViewHolder.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
public FormViewHolder(ViewDataBinding binding) { super(binding.getRoot()); label = new StringBuilder(); this.binding = binding; this.description = binding.getRoot().findViewById(R.id.descriptionLabel); if (description != null) { description.setOnClickListener(v -> new CustomDialog( itemView.getContext(), label.toString(), descriptionText != null ? descriptionText : itemView.getContext().getString(R.string.empty_description), itemView.getContext().getString(R.string.action_close), null, Constants.DESCRIPTION_DIALOG, null ).show()); } }
Example 2
Source File: FormViewHolder.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
public FormViewHolder(ViewDataBinding binding) { super(binding.getRoot()); this.binding = binding; this.description = binding.getRoot().findViewById(R.id.descriptionLabel); if (description != null) { description.setOnClickListener(v -> new CustomDialog( itemView.getContext(), label.toString(), descriptionText != null ? descriptionText : itemView.getContext().getString(R.string.empty_description), itemView.getContext().getString(R.string.action_close), null, Constants.DESCRIPTION_DIALOG, null ).show()); } }
Example 3
Source File: GroupedRecyclerViewAdapter.java From GroupedRecyclerViewAdapter with Apache License 2.0 | 6 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == TYPE_EMPTY){ return new BaseViewHolder(getEmptyView(parent)); } else { if (mUseBinding) { ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), getLayoutId(mTempPosition, viewType), parent, false); return new BaseViewHolder(binding.getRoot()); } else { View view = LayoutInflater.from(mContext).inflate( getLayoutId(mTempPosition, viewType), parent, false); return new BaseViewHolder(view); } } }
Example 4
Source File: FilterHolder.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
FilterHolder(@NonNull ViewDataBinding binding, ObservableField<Filters> openedFilter) { super(binding.getRoot()); this.binding = binding; this.openFilter = openedFilter; this.filterArrow = binding.getRoot().findViewById(R.id.filterArrow); this.filterIcon = binding.getRoot().findViewById(R.id.filterIcon); this.filterTitle = binding.getRoot().findViewById(R.id.filterTitle); this.filterValues = binding.getRoot().findViewById(R.id.filterValues); }
Example 5
Source File: DataBindingEpoxyModel.java From epoxy with Apache License 2.0 | 5 votes |
@Override protected View buildView(@NonNull ViewGroup parent) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); ViewDataBinding binding = DataBindingUtil.inflate(layoutInflater, getViewType(), parent, false); View view = binding.getRoot(); view.setTag(binding); return view; }
Example 6
Source File: ViewModelBaseBindingFragment.java From AndroidViewModel with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { getViewModelHelper().performBinding(this); final ViewDataBinding binding = getViewModelHelper().getBinding(); if (binding != null) { return binding.getRoot(); } else { throw new IllegalStateException("Binding cannot be null. Perform binding before calling getBinding()"); } }
Example 7
Source File: TeiProgramListEnrollmentViewHolder.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 4 votes |
TeiProgramListEnrollmentViewHolder(ViewDataBinding binding) { super(binding.getRoot()); this.binding = binding; }
Example 8
Source File: SimpleDataBindingComponent.java From Flap with Apache License 2.0 | 4 votes |
public SimpleDataBindingComponent(@NonNull final ViewDataBinding binding) { super(binding.getRoot()); this.binding = (FlapItemSimpleDatabindingBinding) binding; }
Example 9
Source File: TrackerListAdapter.java From exodus-android-app with GNU General Public License v3.0 | 4 votes |
TrackerListViewHolder(ViewDataBinding dataBinding) { super(dataBinding.getRoot()); viewDataBinding = dataBinding; }
Example 10
Source File: BindingRecyclerViewAdapter.java From deagle with Apache License 2.0 | 4 votes |
ViewHolder(final ViewDataBinding binding) { super(binding.getRoot()); this.binding = binding; }
Example 11
Source File: ViewModelBrick.java From brickkit-android with Apache License 2.0 | 2 votes |
/** * Constructor to set up the {@link BrickViewHolder} with the {@link ViewDataBinding} * from the right item view. * * @param viewDataBinding the {@link ViewDataBinding} object * from {@link #createViewHolder(View)} */ public ViewModelBrickViewHolder(ViewDataBinding viewDataBinding) { super(viewDataBinding.getRoot()); this.viewDataBinding = viewDataBinding; }