@Override public RepositoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { ItemRepoBinding binding = DataBindingUtil.inflate( LayoutInflater.from(parent.getContext()), R.layout.item_repo, parent, false); return new RepositoryViewHolder(binding); }
@Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new BaseViewHolder(DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), viewType, parent, false)); }
@Override public InnerItem onCreateViewHolder(ViewGroup parent, int viewType) { final InnerItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), viewType, parent, false); return new InnerItem(binding.getRoot()); }
@Override public ProfileItem onCreateViewHolder(ViewGroup parent, int viewType) { final LayoutInflater inflater = LayoutInflater.from(parent.getContext()); final ProfileItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.profile_item, parent, false); return new ProfileItem(binding.getRoot()); }
@Override public DetailsItem onCreateViewHolder(ViewGroup parent, int viewType) { final LayoutInflater inflater = LayoutInflater.from(parent.getContext()); final DetailsItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.details_item, parent, false); return new DetailsItem(binding.getRoot()); }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewDataBinding listItemBinding; if (convertView != null) { listItemBinding = (ViewDataBinding) convertView.getTag(); } else { listItemBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_pages, parent, false); convertView = listItemBinding.getRoot(); convertView.setTag(listItemBinding); } listItemBinding.setVariable(BR.pages,pageBeenList.get(position)); listItemBinding.executePendingBindings(); // listItemBinding.setButtonclick(new ButtonClick(MainActivity.this,position)); return convertView; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivitySubBinding binding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_sub, null,false); setContentView(binding.getRoot()); binding.setHandlers(new MyHandler()); } }
FragmentMainBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false); binding.setHandlers(new MyHandler()); View rootView = binding.getRoot();
listItemBinding = (ViewDataBinding) convertView.getTag(); } else { listItemBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_filter, parent, false); convertView = listItemBinding.getRoot(); convertView.setTag(listItemBinding);
/** * Creates a new ViewHolder for the given layout file. * <p> * The provided layout must be using data binding. * * @param parent The RecyclerView * @param layoutId The layout id that should be inflated. Must use data binding * @param <T> The type of the Binding class that will be generated for the <code>layoutId</code>. * @return A new ViewHolder that has a reference to the binding class */ public static <T extends ViewDataBinding> DataBoundViewHolder<T> create(ViewGroup parent, @LayoutRes int layoutId) { T binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), layoutId, parent, false); return new DataBoundViewHolder<>(binding); } }
@Override public FeedItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final FeedItemBinding binding = DataBindingUtil.inflate(mLayoutInflater, R.layout.feed_item, parent, false); FeedItemViewHolder holder = new FeedItemViewHolder(binding); holder.binding.userName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mCallback == null) { return; } FeedItem model = binding.getModel(); mCallback.onUserClick(model.getUser()); } }); // we don't need grid layout error messages holder.binding.grid.setPrinter(null); return holder; }
public View getView(int position, View convertView, @NonNull ViewGroup parent) { ItemFolderListBinding binding = (convertView == null) ? DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_folder_list, parent, false) : DataBindingUtil.bind(convertView);
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater, R.layout.fragment_login, container, false); binding.fakeUsername.setEnabled(!loggedIn); binding.fakePassword.setEnabled(!loggedIn); binding.fakeLogin.setEnabled(!loggedIn); binding.fakeLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { binding.fakeUsername.setEnabled(false); binding.fakePassword.setEnabled(false); binding.fakeLogin.setEnabled(false); binding.fakeLogin.setText(R.string.label_fake_login_loading); loginHandler.postDelayed(loginRunnable, 2000); } }); return binding.getRoot(); }
/** * Shows the loading dialog with the correct text ("creating keys" or "loading"). */ private void showLoadingDialog() { if (mIsPaused || mLoadingDialog != null) return; DialogLoadingBinding binding = DataBindingUtil.inflate( getLayoutInflater(), R.layout.dialog_loading, null, false); boolean isGeneratingKeys = getIntent().getBooleanExtra(EXTRA_KEY_GENERATION_IN_PROGRESS, false); binding.loadingText.setText((isGeneratingKeys) ? R.string.web_gui_creating_key : R.string.api_loading); mLoadingDialog = new AlertDialog.Builder(this) .setCancelable(false) .setView(binding.getRoot()) .show(); if (!isGeneratingKeys) { new Handler().postDelayed(() -> { if (this.isFinishing() || mLoadingDialog == null) return; binding.loadingSlowMessage.setVisibility(View.VISIBLE); binding.viewLogs.setOnClickListener(v -> startActivity(new Intent(this, LogActivity.class))); }, SLOW_LOADING_TIME); } }
/** * Inflates and binds a layout to an entry to the {@code data} variable * of the bound layout. * * @param inflater The LayoutInflater * @param parent The ViewGroup containing the list of Views * @param layoutId The layout ID to use for the list item * @param entry The data to bind to the inflated View * @return A ViewDataBinding, bound to a newly-inflated View with {@code entry} * set as the {@code data} variable. */ private static ViewDataBinding bindLayout(LayoutInflater inflater, ViewGroup parent, int layoutId, Object entry) { ViewDataBinding binding = DataBindingUtil.inflate(inflater, layoutId, parent, false); if (!binding.setVariable(BR.data, entry)) { String layoutName = parent.getResources().getResourceEntryName(layoutId); Log.w(TAG, "There is no variable 'data' in layout " + layoutName); } return binding; }
@Override public PhotoViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) { return new PhotoViewHolder((PhotoItemBinding) DataBindingUtil.inflate(layoutInflater, R.layout.photo_item, parent, false)); }
@Override public SwordsmanViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { ItemSwordsmanBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_swordsman, parent, false); return new SwordsmanViewHolder(binding); } @Override
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); ItemBubbleListBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_bubble_list, parent, false); return new ViewHolder(binding.getRoot()); }
protected final View setAndBindContentView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @LayoutRes int layoutResId, Bundle savedInstanceState) { if(viewModel == null) { throw new IllegalStateException("viewModel must not be null and should be injected"); } binding = DataBindingUtil.inflate(inflater, layoutResId, container, false); binding.setVariable(BR.vm, viewModel); //noinspection unchecked viewModel.attachView((MvvmView) this, savedInstanceState); return binding.getRoot(); }
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mBinding = DataBindingUtil.inflate(inflater, viewLayoutRes(), container, false); afterInflateView(); return mBinding.getRoot(); }