当前位置: 首页>>代码示例>>Java>>正文


Java DataBindingUtil类代码示例

本文整理汇总了Java中android.databinding.DataBindingUtil的典型用法代码示例。如果您正苦于以下问题:Java DataBindingUtil类的具体用法?Java DataBindingUtil怎么用?Java DataBindingUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataBindingUtil类属于android.databinding包,在下文中一共展示了DataBindingUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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();
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:18,代码来源:Dagger2Activity.java

示例2: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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);
                }
            });
        }
    });
}
 
开发者ID:tresorit,项目名称:ZeroKit-Android-Sample,代码行数:19,代码来源:SignInActivity.java

示例3: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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();

}
 
开发者ID:amspayam,项目名称:PDialogs-Android,代码行数:17,代码来源:DatePicker.java

示例4: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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();
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:17,代码来源:MainActivity.java

示例5: initDrawerLayout

import android.databinding.DataBindingUtil; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:21,代码来源:MainActivity.java

示例6: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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());

}
 
开发者ID:henrymorgen,项目名称:android-advanced-light,代码行数:27,代码来源:LayoutActivity.java

示例7: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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());

}
 
开发者ID:AndProx,项目名称:AndProx,代码行数:20,代码来源:TuneResultActivity.java

示例8: onCreateView

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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;
}
 
开发者ID:scaffeinate,项目名称:Inflix,代码行数:25,代码来源:MoviesFragment.java

示例9: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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);
}
 
开发者ID:rafaeltoledo,项目名称:android-security,代码行数:23,代码来源:MainActivity.java

示例10: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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);
}
 
开发者ID:trdevendran,项目名称:queued-progressbar,代码行数:21,代码来源:MainActivity.java

示例11: onCreateView

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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;
}
 
开发者ID:scaffeinate,项目名称:Inflix,代码行数:23,代码来源:LocalMoviesFragment.java

示例12: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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

}
 
开发者ID:mizutori,项目名称:InAppTranslation_Android,代码行数:22,代码来源:MainActivity.java

示例13: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:21,代码来源:BaseViewModelActivity.java

示例14: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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);
}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:19,代码来源:DataBindingExampleActivity.java

示例15: onCreate

import android.databinding.DataBindingUtil; //导入依赖的package包/类
@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();
}
 
开发者ID:YukiMatsumura,项目名称:android-flux-mortar,代码行数:17,代码来源:MainActivity.java


注:本文中的android.databinding.DataBindingUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。