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 ItemClazzListBindingImpl extends ItemClazzListBinding 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.barrier_desc, 8);
        sViewsWithIds.put(R.id.item_clazzlist_people_icon, 9);
    }
    // views
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback84;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemClazzListBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 10, sIncludes, sViewsWithIds));
    }
    private ItemClazzListBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.constraintlayout.widget.Barrier) bindings[8]
            , (android.widget.TextView) bindings[4]
            , (android.widget.TextView) bindings[6]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[5]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[1]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            , (android.widget.TextView) bindings[3]
            , (android.widget.TextView) bindings[7]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[9]
            , (android.widget.TextView) bindings[2]
            );
        this.clazzDescriptionTxt.setTag(null);
        this.itemClazzlistAttendancePercentage.setTag(null);
        this.itemClazzlistAttendanceTrafficlight.setTag(null);
        this.itemClazzlistBadgeIcon.setTag(null);
        this.itemClazzlistClazzCl.setTag(null);
        this.itemClazzlistClazzTitle.setTag(null);
        this.itemClazzlistNumstudentsText.setTag(null);
        this.itemClazzlistRoleText.setTag(null);
        setRootTag(root);
        // listeners
        mCallback84 = 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.clazz == variableId) {
            setClazz((com.ustadmobile.lib.db.entities.ClazzWithListDisplayDetails) variable);
        }
        else if (BR.itemListener == variableId) {
            setItemListener((com.ustadmobile.core.controller.ClazzListItemListener) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setClazz(@Nullable com.ustadmobile.lib.db.entities.ClazzWithListDisplayDetails Clazz) {
        this.mClazz = Clazz;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.clazz);
        super.requestRebind();
    }
    public void setItemListener(@Nullable com.ustadmobile.core.controller.ClazzListItemListener ItemListener) {
        this.mItemListener = ItemListener;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.itemListener);
        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 clazzExtKtIsAttendanceEnabledAndRecordedClazzViewVISIBLEViewGONE = 0;
        com.ustadmobile.lib.db.entities.ClazzEnrolment clazzClazzActiveEnrolment = null;
        int stringExtKtVisibleIfNotNullOrEmptyClazzClazzDesc = 0;
        int clazzNumTeachers = 0;
        java.lang.String itemClazzlistNumstudentsTextAndroidStringXTeachersYStudentsClazzNumTeachersClazzNumStudents = null;
        boolean clazzClazzActiveEnrolmentJavaLangObjectNull = false;
        float clazzAttendanceAverageInt100 = 0f;
        com.ustadmobile.lib.db.entities.ClazzWithListDisplayDetails clazz = mClazz;
        java.lang.String itemClazzlistAttendancePercentageAndroidStringXPercentAttendedClazzAttendanceAverageInt100 = null;
        java.lang.String clazzClazzName = null;
        com.ustadmobile.core.controller.ClazzListItemListener itemListener = mItemListener;
        java.lang.String clazzClazzDesc = null;
        int clazzClazzActiveEnrolmentJavaLangObjectNullViewVISIBLEViewGONE = 0;
        int clazzNumStudents = 0;
        float clazzAttendanceAverage = 0f;
        boolean clazzExtKtIsAttendanceEnabledAndRecordedClazz = false;

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



                if (clazz != null) {
                    // read clazz.clazzActiveEnrolment
                    clazzClazzActiveEnrolment = clazz.getClazzActiveEnrolment();
                    // read clazz.numTeachers
                    clazzNumTeachers = clazz.getNumTeachers();
                    // read clazz.clazzName
                    clazzClazzName = clazz.getClazzName();
                    // read clazz.clazzDesc
                    clazzClazzDesc = clazz.getClazzDesc();
                    // read clazz.numStudents
                    clazzNumStudents = clazz.getNumStudents();
                    // read clazz.attendanceAverage
                    clazzAttendanceAverage = clazz.getAttendanceAverage();
                }
                // read ClazzExtKt.isAttendanceEnabledAndRecorded(clazz)
                clazzExtKtIsAttendanceEnabledAndRecordedClazz = com.ustadmobile.core.util.ext.ClazzExtKt.isAttendanceEnabledAndRecorded(clazz);
            if((dirtyFlags & 0x5L) != 0) {
                if(clazzExtKtIsAttendanceEnabledAndRecordedClazz) {
                        dirtyFlags |= 0x10L;
                }
                else {
                        dirtyFlags |= 0x8L;
                }
            }


                // read clazz.clazzActiveEnrolment != null
                clazzClazzActiveEnrolmentJavaLangObjectNull = (clazzClazzActiveEnrolment) != (null);
                // read StringExtKt.visibleIfNotNullOrEmpty(clazz.clazzDesc)
                stringExtKtVisibleIfNotNullOrEmptyClazzClazzDesc = com.ustadmobile.port.android.view.ext.StringExtKt.visibleIfNotNullOrEmpty(clazzClazzDesc);
                // read @android:string/x_teachers_y_students
                itemClazzlistNumstudentsTextAndroidStringXTeachersYStudentsClazzNumTeachersClazzNumStudents = itemClazzlistNumstudentsText.getResources().getString(R.string.x_teachers_y_students, clazzNumTeachers, clazzNumStudents);
                // read (clazz.attendanceAverage) * (100)
                clazzAttendanceAverageInt100 = (clazzAttendanceAverage) * (100);
                // read ClazzExtKt.isAttendanceEnabledAndRecorded(clazz) ? View.VISIBLE : View.GONE
                clazzExtKtIsAttendanceEnabledAndRecordedClazzViewVISIBLEViewGONE = ((clazzExtKtIsAttendanceEnabledAndRecordedClazz) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
            if((dirtyFlags & 0x5L) != 0) {
                if(clazzClazzActiveEnrolmentJavaLangObjectNull) {
                        dirtyFlags |= 0x40L;
                }
                else {
                        dirtyFlags |= 0x20L;
                }
            }


                // read clazz.clazzActiveEnrolment != null ? View.VISIBLE : View.GONE
                clazzClazzActiveEnrolmentJavaLangObjectNullViewVISIBLEViewGONE = ((clazzClazzActiveEnrolmentJavaLangObjectNull) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
                // read @android:string/x_percent_attended
                itemClazzlistAttendancePercentageAndroidStringXPercentAttendedClazzAttendanceAverageInt100 = itemClazzlistAttendancePercentage.getResources().getString(R.string.x_percent_attended, clazzAttendanceAverageInt100);
        }
        // batch finished
        if ((dirtyFlags & 0x5L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.clazzDescriptionTxt, clazzClazzDesc);
            this.clazzDescriptionTxt.setVisibility(stringExtKtVisibleIfNotNullOrEmptyClazzClazzDesc);
            this.itemClazzlistAttendancePercentage.setVisibility(clazzExtKtIsAttendanceEnabledAndRecordedClazzViewVISIBLEViewGONE);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemClazzlistAttendancePercentage, itemClazzlistAttendancePercentageAndroidStringXPercentAttendedClazzAttendanceAverageInt100);
            this.itemClazzlistAttendanceTrafficlight.setVisibility(clazzExtKtIsAttendanceEnabledAndRecordedClazzViewVISIBLEViewGONE);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setAttendanceTint(this.itemClazzlistAttendanceTrafficlight, clazzAttendanceAverage);
            this.itemClazzlistBadgeIcon.setVisibility(clazzClazzActiveEnrolmentJavaLangObjectNullViewVISIBLEViewGONE);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemClazzlistClazzTitle, clazzClazzName);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemClazzlistNumstudentsText, itemClazzlistNumstudentsTextAndroidStringXTeachersYStudentsClazzNumTeachersClazzNumStudents);
            com.ustadmobile.port.android.view.binding.TextViewBindingsKt.setMemberRoleName(this.itemClazzlistRoleText, clazzClazzActiveEnrolment);
            this.itemClazzlistRoleText.setVisibility(clazzClazzActiveEnrolmentJavaLangObjectNullViewVISIBLEViewGONE);
        }
        if ((dirtyFlags & 0x4L) != 0) {
            // api target 1

            this.itemClazzlistClazzCl.setOnClickListener(mCallback84);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // itemListener
        com.ustadmobile.core.controller.ClazzListItemListener itemListener = mItemListener;
        // itemListener != null
        boolean itemListenerJavaLangObjectNull = false;
        // clazz
        com.ustadmobile.lib.db.entities.ClazzWithListDisplayDetails clazz = mClazz;



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



            itemListener.onClickClazz(clazz);
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): clazz
        flag 1 (0x2L): itemListener
        flag 2 (0x3L): null
        flag 3 (0x4L): ClazzExtKt.isAttendanceEnabledAndRecorded(clazz) ? View.VISIBLE : View.GONE
        flag 4 (0x5L): ClazzExtKt.isAttendanceEnabledAndRecorded(clazz) ? View.VISIBLE : View.GONE
        flag 5 (0x6L): clazz.clazzActiveEnrolment != null ? View.VISIBLE : View.GONE
        flag 6 (0x7L): clazz.clazzActiveEnrolment != null ? View.VISIBLE : View.GONE
    flag mapping end*/
    //end
}