當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewDataBinding.executePendingBindings方法代碼示例

本文整理匯總了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;

    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:DataBindingUseAdapter.java

示例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();
}
 
開發者ID:wongcain,項目名稱:okuki,代碼行數:9,代碼來源:MainActivity.java

示例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());
}
 
開發者ID:xiaobailong24,項目名稱:MVVMArms,代碼行數:18,代碼來源:WeatherDailyAdapter.java

示例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();
}
 
開發者ID:nicholasrout,項目名稱:shortstories,代碼行數:8,代碼來源:StoryAdapter.java

示例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);
    }
}
 
開發者ID:zxmmmmmm,項目名稱:Mvvm,代碼行數:10,代碼來源:MvvmAdapter.java

示例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);
    }
}
 
開發者ID:wongcain,項目名稱:okuki,代碼行數:12,代碼來源:ViewGroupBindings.java

示例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();
    }
}
 
開發者ID:zxmmmmmm,項目名稱:Mvvm,代碼行數:6,代碼來源:MvvmAdapter.java

示例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();
}
 
開發者ID:goutham106,項目名稱:GmArchMvvm,代碼行數:7,代碼來源:RtoAdapter.java


注:本文中的android.databinding.ViewDataBinding.executePendingBindings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。