package com.alapshin.arctor.presenter;

import android.support.annotation.CallSuper;
import android.util.Log;

import com.alapshin.arctor.BuildConfig;
import com.alapshin.arctor.view.MvpView;

import java.lang.ref.WeakReference;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * Base presenter implementation
 *
 * @author alapshin
 * @since 2015-04-18
 */
public abstract class BasePresenter<V extends MvpView> implements Presenter<V> {
    private final String TAG = this.getClass().getSimpleName();
    /**
     * Reference to view. Using weak reference to avoid memory leaks. Before calling any view
     * methods check that view is attached with isViewAttached
     */
    protected WeakReference<V> viewRef;

    @Override
    @CallSuper
    public void onCreate(@Nullable PresenterBundle savedInstanceState) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onCreate");
        }
    }

    @Override
    @CallSuper
    public void onStart() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onStart");
        }
    }

    @Override
    @CallSuper
    public void onResume() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onResume");
        }
    }

    @Override
    @CallSuper
    public void onPause() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onPause");
        }
    }

    @Override
    @CallSuper
    public void onSaveInstanceState(@Nonnull PresenterBundle outState) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onSaveInstanceState");
        }
    }

    @Override
    @CallSuper
    public void onStop() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onStop");
        }
    }

    @Override
    @CallSuper
    public void onDestroy() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "onDestroy");
        }
    }

    @Override
    @CallSuper
    public void attachView(V view) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "attachView");
        }
        this.viewRef = new WeakReference<V>(view);
    }

    @Override
    @CallSuper
    public void detachView() {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "detachView");
        }
        viewRef.clear();
        viewRef = null;
    }

    public V getView() {
        return viewRef == null ? null : viewRef.get();
    }

    public boolean isViewAttached() {
        return viewRef != null && viewRef.get() != null;
    }
}

@@ -82,73 +82,8 @@
 er;%0A
-import android.util.Log;%0A%0Aimport com.alapshin.arctor.BuildConfig;
 %0Aimp
@@ -322,17 +322,8 @@
 lic 
-abstract 
 clas
@@ -771,1149 +771,507 @@
     
-    if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onCreate%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onStart() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onStart%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onResume() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onResume%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onPause() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onPause%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onSaveInstanceState(@Nonnull PresenterBundle outState) %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onSaveInstanceState%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onStop() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onStop%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onDestroy() %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22onDestroy%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void attachView(V view) %7B%0A        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22attachView%22);%0A        %7D
+%7D%0A%0A    @Override%0A    @CallSuper%0A    public void onStart() %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onResume() %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onPause() %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onSaveInstanceState(@Nonnull PresenterBundle outState) %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onStop() %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void onDestroy() %7B%0A    %7D%0A%0A    @Override%0A    @CallSuper%0A    public void attachView(V view) %7B
 %0A   
@@ -1389,89 +1389,8 @@
 ) %7B%0A
-        if (BuildConfig.DEBUG) %7B%0A            Log.d(TAG, %22detachView%22);%0A        %7D%0A
     

Make BasePresenter class non abstract and remove android dependencies