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 ItemSchoolListItemBindingImpl extends ItemSchoolListItemBinding 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.barrierLoc, 5);
        sViewsWithIds.put(R.id.barrierMemberDetails, 6);
        sViewsWithIds.put(R.id.item_school_list_item_members_iv, 7);
        sViewsWithIds.put(R.id.imageView10, 8);
    }
    // views
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback115;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemSchoolListItemBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 9, sIncludes, sViewsWithIds));
    }
    private ItemSchoolListItemBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.constraintlayout.widget.Barrier) bindings[5]
            , (androidx.constraintlayout.widget.Barrier) bindings[6]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[8]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[2]
            , (android.widget.TextView) bindings[3]
            , (android.widget.ImageView) bindings[7]
            , (android.widget.TextView) bindings[4]
            , (android.widget.TextView) bindings[1]
            );
        this.itemSchoolListItemCl.setTag(null);
        this.itemSchoolListItemLocationIv.setTag(null);
        this.itemSchoolListItemLocationName.setTag(null);
        this.itemSchoolListItemMembersTv.setTag(null);
        this.itemSchoolListItemSchoolName.setTag(null);
        setRootTag(root);
        // listeners
        mCallback115 = 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.presenter == variableId) {
            setPresenter((com.ustadmobile.core.controller.SchoolListPresenter) variable);
        }
        else if (BR.school == variableId) {
            setSchool((com.ustadmobile.lib.db.entities.SchoolWithMemberCountAndLocation) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setPresenter(@Nullable com.ustadmobile.core.controller.SchoolListPresenter Presenter) {
        this.mPresenter = Presenter;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.presenter);
        super.requestRebind();
    }
    public void setSchool(@Nullable com.ustadmobile.lib.db.entities.SchoolWithMemberCountAndLocation School) {
        this.mSchool = School;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.school);
        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 schoolNumStudents = 0;
        java.lang.String schoolSchoolAddress = null;
        int stringExtKtVisibleIfNotNullOrEmptySchoolSchoolAddress = 0;
        java.lang.String itemSchoolListItemMembersTvAndroidStringNumItemsWithNameWithCommaSchoolNumStudentsItemSchoolListItemMembersTvAndroidStringStudentsSchoolNumTeachersItemSchoolListItemMembersTvAndroidStringTeachersLiteral = null;
        int schoolNumTeachers = 0;
        com.ustadmobile.core.controller.SchoolListPresenter presenter = mPresenter;
        com.ustadmobile.lib.db.entities.SchoolWithMemberCountAndLocation school = mSchool;
        java.lang.String schoolSchoolName = null;

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



                if (school != null) {
                    // read school.numStudents
                    schoolNumStudents = school.getNumStudents();
                    // read school.schoolAddress
                    schoolSchoolAddress = school.getSchoolAddress();
                    // read school.numTeachers
                    schoolNumTeachers = school.getNumTeachers();
                    // read school.schoolName
                    schoolSchoolName = school.getSchoolName();
                }


                // read StringExtKt.visibleIfNotNullOrEmpty(school.schoolAddress)
                stringExtKtVisibleIfNotNullOrEmptySchoolSchoolAddress = com.ustadmobile.port.android.view.ext.StringExtKt.visibleIfNotNullOrEmpty(schoolSchoolAddress);
                // read @android:string/num_items_with_name_with_comma
                itemSchoolListItemMembersTvAndroidStringNumItemsWithNameWithCommaSchoolNumStudentsItemSchoolListItemMembersTvAndroidStringStudentsSchoolNumTeachersItemSchoolListItemMembersTvAndroidStringTeachersLiteral = itemSchoolListItemMembersTv.getResources().getString(R.string.num_items_with_name_with_comma, schoolNumStudents, itemSchoolListItemMembersTv.getResources().getString(R.string.students), schoolNumTeachers, itemSchoolListItemMembersTv.getResources().getString(R.string.teachers_literal));
        }
        // batch finished
        if ((dirtyFlags & 0x4L) != 0) {
            // api target 1

            this.itemSchoolListItemCl.setOnClickListener(mCallback115);
        }
        if ((dirtyFlags & 0x6L) != 0) {
            // api target 1

            this.itemSchoolListItemLocationIv.setVisibility(stringExtKtVisibleIfNotNullOrEmptySchoolSchoolAddress);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemSchoolListItemLocationName, schoolSchoolAddress);
            this.itemSchoolListItemLocationName.setVisibility(stringExtKtVisibleIfNotNullOrEmptySchoolSchoolAddress);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemSchoolListItemMembersTv, itemSchoolListItemMembersTvAndroidStringNumItemsWithNameWithCommaSchoolNumStudentsItemSchoolListItemMembersTvAndroidStringStudentsSchoolNumTeachersItemSchoolListItemMembersTvAndroidStringTeachersLiteral);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemSchoolListItemSchoolName, schoolSchoolName);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        // localize variables for thread safety
        // presenter != null
        boolean presenterJavaLangObjectNull = false;
        // presenter
        com.ustadmobile.core.controller.SchoolListPresenter presenter = mPresenter;
        // school
        com.ustadmobile.lib.db.entities.SchoolWithMemberCountAndLocation school = mSchool;



        presenterJavaLangObjectNull = (presenter) != (null);
        if (presenterJavaLangObjectNull) {



            presenter.handleClickEntry(school);
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): presenter
        flag 1 (0x2L): school
        flag 2 (0x3L): null
    flag mapping end*/
    //end
}