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 ItemReportChartHeaderBindingImpl extends ItemReportChartHeaderBinding 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.chart_view, 4);
        sViewsWithIds.put(R.id.button_barrier, 5);
        sViewsWithIds.put(R.id.xapi_space, 6);
        sViewsWithIds.put(R.id.xapi_person_header, 7);
        sViewsWithIds.put(R.id.guideline_person, 8);
        sViewsWithIds.put(R.id.xapi_verb_header, 9);
        sViewsWithIds.put(R.id.guideline_verb, 10);
        sViewsWithIds.put(R.id.xapi_result_header, 11);
        sViewsWithIds.put(R.id.guideline_result, 12);
        sViewsWithIds.put(R.id.xapi_when_header, 13);
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    @Nullable
    private final android.view.View.OnClickListener mCallback69;
    @Nullable
    private final android.view.View.OnClickListener mCallback67;
    @Nullable
    private final android.view.View.OnClickListener mCallback68;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ItemReportChartHeaderBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 14, sIncludes, sViewsWithIds));
    }
    private ItemReportChartHeaderBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (androidx.constraintlayout.widget.Barrier) bindings[5]
            , (com.ustadmobile.port.android.view.XapiChartView) bindings[4]
            , (android.widget.TextView) bindings[1]
            , (androidx.constraintlayout.widget.Guideline) bindings[8]
            , (androidx.constraintlayout.widget.Guideline) bindings[12]
            , (androidx.constraintlayout.widget.Guideline) bindings[10]
            , (android.widget.TextView) bindings[2]
            , (android.widget.TextView) bindings[3]
            , (android.widget.TextView) bindings[7]
            , (android.widget.TextView) bindings[11]
            , (android.widget.Space) bindings[6]
            , (android.widget.TextView) bindings[9]
            , (android.widget.TextView) bindings[13]
            );
        this.exportButton.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        this.previewAddToDashboardButton.setTag(null);
        this.templateButton.setTag(null);
        setRootTag(root);
        // listeners
        mCallback69 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 3);
        mCallback67 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 1);
        mCallback68 = new com.toughra.ustadmobile.generated.callback.OnClickListener(this, 2);
        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.saveAsTemplateVisible == variableId) {
            setSaveAsTemplateVisible((java.lang.Boolean) variable);
        }
        else if (BR.eventHandler == variableId) {
            setEventHandler((com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler) variable);
        }
        else if (BR.mPresenter == variableId) {
            setMPresenter((com.ustadmobile.core.controller.ReportDetailPresenter) variable);
        }
        else if (BR.chart == variableId) {
            setChart((com.ustadmobile.core.util.ext.ChartData) variable);
        }
        else if (BR.adapter == variableId) {
            setAdapter((com.ustadmobile.port.android.view.ReportDetailFragment.RecyclerViewChartAdapter) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setSaveAsTemplateVisible(@Nullable java.lang.Boolean SaveAsTemplateVisible) {
        this.mSaveAsTemplateVisible = SaveAsTemplateVisible;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.saveAsTemplateVisible);
        super.requestRebind();
    }
    public void setEventHandler(@Nullable com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler EventHandler) {
        this.mEventHandler = EventHandler;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.eventHandler);
        super.requestRebind();
    }
    public void setMPresenter(@Nullable com.ustadmobile.core.controller.ReportDetailPresenter MPresenter) {
        this.mMPresenter = MPresenter;
    }
    public void setChart(@Nullable com.ustadmobile.core.util.ext.ChartData Chart) {
        this.mChart = Chart;
        synchronized(this) {
            mDirtyFlags |= 0x8L;
        }
        notifyPropertyChanged(BR.chart);
        super.requestRebind();
    }
    public void setAdapter(@Nullable com.ustadmobile.port.android.view.ReportDetailFragment.RecyclerViewChartAdapter Adapter) {
        this.mAdapter = Adapter;
    }

    @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 chartReportWithFiltersReportUidInt0ViewVISIBLEViewGONE = 0;
        com.ustadmobile.lib.db.entities.ReportWithSeriesWithFilters chartReportWithFilters = null;
        int saveAsTemplateVisibleViewVISIBLEViewGONE = 0;
        java.lang.Boolean saveAsTemplateVisible = mSaveAsTemplateVisible;
        boolean androidxDatabindingViewDataBindingSafeUnboxSaveAsTemplateVisible = false;
        com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler eventHandler = mEventHandler;
        long chartReportWithFiltersReportUid = 0;
        com.ustadmobile.core.util.ext.ChartData chart = mChart;
        boolean chartReportWithFiltersReportUidInt0 = false;

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



                // read androidx.databinding.ViewDataBinding.safeUnbox(saveAsTemplateVisible)
                androidxDatabindingViewDataBindingSafeUnboxSaveAsTemplateVisible = androidx.databinding.ViewDataBinding.safeUnbox(saveAsTemplateVisible);
            if((dirtyFlags & 0x21L) != 0) {
                if(androidxDatabindingViewDataBindingSafeUnboxSaveAsTemplateVisible) {
                        dirtyFlags |= 0x200L;
                }
                else {
                        dirtyFlags |= 0x100L;
                }
            }


                // read androidx.databinding.ViewDataBinding.safeUnbox(saveAsTemplateVisible) ? View.VISIBLE : View.GONE
                saveAsTemplateVisibleViewVISIBLEViewGONE = ((androidxDatabindingViewDataBindingSafeUnboxSaveAsTemplateVisible) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
        }
        if ((dirtyFlags & 0x28L) != 0) {



                if (chart != null) {
                    // read chart.reportWithFilters
                    chartReportWithFilters = chart.getReportWithFilters();
                }


                if (chartReportWithFilters != null) {
                    // read chart.reportWithFilters.reportUid
                    chartReportWithFiltersReportUid = chartReportWithFilters.getReportUid();
                }


                // read chart.reportWithFilters.reportUid == 0
                chartReportWithFiltersReportUidInt0 = (chartReportWithFiltersReportUid) == (0);
            if((dirtyFlags & 0x28L) != 0) {
                if(chartReportWithFiltersReportUidInt0) {
                        dirtyFlags |= 0x80L;
                }
                else {
                        dirtyFlags |= 0x40L;
                }
            }


                // read chart.reportWithFilters.reportUid == 0 ? View.VISIBLE : View.GONE
                chartReportWithFiltersReportUidInt0ViewVISIBLEViewGONE = ((chartReportWithFiltersReportUidInt0) ? (android.view.View.VISIBLE) : (android.view.View.GONE));
        }
        // batch finished
        if ((dirtyFlags & 0x20L) != 0) {
            // api target 1

            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.exportButton, exportButton.getResources().getString(R.string.export));
            this.exportButton.setOnClickListener(mCallback67);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.previewAddToDashboardButton, previewAddToDashboardButton.getResources().getString(R.string.add_to, previewAddToDashboardButton.getResources().getString(R.string.dashboard)));
            this.previewAddToDashboardButton.setOnClickListener(mCallback68);
            this.templateButton.setOnClickListener(mCallback69);
        }
        if ((dirtyFlags & 0x28L) != 0) {
            // api target 1

            this.previewAddToDashboardButton.setVisibility(chartReportWithFiltersReportUidInt0ViewVISIBLEViewGONE);
        }
        if ((dirtyFlags & 0x21L) != 0) {
            // api target 1

            this.templateButton.setVisibility(saveAsTemplateVisibleViewVISIBLEViewGONE);
        }
    }
    // Listener Stub Implementations
    // callback impls
    public final void _internalCallbackOnClick(int sourceId , android.view.View callbackArg_0) {
        switch(sourceId) {
            case 3: {
                // localize variables for thread safety
                // chart
                com.ustadmobile.core.util.ext.ChartData chart = mChart;
                // chart.reportWithFilters
                com.ustadmobile.lib.db.entities.ReportWithSeriesWithFilters chartReportWithFilters = null;
                // eventHandler
                com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler eventHandler = mEventHandler;
                // eventHandler != null
                boolean eventHandlerJavaLangObjectNull = false;
                // chart != null
                boolean chartJavaLangObjectNull = false;



                eventHandlerJavaLangObjectNull = (eventHandler) != (null);
                if (eventHandlerJavaLangObjectNull) {



                    chartJavaLangObjectNull = (chart) != (null);
                    if (chartJavaLangObjectNull) {


                        chartReportWithFilters = chart.getReportWithFilters();

                        eventHandler.onClickAddAsTemplate(chartReportWithFilters);
                    }
                }
                break;
            }
            case 1: {
                // localize variables for thread safety
                // eventHandler
                com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler eventHandler = mEventHandler;
                // eventHandler != null
                boolean eventHandlerJavaLangObjectNull = false;



                eventHandlerJavaLangObjectNull = (eventHandler) != (null);
                if (eventHandlerJavaLangObjectNull) {


                    eventHandler.onClickExportButton();
                }
                break;
            }
            case 2: {
                // localize variables for thread safety
                // chart
                com.ustadmobile.core.util.ext.ChartData chart = mChart;
                // chart.reportWithFilters
                com.ustadmobile.lib.db.entities.ReportWithSeriesWithFilters chartReportWithFilters = null;
                // eventHandler
                com.ustadmobile.port.android.view.ReportDetailFragmentEventHandler eventHandler = mEventHandler;
                // eventHandler != null
                boolean eventHandlerJavaLangObjectNull = false;
                // chart != null
                boolean chartJavaLangObjectNull = false;



                eventHandlerJavaLangObjectNull = (eventHandler) != (null);
                if (eventHandlerJavaLangObjectNull) {



                    chartJavaLangObjectNull = (chart) != (null);
                    if (chartJavaLangObjectNull) {


                        chartReportWithFilters = chart.getReportWithFilters();

                        eventHandler.onClickAddToDashboard(chartReportWithFilters);
                    }
                }
                break;
            }
        }
    }
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): saveAsTemplateVisible
        flag 1 (0x2L): eventHandler
        flag 2 (0x3L): mPresenter
        flag 3 (0x4L): chart
        flag 4 (0x5L): adapter
        flag 5 (0x6L): null
        flag 6 (0x7L): chart.reportWithFilters.reportUid == 0 ? View.VISIBLE : View.GONE
        flag 7 (0x8L): chart.reportWithFilters.reportUid == 0 ? View.VISIBLE : View.GONE
        flag 8 (0x9L): androidx.databinding.ViewDataBinding.safeUnbox(saveAsTemplateVisible) ? View.VISIBLE : View.GONE
        flag 9 (0xaL): androidx.databinding.ViewDataBinding.safeUnbox(saveAsTemplateVisible) ? View.VISIBLE : View.GONE
    flag mapping end*/
    //end
}