// Path: library/src/main/java/eu/inloop/viewmodel/binding/ViewModelBindingConfig.java
// public class ViewModelBindingConfig {
// 
//     @LayoutRes
//     private final int mLayoutResource;
//     private final int mViewModelVariableName;
//     @NonNull
//     private final Context mContext;
// 
//     /**
//      * Create a ViewModelBinding Config object for an Activity/Fragment
//      * This constructor should be used if the binding variable is named differently
//      *
//      * @param layoutResource        Layout resource ID
//      * @param viewModelVariableName Data Binding variable name for injecting the ViewModel - use
//      *                              generated id (e.g. BR.mViewModel)
//      */
//     public ViewModelBindingConfig(@LayoutRes int layoutResource, int viewModelVariableName, @NonNull Context context) {
//         mLayoutResource = layoutResource;
//         mViewModelVariableName = viewModelVariableName;
//         mContext = context;
//     }
// 
//     /**
//      * Create a ViewModelBinding Config object for an Activity/Fragment
//      * Use this constructor if the binding variable is named viewModel
//      *
//      * @param layoutResource Layout resource ID
//      */
//     public ViewModelBindingConfig(@LayoutRes int layoutResource, @NonNull Context context) {
//         this(layoutResource, BR.viewModel, context);
//     }
// 
//     @LayoutRes
//     public int getLayoutResource() {
//         return mLayoutResource;
//     }
// 
//     public int getViewModelVariableName() {
//         return mViewModelVariableName;
//     }
// 
//     @NonNull
//     public Context getContext() {
//         return mContext;
//     }
// }


import android.app.Activity;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import java.util.UUID;
import eu.inloop.viewmodel.binding.ViewModelBindingConfig;
                Log.d("model", "Fragment recreated by system or ViewModelStatePagerAdapter - restoring viewmodel"); //NON-NLS
            }
            mViewModel.onCreate(arguments, savedInstanceState);
        }
    }

    /**
     * Call from {@link androidx.core.app.Fragment#onViewCreated(android.view.View, android.os.Bundle)}
     * or {@link android.app.Activity#onCreate(android.os.Bundle)}
     *
     * @param view view
     */
    public void setView(@NonNull final T view) {
        if (mViewModel == null) {
            //no viewmodel for this fragment
            return;
        }
        mViewModel.onBindView(view);
    }

    public void performBinding(@NonNull final IView bindingView) {
        // skip if already create
        if (mBinding != null) {
            return;
        }

        // get ViewModelBinding config
        final ViewModelBindingConfig viewModelConfig = bindingView.getViewModelBindingConfig();
        // if fragment not providing ViewModelBindingConfig, do not perform binding operations
        if (viewModelConfig == null) {
// Path: library/src/main/java/eu/inloop/viewmodel/binding/ViewModelBindingConfig.java
// public class ViewModelBindingConfig {
// 
//     @LayoutRes
//     private final int mLayoutResource;
//     private final int mViewModelVariableName;
//     @NonNull
//     private final Context mContext;
// 
//     /**
//      * Create a ViewModelBinding Config object for an Activity/Fragment
//      * This constructor should be used if the binding variable is named differently
//      *
//      * @param layoutResource        Layout resource ID
//      * @param viewModelVariableName Data Binding variable name for injecting the ViewModel - use
//      *                              generated id (e.g. BR.mViewModel)
//      */
//     public ViewModelBindingConfig(@LayoutRes int layoutResource, int viewModelVariableName, @NonNull Context context) {
//         mLayoutResource = layoutResource;
//         mViewModelVariableName = viewModelVariableName;
//         mContext = context;
//     }
// 
//     /**
//      * Create a ViewModelBinding Config object for an Activity/Fragment
//      * Use this constructor if the binding variable is named viewModel
//      *
//      * @param layoutResource Layout resource ID
//      */
//     public ViewModelBindingConfig(@LayoutRes int layoutResource, @NonNull Context context) {
//         this(layoutResource, BR.viewModel, context);
//     }
// 
//     @LayoutRes
//     public int getLayoutResource() {
//         return mLayoutResource;
//     }
// 
//     public int getViewModelVariableName() {
//         return mViewModelVariableName;
//     }
// 
//     @NonNull
//     public Context getContext() {
//         return mContext;
//     }
// }


// Path: library/src/main/java/eu/inloop/viewmodel/ViewModelHelper.java
import android.app.Activity;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import java.util.UUID;
import eu.inloop.viewmodel.binding.ViewModelBindingConfig;

                Log.d("model", "Fragment recreated by system or ViewModelStatePagerAdapter - restoring viewmodel"); //NON-NLS
            }
            mViewModel.onCreate(arguments, savedInstanceState);
        }
    }

    /**
     * Call from {@link androidx.core.app.Fragment#onViewCreated(android.view.View, android.os.Bundle)}
     * or {@link android.app.Activity#onCreate(android.os.Bundle)}
     *
     * @param view view
     */
    public void setView(@NonNull final T view) {
        if (mViewModel == null) {
            //no viewmodel for this fragment
            return;
        }
        mViewModel.onBindView(view);
    }

    public void performBinding(@NonNull final IView bindingView) {
        // skip if already create
        if (mBinding != null) {
            return;
        }

        // get ViewModelBinding config
        final ViewModelBindingConfig viewModelConfig = bindingView.getViewModelBindingConfig();
        // if fragment not providing ViewModelBindingConfig, do not perform binding operations
        if (viewModelConfig == null) {
            return;