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 ItemAccountListBindingImpl extends ItemAccountListBinding 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.account_user_icon, 9);
        sViewsWithIds.put(R.id.account_link_icon, 10);
        sViewsWithIds.put(R.id.labelBarrier, 11);
        sViewsWithIds.put(R.id.dividerBarrier, 12);
    }
    // views
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback90;
    @Nullable
    private final android.view.View.OnClickListener mCallback91;
    @Nullable
    private final android.view.View.OnClickListener mCallback89;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemAccountListBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 13, sIncludes, sViewsWithIds));
    }
    private ItemAccountListBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (com.google.android.material.button.MaterialButton) bindings[2]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[10]
            , (com.google.android.material.button.MaterialButton) bindings[7]
            , (com.google.android.material.button.MaterialButton) bindings[6]
            , (androidx.appcompat.widget.AppCompatImageView) bindings[9]
            , (android.view.View) bindings[8]
            , (androidx.constraintlayout.widget.Barrier) bindings[12]
            , (androidx.constraintlayout.widget.ConstraintLayout) bindings[0]
            , (androidx.constraintlayout.widget.Barrier) bindings[11]
            , (android.widget.TextView) bindings[3]
            , (android.widget.TextView) bindings[5]
            , (de.hdodenhof.circleimageview.CircleImageView) bindings[1]
            , (android.widget.TextView) bindings[4]
            );
        this.accountDeleteIcon.setTag(null);
        this.accountLogout.setTag(null);
        this.accountProfile.setTag(null);
        this.divider.setTag(null);
        this.itemAccountList.setTag(null);
        this.personFullName.setTag(null);
        this.personLink.setTag(null);
        this.personProfileIcon.setTag(null);
        this.personUsername.setTag(null);
        setRootTag(root);
        // listeners
        mCallback90 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        mCallback91 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 3);
        mCallback89 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x20L;
        }
        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.logoutBtnVisibility == variableId) {
            setLogoutBtnVisibility((java.lang.Integer) variable);
        }
        else if (BR.profileBtnVisibility == variableId) {
            setProfileBtnVisibility((java.lang.Integer) variable);
        }
        else if (BR.presenter == variableId) {
            setPresenter((com.ustadmobile.core.controller.AccountListPresenter) variable);
        }
        else if (BR.activeAccount == variableId) {
            setActiveAccount((boolean) variable);
        }
        else if (BR.session == variableId) {
            setSession((com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setLogoutBtnVisibility(@Nullable java.lang.Integer LogoutBtnVisibility) {
        this.mLogoutBtnVisibility = LogoutBtnVisibility;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.logoutBtnVisibility);
        super.requestRebind();
    }
    public void setProfileBtnVisibility(@Nullable java.lang.Integer ProfileBtnVisibility) {
        this.mProfileBtnVisibility = ProfileBtnVisibility;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.profileBtnVisibility);
        super.requestRebind();
    }
    public void setPresenter(@Nullable com.ustadmobile.core.controller.AccountListPresenter Presenter) {
        this.mPresenter = Presenter;
        synchronized(this) {
            mDirtyFlags |= 0x4L;
        }
        notifyPropertyChanged(BR.presenter);
        super.requestRebind();
    }
    public void setActiveAccount(boolean ActiveAccount) {
        this.mActiveAccount = ActiveAccount;
        synchronized(this) {
            mDirtyFlags |= 0x8L;
        }
        notifyPropertyChanged(BR.activeAccount);
        super.requestRebind();
    }
    public void setSession(@Nullable com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint Session) {
        this.mSession = Session;
        synchronized(this) {
            mDirtyFlags |= 0x10L;
        }
        notifyPropertyChanged(BR.session);
        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;
        }
        java.lang.String sessionPersonUsername = null;
        com.ustadmobile.port.android.view.util.ForeignKeyAttachmentUriAdapter personDetailFragmentFOREIGNKEYADAPTERPERSON = null;
        java.lang.String sessionEndpointUrl = null;
        java.lang.Integer logoutBtnVisibility = mLogoutBtnVisibility;
        java.lang.Integer profileBtnVisibility = mProfileBtnVisibility;
        int androidxDatabindingViewDataBindingSafeUnboxProfileBtnVisibility = 0;
        java.lang.String sessionPersonFirstNames = null;
        com.ustadmobile.core.controller.AccountListPresenter presenter = mPresenter;
        com.ustadmobile.lib.db.entities.Person sessionPerson = null;
        float profileBtnVisibilityViewGONEAccountLogoutAndroidDimenDimen70dpAccountLogoutAndroidDimenDimen16dp = 0f;
        java.lang.String sessionPersonFirstNamesJavaLangString = null;
        boolean activeAccount = mActiveAccount;
        com.ustadmobile.core.account.Endpoint sessionEndpoint = null;
        com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint session = mSession;
        java.lang.String sessionPersonFirstNamesJavaLangStringSessionPersonLastName = null;
        int androidxDatabindingViewDataBindingSafeUnboxLogoutBtnVisibility = 0;
        long sessionPersonPersonUid = 0;
        int activeAccountViewVISIBLEViewGONE = 0;
        boolean profileBtnVisibilityViewGONE = false;
        int activeAccountViewGONEViewVISIBLE = 0;
        java.lang.String sessionPersonLastName = null;

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

                // read PersonDetailFragment.FOREIGNKEYADAPTER_PERSON
                personDetailFragmentFOREIGNKEYADAPTERPERSON = com.ustadmobile.port.android.view.PersonDetailFragment.getFOREIGNKEYADAPTER_PERSON();
        }
        if ((dirtyFlags & 0x21L) != 0) {



                // read androidx.databinding.ViewDataBinding.safeUnbox(logoutBtnVisibility)
                androidxDatabindingViewDataBindingSafeUnboxLogoutBtnVisibility = androidx.databinding.ViewDataBinding.safeUnbox(logoutBtnVisibility);
        }
        if ((dirtyFlags & 0x22L) != 0) {



                // read androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility)
                androidxDatabindingViewDataBindingSafeUnboxProfileBtnVisibility = androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility);


                // read androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility) == View.GONE
                profileBtnVisibilityViewGONE = (androidxDatabindingViewDataBindingSafeUnboxProfileBtnVisibility) == (android.view.View.GONE);
            if((dirtyFlags & 0x22L) != 0) {
                if(profileBtnVisibilityViewGONE) {
                        dirtyFlags |= 0x80L;
                }
                else {
                        dirtyFlags |= 0x40L;
                }
            }


                // read androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility) == View.GONE ? @android:dimen/dimen_70dp : @android:dimen/dimen_16dp
                profileBtnVisibilityViewGONEAccountLogoutAndroidDimenDimen70dpAccountLogoutAndroidDimenDimen16dp = ((profileBtnVisibilityViewGONE) ? (accountLogout.getResources().getDimension(R.dimen.dimen_70dp)) : (accountLogout.getResources().getDimension(R.dimen.dimen_16dp)));
        }
        if ((dirtyFlags & 0x28L) != 0) {

            if((dirtyFlags & 0x28L) != 0) {
                if(activeAccount) {
                        dirtyFlags |= 0x200L;
                        dirtyFlags |= 0x800L;
                }
                else {
                        dirtyFlags |= 0x100L;
                        dirtyFlags |= 0x400L;
                }
            }


                // read activeAccount ? View.VISIBLE : View.GONE
                activeAccountViewVISIBLEViewGONE = ((activeAccount) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
                // read activeAccount ? View.GONE : View.VISIBLE
                activeAccountViewGONEViewVISIBLE = ((activeAccount) ? (android.view.View.GONE) : (android.view.View.VISIBLE));
        }
        if ((dirtyFlags & 0x30L) != 0) {



                if (session != null) {
                    // read session.person
                    sessionPerson = session.getPerson();
                    // read session.endpoint
                    sessionEndpoint = session.getEndpoint();
                }


                if (sessionPerson != null) {
                    // read session.person.username
                    sessionPersonUsername = sessionPerson.getUsername();
                    // read session.person.firstNames
                    sessionPersonFirstNames = sessionPerson.getFirstNames();
                    // read session.person.personUid
                    sessionPersonPersonUid = sessionPerson.getPersonUid();
                    // read session.person.lastName
                    sessionPersonLastName = sessionPerson.getLastName();
                }
                if (sessionEndpoint != null) {
                    // read session.endpoint.url
                    sessionEndpointUrl = sessionEndpoint.getUrl();
                }


                // read (session.person.firstNames) + (" ")
                sessionPersonFirstNamesJavaLangString = (sessionPersonFirstNames) + (" ");


                // read ((session.person.firstNames) + (" ")) + (session.person.lastName)
                sessionPersonFirstNamesJavaLangStringSessionPersonLastName = (sessionPersonFirstNamesJavaLangString) + (sessionPersonLastName);
        }
        // batch finished
        if ((dirtyFlags & 0x28L) != 0) {
            // api target 1

            this.accountDeleteIcon.setVisibility(activeAccountViewGONEViewVISIBLE);
            this.divider.setVisibility(activeAccountViewVISIBLEViewGONE);
        }
        if ((dirtyFlags & 0x20L) != 0) {
            // api target 1

            this.accountDeleteIcon.setOnClickListener(mCallback89);
            this.accountLogout.setOnClickListener(mCallback91);
            this.accountProfile.setOnClickListener(mCallback90);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.accountProfile, java.lang.String.format(accountProfile.getResources().getString(R.string.my), accountProfile.getResources().getString(R.string.profile)));
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKeyAdapter(this.personProfileIcon, personDetailFragmentFOREIGNKEYADAPTERPERSON);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.imageForeignKeyPlaceholder(this.personProfileIcon, androidx.appcompat.content.res.AppCompatResources.getDrawable(personProfileIcon.getContext(), R.drawable.ic_account_circle_black_24dp));
        }
        if ((dirtyFlags & 0x22L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ViewBindingsKt.setMarginStartValue(this.accountLogout, profileBtnVisibilityViewGONEAccountLogoutAndroidDimenDimen70dpAccountLogoutAndroidDimenDimen16dp);
            this.accountProfile.setVisibility(androidxDatabindingViewDataBindingSafeUnboxProfileBtnVisibility);
        }
        if ((dirtyFlags & 0x21L) != 0) {
            // api target 1

            this.accountLogout.setVisibility(androidxDatabindingViewDataBindingSafeUnboxLogoutBtnVisibility);
        }
        if ((dirtyFlags & 0x30L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.personFullName, sessionPersonFirstNamesJavaLangStringSessionPersonLastName);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.personLink, sessionEndpointUrl);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKey(this.personProfileIcon, sessionPersonPersonUid, sessionEndpointUrl);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.personUsername, sessionPersonUsername);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 2: {
                // localize variables for thread safety
                // presenter != null
                boolean presenterJavaLangObjectNull = false;
                // presenter
                com.ustadmobile.core.controller.AccountListPresenter presenter = mPresenter;
                // session.person != null
                boolean sessionPersonJavaLangObjectNull = false;
                // session
                com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint session = mSession;
                // session.person.personUid
                long sessionPersonPersonUid = 0;
                // session != null
                boolean sessionJavaLangObjectNull = false;
                // session.person
                com.ustadmobile.lib.db.entities.Person sessionPerson = null;



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



                    sessionJavaLangObjectNull = (session) != (null);
                    if (sessionJavaLangObjectNull) {


                        sessionPerson = session.getPerson();

                        sessionPersonJavaLangObjectNull = (sessionPerson) != (null);
                        if (sessionPersonJavaLangObjectNull) {


                            sessionPersonPersonUid = sessionPerson.getPersonUid();

                            presenter.handleClickProfile(sessionPersonPersonUid);
                        }
                    }
                }
                break;
            }
            case 3: {
                // localize variables for thread safety
                // presenter != null
                boolean presenterJavaLangObjectNull = false;
                // presenter
                com.ustadmobile.core.controller.AccountListPresenter presenter = mPresenter;
                // session
                com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint session = mSession;



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



                    presenter.handleClickLogout(session);
                }
                break;
            }
            case 1: {
                // localize variables for thread safety
                // presenter != null
                boolean presenterJavaLangObjectNull = false;
                // presenter
                com.ustadmobile.core.controller.AccountListPresenter presenter = mPresenter;
                // session
                com.ustadmobile.core.account.UserSessionWithPersonAndEndpoint session = mSession;



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



                    presenter.handleClickDeleteSession(session);
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): logoutBtnVisibility
        flag 1 (0x2L): profileBtnVisibility
        flag 2 (0x3L): presenter
        flag 3 (0x4L): activeAccount
        flag 4 (0x5L): session
        flag 5 (0x6L): null
        flag 6 (0x7L): androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility) == View.GONE ? @android:dimen/dimen_70dp : @android:dimen/dimen_16dp
        flag 7 (0x8L): androidx.databinding.ViewDataBinding.safeUnbox(profileBtnVisibility) == View.GONE ? @android:dimen/dimen_70dp : @android:dimen/dimen_16dp
        flag 8 (0x9L): activeAccount ? View.VISIBLE : View.GONE
        flag 9 (0xaL): activeAccount ? View.VISIBLE : View.GONE
        flag 10 (0xbL): activeAccount ? View.GONE : View.VISIBLE
        flag 11 (0xcL): activeAccount ? View.GONE : View.VISIBLE
    flag mapping end*/
    //end
}