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 ItemCourseGroupsetEditHeaderBindingImpl extends ItemCourseGroupsetEditHeaderBinding implements com.toughra.ustadmobile.generated.callback.AfterTextChanged.Listener, 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.fragment_course_group_set_number_groups_input, 5);
    }
    // views
    // variables
    @Nullable
    private final androidx.databinding.adapters.TextViewBindingAdapter.AfterTextChanged mCallback15;
    @Nullable
    private final android.view.View.OnClickListener mCallback16;
    // values
    // listeners
    // Inverse Binding Event Handlers
    private androidx.databinding.InverseBindingListener fragmentCourseGroupSetNumberGroupsTextandroidTextAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of ("") + (courseGroupSet.cgsTotalGroups)
            //         is courseGroupSet.setCgsTotalGroups((int) androidx.databinding.ViewDataBinding.parse(callbackArg_0, courseGroupSet.cgsTotalGroups))
            java.lang.String callbackArg_0 = androidx.databinding.adapters.TextViewBindingAdapter.getTextString(fragmentCourseGroupSetNumberGroupsText);
            // localize variables for thread safety
            // courseGroupSet != null
            boolean courseGroupSetJavaLangObjectNull = false;
            // (int) androidx.databinding.ViewDataBinding.parse(callbackArg_0, courseGroupSet.cgsTotalGroups)
            int intAndroidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups = 0;
            // androidx.databinding.ViewDataBinding.parse(callbackArg_0, courseGroupSet.cgsTotalGroups)
            int androidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups = 0;
            // ("") + (courseGroupSet.cgsTotalGroups)
            java.lang.String javaLangStringCourseGroupSetCgsTotalGroups = null;
            // courseGroupSet
            com.ustadmobile.lib.db.entities.CourseGroupSet courseGroupSet = mCourseGroupSet;
            // courseGroupSet.cgsTotalGroups
            int courseGroupSetCgsTotalGroups = 0;



            courseGroupSetJavaLangObjectNull = (courseGroupSet) != (null);
            if (courseGroupSetJavaLangObjectNull) {





                courseGroupSetCgsTotalGroups = courseGroupSet.getCgsTotalGroups();

                androidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups = androidx.databinding.ViewDataBinding.parse(callbackArg_0, courseGroupSetCgsTotalGroups);

                intAndroidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups = ((int) (androidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups));

                courseGroupSet.setCgsTotalGroups(intAndroidxDatabindingViewDataBindingParseCallbackArg0CourseGroupSetCgsTotalGroups);
            }
        }
    };
    private androidx.databinding.InverseBindingListener fragmentCourseGroupSetTitleTextandroidTextAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of courseGroupSet.cgsName
            //         is courseGroupSet.setCgsName((java.lang.String) callbackArg_0)
            java.lang.String callbackArg_0 = androidx.databinding.adapters.TextViewBindingAdapter.getTextString(fragmentCourseGroupSetTitleText);
            // localize variables for thread safety
            // courseGroupSet != null
            boolean courseGroupSetJavaLangObjectNull = false;
            // courseGroupSet
            com.ustadmobile.lib.db.entities.CourseGroupSet courseGroupSet = mCourseGroupSet;
            // courseGroupSet.cgsName
            java.lang.String courseGroupSetCgsName = null;



            courseGroupSetJavaLangObjectNull = (courseGroupSet) != (null);
            if (courseGroupSetJavaLangObjectNull) {




                courseGroupSet.setCgsName(((java.lang.String) (callbackArg_0)));
            }
        }
    };

    public ItemCourseGroupsetEditHeaderBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 6, sIncludes, sViewsWithIds));
    }
    private ItemCourseGroupsetEditHeaderBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (android.widget.Button) bindings[4]
            , (com.google.android.material.textfield.TextInputLayout) bindings[5]
            , (com.google.android.material.textfield.TextInputEditText) bindings[3]
            , (com.google.android.material.textfield.TextInputLayout) bindings[1]
            , (com.google.android.material.textfield.TextInputEditText) bindings[2]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            );
        this.fragmentCourseGroupSetAssignButton.setTag(null);
        this.fragmentCourseGroupSetNumberGroupsText.setTag(null);
        this.fragmentCourseGroupSetTitleInput.setTag(null);
        this.fragmentCourseGroupSetTitleText.setTag(null);
        this.fragmentCourseTerminologyEditEditClx.setTag(null);
        setRootTag(root);
        // listeners
        mCallback15 = new com.toughra.ustadmobile.generated.callback.AfterTextChanged(this, 1);
        mCallback16 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x8L;
        }
        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.listener == variableId) {
            setListener((com.ustadmobile.port.android.view.CourseGroupSetEditFragmentEventHandler) variable);
        }
        else if (BR.courseGroupSet == variableId) {
            setCourseGroupSet((com.ustadmobile.lib.db.entities.CourseGroupSet) variable);
        }
        else if (BR.titleErrorText == variableId) {
            setTitleErrorText((java.lang.String) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setListener(@Nullable com.ustadmobile.port.android.view.CourseGroupSetEditFragmentEventHandler Listener) {
        this.mListener = Listener;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.listener);
        super.requestRebind();
    }
    public void setCourseGroupSet(@Nullable com.ustadmobile.lib.db.entities.CourseGroupSet CourseGroupSet) {
        this.mCourseGroupSet = CourseGroupSet;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.courseGroupSet);
        super.requestRebind();
    }
    public void setTitleErrorText(@Nullable java.lang.String TitleErrorText) {
        this.mTitleErrorText = TitleErrorText;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.titleErrorText);
        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;
        }
        java.lang.String courseGroupSetCgsName = null;
        com.ustadmobile.port.android.view.CourseGroupSetEditFragmentEventHandler listener = mListener;
        int courseGroupSetCgsTotalGroups = 0;
        boolean titleErrorTextJavaLangObjectNull = false;
        java.lang.String javaLangStringCourseGroupSetCgsTotalGroups = null;
        com.ustadmobile.lib.db.entities.CourseGroupSet courseGroupSet = mCourseGroupSet;
        java.lang.String titleErrorText = mTitleErrorText;

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



                if (courseGroupSet != null) {
                    // read courseGroupSet.cgsName
                    courseGroupSetCgsName = courseGroupSet.getCgsName();
                    // read courseGroupSet.cgsTotalGroups
                    courseGroupSetCgsTotalGroups = courseGroupSet.getCgsTotalGroups();
                }


                // read ("") + (courseGroupSet.cgsTotalGroups)
                javaLangStringCourseGroupSetCgsTotalGroups = ("") + (courseGroupSetCgsTotalGroups);
        }
        if ((dirtyFlags & 0xcL) != 0) {



                // read titleErrorText != null
                titleErrorTextJavaLangObjectNull = (titleErrorText) != (null);
        }
        // batch finished
        if ((dirtyFlags & 0x8L) != 0) {
            // api target 1

            this.fragmentCourseGroupSetAssignButton.setOnClickListener(mCallback16);
            androidx.databinding.adapters.TextViewBindingAdapter.setTextWatcher(this.fragmentCourseGroupSetNumberGroupsText, (androidx.databinding.adapters.TextViewBindingAdapter.BeforeTextChanged)null, (androidx.databinding.adapters.TextViewBindingAdapter.OnTextChanged)null, mCallback15, fragmentCourseGroupSetNumberGroupsTextandroidTextAttrChanged);
            androidx.databinding.adapters.TextViewBindingAdapter.setTextWatcher(this.fragmentCourseGroupSetTitleText, (androidx.databinding.adapters.TextViewBindingAdapter.BeforeTextChanged)null, (androidx.databinding.adapters.TextViewBindingAdapter.OnTextChanged)null, (androidx.databinding.adapters.TextViewBindingAdapter.AfterTextChanged)null, fragmentCourseGroupSetTitleTextandroidTextAttrChanged);
        }
        if ((dirtyFlags & 0xaL) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.fragmentCourseGroupSetNumberGroupsText, javaLangStringCourseGroupSetCgsTotalGroups);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.fragmentCourseGroupSetTitleText, courseGroupSetCgsName);
        }
        if ((dirtyFlags & 0xcL) != 0) {
            // api target 1

            this.fragmentCourseGroupSetTitleInput.setErrorEnabled(titleErrorTextJavaLangObjectNull);
            com.ustadmobile.port.android.view.binding.TextInputLayoutBindingsKt.setErrorText(this.fragmentCourseGroupSetTitleInput, titleErrorText);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackAfterTextChanged(int sourceId , android.text.Editable callbackArg_0) {
        // localize variables for thread safety
        // listener != null
        boolean listenerJavaLangObjectNull = false;
        // text.length
        int callbackArg0Length = 0;
        // listener
        com.ustadmobile.port.android.view.CourseGroupSetEditFragmentEventHandler listener = mListener;
        // text.length > 0
        boolean callbackArg0LengthInt0 = false;


        if ((callbackArg_0) != (null)) {


            callbackArg0Length = callbackArg_0.length();


            callbackArg0LengthInt0 = (callbackArg0Length) > (0);
            if (callbackArg0LengthInt0) {



                listenerJavaLangObjectNull = (listener) != (null);
                if (listenerJavaLangObjectNull) {




                    callbackArg_0.toString();

                    java.lang.Integer.valueOf(callbackArg_0.toString());

                    listener.handleNumberOfGroupsChanged(java.lang.Integer.valueOf(callbackArg_0.toString()));
                }
            }
            else {



                listenerJavaLangObjectNull = (listener) != (null);
                if (listenerJavaLangObjectNull) {



                    listener.handleNumberOfGroupsChanged(0);
                }
            }
        }
    }
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // listener != null
        boolean listenerJavaLangObjectNull = false;
        // listener
        com.ustadmobile.port.android.view.CourseGroupSetEditFragmentEventHandler listener = mListener;



        listenerJavaLangObjectNull = (listener) != (null);
        if (listenerJavaLangObjectNull) {


            listener.handleAssignRandomGroupsClicked();
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): listener
        flag 1 (0x2L): courseGroupSet
        flag 2 (0x3L): titleErrorText
        flag 3 (0x4L): null
    flag mapping end*/
    //end
}