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 ItemScopedGrantListBindingImpl extends ItemScopedGrantListBinding implements com.toughra.ustadmobile.generated.callback.OnSelectionStateChangedListener.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 = null;
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    @Nullable
    private final com.ustadmobile.port.android.view.binding.OnSelectionStateChangedListener mCallback12;
    @Nullable
    private final android.view.View.OnClickListener mCallback13;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemScopedGrantListBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 3, sIncludes, sViewsWithIds));
    }
    private ItemScopedGrantListBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (android.widget.TextView) bindings[1]
            , (android.widget.TextView) bindings[2]
            );
        this.line1Text.setTag(null);
        this.line2Text.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        mCallback12 = new com.toughra.ustadmobile.generated.callback.OnSelectionStateChangedListener(this, 1);
        mCallback13 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x10L;
        }
        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.itemListener == variableId) {
            setItemListener((com.ustadmobile.core.controller.ScopedGrantListItemListener) variable);
        }
        else if (BR.scopedGrantFlagMessageIds == variableId) {
            setScopedGrantFlagMessageIds((java.util.List<com.ustadmobile.core.model.BitmaskMessageId>) variable);
        }
        else if (BR.selectablePagedListAdapter == variableId) {
            setSelectablePagedListAdapter((com.ustadmobile.port.android.view.ScopedGrantListRecyclerAdapter) variable);
        }
        else if (BR.scopedGrant == variableId) {
            setScopedGrant((com.ustadmobile.lib.db.entities.ScopedGrantWithName) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setItemListener(@Nullable com.ustadmobile.core.controller.ScopedGrantListItemListener ItemListener) {
        this.mItemListener = ItemListener;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.itemListener);
        super.requestRebind();
    }
    public void setScopedGrantFlagMessageIds(@Nullable java.util.List<com.ustadmobile.core.model.BitmaskMessageId> ScopedGrantFlagMessageIds) {
        this.mScopedGrantFlagMessageIds = ScopedGrantFlagMessageIds;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.scopedGrantFlagMessageIds);
        super.requestRebind();
    }
    public void setSelectablePagedListAdapter(@Nullable com.ustadmobile.port.android.view.ScopedGrantListRecyclerAdapter SelectablePagedListAdapter) {
        this.mSelectablePagedListAdapter = SelectablePagedListAdapter;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.selectablePagedListAdapter);
        super.requestRebind();
    }
    public void setScopedGrant(@Nullable com.ustadmobile.lib.db.entities.ScopedGrantWithName ScopedGrant) {
        this.mScopedGrant = ScopedGrant;
        synchronized(this) {
            mDirtyFlags |= 0x8L;
        }
        notifyPropertyChanged(BR.scopedGrant);
        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;
        }
        com.ustadmobile.core.controller.ScopedGrantListItemListener itemListener = mItemListener;
        java.util.List<com.ustadmobile.core.model.BitmaskMessageId> scopedGrantFlagMessageIds = mScopedGrantFlagMessageIds;
        java.lang.String scopedGrantName = null;
        com.ustadmobile.port.android.view.ScopedGrantListRecyclerAdapter selectablePagedListAdapter = mSelectablePagedListAdapter;
        long scopedGrantSgPermissions = 0;
        com.ustadmobile.lib.db.entities.ScopedGrantWithName scopedGrant = mScopedGrant;

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


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

                    if (scopedGrant != null) {
                        // read scopedGrant.name
                        scopedGrantName = scopedGrant.getName();
                    }
            }

                if (scopedGrant != null) {
                    // read scopedGrant.sgPermissions
                    scopedGrantSgPermissions = scopedGrant.getSgPermissions();
                }
        }
        if ((dirtyFlags & 0x14L) != 0) {
        }
        // batch finished
        if ((dirtyFlags & 0x18L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.line1Text, scopedGrantName);
        }
        if ((dirtyFlags & 0x1aL) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.TextViewBindingsKt.setBitmaskListTextFromMap(this.line2Text, scopedGrantSgPermissions, scopedGrantFlagMessageIds);
        }
        if ((dirtyFlags & 0x14L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ViewBindingsKt.setSelectableViewHelper(this.mboundView0, selectablePagedListAdapter, mCallback13, mCallback12);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnSelectionStateChanged(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // selectablePagedListAdapter != null
        boolean selectablePagedListAdapterJavaLangObjectNull = false;
        // selectablePagedListAdapter
        com.ustadmobile.port.android.view.ScopedGrantListRecyclerAdapter selectablePagedListAdapter = mSelectablePagedListAdapter;
        // scopedGrant
        com.ustadmobile.lib.db.entities.ScopedGrantWithName scopedGrant = mScopedGrant;



        selectablePagedListAdapterJavaLangObjectNull = (selectablePagedListAdapter) != (null);
        if (selectablePagedListAdapterJavaLangObjectNull) {




            selectablePagedListAdapter.onItemSelectedChanged(callbackArg_0, scopedGrant);
        }
    }
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // itemListener
        com.ustadmobile.core.controller.ScopedGrantListItemListener itemListener = mItemListener;
        // itemListener != null
        boolean itemListenerJavaLangObjectNull = false;
        // scopedGrant
        com.ustadmobile.lib.db.entities.ScopedGrantWithName scopedGrant = mScopedGrant;



        itemListenerJavaLangObjectNull = (itemListener) != (null);
        if (itemListenerJavaLangObjectNull) {



            itemListener.onClickScopedGrant(scopedGrant);
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): itemListener
        flag 1 (0x2L): scopedGrantFlagMessageIds
        flag 2 (0x3L): selectablePagedListAdapter
        flag 3 (0x4L): scopedGrant
        flag 4 (0x5L): null
    flag mapping end*/
    //end
}