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 ItemContentEntrySimpleListBindingImpl extends ItemContentEntrySimpleListBinding 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 = new android.util.SparseIntArray();
        sViewsWithIds.put(R.id.content_entry_status, 10);
        sViewsWithIds.put(R.id.content_entry_locally_available, 11);
        sViewsWithIds.put(R.id.action_btn_holder, 12);
    }
    // views
    // variables
    @Nullable
    private final com.ustadmobile.port.android.view.binding.OnSelectionStateChangedListener mCallback100;
    @Nullable
    private final android.view.View.OnClickListener mCallback101;
    @Nullable
    private final android.view.View.OnClickListener mCallback102;
    @Nullable
    private final android.view.View.OnClickListener mCallback103;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemContentEntrySimpleListBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 13, sIncludes, sViewsWithIds));
    }
    private ItemContentEntrySimpleListBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (android.widget.FrameLayout) bindings[12]
            , (android.widget.TextView) bindings[5]
            , (com.ustadmobile.port.android.view.DownloadStatusButton) bindings[8]
            , (android.widget.TextView) bindings[7]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[1]
            , (android.widget.TextView) bindings[4]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[11]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[6]
            , (android.widget.ProgressBar) bindings[2]
            , (com.google.android.material.button.MaterialButton) bindings[9]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[10]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[3]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            );
        this.contentEntryItemDescription.setTag(null);
        this.contentEntryItemDownload.setTag(null);
        this.contentEntryItemMimetypeText.setTag(null);
        this.contentEntryItemThumbnail.setTag(null);
        this.contentEntryItemTitle.setTag(null);
        this.contentEntryMimetypeIcon.setTag(null);
        this.contentEntryProgress.setTag(null);
        this.contentEntrySelectBtn.setTag(null);
        this.contentProgressFailCorrect.setTag(null);
        this.itemContentEntryList.setTag(null);
        setRootTag(root);
        // listeners
        mCallback100 = new com.toughra.ustadmobile.generated.callback.OnSelectionStateChangedListener(this, 1);
        mCallback101 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        mCallback102 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 3);
        mCallback103 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 4);
        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.itemListener == variableId) {
            setItemListener((com.ustadmobile.core.controller.ContentEntryListItemListener) variable);
        }
        else if (BR.selectablePagedListAdapter == variableId) {
            setSelectablePagedListAdapter((com.ustadmobile.port.android.view.ContentEntryListRecyclerAdapter) variable);
        }
        else if (BR.contentEntry == variableId) {
            setContentEntry((com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setItemListener(@Nullable com.ustadmobile.core.controller.ContentEntryListItemListener ItemListener) {
        this.mItemListener = ItemListener;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.itemListener);
        super.requestRebind();
    }
    public void setSelectablePagedListAdapter(@Nullable com.ustadmobile.port.android.view.ContentEntryListRecyclerAdapter SelectablePagedListAdapter) {
        this.mSelectablePagedListAdapter = SelectablePagedListAdapter;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.selectablePagedListAdapter);
        super.requestRebind();
    }
    public void setContentEntry(@Nullable com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer ContentEntry) {
        this.mContentEntry = ContentEntry;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.contentEntry);
        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;
        }
        long contentEntryContentEntryUid = 0;
        int contentEntryContentTypeFlag = 0;
        int contentEntryLeafViewVISIBLEViewGONE = 0;
        com.ustadmobile.port.android.view.util.ForeignKeyAttachmentUriAdapter contentEntryDetailFragmentFOREIGNKEYADAPTERENTRY = null;
        com.ustadmobile.core.controller.ContentEntryListItemListener itemListener = mItemListener;
        java.lang.String contentEntryDescription = null;
        com.ustadmobile.port.android.view.ContentEntryListRecyclerAdapter selectablePagedListAdapter = mSelectablePagedListAdapter;
        android.graphics.drawable.Drawable contentEntryLeafContentEntryItemThumbnailAndroidDrawableIcRoundBookContentEntryItemThumbnailAndroidDrawableIcRoundFolder = null;
        int contentEntryScoreProgressProgress = 0;
        com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer contentEntry = mContentEntry;
        boolean contentEntryCeInactive = false;
        boolean contentEntryLeaf = false;
        com.ustadmobile.lib.db.entities.ContentEntryStatementScoreProgress contentEntryScoreProgress = null;
        float contentEntryCeInactiveFloat5fFloat1f = 0f;
        java.lang.String contentEntryTitle = null;

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

                // read ContentEntryDetailFragment.FOREIGNKEYADAPTER_ENTRY
                contentEntryDetailFragmentFOREIGNKEYADAPTERENTRY = com.ustadmobile.port.android.view.ContentEntryDetailFragment.getFOREIGNKEYADAPTER_ENTRY();
        }
        if ((dirtyFlags & 0xaL) != 0) {
        }
        if ((dirtyFlags & 0xcL) != 0) {



                if (contentEntry != null) {
                    // read contentEntry.contentEntryUid
                    contentEntryContentEntryUid = contentEntry.getContentEntryUid();
                    // read contentEntry.contentTypeFlag
                    contentEntryContentTypeFlag = contentEntry.getContentTypeFlag();
                    // read contentEntry.description
                    contentEntryDescription = contentEntry.getDescription();
                    // read contentEntry.ceInactive
                    contentEntryCeInactive = contentEntry.getCeInactive();
                    // read contentEntry.leaf
                    contentEntryLeaf = contentEntry.getLeaf();
                    // read contentEntry.scoreProgress
                    contentEntryScoreProgress = contentEntry.getScoreProgress();
                    // read contentEntry.title
                    contentEntryTitle = contentEntry.getTitle();
                }
            if((dirtyFlags & 0xcL) != 0) {
                if(contentEntryCeInactive) {
                        dirtyFlags |= 0x200L;
                }
                else {
                        dirtyFlags |= 0x100L;
                }
            }
            if((dirtyFlags & 0xcL) != 0) {
                if(contentEntryLeaf) {
                        dirtyFlags |= 0x20L;
                        dirtyFlags |= 0x80L;
                }
                else {
                        dirtyFlags |= 0x10L;
                        dirtyFlags |= 0x40L;
                }
            }


                // read contentEntry.ceInactive ? .5f : 1f
                contentEntryCeInactiveFloat5fFloat1f = ((contentEntryCeInactive) ? (.5f) : (1f));
                // read contentEntry.leaf ? View.VISIBLE : View.GONE
                contentEntryLeafViewVISIBLEViewGONE = ((contentEntryLeaf) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
                // read contentEntry.leaf ? @android:drawable/ic_round_book : @android:drawable/ic_round_folder
                contentEntryLeafContentEntryItemThumbnailAndroidDrawableIcRoundBookContentEntryItemThumbnailAndroidDrawableIcRoundFolder = ((contentEntryLeaf) ? (androidx.appcompat.content.res.AppCompatResources.getDrawable(contentEntryItemThumbnail.getContext(), R.drawable.ic_round_book)) : (androidx.appcompat.content.res.AppCompatResources.getDrawable(contentEntryItemThumbnail.getContext(), R.drawable.ic_round_folder)));
                if (contentEntryScoreProgress != null) {
                    // read contentEntry.scoreProgress.progress
                    contentEntryScoreProgressProgress = contentEntryScoreProgress.getProgress();
                }
        }
        // batch finished
        if ((dirtyFlags & 0xcL) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.contentEntryItemDescription, contentEntryDescription);
            this.contentEntryItemMimetypeText.setVisibility(contentEntryLeafViewVISIBLEViewGONE);
            com.ustadmobile.port.android.view.binding.TextViewBindingsKt.setTextMessageIdOptionSelected(this.contentEntryItemMimetypeText, contentEntryContentTypeFlag);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageFilePath(this.contentEntryItemThumbnail, (java.lang.String)null, contentEntryLeafContentEntryItemThumbnailAndroidDrawableIcRoundBookContentEntryItemThumbnailAndroidDrawableIcRoundFolder);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKey(this.contentEntryItemThumbnail, contentEntryContentEntryUid, (java.lang.String)null);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.contentEntryItemTitle, contentEntryTitle);
            this.contentEntryMimetypeIcon.setVisibility(contentEntryLeafViewVISIBLEViewGONE);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageLookupKey(this.contentEntryMimetypeIcon, contentEntryContentTypeFlag);
            this.contentEntryProgress.setProgress(contentEntryScoreProgressProgress);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setIconOnProgressFlag(this.contentProgressFailCorrect, contentEntryScoreProgress);
            this.itemContentEntryList.setTag(contentEntryContentEntryUid);
            // api target 11
            if(getBuildSdkInt() >= 11) {

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

            this.contentEntryItemDownload.setOnClickListener(mCallback102);
            com.ustadmobile.port.android.view.binding.TextViewBindingsKt.setTextMessageIdOptions(this.contentEntryItemMimetypeText, com.ustadmobile.port.android.view.ContentEntryList2Fragment.CONTENT_ENTRY_TYPE_LABEL_MAP, (java.lang.Integer)null, (java.lang.String)null);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKeyAdapter(this.contentEntryItemThumbnail, contentEntryDetailFragmentFOREIGNKEYADAPTERENTRY);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageLookupMap(this.contentEntryMimetypeIcon, com.ustadmobile.port.android.view.ContentEntryList2Fragment.CONTENT_ENTRY_TYPE_ICON_MAP, (java.lang.Integer)null);
            this.contentEntrySelectBtn.setOnClickListener(mCallback103);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.contentEntrySelectBtn, contentEntrySelectBtn.getResources().getString(R.string.select_item, ""));
        }
        if ((dirtyFlags & 0xaL) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ViewBindingsKt.setSelectableViewHelper(this.itemContentEntryList, selectablePagedListAdapter, mCallback101, mCallback100);
        }
    }
    // 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.ContentEntryListRecyclerAdapter selectablePagedListAdapter = mSelectablePagedListAdapter;
        // contentEntry
        com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer contentEntry = mContentEntry;



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




            selectablePagedListAdapter.onItemSelectedChanged(callbackArg_0, contentEntry);
        }
    }
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 2: {
                // localize variables for thread safety
                // itemListener
                com.ustadmobile.core.controller.ContentEntryListItemListener itemListener = mItemListener;
                // itemListener != null
                boolean itemListenerJavaLangObjectNull = false;
                // contentEntry
                com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer contentEntry = mContentEntry;



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



                    itemListener.onClickContentEntry(contentEntry);
                }
                break;
            }
            case 3: {
                // localize variables for thread safety
                // itemListener
                com.ustadmobile.core.controller.ContentEntryListItemListener itemListener = mItemListener;
                // itemListener != null
                boolean itemListenerJavaLangObjectNull = false;
                // contentEntry
                com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer contentEntry = mContentEntry;



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



                    itemListener.onClickDownloadContentEntry(contentEntry);
                }
                break;
            }
            case 4: {
                // localize variables for thread safety
                // itemListener
                com.ustadmobile.core.controller.ContentEntryListItemListener itemListener = mItemListener;
                // itemListener != null
                boolean itemListenerJavaLangObjectNull = false;
                // contentEntry
                com.ustadmobile.lib.db.entities.ContentEntryWithParentChildJoinAndStatusAndMostRecentContainer contentEntry = mContentEntry;



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



                    itemListener.onClickSelectContentEntry(contentEntry);
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): itemListener
        flag 1 (0x2L): selectablePagedListAdapter
        flag 2 (0x3L): contentEntry
        flag 3 (0x4L): null
        flag 4 (0x5L): contentEntry.leaf ? View.VISIBLE : View.GONE
        flag 5 (0x6L): contentEntry.leaf ? View.VISIBLE : View.GONE
        flag 6 (0x7L): contentEntry.leaf ? @android:drawable/ic_round_book : @android:drawable/ic_round_folder
        flag 7 (0x8L): contentEntry.leaf ? @android:drawable/ic_round_book : @android:drawable/ic_round_folder
        flag 8 (0x9L): contentEntry.ceInactive ? .5f : 1f
        flag 9 (0xaL): contentEntry.ceInactive ? .5f : 1f
    flag mapping end*/
    //end
}