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 ItemCourseDetailDownloadBindingImpl extends ItemCourseDetailDownloadBinding 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 mCallback175;
    @Nullable
    private final android.view.View.OnClickListener mCallback176;
    @Nullable
    private final android.view.View.OnClickListener mCallback174;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemCourseDetailDownloadBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 4, sIncludes, sViewsWithIds));
    }
    private ItemCourseDetailDownloadBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (com.google.android.material.button.MaterialButton) bindings[1]
            , (com.google.android.material.button.MaterialButton) bindings[3]
            , (com.google.android.material.button.MaterialButton) bindings[2]
            );
        this.itemCourseDownloadAllButton.setTag(null);
        this.itemCoursePermissionsButton.setTag(null);
        this.itemCourseShareButton.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        mCallback175 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        mCallback176 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 3);
        mCallback174 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x4L;
        }
        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.permissionButtonVisible == variableId) {
            setPermissionButtonVisible((boolean) variable);
        }
        else if (BR.fragmentEventHandler == variableId) {
            setFragmentEventHandler((com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setPermissionButtonVisible(boolean PermissionButtonVisible) {
        this.mPermissionButtonVisible = PermissionButtonVisible;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.permissionButtonVisible);
        super.requestRebind();
    }
    public void setFragmentEventHandler(@Nullable com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener FragmentEventHandler) {
        this.mFragmentEventHandler = FragmentEventHandler;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.fragmentEventHandler);
        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;
        }
        int permissionButtonVisibleViewVISIBLEViewGONE = 0;
        boolean permissionButtonVisible = mPermissionButtonVisible;
        com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener fragmentEventHandler = mFragmentEventHandler;

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

            if((dirtyFlags & 0x5L) != 0) {
                if(permissionButtonVisible) {
                        dirtyFlags |= 0x10L;
                }
                else {
                        dirtyFlags |= 0x8L;
                }
            }


                // read permissionButtonVisible ? View.VISIBLE : View.GONE
                permissionButtonVisibleViewVISIBLEViewGONE = ((permissionButtonVisible) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
        }
        // batch finished
        if ((dirtyFlags & 0x4L) != 0) {
            // api target 1

            this.itemCourseDownloadAllButton.setOnClickListener(mCallback174);
            this.itemCoursePermissionsButton.setOnClickListener(mCallback176);
            this.itemCourseShareButton.setOnClickListener(mCallback175);
        }
        if ((dirtyFlags & 0x5L) != 0) {
            // api target 1

            this.itemCoursePermissionsButton.setVisibility(permissionButtonVisibleViewVISIBLEViewGONE);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 2: {
                // localize variables for thread safety
                // fragmentEventHandler
                com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener fragmentEventHandler = mFragmentEventHandler;
                // fragmentEventHandler != null
                boolean fragmentEventHandlerJavaLangObjectNull = false;



                fragmentEventHandlerJavaLangObjectNull = (fragmentEventHandler) != (null);
                if (fragmentEventHandlerJavaLangObjectNull) {


                    fragmentEventHandler.onClickShare();
                }
                break;
            }
            case 3: {
                // localize variables for thread safety
                // fragmentEventHandler
                com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener fragmentEventHandler = mFragmentEventHandler;
                // fragmentEventHandler != null
                boolean fragmentEventHandlerJavaLangObjectNull = false;



                fragmentEventHandlerJavaLangObjectNull = (fragmentEventHandler) != (null);
                if (fragmentEventHandlerJavaLangObjectNull) {


                    fragmentEventHandler.onClickPermissions();
                }
                break;
            }
            case 1: {
                // localize variables for thread safety
                // fragmentEventHandler
                com.ustadmobile.port.android.view.ClazzDetailOverviewEventListener fragmentEventHandler = mFragmentEventHandler;
                // fragmentEventHandler != null
                boolean fragmentEventHandlerJavaLangObjectNull = false;



                fragmentEventHandlerJavaLangObjectNull = (fragmentEventHandler) != (null);
                if (fragmentEventHandlerJavaLangObjectNull) {


                    fragmentEventHandler.onClickShare();
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): permissionButtonVisible
        flag 1 (0x2L): fragmentEventHandler
        flag 2 (0x3L): null
        flag 3 (0x4L): permissionButtonVisible ? View.VISIBLE : View.GONE
        flag 4 (0x5L): permissionButtonVisible ? View.VISIBLE : View.GONE
    flag mapping end*/
    //end
}