// Path: library/src/main/java/eu/inloop/viewmodel/base/ViewModelBaseActivity.java
// public abstract class ViewModelBaseActivity<T extends IView, R extends AbstractViewModel<T>> extends ViewModelBaseEmptyActivity implements IView  {
// 
//     @NonNull
//     private final ViewModelHelper<T, R> mViewModeHelper = new ViewModelHelper<>();
// 
//     @CallSuper
//     @Override
//     protected void onCreate(@Nullable final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         
//         Class<? extends AbstractViewModel<T>> viewModelClass = getViewModelClass();
//         // try to extract the ViewModel class from the implementation
//         if (viewModelClass == null) {
//             //noinspection unchecked
//             viewModelClass = (Class<? extends AbstractViewModel<T>>) ProxyViewHelper.getGenericType(getClass(), AbstractViewModel.class);
//         }
//         mViewModeHelper.onCreate(this, savedInstanceState, viewModelClass, getIntent().getExtras());
//     }
// 
//     /**
//      * Call this after your view is ready - usually on the end of {@link android.app.Activity#onCreate(Bundle)}
//      * @param view view
//      */
//     @SuppressWarnings("unused")
//     public void setModelView(@NonNull final T view) {
//         mViewModeHelper.setView(view);
//     }
// 
//     @Nullable
//     public Class<R> getViewModelClass() {
//         return null;
//     }
// 
//     @CallSuper
//     @Override
//     public void onSaveInstanceState(@NonNull final Bundle outState) {
//         super.onSaveInstanceState(outState);
//         mViewModeHelper.onSaveInstanceState(outState);
//     }
// 
//     @CallSuper
//     @Override
//     public void onStart() {
//         super.onStart();
//         mViewModeHelper.onStart();
//     }
// 
//     @CallSuper
//     @Override
//     public void onStop() {
//         super.onStop();
//         mViewModeHelper.onStop();
//     }
// 
//     @CallSuper
//     @Override
//     public void onDestroy() {
//         mViewModeHelper.onDestroy(this);
//         super.onDestroy();
//     }
// 
//     /**
//      * @see ViewModelHelper#getViewModel()
//      */
//     @SuppressWarnings("unused")
//     @NonNull
//     public R getViewModel() {
//         return mViewModeHelper.getViewModel();
//     }
// 
//     @Override
//     public void removeViewModel() {
//         mViewModeHelper.removeViewModel(this);
//     }
// 
//     @Nullable
//     @Override
//     public ViewModelBindingConfig getViewModelBindingConfig() {
//         return null;
//     }
// }
// 
// Path: library/src/androidTest/java/eu/inloop/viewmodel/fixture/fragment/VMTestFragment.java
// public class VMTestFragment extends ViewModelBaseFragment<IVMTestFragmentView, VMTestFragmentViewModel>
//         implements IVMTestFragmentView {
// 
//     @Nullable
//     @Override
//     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return new LinearLayout(getContext());
//     }
// 
//     @Override
//     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         setModelView(this);
//     }
// 
//     @Override
//     public void onLoadData(boolean loaded) {
//         requireActivity().setResult(VMTestActivity.RESULT_CODE_OK);
//         requireActivity().finish();
//     }
// }


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.widget.LinearLayout;
import eu.inloop.viewmodel.base.ViewModelBaseActivity;
import eu.inloop.viewmodel.fixture.fragment.VMTestFragment;

        LinearLayout view = new LinearLayout(this);
        view.setId(android.R.id.content);
        setContentView(view);

        if (savedInstanceState == null) {
            addTestFragment();
        }

        setModelView(this);
    }

    public void addTestFragment() {
        getSupportFragmentManager()
                .beginTransaction()
                .add(android.R.id.content, new VMTestFragment())
                .commitNow();
    }

    public void removeTestFragment() {
        getSupportFragmentManager()
                .beginTransaction()
                .remove(getTestFragment())
                .commitNow();
    }

    @NonNull
    public VMTestFragment getTestFragment() {
        for (Fragment fragment : getSupportFragmentManager().getFragments()) {
            if (fragment instanceof VMTestFragment) {
// Path: library/src/main/java/eu/inloop/viewmodel/base/ViewModelBaseActivity.java
// public abstract class ViewModelBaseActivity<T extends IView, R extends AbstractViewModel<T>> extends ViewModelBaseEmptyActivity implements IView  {
// 
//     @NonNull
//     private final ViewModelHelper<T, R> mViewModeHelper = new ViewModelHelper<>();
// 
//     @CallSuper
//     @Override
//     protected void onCreate(@Nullable final Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         
//         Class<? extends AbstractViewModel<T>> viewModelClass = getViewModelClass();
//         // try to extract the ViewModel class from the implementation
//         if (viewModelClass == null) {
//             //noinspection unchecked
//             viewModelClass = (Class<? extends AbstractViewModel<T>>) ProxyViewHelper.getGenericType(getClass(), AbstractViewModel.class);
//         }
//         mViewModeHelper.onCreate(this, savedInstanceState, viewModelClass, getIntent().getExtras());
//     }
// 
//     /**
//      * Call this after your view is ready - usually on the end of {@link android.app.Activity#onCreate(Bundle)}
//      * @param view view
//      */
//     @SuppressWarnings("unused")
//     public void setModelView(@NonNull final T view) {
//         mViewModeHelper.setView(view);
//     }
// 
//     @Nullable
//     public Class<R> getViewModelClass() {
//         return null;
//     }
// 
//     @CallSuper
//     @Override
//     public void onSaveInstanceState(@NonNull final Bundle outState) {
//         super.onSaveInstanceState(outState);
//         mViewModeHelper.onSaveInstanceState(outState);
//     }
// 
//     @CallSuper
//     @Override
//     public void onStart() {
//         super.onStart();
//         mViewModeHelper.onStart();
//     }
// 
//     @CallSuper
//     @Override
//     public void onStop() {
//         super.onStop();
//         mViewModeHelper.onStop();
//     }
// 
//     @CallSuper
//     @Override
//     public void onDestroy() {
//         mViewModeHelper.onDestroy(this);
//         super.onDestroy();
//     }
// 
//     /**
//      * @see ViewModelHelper#getViewModel()
//      */
//     @SuppressWarnings("unused")
//     @NonNull
//     public R getViewModel() {
//         return mViewModeHelper.getViewModel();
//     }
// 
//     @Override
//     public void removeViewModel() {
//         mViewModeHelper.removeViewModel(this);
//     }
// 
//     @Nullable
//     @Override
//     public ViewModelBindingConfig getViewModelBindingConfig() {
//         return null;
//     }
// }
// 
// Path: library/src/androidTest/java/eu/inloop/viewmodel/fixture/fragment/VMTestFragment.java
// public class VMTestFragment extends ViewModelBaseFragment<IVMTestFragmentView, VMTestFragmentViewModel>
//         implements IVMTestFragmentView {
// 
//     @Nullable
//     @Override
//     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         return new LinearLayout(getContext());
//     }
// 
//     @Override
//     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         setModelView(this);
//     }
// 
//     @Override
//     public void onLoadData(boolean loaded) {
//         requireActivity().setResult(VMTestActivity.RESULT_CODE_OK);
//         requireActivity().finish();
//     }
// }


// Path: library/src/androidTest/java/eu/inloop/viewmodel/fixture/activity/VMTestActivity.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.widget.LinearLayout;
import eu.inloop.viewmodel.base.ViewModelBaseActivity;
import eu.inloop.viewmodel.fixture.fragment.VMTestFragment;


        LinearLayout view = new LinearLayout(this);
        view.setId(android.R.id.content);
        setContentView(view);

        if (savedInstanceState == null) {
            addTestFragment();
        }

        setModelView(this);
    }

    public void addTestFragment() {
        getSupportFragmentManager()
                .beginTransaction()
                .add(android.R.id.content, new VMTestFragment())
                .commitNow();
    }

    public void removeTestFragment() {
        getSupportFragmentManager()
                .beginTransaction()
                .remove(getTestFragment())
                .commitNow();
    }

    @NonNull
    public VMTestFragment getTestFragment() {
        for (Fragment fragment : getSupportFragmentManager().getFragments()) {
            if (fragment instanceof VMTestFragment) {
                return (VMTestFragment) fragment;