package it.integry.integrywmsnative.view.bottomsheet.viewmodel;

import androidx.databinding.ObservableList;

import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnSimpleListChangedCallback;

public class SimpleListChangedCallback extends ObservableList.OnListChangedCallback {

    private IOnSimpleListChangedCallback mOnSimpleListChangedCallback;

    public SimpleListChangedCallback(IOnSimpleListChangedCallback onSimpleListChangedCallback) {
        mOnSimpleListChangedCallback = onSimpleListChangedCallback;
    }

    @Override
    public void onChanged(ObservableList sender) {
        mOnSimpleListChangedCallback.onChange();
    }

    @Override
    public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
        mOnSimpleListChangedCallback.onChange();
    }

    @Override
    public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
        mOnSimpleListChangedCallback.onChange();
    }

    @Override
    public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
        mOnSimpleListChangedCallback.onChange();
    }

    @Override
    public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
        mOnSimpleListChangedCallback.onChange();
        mOnSimpleListChangedCallback.onChange();
    }
}
