Java 类android.databinding.DataBindingUtil 实例源码

项目:PDialogs-Android    文件:DatePicker.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.view_date_picker, null, true);
    setContentView(binding.getRoot());

    setCancelable(true);
    if (getWindow() != null) {
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }


    findViews();

}
项目:ClouldReader    文件:MainActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);

        initStatusView();
        initId();
        initRxBus();

        StatusBarUtil.setColorNoTranslucentForDrawerLayout(MainActivity.this, drawerLayout,
                CommonUtils.getColor(R.color.colorTheme));
        initContentFragment();
        initDrawerLayout();
        initListener();
    }
项目:ClouldReader    文件:MainActivity.java   
/**
 * inflateHeaderView 进来的布局要宽一些
 */
private void initDrawerLayout() {
    navView.inflateHeaderView(R.layout.nav_header_main);
    View headerView = navView.getHeaderView(0);
    bind = DataBindingUtil.bind(headerView);
    bind.setListener(this);
    bind.dayNightSwitch.setChecked(SPUtils.getNightMode());

    ImgLoadUtil.displayCircle(bind.ivAvatar, ConstantsImageUrl.IC_AVATAR);
    bind.llNavExit.setOnClickListener(this);
    bind.ivAvatar.setOnClickListener(this);

    bind.llNavHomepage.setOnClickListener(listener);
    bind.llNavScanDownload.setOnClickListener(listener);
    bind.llNavDeedback.setOnClickListener(listener);
    bind.llNavAbout.setOnClickListener(listener);
    bind.llNavLogin.setOnClickListener(listener);
}
项目:Mix    文件:Dagger2Activity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityDagger2Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_dagger2);
    mCalendar = new Calendar();
    binding.setCalendar(mCalendar);

    DaggerCalendarComponent.
            builder().
            apiHttpModule(new ApiHttpModule()).
            calendarPresenterModule(new CalendarPresenterModule(this)).
            build().
            inject(this);

    initToolbar();
    initView();
}
项目:android-advanced-light    文件:LayoutActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityLayoutBinding binding=DataBindingUtil.setContentView(this, R.layout.activity_layout);
    binding.setName("风清扬");
    binding.setAge(70);
    binding.setMan(true);

    ArrayList list=new ArrayList();
    list.add("0");
    list.add("1");
    binding.setList(list);

    Map map=new HashMap();
    map.put("age","30");
    binding.setMap(map);

    String[] arrays = {"张无忌", "慕容龙城"};
    binding.setArrays(arrays);

    Swordsman swordsman=new Swordsman("独孤求败","SS");
    binding.setSwordsman(swordsman);

    binding.setTime(new Date());

}
项目:ZeroKit-Android-SDK    文件:SignInActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getComponent().inject(this);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_signin);
    binding.setViewmodel(viewModel);
    binding.container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            binding.bottomBar.post(new Runnable() {
                @Override
                public void run() {
                    binding.bottomBar.setVisibility(binding.container.getRootView().getHeight() - binding.container.getHeight() > dpToPx(SignInActivity.this, 200) ? View.GONE : View.VISIBLE);
                }
            });
        }
    });
}
项目:AndProx    文件:TuneResultActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.activity_tune_result);
    ActivityTuneResultBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_tune_result);
    TuneResult tuneResult = getIntent().getParcelableExtra(TUNE_RESULT_KEY);
    binding.setTuneResult(tuneResult);

    GraphView gphTuning = (GraphView) findViewById(R.id.gphTuning);
    LineGraphSeries<DataPoint> tuningSeries = getLineGraph(tuneResult);
    gphTuning.addSeries(tuningSeries);

    gphTuning.getViewport().setScalable(true);
    gphTuning.getViewport().setScrollable(true);

    // Translate the graph around on a pseudo-log scale
    gphTuning.getGridLabelRenderer().setLabelFormatter(new FrequencyLabelFormatter());

}
项目:Inflix    文件:MoviesFragment.java   
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_media_grid, container, false);
    mContentLoadingUitl = ContentLoadingUtil.with(mContext)
            .setContent(mBinding.recyclerViewMediaList)
            .setProgress(mBinding.progressBarLoading)
            .setError(mBinding.textViewErrorMessage);
    View view = mBinding.getRoot();

    if (getArguments() != null) {
        mType = getArguments().getString(TYPE, DISCOVER);
    }

    mBinding.recyclerViewMediaList.setHasFixedSize(true);
    mBinding.recyclerViewMediaList.setLayoutManager(mLayoutManager);

    mAdapter = new MediaAdapter(this);
    mBinding.recyclerViewMediaList.setAdapter(mAdapter);
    mBinding.recyclerViewMediaList.addOnScrollListener(mEndlessScollListener);

    return view;
}
项目:android-security    文件:MainActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    client = new GoogleApiClient.Builder(this)
            .addApi(SafetyNet.API)
            .enableAutoManage(this, this)
            .build();

    binding.root.setText(new RootBeer(this).isRooted() ? "Device is rooted" : "Device isn't rooted");
    binding.installation.setText(InstallationChecker.verifyInstaller(this) ? "Installed from Play Store" : "Installed from unknown source");

    binding.enviroment.setText((EnvironmentChecker.alternativeIsEmulator() ? "Running on an emulator" : "Running on a device")
            + (EnvironmentChecker.isDebuggable(this) ? " with debugger" : ""));

    binding.tampering.setText((InstallationChecker.checkPackage(this) ?
            "The package is consistent" : "The package was modified")
            + (SignatureUtils.checkSignature(this) ? " and the signature is ok" : " and the signature was changed!"));

    binding.setController(this);
}
项目:queued-progressbar    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mBinding = DataBindingUtil.setContentView(this, com.github.trdevendran.queuedprogressbar.R.layout.activity_main);

    mBinding.ballCountControllerSb.setOnSeekBarChangeListener(this);
    mBinding.radiusControllerSb.setOnSeekBarChangeListener(this);
    mBinding.speedControllerSb.setOnSeekBarChangeListener(this);

    mBinding.defaultColorRb.setOnCheckedChangeListener(this);
    mBinding.greenColorRb.setOnCheckedChangeListener(this);
    mBinding.blueColorRb.setOnCheckedChangeListener(this);
    mBinding.redColorRb.setOnCheckedChangeListener(this);

    mBinding.ballCountControllerSb.setProgress(5);
    mBinding.radiusControllerSb.setProgress(5);
    mBinding.speedControllerSb.setProgress(5);
    mBinding.defaultColorRb.setChecked(true);
}
项目:Inflix    文件:LocalMoviesFragment.java   
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_media_grid, container, false);
    mContentLoadingUtil = ContentLoadingUtil.with(mContext)
            .setContent(mBinding.recyclerViewMediaList)
            .setProgress(mBinding.progressBarLoading)
            .setError(mBinding.textViewErrorMessage);
    View view = mBinding.getRoot();

    if (getArguments() != null) {
        mType = getArguments().getString(TYPE, FAVORITES);
    }

    mBinding.recyclerViewMediaList.setHasFixedSize(true);
    mBinding.recyclerViewMediaList.setLayoutManager(mLayoutManager);

    mAdapter = new FavoritesAdapter(this);
    mBinding.recyclerViewMediaList.setAdapter(mAdapter);

    return view;
}
项目:InAppTranslation_Android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    //TODO: Make Spinner example

}
项目:mvvm-template    文件:BaseViewModelActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TAG = getClass().getSimpleName();

    //init data binding
    binding = DataBindingUtil.setContentView(this, getLayout());
    initViews();

    // int view model
    // noinspection unchecked
    Class<VM> viewModelClass = (Class<VM>) ((ParameterizedType) getClass()
            .getGenericSuperclass()).getActualTypeArguments()[1]; // 1 is BaseViewModel

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(viewModelClass);

    viewModel.onCreate(getIntent().getExtras(), navigatorHelper);
    viewModel.getStateLiveData().observe(this, this::handleState);
}
项目:SDHtmlTextView    文件:DataBindingExampleActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_data_binding_example);

    // create dummy item
    NewsItem item = new NewsItem();
    item.setHtml("<p>Interdum et malesuada <b>some bold text in here</b> fames ac ante ipsum primis in faucibus.</p>");

    // in XML we declared a variable newsItem, data binding generated the set method
    // once set, all fields/values/views are updated accordingly
    binding.setNewsItem(item);

    // if you have set an android:id in XML, data binding do the 'findViewById()'
    DrawTableLinkSpan drawTableLinkSpan = new DrawTableLinkSpan();
    drawTableLinkSpan.setTableLinkText("[tap for table]");
    binding.htmlText.setDrawTableLinkSpan(drawTableLinkSpan);
}
项目:android-flux-mortar    文件:MainActivity.java   
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
  binding.button.setOnClickListener(v -> SettingActivity.startActivity(this));

  DaggerService.<MainComponent>getComponent(this).injectMembers(this);

  settingStore.rotate().compose(bindToLifecycle()).subscribe(on -> {
    setRequestedOrientation(on ? ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
        : ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
  });

  log.add(this.toString());
  Toast.makeText(this, "log=" + log.size() + " fm." + this, Toast.LENGTH_SHORT).show();
}
项目:Near    文件:ChatActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_chat);
    binding.chatRv.setLayoutManager(new LinearLayoutManager(this));
    mChatAdapter = new ChatAdapter();
    binding.chatRv.setAdapter(mChatAdapter);
    mChatAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
        @Override
        public void onItemRangeInserted(int positionStart, int itemCount) {
            binding.chatRv.scrollToPosition(positionStart);
        }
    });

    mParticipant = getIntent().getParcelableExtra(BUNDLE_PARTICIPANT);
    setTitle("Chat with " + mParticipant.getName());
    initNearConnect();
    initMessagingUi();
}
项目:ZeroKit-Android-Sample    文件:SignInActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getComponent().inject(this);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_signin);
    binding.setViewmodel(viewModel);
    binding.container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            binding.bottomBar.post(new Runnable() {
                @Override
                public void run() {
                    binding.bottomBar.setVisibility(binding.container.getRootView().getHeight() - binding.container.getHeight() > dpToPx(SignInActivity.this, 200) ? View.GONE : View.VISIBLE);
                }
            });
        }
    });
}
项目:Android-Skin    文件:DatabindingActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     mActivityDatabindingBinding = DataBindingUtil.setContentView(
            this, R.layout.activity_databinding);

    User user = new User("lin", "暂时不支持Databinding换肤哦");
    user.setCheck(true);
    mActivityDatabindingBinding.setUser(user);
}
项目:SuperNatives    文件:PowerStatDelegate.java   
@NonNull
@Override
public PowerStatViewHolder onCreateViewHolder(@NonNull ViewGroup parent) {
    context = parent.getContext();
    RvPowerStatProgressBinding binding = DataBindingUtil.inflate(
            LayoutInflater.from(context),
            R.layout.rv_power_stat_progress, parent, false);
    return new PowerStatViewHolder(binding);
}
项目:iroha-demo-android    文件:AssetSenderFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    binding = DataBindingUtil.bind(view);
    binding.qrButton.setOnClickListener(assetSenderPresenter.onQRShowClicked());
    binding.submitButton.setOnClickListener(assetSenderPresenter.onSubmitClicked());
    binding.amount.addTextChangedListener(assetSenderPresenter.textWatcher());
}
项目:ClouldReader    文件:BookAdapter.java   
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    switch (viewType) {
        case TYPE_HEADER_BOOK:
            HeaderItemBookBinding mBindHeader = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.header_item_book, parent, false);
            return new HeaderViewHolder(mBindHeader.getRoot());
        case TYPE_FOOTER_BOOK:
            FooterItemBookBinding mBindFooter = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.footer_item_book, parent, false);
            return new FooterViewHolder(mBindFooter.getRoot());
        default:
            ItemBookBinding mBindBook = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_book, parent, false);
            return new BookViewHolder(mBindBook.getRoot());
    }
}
项目:Android-Code-Demos    文件:AnimationActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_animation);
    mBinding.addOnRebindCallback(new OnRebindCallback() {
        @Override
        public boolean onPreBind(ViewDataBinding binding) {
            ViewGroup view = (ViewGroup) binding.getRoot();
            TransitionManager.beginDelayedTransition(view);
            return true;
        }
    });
    mBinding.setPresenter(new Presenter());
}
项目:Android-HTTPS-based-on-MVVM    文件:RecyclerViewActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_recycler_view);
    viewModel = new ListViewModel(this);
    binding.setViewModel(viewModel);
    binding.toolbar.setTitle("RecyclerView");
    setSupportActionBar(binding.toolbar);
    initRecyclerView();
}
项目:ClouldReader    文件:NavHomePageActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_nav_home_page);

    binding.toolbarLayout.setTitle(getString(R.string.app_name));
    StatusBarUtil.setTranslucentForImageView(this, 0, binding.toolbar);
    binding.fabShare.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ShareUtils.share(v.getContext(), R.string.string_share_text);
        }
    });
}
项目:spline    文件:EditorActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_editor);
    setSupportActionBar(mBinding.toolbar);

    String fileName = "untitled.json";
    Bundle bundle = getIntent().getExtras();
    if (bundle != null && bundle.getString(FILENAME) != null) {
        fileName = bundle.getString(FILENAME);
    }

    mViewModel = new DocumentViewModel(this, fileName);
    mViewModel.loadDocument();

    mBinding.setViewModel(mViewModel);


    // Do some necessary non-data binding view work

    // TaskDescription constructor requires us to specify an overview title bar color, so we
    // grab primary color to match the original color
    int primaryColor = getColor(R.color.colorPrimary);
    ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
            mViewModel.getPrettyFileName(), null, primaryColor
    );

    // Set our overview task description with custom name matching the current doc file name
    setTaskDescription(td);

    mLayerTypePopup = new PopupMenu(this, mBinding.addLayerBtn);
    mLayerTypePopup.getMenuInflater().inflate(
            R.menu.menu_layer_types, mLayerTypePopup.getMenu());
    mLayerTypePopup.setOnMenuItemClickListener(mViewModel.getOnMenuItemClickListener());

    registerForContextMenu(mBinding.documentView);
    registerForContextMenu(mBinding.layerList);
}
项目:firestore-android-arch-components    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
    setSupportActionBar(binding.toolbar);

    // View model
    viewModel = getViewModel(MainViewModel.class);
    initRecycler();

    binding.setHandler(clear -> {
        if (clear) {
            mFilterDialog.resetFilters();
            onFilter(Filters.getDefault());
        } else {
            // Show the dialog containing filter options
            mFilterDialog.show(getSupportFragmentManager(), FilterDialogFragment.TAG);
        }
    });

    viewModel.isSignedIn().observe(this, isSigned -> {
        // Start sign in if necessary
        //noinspection ConstantConditions
        if (! isSigned) startSignIn();
    });

    viewModel.restaurants().observe(this, listResource -> {
        if (listResource.isSuccessful()) {
            adapter.replace(listResource.data());
        }
    });

    // Filter Dialog
    mFilterDialog = new FilterDialogFragment();
}
项目:swipeablerecyclerview    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
    binding.setHandler(this);

    setRecyclerView();
}
项目:Android-Code-Demos    文件:ExpressionActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Employee employee = new Employee("Inno", "Fang", false);
    employee.setAvatar("https://avatars0.githubusercontent.com/u/15724026?v=3&s=460");
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_expression);
    mBinding.setEmployee(employee);
}
项目:Demos    文件:ObservableActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityObservableBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_observable);

    // Observable Objects
    final ObservableObjectsUser user = new ObservableObjectsUser("容华", "谢后");

    // ObservableFields
    //final ObservableFieldsUser user = new ObservableFieldsUser("容华", "谢后");

    // Observable Collections
    //final ObservableArrayMap<String, String> user = new ObservableArrayMap<>();
    //user.put("firstName", "容华");
    //user.put("lastName", "谢后");

    binding.setUser(user);

    binding.setClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Observable Objects
            user.setFirstName("空谷");
            user.setLastName("幽兰");

            // ObservableFields
            //user.firstName.set("空谷");
            //user.lastName.set("幽兰");

            // Observable Collections
            //user.put("firstName", "空谷");
            //user.put("lastName", "幽兰");
        }
    });
}
项目:ComponentProjectDemo    文件:ModuleAMainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mMainActivity = DataBindingUtil.setContentView(this, R.layout.modulea_activity_main);
    init();

}
项目:AnimatedRecyclerView    文件:SampleActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivitySampleBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_sample);

    getSupportFragmentManager().beginTransaction()
            .replace(binding.content.getId(), new OptionsFragment())
            .commit();

}
项目:mao-android    文件:HelloJniFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.i("onCreateView");
    mDataBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_sample, container, false);
    mDataBinding.setHandler(this);
    mDataBinding.txtContent.setText(this.getClass().getSimpleName());
    return mDataBinding.getRoot();
}
项目:SearchLayout    文件:FlowSearchLayout.java   
private void setUp(Context context, AttributeSet attrs, int defStyleAttr) {
    inflater = LayoutInflater.from(context);
    mBinding = DataBindingUtil.inflate(inflater, R.layout.layout_search, this, true);
    mBinding.setPresenter(new Presenter());
    allNames = SearchManger.getInstance(getContext()).getAllNames();
    initAttr(context, attrs, defStyleAttr);
    mBinding.svSearch.setOnQueryTextListener(this);
    mBinding.svSearch.setOnQueryTextFocusChangeListener(this);
    initHistoryData(allNames);
    initNetTags(allNames);
    initSuggestion();
    initSearchView();
}
项目:Inflix    文件:UserReviewsFragment.java   
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_user_reviews, container, false);
    mContentLoadingUtil = ContentLoadingUtil.with(mContext)
            .setContent(mBinding.recyclerViewUserReviews)
            .setProgress(mBinding.progressBarLoading)
            .setError(mBinding.textViewErrorMessage);

    mBinding.recyclerViewUserReviews.setLayoutManager(mLayoutManager);
    mBinding.recyclerViewUserReviews.setHasFixedSize(true);
    mBinding.recyclerViewUserReviews.setAdapter(mAdapter);
    mBinding.recyclerViewUserReviews.addOnScrollListener(mEndlessScollListener);

    RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
    mBinding.recyclerViewUserReviews.addItemDecoration(itemDecoration);

    if (savedInstanceState == null) {
        //noinspection ConstantConditions
        mResourceId = getArguments().getLong(RESOURCE_ID, 0);

        if (mResourceId != 0) {
            fetchMovieReviews(mResourceId);
        }
    } else {
        List<MovieReview> movieReviewList = savedInstanceState.getParcelableArrayList(MOVIE_REVIEWS);
        updateReviewsUI(movieReviewList);
    }

    return mBinding.getRoot();
}
项目:AndroidProgramming3e    文件:BeatBoxFragment.java   
@Override
public SoundHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    ListItemSoundBinding binding = DataBindingUtil
            .inflate(inflater, R.layout.list_item_sound, parent, false);
    return new SoundHolder(binding);
}
项目:SampleAppArch    文件:FeedActivityModule.java   
@Provides
DialogFeedentryBinding provideDialogBinding(FeedActivity activity,
    FeedEntryListViewModel feedEntryListViewModel) {
  DialogFeedentryBinding binding = DataBindingUtil
      .inflate(LayoutInflater.from(activity), R.layout.dialog_feedentry, null, false);
  binding.setFeedEntry(feedEntryListViewModel.getFeedEntry().get());
  return binding;
}
项目:Flubber    文件:SettingsRVAdapter.java   
@Override
public BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    final LayoutInflater inflater = LayoutInflater.from(context);
    ListItemProgressBinding binding =
            DataBindingUtil.inflate(inflater, R.layout.list_item_progress, parent, false);

    return new BindingHolder(binding);
}
项目:BWS-Android    文件:EnrollmentActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    DataBindingUtil.setContentView(this, R.layout.activity_facial_recognition);

    EnrollmentTokenProvider tokenProvider = getIntent().getParcelableExtra(EXTRA_TOKEN_PROVIDER);
    if (tokenProvider == null) {
        throw new IllegalStateException("missing or invalid extra: " + EXTRA_TOKEN_PROVIDER);
    }

    setupFragment(tokenProvider);
}
项目:ElephantAsia    文件:SearchContactActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  SearchContactActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.search_contact_activity);
  binding.setC(contact);
  ButterKnife.bind(this);
  setSupportActionBar(toolbar);

  if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }

  KeyboardHelpers.hideKeyboardListener(binding.getRoot(), this);
}
项目:CXJPadProject    文件:PkgDetailFragment.java   
@Override
protected View initRootView(LayoutInflater inflater) {
    if (view == null) {
        view = View.inflate(getActivity(), R.layout.fragment_pkg_detail, null);
    }
    binding = DataBindingUtil.bind(view);
    ViewGroup myparent = (ViewGroup) view.getParent();
    if (myparent != null) {
        myparent.removeView(view);
    }
    return view;
}