// Path: library/src/main/java/eu/inloop/viewmodel/IViewModelProvider.java
// public interface IViewModelProvider {
// 
//     /**
//      * See {@link eu.inloop.viewmodel.base.ViewModelBaseActivity} on how to implement.
//      * @return the {@link ViewModelProvider}.
//      */
//     @Nullable
//     ViewModelProvider getViewModelProvider();
// }
// 
// Path: library/src/main/java/eu/inloop/viewmodel/ViewModelProvider.java
// public class ViewModelProvider {
// 
//     @NonNull
//     private final HashMap<String, AbstractViewModel<? extends IView>> mViewModelCache;
// 
//     @NonNull
//     public static ViewModelProvider newInstance(@NonNull final FragmentActivity activity) {
//         if (activity.getLastCustomNonConfigurationInstance() == null) {
//             return new ViewModelProvider();
//         } else {
//             return (ViewModelProvider) activity.getLastCustomNonConfigurationInstance();
//         }
//     }
// 
//     @SuppressWarnings({"deprecation", "unused"})
//     @NonNull
//     @Deprecated
//     public static ViewModelProvider newInstance(@NonNull final Activity activity) {
//         if (activity.getLastNonConfigurationInstance() == null) {
//             return new ViewModelProvider();
//         } else {
//             return (ViewModelProvider) activity.getLastNonConfigurationInstance();
//         }
//     }
// 
//     private ViewModelProvider() {
//         mViewModelCache = new HashMap<>();
//     }
// 
//     public synchronized void remove(@Nullable String modeIdentifier) {
//         mViewModelCache.remove(modeIdentifier);
//     }
// 
//     public synchronized void removeAllViewModels() {
//         mViewModelCache.clear();
//     }
// 
//     @VisibleForTesting
//     @NonNull
//     Map<String, AbstractViewModel<? extends IView>> getViewModels() {
//         return Collections.unmodifiableMap(mViewModelCache);
//     }
// 
//     @SuppressWarnings("unchecked")
//     @NonNull
//     public synchronized <T extends IView> ViewModelWrapper<T> getViewModel(@NonNull final String modelIdentifier,
//                                                                            @NonNull final Class<? extends AbstractViewModel<T>> viewModelClass) {
//         AbstractViewModel<T> instance = (AbstractViewModel<T>) mViewModelCache.get(modelIdentifier);
//         if (instance != null) {
//             return new ViewModelWrapper<>(instance, false);
//         }
// 
//         try {
//             instance = viewModelClass.newInstance();
//         } catch (final Exception ex) {
//             throw new RuntimeException(ex);
//         }
//         instance.setUniqueIdentifier(modelIdentifier);
//         mViewModelCache.put(modelIdentifier, instance);
//         return new ViewModelWrapper<>(instance, true);
//     }
// 
//     final static class ViewModelWrapper<T extends IView> {
//         @NonNull
//         final AbstractViewModel<T> viewModel;
//         final boolean wasCreated;
// 
//         private ViewModelWrapper(@NonNull AbstractViewModel<T> mViewModel, final boolean mWasCreated) {
//             this.viewModel = mViewModel;
//             this.wasCreated = mWasCreated;
//         }
//     }
// }


import android.os.Bundle;
import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import eu.inloop.viewmodel.IViewModelProvider;
import eu.inloop.viewmodel.ViewModelProvider;
package eu.inloop.viewmodel.base;



/**
 * All your activities must extend this activity - even in case your activity has no viewmodel. The fragment viewmodels are using the {@link IViewModelProvider}
 * interface to get the {@link ViewModelProvider} from the current activity.
 * You can copy this implementation in case you don't want to extend this class.
 */
public abstract class ViewModelBaseEmptyActivity extends AppCompatActivity implements IViewModelProvider {

    @Nullable
// Path: library/src/main/java/eu/inloop/viewmodel/IViewModelProvider.java
// public interface IViewModelProvider {
// 
//     /**
//      * See {@link eu.inloop.viewmodel.base.ViewModelBaseActivity} on how to implement.
//      * @return the {@link ViewModelProvider}.
//      */
//     @Nullable
//     ViewModelProvider getViewModelProvider();
// }
// 
// Path: library/src/main/java/eu/inloop/viewmodel/ViewModelProvider.java
// public class ViewModelProvider {
// 
//     @NonNull
//     private final HashMap<String, AbstractViewModel<? extends IView>> mViewModelCache;
// 
//     @NonNull
//     public static ViewModelProvider newInstance(@NonNull final FragmentActivity activity) {
//         if (activity.getLastCustomNonConfigurationInstance() == null) {
//             return new ViewModelProvider();
//         } else {
//             return (ViewModelProvider) activity.getLastCustomNonConfigurationInstance();
//         }
//     }
// 
//     @SuppressWarnings({"deprecation", "unused"})
//     @NonNull
//     @Deprecated
//     public static ViewModelProvider newInstance(@NonNull final Activity activity) {
//         if (activity.getLastNonConfigurationInstance() == null) {
//             return new ViewModelProvider();
//         } else {
//             return (ViewModelProvider) activity.getLastNonConfigurationInstance();
//         }
//     }
// 
//     private ViewModelProvider() {
//         mViewModelCache = new HashMap<>();
//     }
// 
//     public synchronized void remove(@Nullable String modeIdentifier) {
//         mViewModelCache.remove(modeIdentifier);
//     }
// 
//     public synchronized void removeAllViewModels() {
//         mViewModelCache.clear();
//     }
// 
//     @VisibleForTesting
//     @NonNull
//     Map<String, AbstractViewModel<? extends IView>> getViewModels() {
//         return Collections.unmodifiableMap(mViewModelCache);
//     }
// 
//     @SuppressWarnings("unchecked")
//     @NonNull
//     public synchronized <T extends IView> ViewModelWrapper<T> getViewModel(@NonNull final String modelIdentifier,
//                                                                            @NonNull final Class<? extends AbstractViewModel<T>> viewModelClass) {
//         AbstractViewModel<T> instance = (AbstractViewModel<T>) mViewModelCache.get(modelIdentifier);
//         if (instance != null) {
//             return new ViewModelWrapper<>(instance, false);
//         }
// 
//         try {
//             instance = viewModelClass.newInstance();
//         } catch (final Exception ex) {
//             throw new RuntimeException(ex);
//         }
//         instance.setUniqueIdentifier(modelIdentifier);
//         mViewModelCache.put(modelIdentifier, instance);
//         return new ViewModelWrapper<>(instance, true);
//     }
// 
//     final static class ViewModelWrapper<T extends IView> {
//         @NonNull
//         final AbstractViewModel<T> viewModel;
//         final boolean wasCreated;
// 
//         private ViewModelWrapper(@NonNull AbstractViewModel<T> mViewModel, final boolean mWasCreated) {
//             this.viewModel = mViewModel;
//             this.wasCreated = mWasCreated;
//         }
//     }
// }


// Path: library/src/main/java/eu/inloop/viewmodel/base/ViewModelBaseEmptyActivity.java
import android.os.Bundle;
import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import eu.inloop.viewmodel.IViewModelProvider;
import eu.inloop.viewmodel.ViewModelProvider;

package eu.inloop.viewmodel.base;



/**
 * All your activities must extend this activity - even in case your activity has no viewmodel. The fragment viewmodels are using the {@link IViewModelProvider}
 * interface to get the {@link ViewModelProvider} from the current activity.
 * You can copy this implementation in case you don't want to extend this class.
 */
public abstract class ViewModelBaseEmptyActivity extends AppCompatActivity implements IViewModelProvider {

    @Nullable
    private ViewModelProvider mViewModelProvider;