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 ItemSortHeaderOptionBindingImpl extends ItemSortHeaderOptionBinding 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
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback54;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemSortHeaderOptionBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 3, sIncludes, sViewsWithIds));
    }
    private ItemSortHeaderOptionBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.appcompat.widget.AppCompatImageView) bindings[2]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            , (android.widget.TextView) bindings[1]
            );
        this.itemSortAscDesc.setTag(null);
        this.itemSortSelectedLayout.setTag(null);
        this.itemSortSelectedText.setTag(null);
        setRootTag(root);
        // listeners
        mCallback54 = 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.sortOption == variableId) {
            setSortOption((com.ustadmobile.core.util.SortOrderOption) variable);
        }
        else if (BR.onClickSort == variableId) {
            setOnClickSort((android.view.View.OnClickListener) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setSortOption(@Nullable com.ustadmobile.core.util.SortOrderOption SortOption) {
        this.mSortOption = SortOption;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.sortOption);
        super.requestRebind();
    }
    public void setOnClickSort(@Nullable android.view.View.OnClickListener OnClickSort) {
        this.mOnClickSort = OnClickSort;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.onClickSort);
        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;
        }
        android.graphics.drawable.Drawable sortOptionOrderItemSortAscDescAndroidDrawableIcArrowDownward24ItemSortAscDescAndroidDrawableIcArrowUpward24 = null;
        com.ustadmobile.core.util.SortOrderOption sortOption = mSortOption;
        int sortOptionFieldMessageId = 0;
        boolean sortOptionOrder = false;
        android.view.View.OnClickListener onClickSort = mOnClickSort;

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



                if (sortOption != null) {
                    // read sortOption.fieldMessageId
                    sortOptionFieldMessageId = sortOption.getFieldMessageId();
                    // read sortOption.order
                    sortOptionOrder = sortOption.getOrder();
                }
            if((dirtyFlags & 0x5L) != 0) {
                if(sortOptionOrder) {
                        dirtyFlags |= 0x10L;
                }
                else {
                        dirtyFlags |= 0x8L;
                }
            }


                // read sortOption.order ? @android:drawable/ic_arrow_downward_24 : @android:drawable/ic_arrow_upward_24
                sortOptionOrderItemSortAscDescAndroidDrawableIcArrowDownward24ItemSortAscDescAndroidDrawableIcArrowUpward24 = ((sortOptionOrder) ? (androidx.appcompat.content.res.AppCompatResources.getDrawable(itemSortAscDesc.getContext(), R.drawable.ic_arrow_downward_24)) : (androidx.appcompat.content.res.AppCompatResources.getDrawable(itemSortAscDesc.getContext(), R.drawable.ic_arrow_upward_24)));
        }
        // batch finished
        if ((dirtyFlags & 0x5L) != 0) {
            // api target 1

            androidx.databinding.adapters.ImageViewBindingAdapter.setImageDrawable(this.itemSortAscDesc, sortOptionOrderItemSortAscDescAndroidDrawableIcArrowDownward24ItemSortAscDescAndroidDrawableIcArrowUpward24);
            com.ustadmobile.port.android.view.binding.TextViewBindingsKt.setTextMessageId(this.itemSortSelectedText, sortOptionFieldMessageId);
        }
        if ((dirtyFlags & 0x4L) != 0) {
            // api target 1

            this.itemSortSelectedLayout.setOnClickListener(mCallback54);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // onClickSort
        android.view.View.OnClickListener onClickSort = mOnClickSort;
        // onClickSort != null
        boolean onClickSortJavaLangObjectNull = false;



        onClickSortJavaLangObjectNull = (onClickSort) != (null);
        if (onClickSortJavaLangObjectNull) {



            onClickSort.onClick(callbackArg_0);
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): sortOption
        flag 1 (0x2L): onClickSort
        flag 2 (0x3L): null
        flag 3 (0x4L): sortOption.order ? @android:drawable/ic_arrow_downward_24 : @android:drawable/ic_arrow_upward_24
        flag 4 (0x5L): sortOption.order ? @android:drawable/ic_arrow_downward_24 : @android:drawable/ic_arrow_upward_24
    flag mapping end*/
    //end
}