package com.toughra.ustadmobile.databinding;
import com.toughra.ustadmobile.R;
import com.toughra.ustadmobile.BR;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.View;
@SuppressWarnings("unchecked")
public class FragmentSiteEditBindingImpl extends FragmentSiteEditBinding implements com.toughra.ustadmobile.generated.callback.OnClickListener.Listener {

    @Nullable
    private static final androidx.databinding.ViewDataBinding.IncludedLayouts sIncludes;
    @Nullable
    private static final android.util.SparseIntArray sViewsWithIds;
    static {
        sIncludes = new androidx.databinding.ViewDataBinding.IncludedLayouts(9);
        sIncludes.setIncludes(1, 
            new String[] {"item_createnew"},
            new int[] {5},
            new int[] {com.toughra.ustadmobile.R.layout.item_createnew});
        sViewsWithIds = new android.util.SparseIntArray();
        sViewsWithIds.put(R.id.title_textedit, 6);
        sViewsWithIds.put(R.id.fragment_work_space_edit_terms_rv, 7);
        sViewsWithIds.put(R.id.site_terms_rv, 8);
    }
    // views
    @Nullable
    private final com.toughra.ustadmobile.databinding.ItemCreatenewBinding mboundView1;
    @NonNull
    private final com.google.android.material.textfield.TextInputEditText mboundView2;
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback71;
    // values
    // listeners
    // Inverse Binding Event Handlers
    private androidx.databinding.InverseBindingListener guestEnabledSwitchandroidCheckedAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of site.guestLogin
            //         is site.setGuestLogin((boolean) callbackArg_0)
            boolean callbackArg_0 = guestEnabledSwitch.isChecked();
            // localize variables for thread safety
            // site
            com.ustadmobile.lib.db.entities.Site site = mSite;
            // site.guestLogin
            boolean siteGuestLogin = false;
            // site != null
            boolean siteJavaLangObjectNull = false;



