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 ItemScopedGrantEditBindingImpl extends ItemScopedGrantEditBinding 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 = null;
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback37;
    @Nullable
    private final android.view.View.OnClickListener mCallback38;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemScopedGrantEditBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 4, sIncludes, sViewsWithIds));
    }
    private ItemScopedGrantEditBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (android.widget.TextView) bindings[1]
            , (android.widget.TextView) bindings[2]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[3]
            );
        this.itemScheduleLine1Text.setTag(null);
        this.itemScheduleLine2Text.setTag(null);
        this.itemScheduleSecondaryMenuImageview.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        mCallback37 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        mCallback38 = 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.scopedGrantListener == variableId) {
            setScopedGrantListener((com.ustadmobile.core.util.OneToManyJoinEditListener<com.ustadmobile.lib.db.entities.ScopedGrantAndName>) variable);
        }
        else if (BR.scopedGrant == variableId) {
            setScopedGrant((com.ustadmobile.lib.db.entities.ScopedGrantAndName) variable);
        }
        else if (BR.scopedGrantFlagMessageIds == variableId) {
            setScopedGrantFlagMessageIds((java.util.List<com.ustadmobile.core.model.BitmaskMessageId>) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setScopedGrantListener(@Nullable com.ustadmobile.core.util.OneToManyJoinEditListener<com.ustadmobile.lib.db.entities.ScopedGrantAndName> ScopedGrantListener) {
        this.mScopedGrantListener = ScopedGrantListener;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.scopedGrantListener);
        super.requestRebind();
    }
    public void setScopedGrant(@Nullable com.ustadmobile.lib.db.entities.ScopedGrantAndName ScopedGrant) {
        this.mScopedGrant = ScopedGrant;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.scopedGrant);
        super.requestRebind();
    }
    public void setScopedGrantFlagMessageIds(@Nullable java.util.List<com.ustadmobile.core.model.BitmaskMessageId> ScopedGrantFlagMessageIds) {
        this.mScopedGrantFlagMessageIds = ScopedGrantFlagMessageIds;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.scopedGrantFlagMessageIds);
        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.util.OneToManyJoinEditListener<com.ustadmobile.lib.db.entities.ScopedGrantAndName> scopedGrantListener = mScopedGrantListener;
        java.lang.String scopedGrantName = null;
        boolean intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETE = false;
        com.ustadmobile.lib.db.entities.ScopedGrantAndName scopedGrant = mScopedGrant;
        java.util.List<com.ustadmobile.core.model.BitmaskMessageId> scopedGrantFlagMessageIds = mScopedGrantFlagMessageIds;
        com.ustadmobile.lib.db.entities.ScopedGrant scopedGrantScopedGrant = null;
        long scopedGrantScopedGrantSgPermissions = 0;
        int intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETEViewINVISIBLEViewVISIBLE = 0;
        int scopedGrantScopedGrantSgFlags = 0;

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


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

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

                if (scopedGrant != null) {
                    // read scopedGrant.scopedGrant
                    scopedGrantScopedGrant = scopedGrant.getScopedGrant();
                }


                if (scopedGrantScopedGrant != null) {
                    // read scopedGrant.scopedGrant.sgPermissions
                    scopedGrantScopedGrantSgPermissions = scopedGrantScopedGrant.getSgPermissions();
                }
            if ((dirtyFlags & 0xaL) != 0) {

                    if (scopedGrantScopedGrant != null) {
                        // read scopedGrant.scopedGrant.sgFlags
                        scopedGrantScopedGrantSgFlags = scopedGrantScopedGrant.getSgFlags();
                    }


                    // read IntExtKt.hasFlag(scopedGrant.scopedGrant.sgFlags, ScopedGrant.FLAG_NO_DELETE)
                    intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETE = com.ustadmobile.core.util.ext.IntExtKt.hasFlag(scopedGrantScopedGrantSgFlags, com.ustadmobile.lib.db.entities.ScopedGrant.FLAG_NO_DELETE);
                if((dirtyFlags & 0xaL) != 0) {
                    if(intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETE) {
                            dirtyFlags |= 0x20L;
                    }
                    else {
                            dirtyFlags |= 0x10L;
                    }
                }


                    // read IntExtKt.hasFlag(scopedGrant.scopedGrant.sgFlags, ScopedGrant.FLAG_NO_DELETE) ? View.INVISIBLE : View.VISIBLE
                    intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETEViewINVISIBLEViewVISIBLE = ((intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETE) ? (android.view.View.INVISIBLE) : (android.view.View.VISIBLE));
            }
        }
        // batch finished
        if ((dirtyFlags & 0xaL) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemScheduleLine1Text, scopedGrantName);
            this.itemScheduleSecondaryMenuImageview.setVisibility(intExtKtHasFlagScopedGrantScopedGrantSgFlagsScopedGrantFLAGNODELETEViewINVISIBLEViewVISIBLE);
        }
        if ((dirtyFlags & 0xeL) != 0) {
            // api target 1

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

            this.itemScheduleSecondaryMenuImageview.setOnClickListener(mCallback38);
            this.mboundView0.setOnClickListener(mCallback37);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 1: {
                // localize variables for thread safety
                // scopedGrantListener != null
                boolean scopedGrantListenerJavaLangObjectNull = false;
                // scopedGrant
                com.ustadmobile.lib.db.entities.ScopedGrantAndName scopedGrant = mScopedGrant;
                // scopedGrantListener
                com.ustadmobile.core.util.OneToManyJoinEditListener<com.ustadmobile.lib.db.entities.ScopedGrantAndName> scopedGrantListener = mScopedGrantListener;



                scopedGrantListenerJavaLangObjectNull = (scopedGrantListener) != (null);
                if (scopedGrantListenerJavaLangObjectNull) {



                    scopedGrantListener.onClickEdit(scopedGrant);
                }
                break;
            }
            case 2: {
                // localize variables for thread safety
                // scopedGrantListener != null
                boolean scopedGrantListenerJavaLangObjectNull = false;
                // scopedGrant
                com.ustadmobile.lib.db.entities.ScopedGrantAndName scopedGrant = mScopedGrant;
                // scopedGrantListener
                com.ustadmobile.core.util.OneToManyJoinEditListener<com.ustadmobile.lib.db.entities.ScopedGrantAndName> scopedGrantListener = mScopedGrantListener;



                scopedGrantListenerJavaLangObjectNull = (scopedGrantListener) != (null);
                if (scopedGrantListenerJavaLangObjectNull) {



                    scopedGrantListener.onClickDelete(scopedGrant);
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): scopedGrantListener
        flag 1 (0x2L): scopedGrant
        flag 2 (0x3L): scopedGrantFlagMessageIds
        flag 3 (0x4L): null
        flag 4 (0x5L): IntExtKt.hasFlag(scopedGrant.scopedGrant.sgFlags, ScopedGrant.FLAG_NO_DELETE) ? View.INVISIBLE : View.VISIBLE
        flag 5 (0x6L): IntExtKt.hasFlag(scopedGrant.scopedGrant.sgFlags, ScopedGrant.FLAG_NO_DELETE) ? View.INVISIBLE : View.VISIBLE
    flag mapping end*/
    //end
}