Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.cain.mvvmexample;
- import android.content.Intent;
- import android.databinding.BindingAdapter;
- import android.databinding.InverseBindingAdapter;
- import android.databinding.InverseBindingListener;
- import android.support.annotation.Nullable;
- import android.view.View;
- public class ViewBindings {
- @BindingAdapter(value = {"navRequest", "navRequestAttrChanged"}, requireAll = false)
- public static void setNavRequest(View view, @Nullable NavigationRequest navRequest, @Nullable InverseBindingListener inverseBindingListener) {
- if (navRequest != null) {
- Intent intent = navRequest.getIntent(view.getContext());
- view.getContext().startActivity(intent);
- if (inverseBindingListener != null) {
- inverseBindingListener.onChange();
- }
- }
- }
- @InverseBindingAdapter(attribute = "navRequest")
- public static NavigationRequest getNavRequest(View view) {
- return null; // clear nav request
- }
- }
Add Comment
Please, Sign In to add comment