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 ItemCourseBlockEditBindingImpl extends ItemCourseBlockEditBinding 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.item_course_block_reorder, 4);
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback166;
    @Nullable
    private final android.view.View.OnClickListener mCallback164;
    @Nullable
    private final android.view.View.OnClickListener mCallback162;
    @Nullable
    private final android.view.View.OnClickListener mCallback165;
    @Nullable
    private final android.view.View.OnClickListener mCallback163;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemCourseBlockEditBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 5, sIncludes, sViewsWithIds));
    }
    private ItemCourseBlockEditBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.appcompat.widget.AppCompatImageView) bindings[1]
            , (android.widget.TextView) bindings[2]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[3]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[4]
            );
        this.itemCourseBlockIcon.setTag(null);
        this.itemCourseBlockLine1Text.setTag(null);
        this.itemCourseBlockMoreOption.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        mCallback166 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 5);
        mCallback164 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 3);
        mCallback162 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        mCallback165 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 4);
        mCallback163 = 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.block == variableId) {
            setBlock((com.ustadmobile.lib.db.entities.CourseBlockWithEntity) variable);
        }
        else if (BR.mPresenter == variableId) {
            setMPresenter((com.ustadmobile.core.controller.ClazzEdit2Presenter) variable);
        }
        else if (BR.oneToManyJoinListener == variableId) {
            setOneToManyJoinListener((com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity>) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setBlock(@Nullable com.ustadmobile.lib.db.entities.CourseBlockWithEntity Block) {
        this.mBlock = Block;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.block);
        super.requestRebind();
    }
    public void setMPresenter(@Nullable com.ustadmobile.core.controller.ClazzEdit2Presenter MPresenter) {
        this.mMPresenter = MPresenter;
    }
    public void setOneToManyJoinListener(@Nullable com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> OneToManyJoinListener) {
        this.mOneToManyJoinListener = OneToManyJoinListener;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.oneToManyJoinListener);
        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.lib.db.entities.ContentEntry blockEntry = null;
        int blockCbTypeCourseBlockBLOCKCONTENTTYPEBlockEntryContentTypeFlagBlockCbType = 0;
        boolean blockCbHidden = false;
        com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;
        com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
        int blockCbIndentLevel = 0;
        int blockEntryContentTypeFlag = 0;
        boolean blockCbTypeCourseBlockBLOCKCONTENTTYPE = false;
        java.lang.String blockCbTitle = null;
        float blockCbHiddenFloat05fFloat1f = 0f;
        int blockCbType = 0;

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



                if (block != null) {
                    // read block.cbHidden
                    blockCbHidden = block.getCbHidden();
                    // read block.cbIndentLevel
                    blockCbIndentLevel = block.getCbIndentLevel();
                    // read block.cbTitle
                    blockCbTitle = block.getCbTitle();
                    // read block.cbType
                    blockCbType = block.getCbType();
                }
            if((dirtyFlags & 0x9L) != 0) {
                if(blockCbHidden) {
                        dirtyFlags |= 0x80L;
                }
                else {
                        dirtyFlags |= 0x40L;
                }
            }


                // read block.cbHidden ? 0.5f : 1f
                blockCbHiddenFloat05fFloat1f = ((blockCbHidden) ? (0.5f) : (1f));
                // read block.cbType == CourseBlock.BLOCK_CONTENT_TYPE
                blockCbTypeCourseBlockBLOCKCONTENTTYPE = (blockCbType) == (com.ustadmobile.lib.db.entities.CourseBlock.BLOCK_CONTENT_TYPE);
            if((dirtyFlags & 0x9L) != 0) {
                if(blockCbTypeCourseBlockBLOCKCONTENTTYPE) {
                        dirtyFlags |= 0x20L;
                }
                else {
                        dirtyFlags |= 0x10L;
                }
            }
        }
        // batch finished

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

                if (block != null) {
                    // read block.entry
                    blockEntry = block.getEntry();
                }


                if (blockEntry != null) {
                    // read block.entry.contentTypeFlag
                    blockEntryContentTypeFlag = blockEntry.getContentTypeFlag();
                }
        }

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

                // read block.cbType == CourseBlock.BLOCK_CONTENT_TYPE ? block.entry.contentTypeFlag : block.cbType
                blockCbTypeCourseBlockBLOCKCONTENTTYPEBlockEntryContentTypeFlagBlockCbType = ((blockCbTypeCourseBlockBLOCKCONTENTTYPE) ? (blockEntryContentTypeFlag) : (blockCbType));
        }
        // batch finished
        if ((dirtyFlags & 0x9L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ViewBindingsKt.setIndentLevel(this.itemCourseBlockIcon, blockCbIndentLevel);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageLookupKey(this.itemCourseBlockIcon, blockCbTypeCourseBlockBLOCKCONTENTTYPEBlockEntryContentTypeFlagBlockCbType);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemCourseBlockLine1Text, blockCbTitle);
            com.ustadmobile.port.android.view.binding.PopupViewBindingKt.setOnBlockPopupMenuItemClickListener(this.itemCourseBlockMoreOption, mCallback163, mCallback164, mCallback165, mCallback166, block);
            // api target 11
            if(getBuildSdkInt() >= 11) {

                this.mboundView0.setAlpha(blockCbHiddenFloat05fFloat1f);
            }
        }
        if ((dirtyFlags & 0x8L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageLookupMap(this.itemCourseBlockIcon, com.ustadmobile.port.android.view.ClazzEditFragment.BLOCK_WITH_ENTRY_MAP, (java.lang.Integer)null);
            this.itemCourseBlockLine1Text.setOnClickListener(mCallback162);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 5: {
                // localize variables for thread safety
                // oneToManyJoinListener
                com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
                // oneToManyJoinListener != null
                boolean oneToManyJoinListenerJavaLangObjectNull = false;
                // block
                com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;



                oneToManyJoinListenerJavaLangObjectNull = (oneToManyJoinListener) != (null);
                if (oneToManyJoinListenerJavaLangObjectNull) {



                    oneToManyJoinListener.onClickDelete(block);
                }
                break;
            }
            case 3: {
                // localize variables for thread safety
                // oneToManyJoinListener
                com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
                // oneToManyJoinListener != null
                boolean oneToManyJoinListenerJavaLangObjectNull = false;
                // block
                com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;



                oneToManyJoinListenerJavaLangObjectNull = (oneToManyJoinListener) != (null);
                if (oneToManyJoinListenerJavaLangObjectNull) {



                    oneToManyJoinListener.onClickIndent(block);
                }
                break;
            }
            case 1: {
                // localize variables for thread safety
                // oneToManyJoinListener
                com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
                // oneToManyJoinListener != null
                boolean oneToManyJoinListenerJavaLangObjectNull = false;
                // block
                com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;



                oneToManyJoinListenerJavaLangObjectNull = (oneToManyJoinListener) != (null);
                if (oneToManyJoinListenerJavaLangObjectNull) {



                    oneToManyJoinListener.onClickEdit(block);
                }
                break;
            }
            case 4: {
                // localize variables for thread safety
                // oneToManyJoinListener
                com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
                // oneToManyJoinListener != null
                boolean oneToManyJoinListenerJavaLangObjectNull = false;
                // block
                com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;



                oneToManyJoinListenerJavaLangObjectNull = (oneToManyJoinListener) != (null);
                if (oneToManyJoinListenerJavaLangObjectNull) {



                    oneToManyJoinListener.onClickUnIndent(block);
                }
                break;
            }
            case 2: {
                // localize variables for thread safety
                // oneToManyJoinListener
                com.ustadmobile.core.util.TreeOneToManyJoinEditListener<com.ustadmobile.lib.db.entities.CourseBlockWithEntity> oneToManyJoinListener = mOneToManyJoinListener;
                // oneToManyJoinListener != null
                boolean oneToManyJoinListenerJavaLangObjectNull = false;
                // block
                com.ustadmobile.lib.db.entities.CourseBlockWithEntity block = mBlock;



                oneToManyJoinListenerJavaLangObjectNull = (oneToManyJoinListener) != (null);
                if (oneToManyJoinListenerJavaLangObjectNull) {



                    oneToManyJoinListener.onClickHide(block);
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): block
        flag 1 (0x2L): mPresenter
        flag 2 (0x3L): oneToManyJoinListener
        flag 3 (0x4L): null
        flag 4 (0x5L): block.cbType == CourseBlock.BLOCK_CONTENT_TYPE ? block.entry.contentTypeFlag : block.cbType
        flag 5 (0x6L): block.cbType == CourseBlock.BLOCK_CONTENT_TYPE ? block.entry.contentTypeFlag : block.cbType
        flag 6 (0x7L): block.cbHidden ? 0.5f : 1f
        flag 7 (0x8L): block.cbHidden ? 0.5f : 1f
    flag mapping end*/
    //end
}