android.databinding.DataBindingUtil Java Examples
The following examples show how to use
android.databinding.DataBindingUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntroWelcomeFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // init dependency injection if (getActivity() instanceof ActivityWithComponent) { ((ActivityWithComponent) getActivity()).getActivityComponent().inject(this); } // inflate the view binding = DataBindingUtil.inflate( inflater, R.layout.fragment_intro_welcome, container, false); view = binding.getRoot(); setStatusBarWhite(view); hideToolbar(); // bind data to view binding.setVersion(getString(R.string.version_display, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)); binding.setHandlers(new ClickHandlers()); return view; }
Example #2
Source File: HomeActivity.java From PainlessMusicPlayer with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidInjection.inject(this); binding = DataBindingUtil.setContentView(this, R.layout.activity_home); binding.setModel(viewModel); navigationView = findViewById(R.id.navigationView); setSupportActionBar(binding.toolbar); initNavigation(); getLifecycle().addObserver(presenter); handleIntent(savedInstanceState == null); }
Example #3
Source File: SettingSwitchRowView.java From droidkaigi2016 with Apache License 2.0 | 6 votes |
public SettingSwitchRowView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.view_setting_switch_row, this, true); if (!isInEditMode()) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SettingSwitchRow); String title = a.getString(R.styleable.SettingSwitchRow_settingTitle); String description = a.getString(R.styleable.SettingSwitchRow_settingDescription); binding.settingTitle.setText(title); binding.settingDescription.setText(description); binding.getRoot().setOnClickListener(v -> toggle()); binding.settingSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> { if (onCheckedChangeListener != null) { onCheckedChangeListener.onCheckedChanged(buttonView, isChecked); } }); a.recycle(); } }
Example #4
Source File: SuggestionsActivity.java From reel-search-android with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBinding = DataBindingUtil.setContentView(this, R.layout.activity_suggestions); mDictionaryManager = new DictionaryManager(this); mAdapter = new SuggestionsAdapter(this); mBinding.lstSuggestions.setAdapter(mAdapter); mBinding.btnSelect.setOnClickListener(v -> { final int selectedPosition = mBinding.reelSearch.getLayoutManager().getSelection(); Snackbar.make(mBinding.btnSelect, "Selected position " + selectedPosition + " item " + mAdapter.getItem(selectedPosition), Snackbar.LENGTH_SHORT).show(); }); mBinding.txtQuery.setFilters(new InputFilter[]{ (source, start, end, dest, dstart, dend) -> source.toString().toLowerCase().trim() }); mBinding.reelSearch.setOnSelectionChangedListener((prevSelection, newSelection) -> { Log.e("Selection", "Changed to " + newSelection + " from " + prevSelection); }); }
Example #5
Source File: DBFlowSwipeActivity.java From all-base-adapter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.activity_dbflow_swipe, null, false); setContentView(mBinding.getRoot()); mAdapter = new SingleBindingAdapter<>(this, mDatas = iniDatas(), R.layout.item_db_flow_swipe); mAdapter.setItemPresenter(new ItemDelPresenter()); //ViewGroupUtils.addViews(mBinding.flowLayout, mAdapter); mVGUtil = new VGUtil.Builder() .setParent(mBinding.flowLayout) .setAdapter(mAdapter) .build() .bind(); }
Example #6
Source File: AlbumAdapter.java From VCL-Android with Apache License 2.0 | 6 votes |
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; View v = convertView; MediaWrapper mw = mMediaList.get(position); if (v == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); holder = new ViewHolder(); holder.binding = DataBindingUtil.inflate(inflater, R.layout.audio_browser_item, parent, false); v = holder.binding.getRoot(); v.setTag(R.layout.audio_browser_item, holder); } else holder = (ViewHolder) v.getTag(R.layout.audio_browser_item); holder.binding.setPosition(position); holder.binding.setMedia(mw); holder.binding.setFooter(position != mMediaList.size() - 1); holder.binding.setClickable(mContextPopupMenuListener != null); holder.binding.setHandler(this); holder.binding.executePendingBindings(); return v; }
Example #7
Source File: JoinConferenceDialog.java From Conversations with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.join_public_channel); DialogJoinConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_join_conference, null, false); DelayedHintHelper.setHint(R.string.channel_full_jid_example, binding.jid); this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item); binding.jid.setAdapter(knownHostsAdapter); String prefilledJid = getArguments().getString(PREFILLED_JID_KEY); if (prefilledJid != null) { binding.jid.append(prefilledJid); } StartConversationActivity.populateAccountSpinner(getActivity(), getArguments().getStringArrayList(ACCOUNTS_LIST_KEY), binding.account); builder.setView(binding.getRoot()); builder.setPositiveButton(R.string.join, null); builder.setNegativeButton(R.string.cancel, null); AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(view -> mListener.onJoinDialogPositiveClick(dialog, binding.account, binding.accountJidLayout, binding.jid, binding.bookmark.isChecked())); binding.jid.setOnEditorActionListener((v, actionId, event) -> { mListener.onJoinDialogPositiveClick(dialog, binding.account, binding.accountJidLayout, binding.jid, binding.bookmark.isChecked()); return true; }); return dialog; }
Example #8
Source File: BaseActivity.java From dapp-wallet-demo with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; mBinding = DataBindingUtil.setContentView(this, layoutId()); initView(savedInstanceState); // 状态栏设置 if (isLightStatusTheme()) { QMUIStatusBarHelper.setStatusBarLightMode(this); } else { QMUIStatusBarHelper.setStatusBarDarkMode(this); } // 事件消息订阅 if (isRegisterEvent() && !EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } // force portrait setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
Example #9
Source File: LoginActivity.java From StudentAttendanceCheck with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); b = DataBindingUtil.setContentView(this, R.layout.activity_login); initInstance(); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.loginFragmentContentContainer, FragmentLogin.newInstance(), "LoginFragment") .commit(); } }
Example #10
Source File: MainActivity.java From moserp with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DataBindingUtil.setContentView(this, R.layout.activity_main); View contentView = findViewById(R.id.main_content); includeFacilityViewBinding = DataBindingUtil.findBinding(contentView); initRecyclerView(includeFacilityViewBinding.facilitiesList); initToolbar(); if (getSupportActionBar() != null) { getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_black_18dp); } NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupNavigationView(navigationView); } setupActionButtons(); }
Example #11
Source File: ReceiptFrg.java From Android-POS with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater,R.layout.fragment_receipt_frg, container, false); products = new ArrayList<>(); customers = new Customer(getActivity()).getAllCustomer();//get all customer details from customer database seller = new User(getActivity()).getUserDetails();//this user method will return userDatavaseModelClassObject sellsInfo = new SellsInfo(getActivity()); stock = new Stock(getActivity()); printInfo = new PrintSellInfo(); customerDatabase = new Customer(getActivity()); customerDue = new CustomerDue(getActivity()); soldProductInfo = new SoldProductInfo(getActivity()); calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyy");//example date 06-11-17 date = dateFormat.format(calendar.getTime()); Log.d(TAG, "onCreateView: -----------"+date); return binding.getRoot(); }
Example #12
Source File: SearchToolbar.java From droidkaigi2016 with Apache License 2.0 | 6 votes |
public SearchToolbar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.toolbar_search, this, true); if (!isInEditMode()) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SearchToolbar); try { boolean focus = a.getBoolean(R.styleable.SearchToolbar_searchFocus, false); int hintResId = a.getResourceId(R.styleable.SearchToolbar_searchHint, R.string.search_hint); setHint(hintResId); if (focus) { binding.editSearch.requestFocus(); } else { clearFocus(); } toggleCloseButtonVisible(false); initView(); } finally { a.recycle(); } } }
Example #13
Source File: DeviceDetailActivity.java From device-database with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_device_detail); binding.setDevice(new ObservableDevice()); coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator_layout); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); deviceUri = getIntent().getExtras().getParcelable(EXTRA_DEVICE_URI); getLoaderManager().initLoader(ID_DEVICE, null, this); }
Example #14
Source File: StockSummaryFragment.java From Building-Professional-Android-Applications with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate( inflater, R.layout.portfolio_fragment_stock_summary, container, false); binding.setModel(viewModel); View view = binding.getRoot(); return view; }
Example #15
Source File: StockSummaryFragment.java From Building-Professional-Android-Applications with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate( inflater, R.layout.portfolio_fragment_stock_summary, container, false); View view = binding.getRoot(); return view; }
Example #16
Source File: StockSummaryFragment.java From Building-Professional-Android-Applications with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate( inflater, R.layout.portfolio_fragment_stock_summary, container, false); View view = binding.getRoot(); return view; }
Example #17
Source File: StockSummaryFragment.java From Building-Professional-Android-Applications with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate( inflater, R.layout.portfolio_fragment_stock_summary, container, false); View view = binding.getRoot(); return view; }
Example #18
Source File: CollectionsAdapter.java From 10000sentences with Apache License 2.0 | 5 votes |
@NonNull @Override public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); SentenceCollectionBinding binding; if (convertView == null) { binding = DataBindingUtil.inflate(inflater, R.layout.sentence_collection, parent, false); } else { binding = DataBindingUtil.getBinding(convertView); } final SentenceCollection collection = getItem(position); binding.setKnownLanguage(languages.get(collection.getKnownLanguage())); binding.setTargetLanguage(languages.get(collection.getTargetLanguage())); binding.setCollection(getItem(position)); binding.getRoot().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { CollectionActivity.start((BaseActivity) getContext(), collection.getCollectionID()); } }); return binding.getRoot(); }
Example #19
Source File: VRAdapter.java From VRPlayer with Apache License 2.0 | 5 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { ItemVrListBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.item_vr_list, parent, false); ViewHolder viewHolder = new ViewHolder(binding); binding.setViewHolder(viewHolder); return viewHolder; }
Example #20
Source File: StockSummaryFragment.java From Building-Professional-Android-Applications with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate( inflater, R.layout.portfolio_fragment_stock_summary, container, false); View view = binding.getRoot(); return view; }
Example #21
Source File: TimetableAddActivity.java From Sunshine with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String courseId = getIntent().getStringExtra("courseId"); binding = DataBindingUtil.setContentView(this, R.layout.activity_timetable_add); viewModel = new TimetableAddViewModel(this, binding, courseId); binding.setViewModel(viewModel); initViews(); }
Example #22
Source File: HistoryFragment.java From chaoli-forum-for-android-2 with GNU General Public License v3.0 | 5 votes |
@Override public void setViewModel(BaseViewModel viewModel) { this.viewModel = (HistoryFragmentVM) viewModel; //this.viewModel.setUrl(Constants.GET_ACTIVITIES_URL + mUserId); HomepageHistoryBinding binding = DataBindingUtil.bind(mSwipyRefreshLayout); binding.setViewModel(this.viewModel); }
Example #23
Source File: MainActivity.java From AndroidAgeraTutorial with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater()); //setContentView(binding.getRoot()); ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); binding.setClickListener(this); binding.setMap(mActInfoMap); }
Example #24
Source File: MediaAdapter.java From Conversations with GNU General Public License v3.0 | 5 votes |
@NonNull @Override public MediaViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); MediaBinding binding = DataBindingUtil.inflate(layoutInflater, R.layout.media, parent, false); return new MediaViewHolder(binding); }
Example #25
Source File: StagesFragment.java From triviums with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment binding = DataBindingUtil.inflate(inflater, R.layout.fragment_stages, container, false); View view = binding.getRoot(); binding.setClick(new MyHandler()); //Get intent extras categoryId = getArguments().getString("CategoryId"); categoryName = getArguments().getString("categoryName"); //Initialize the recyclerview initRecyclerView(); //Clear the adapter to avoid duplicates totalPage.clear(); connectivityReceiver.observe(this, connectionModel -> { if (connectionModel.isConnected()) { isConnected = true; binding.noInternet.setVisibility(View.GONE); binding.loader.setVisibility(View.VISIBLE); binding.stageView.setVisibility(View.VISIBLE); getProgress(categoryName); //Call the showStage method showStage(categoryId); } else { isConnected = false; showDialogForTimeout(); } }); return view; }
Example #26
Source File: MainActivity.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
private void initHeaderView() { if (headerBinding == null) { View header = getBinding().nav.inflateHeaderView(R.layout.activity_main_nav_header); headerBinding = DataBindingUtil.bind(header); } setupHeader(); headerBinding.getRoot().setOnLongClickListener(v -> { if (BuildConfig.DEBUG) { toFragment(new FragmentDebug()); } return true; }); headerBinding.getRoot().setOnClickListener(view -> startActivityForResult(UserInfoActivity.class, REQUEST_USER_INFO)); }
Example #27
Source File: BeatBoxFragment.java From AndroidProgramming3e with Apache License 2.0 | 5 votes |
@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); }
Example #28
Source File: MainActivity.java From views-widgets-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); ObservableArrayList users = new ObservableArrayList(); users.add(new User("George", "Mount")); binding.setUsers(users); binding.setHandler(new ButtonHandler(users)); }
Example #29
Source File: FragmentRegister.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { fragmentRegisterBinding = DataBindingUtil.inflate(inflater, R.layout.activity_register, container, false); return fragmentRegisterBinding.getRoot(); }
Example #30
Source File: IncludeDataBindingLayoutActivity.java From data-binding-sample with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); User user = new User(); user.setId(100); user.setName("MNC"); user.setDescription("Andoid M is Macadamia Nut Cookie?"); ActivityIncludeBinding binding = DataBindingUtil .setContentView(this, R.layout.activity_include); binding.setUser(user); }