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 FragmentJoinWithCodeBindingImpl extends FragmentJoinWithCodeBinding 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 = null;
        sViewsWithIds = new android.util.SparseIntArray();
        sViewsWithIds.put(R.id.instructions_text, 4);
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    @NonNull
    private final com.google.android.material.textfield.TextInputEditText mboundView2;
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback14;
    // values
    // listeners
    // Inverse Binding Event Handlers
    private androidx.databinding.InverseBindingListener mboundView2androidTextAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of joinCode
            //         is com.toughra.ustadmobile.databinding.FragmentJoinWithCodeBindingImpl.this.setJoinCode(callbackArg_0)
            java.lang.String callbackArg_0 = androidx.databinding.adapters.TextViewBindingAdapter.getTextString(mboundView2);
            // localize variables for thread safety
            // joinCode
            java.lang.String joinCode = mJoinCode;


            if ((com.toughra.ustadmobile.databinding.FragmentJoinWithCodeBindingImpl.this) != (null)) {



                com.toughra.ustadmobile.databinding.FragmentJoinWithCodeBindingImpl.this.setJoinCode(callbackArg_0);
            }
        }
    };

    public FragmentJoinWithCodeBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 5, sIncludes, sViewsWithIds));
    }
    private FragmentJoinWithCodeBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (com.google.android.material.textfield.TextInputLayout) bindings[1]
            , (android.widget.TextView) bindings[4]
            , (com.google.android.material.button.MaterialButton) bindings[3]
            );
        this.codeInputTextinputlayout.setTag(null);
        this.joinButton.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        this.mboundView2 = (com.google.android.material.textfield.TextInputEditText) bindings[2];
        this.mboundView2.setTag(null);
        setRootTag(root);
        // listeners
        mCallback14 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        invalidateAll();
    }

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

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

    @Override
    public boolean setVariable(int variableId, @Nullable Object variable)  {
        boolean variableSet = true;
        if (BR.buttonEnabled == variableId) {
            setButtonEnabled((boolean) variable);
        }
        else if (BR.joinCode == variableId) {
            setJoinCode((java.lang.String) variable);
        }
        else if (BR.entityType == variableId) {
            setEntityType((java.lang.String) variable);
        }
        else if (BR.presenter == variableId) {
            setPresenter((com.ustadmobile.core.controller.JoinWithCodePresenter) variable);
        }
        else if (BR.buttonLabel == variableId) {
            setButtonLabel((java.lang.String) variable);
        }
        else if (BR.errorText == variableId) {
            setErrorText((java.lang.String) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setButtonEnabled(boolean ButtonEnabled) {
        this.mButtonEnabled = ButtonEnabled;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.buttonEnabled);
        super.requestRebind();
    }
    public void setJoinCode(@Nullable java.lang.String JoinCode) {
        this.mJoinCode = JoinCode;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.joinCode);
        super.requestRebind();
    }
    public void setEntityType(@Nullable java.lang.String EntityType) {
        this.mEntityType = EntityType;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.entityType);
        super.requestRebind();
    }
    public void setPresenter(@Nullable com.ustadmobile.core.controller.JoinWithCodePresenter Presenter) {
        this.mPresenter = Presenter;
        synchronized(this) {
            mDirtyFlags |= 0x8L;
        }
        notifyPropertyChanged(BR.presenter);
        super.requestRebind();
    }
    public void setButtonLabel(@Nullable java.lang.String ButtonLabel) {
        this.mButtonLabel = ButtonLabel;
        synchronized(this) {
            mDirtyFlags |= 0x10L;
        }
        notifyPropertyChanged(BR.buttonLabel);
        super.requestRebind();
    }
    public void setErrorText(@Nullable java.lang.String ErrorText) {
        this.mErrorText = ErrorText;
        synchronized(this) {
            mDirtyFlags |= 0x20L;
        }
        notifyPropertyChanged(BR.errorText);
        super.requestRebind();
    }

    @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;
        }
        boolean buttonEnabled = mButtonEnabled;
        boolean errorTextJavaLangObjectNull = false;
        java.lang.String joinCode = mJoinCode;
        java.lang.String entityType = mEntityType;
        com.ustadmobile.core.controller.JoinWithCodePresenter presenter = mPresenter;
        java.lang.String buttonLabel = mButtonLabel;
        java.lang.String stringFormatMboundView2AndroidStringEntityCodeEntityType = null;
        java.lang.String errorText = mErrorText;

        if ((dirtyFlags & 0x41L) != 0) {
        }
        if ((dirtyFlags & 0x42L) != 0) {
        }
        if ((dirtyFlags & 0x44L) != 0) {



                // read String.format(@android:string/entity_code, entityType)
                stringFormatMboundView2AndroidStringEntityCodeEntityType = java.lang.String.format(mboundView2.getResources().getString(R.string.entity_code), entityType);
        }
        if ((dirtyFlags & 0x50L) != 0) {
        }
        if ((dirtyFlags & 0x60L) != 0) {



                // read errorText != null
                errorTextJavaLangObjectNull = (errorText) != (null);
        }
        // batch finished
        if ((dirtyFlags & 0x60L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.TextInputLayoutBindingsKt.setErrorText(this.codeInputTextinputlayout, errorText);
            this.codeInputTextinputlayout.setErrorEnabled(errorTextJavaLangObjectNull);
        }
        if ((dirtyFlags & 0x41L) != 0) {
            // api target 1

            this.joinButton.setEnabled(buttonEnabled);
            this.mboundView2.setEnabled(buttonEnabled);
        }
        if ((dirtyFlags & 0x40L) != 0) {
            // api target 1

            this.joinButton.setOnClickListener(mCallback14);
            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);
        }
        if ((dirtyFlags & 0x50L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.joinButton, buttonLabel);
        }
        if ((dirtyFlags & 0x42L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView2, joinCode);
        }
        if ((dirtyFlags & 0x44L) != 0) {
            // api target 1

            this.mboundView2.setHint(stringFormatMboundView2AndroidStringEntityCodeEntityType);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // joinCode
        java.lang.String joinCode = mJoinCode;
        // presenter != null
        boolean presenterJavaLangObjectNull = false;
        // presenter
        com.ustadmobile.core.controller.JoinWithCodePresenter presenter = mPresenter;



        presenterJavaLangObjectNull = (presenter) != (null);
        if (presenterJavaLangObjectNull) {



            presenter.handleClickDone(joinCode);
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): buttonEnabled
        flag 1 (0x2L): joinCode
        flag 2 (0x3L): entityType
        flag 3 (0x4L): presenter
        flag 4 (0x5L): buttonLabel
        flag 5 (0x6L): errorText
        flag 6 (0x7L): null
    flag mapping end*/
    //end
}