本文整理汇总了Java中android.databinding.ViewDataBinding.executePendingBindings方法的典型用法代码示例。如果您正苦于以下问题:Java ViewDataBinding.executePendingBindings方法的具体用法?Java ViewDataBinding.executePendingBindings怎么用?Java ViewDataBinding.executePendingBindings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.databinding.ViewDataBinding
的用法示例。
在下文中一共展示了ViewDataBinding.executePendingBindings方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
protected void convert(MovieViewHolder helper, Movie item) {
ViewDataBinding binding = helper.getBinding();
binding.setVariable(BR.movie, item);
binding.setVariable(BR.presenter, mPresenter);
binding.executePendingBindings();
switch (helper.getLayoutPosition() %
2) {
case 0:
helper.setImageResource(R.id.iv, R.mipmap.m_img1);
break;
case 1:
helper.setImageResource(R.id.iv, R.mipmap.m_img2);
break;
}
}
示例2: onCreate
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewDataBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
vm = new MainViewModel();
binding.setVariable(BR.vm, vm);
binding.executePendingBindings();
}
示例3: convert
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
protected void convert(BaseBindHolder helper, WeatherDailyResponse.DailyResult.Daily item) {
ViewDataBinding binding = helper.getBinding();
binding.setVariable(BR.daily, item);
binding.executePendingBindings();
SuperTextView superTextView = helper.getView(R.id.super_item_daily);
ArmsUtils.INSTANCE.obtainArmsComponent(mContext).imageLoader()
.loadImage(mContext,
ImageConfigImpl.builder()
.url(String.format(Locale.CHINESE, Api.API_WEATHER_ICON_URL, item.getCodeDay()))
.placeholder(R.mipmap.ic_placeholder)
.errorPic(R.mipmap.weather_unknown)
.transformation(new FitCenter())
.imageView(superTextView.getRightIconIV())
.build());
}
示例4: onBindViewHolder
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(DataBindingViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
ViewDataBinding binding = holder.getBinding();
binding.setVariable(BR.listener, mStoryListener);
binding.executePendingBindings();
}
示例5: onBindViewHolder
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
public final void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List<Object> payloads) {
if (isForDataBinding(payloads)) {
ViewDataBinding binding = DataBindingUtil.getBinding(holder.itemView);
binding.executePendingBindings();
} else {
super.onBindViewHolder(holder, position, payloads);
}
}
示例6: loadComponent
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@BindingAdapter("component")
public static void loadComponent(ViewGroup viewGroup, MvvmComponent component) {
if (component != null) {
ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()), component.getLayoutResId(), viewGroup, false);
View view = binding.getRoot();
binding.setVariable(BR.vm, component.getViewModel());
binding.executePendingBindings();
viewGroup.removeAllViews();
viewGroup.addView(view);
}
}
示例7: onBindBinding
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
protected void onBindBinding(ViewDataBinding binding, int variableId, @LayoutRes int layoutRes, int position, T item) {
if (bindingItem.bind(binding, item)) {
binding.executePendingBindings();
}
}
示例8: convert
import android.databinding.ViewDataBinding; //导入方法依赖的package包/类
@Override
protected void convert(BaseBindHolder helper, TextContent item) {
ViewDataBinding binding = helper.getBinding();
binding.setVariable(BR.content, item);
binding.executePendingBindings();
}