            siteJavaLangObjectNull = (site) != (null);
            if (siteJavaLangObjectNull) {




                site.setGuestLogin(((boolean) (callbackArg_0)));
            }
        }
    };
    private androidx.databinding.InverseBindingListener mboundView2androidTextAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of site.siteName
            //         is site.setSiteName((java.lang.String) callbackArg_0)
            java.lang.String callbackArg_0 = androidx.databinding.adapters.TextViewBindingAdapter.getTextString(mboundView2);
            // localize variables for thread safety
            // site
            com.ustadmobile.lib.db.entities.Site site = mSite;
            // site != null
            boolean siteJavaLangObjectNull = false;
            // site.siteName
            java.lang.String siteSiteName = null;



            siteJavaLangObjectNull = (site) != (null);
            if (siteJavaLangObjectNull) {




                site.setSiteName(((java.lang.String) (callbackArg_0)));
            }
        }
    };
    private androidx.databinding.InverseBindingListener registrationAllowedSwitchandroidCheckedAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of site.registrationAllowed
            //         is site.setRegistrationAllowed((boolean) callbackArg_0)
            boolean callbackArg_0 = registrationAllowedSwitch.isChecked();
            // localize variables for thread safety
            // site
            com.ustadmobile.lib.db.entities.Site site = mSite;
            // site.registrationAllowed
            boolean siteRegistrationAllowed = false;
            // site != null
            boolean siteJavaLangObjectNull = false;



            siteJavaLangObjectNull = (site) != (null);
            if (siteJavaLangObjectNull) {




                site.setRegistrationAllowed(((boolean) (callbackArg_0)));
            }
        }
    };

    public FragmentSiteEditBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 9, sIncludes, sViewsWithIds));
    }
    private FragmentSiteEditBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.core.widget.NestedScrollView) bindings[0]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[1]
            , (android.widget.TextView) bindings[7]
            , (com.google.android.material.switchmaterial.SwitchMaterial) bindings[3]
            , (com.google.android.material.switchmaterial.SwitchMaterial) bindings[4]
            , (androidx.recyclerview.widget.RecyclerView) bindings[8]
            , (com.google.android.material.textfield.TextInputLayout) bindings[6]
            );
        this.fragmentSiteEditEditScroll.setTag(null);
        this.fragmentWorkSpaceEditEditClx.setTag(null);
        this.guestEnabledSwitch.setTag(null);
        this.mboundView1 = (com.toughra.ustadmobile.databinding.ItemCreatenewBinding) bindings[5];
        setContainedBinding(this.mboundView1);
        this.mboundView2 = (com.google.android.material.textfield.TextInputEditText) bindings[2];
        this.mboundView2.setTag(null);
        this.registrationAllowedSwitch.setTag(null);
        setRootTag(root);
        // listeners
        mCallback71 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x10L;
        }
        mboundView1.invalidateAll();
        requestRebind();
    }

    @Override
    public boolean hasPendingBindings() {
        synchronized(this) {
            if (mDirtyFlags != 0) {
                return true;
            }
        }
        if (mboundView1.hasPendingBindings()) {
            return true;
        }
        return false;
    }

    @Override
    public boolean setVariable(int variableId, @Nullable Object variable)  {
        boolean variableSet = true;
        if (BR.site == variableId) {
            setSite((com.ustadmobile.lib.db.entities.Site) variable);
        }
        else if (BR.loading == variableId) {
            setLoading((boolean) variable);
        }
        else if (BR.fieldsEnabled == variableId) {
            setFieldsEnabled((boolean) variable);
        }
        else if (BR.mPresenter == variableId) {
            setMPresenter((com.ustadmobile.core.controller.SiteEditPresenter) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setSite(@Nullable com.ustadmobile.lib.db.entities.Site Site) {
        this.mSite = Site;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.site);
        super.requestRebind();
    }
    public void setLoading(boolean Loading) {
        this.mLoading = Loading;
    }
    public void setFieldsEnabled(boolean FieldsEnabled) {
        this.mFieldsEnabled = FieldsEnabled;
    }
    public void setMPresenter(@Nullable com.ustadmobile.core.controller.SiteEditPresenter MPresenter) {
        this.mMPresenter = MPresenter;
        synchronized(this) {
            mDirtyFlags |= 0x8L;
        }
        notifyPropertyChanged(BR.mPresenter);
        super.requestRebind();
    }

    @Override
    public void setLifecycleOwner(@Nullable androidx.lifecycle.LifecycleOwner lifecycleOwner) {
        super.setLifecycleOwner(lifecycleOwner);
        mboundView1.setLifecycleOwner(lifecycleOwner);
    }

    @Override
    protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
        switch (localFieldId) {
        }
        return false;
    }

    @Override
    protected void executeBindings() {
        long dirtyFlags = 0;
        synchronized(this) {
            dirtyFlags = mDirtyFlags;
            mDirtyFlags = 0;
        }
        com.ustadmobile.lib.db.entities.Site site = mSite;
        java.lang.String siteSiteName = null;
        boolean siteGuestLogin = false;
        boolean siteRegistrationAllowed = false;
        com.ustadmobile.core.controller.SiteEditPresenter mPresenter = mMPresenter;

        if ((dirtyFlags & 0x11L) != 0) {



                if (site != null) {
                    // read site.siteName
                    siteSiteName = site.getSiteName();
                    // read site.guestLogin
                    siteGuestLogin = site.getGuestLogin();
                    // read site.registrationAllowed
                    siteRegistrationAllowed = site.getRegistrationAllowed();
                }
        }
        // batch finished
        if ((dirtyFlags & 0x11L) != 0) {
            // api target 1

            androidx.databinding.adapters.CompoundButtonBindingAdapter.setChecked(this.guestEnabledSwitch, siteGuestLogin);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView2, siteSiteName);
            androidx.databinding.adapters.CompoundButtonBindingAdapter.setChecked(this.registrationAllowedSwitch, siteRegistrationAllowed);
        }
        if ((dirtyFlags & 0x10L) != 0) {
            // api target 1

            androidx.databinding.adapters.CompoundButtonBindingAdapter.setListeners(this.guestEnabledSwitch, (android.widget.CompoundButton.OnCheckedChangeListener)null, guestEnabledSwitchandroidCheckedAttrChanged);
            this.mboundView1.setOnClickNew(mCallback71);
            this.mboundView1.setCreateNewText(getRoot().getResources().getString(R.string.terms_and_policies));
            androidx.databinding.adapters.TextViewBindingAdapter.setTextWatcher(this.mboundView2, (androidx.databinding.adapters.TextViewBindingAdapter.BeforeTextChanged)null, (androidx.databinding.adapters.TextViewBindingAdapter.OnTextChanged)null, (androidx.databinding.adapters.TextViewBindingAdapter.AfterTextChanged)null, mboundView2androidTextAttrChanged);
            androidx.databinding.adapters.CompoundButtonBindingAdapter.setListeners(this.registrationAllowedSwitch, (android.widget.CompoundButton.OnCheckedChangeListener)null, registrationAllowedSwitchandroidCheckedAttrChanged);
        }
        executeBindingsOn(mboundView1);
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // mPresenter != null
        boolean mPresenterJavaLangObjectNull = false;
        // mPresenter.siteTermsOneToManyJoinListener
        com.ustadmobile.core.util.NavigateForResultOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.SiteTermsWithLanguage> mPresenterSiteTermsOneToManyJoinListener = null;
        // mPresenter.siteTermsOneToManyJoinListener != null
        boolean mPresenterSiteTermsOneToManyJoinListenerJavaLangObjectNull = false;
        // mPresenter
        com.ustadmobile.core.controller.SiteEditPresenter mPresenter = mMPresenter;



        mPresenterJavaLangObjectNull = (mPresenter) != (null);
        if (mPresenterJavaLangObjectNull) {


            mPresenterSiteTermsOneToManyJoinListener = mPresenter.getSiteTermsOneToManyJoinListener();

            mPresenterSiteTermsOneToManyJoinListenerJavaLangObjectNull = (mPresenterSiteTermsOneToManyJoinListener) != (null);
            if (mPresenterSiteTermsOneToManyJoinListenerJavaLangObjectNull) {


                mPresenterSiteTermsOneToManyJoinListener.onClickNew();
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): site
        flag 1 (0x2L): loading
        flag 2 (0x3L): fieldsEnabled
        flag 3 (0x4L): mPresenter
        flag 4 (0x5L): null
    flag mapping end*/
    //end
}