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 ItemSiteBindingImpl extends ItemSiteBinding  {

    @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.site_name_icon, 4);
        sViewsWithIds.put(R.id.site_name_label, 5);
        sViewsWithIds.put(R.id.site_guest_icon, 6);
        sViewsWithIds.put(R.id.guest_label, 7);
        sViewsWithIds.put(R.id.register_allow_icon, 8);
        sViewsWithIds.put(R.id.registration_allowed_label, 9);
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemSiteBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 10, sIncludes, sViewsWithIds));
    }
    private ItemSiteBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (android.widget.TextView) bindings[7]
            , (android.widget.ImageView) bindings[8]
            , (android.widget.TextView) bindings[3]
            , (android.widget.TextView) bindings[9]
            , (android.widget.ImageView) bindings[6]
            , (android.widget.ImageView) bindings[4]
            , (android.widget.TextView) bindings[5]
            , (android.widget.TextView) bindings[1]
            , (android.widget.TextView) bindings[2]
            );
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        this.registerAllowedText.setTag(null);
        this.siteNameText.setTag(null);
        this.workspaceGuestText.setTag(null);
        setRootTag(root);
        // listeners
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x2L;
        }
        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.site == variableId) {
            setSite((com.ustadmobile.lib.db.entities.Site) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setSite(@Nullable com.ustadmobile.lib.db.entities.Site Site) {
        this.mSite = Site;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.site);
        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;
        }
        com.ustadmobile.lib.db.entities.Site site = mSite;
        java.lang.String siteGuestLoginWorkspaceGuestTextAndroidStringYesWorkspaceGuestTextAndroidStringNo = null;
        java.lang.String siteSiteName = null;
        boolean siteGuestLogin = false;
        boolean siteRegistrationAllowed = false;
        java.lang.String siteRegistrationAllowedRegisterAllowedTextAndroidStringYesRegisterAllowedTextAndroidStringNo = null;

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



                if (site != null) {
                    // read site.siteName
                    siteSiteName = site.getSiteName();
                    // read site.guestLogin
                    siteGuestLogin = site.getGuestLogin();
                    // read site.registrationAllowed
                    siteRegistrationAllowed = site.getRegistrationAllowed();
                }
            if((dirtyFlags & 0x3L) != 0) {
                if(siteGuestLogin) {
                        dirtyFlags |= 0x8L;
                }
                else {
                        dirtyFlags |= 0x4L;
                }
            }
            if((dirtyFlags & 0x3L) != 0) {
                if(siteRegistrationAllowed) {
                        dirtyFlags |= 0x20L;
                }
                else {
                        dirtyFlags |= 0x10L;
                }
            }


                // read site.guestLogin ? @android:string/yes : @android:string/no
                siteGuestLoginWorkspaceGuestTextAndroidStringYesWorkspaceGuestTextAndroidStringNo = ((siteGuestLogin) ? (workspaceGuestText.getResources().getString(R.string.yes)) : (workspaceGuestText.getResources().getString(R.string.no)));
                // read site.registrationAllowed ? @android:string/yes : @android:string/no
                siteRegistrationAllowedRegisterAllowedTextAndroidStringYesRegisterAllowedTextAndroidStringNo = ((siteRegistrationAllowed) ? (registerAllowedText.getResources().getString(R.string.yes)) : (registerAllowedText.getResources().getString(R.string.no)));
        }
        // batch finished
        if ((dirtyFlags & 0x3L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.registerAllowedText, siteRegistrationAllowedRegisterAllowedTextAndroidStringYesRegisterAllowedTextAndroidStringNo);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.siteNameText, siteSiteName);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.workspaceGuestText, siteGuestLoginWorkspaceGuestTextAndroidStringYesWorkspaceGuestTextAndroidStringNo);
        }
    }
    // Listener Stub Implementations
    // callback impls
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): site
        flag 1 (0x2L): null
        flag 2 (0x3L): site.guestLogin ? @android:string/yes : @android:string/no
        flag 3 (0x4L): site.guestLogin ? @android:string/yes : @android:string/no
        flag 4 (0x5L): site.registrationAllowed ? @android:string/yes : @android:string/no
        flag 5 (0x6L): site.registrationAllowed ? @android:string/yes : @android:string/no
    flag mapping end*/
    //end
}