// Path: app/src/main/java/io/petros/posts/app/PostsApplication.java
// @SuppressWarnings("checkstyle:overloadmethodsdeclarationorder")
// public class PostsApplication extends Application {
// 
//     private static ApplicationComponent applicationComponent;
// 
//     static {
//         AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); // NOTE: This enables the "proxy" trick on the vector images.
//     }
// 
//     @Inject AppSnackbarActions appSnackbarActions;
// 
//     // HELPER // ************************************************************************************************************
// 
//     public static ApplicationComponent getApplicationComponent() {
//         return applicationComponent;
//     }
// 
//     public static SnackbarActions snackbar(final Activity activity) {
//         return ((PostsApplication) activity.getApplication()).snackbar();
//     }
// 
//     // APPLICATION // *******************************************************************************************************
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         initDagger();
//         initRealm();
//         initTimber();
//         Timber.i("Posts application created!");
//     }
// 
//     private void initDagger() {
//         applicationComponent = DaggerApplicationComponent.builder()
//                 .appModule(new AppModule(this))
//                 .netModule(new NetModule(BASE_URL))
//                 .dataModule(new DataModule())
//                 .serviceModule(new ServiceModule())
//                 .activityModule(new ActivityModule()).build();
//         applicationComponent.inject(this);
//     }
// 
//     private void initTimber() {
//         Timber.plant(new Timber.DebugTree());
//     }
// 
//     protected void initRealm() {
//         Realm.init(this);
//     }
// 
//     // GET // ***************************************************************************************************************
// 
//     public Realm getDefaultRealmInstance() {
//         return Realm.getDefaultInstance();
//     }
// 
//     // ACTIONS // ***********************************************************************************************************
// 
//     public SnackbarActions snackbar() {
//         return appSnackbarActions;
//     }
// 
// }


import android.annotation.SuppressLint;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.petros.posts.app.PostsApplication;
import timber.log.Timber;

    @Override
    protected void onStop() {
        Timber.d("%s stopped.", getClass().getSimpleName());
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        Timber.d("%s destroyed.", getClass().getSimpleName());
        super.onDestroy();
    }

    // TOOLBAR // ***********************************************************************************************************

    @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
    protected void setToolbar(final Toolbar toolbar) {
        setSupportActionBar(toolbar);
        @Nullable final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
        } else {
            Timber.w("Cannot get an action bar for this activity; verify that this activity has actually defined a toolbar.");
        }
    }

    // SNACKBAR // **********************************************************************************************************

    protected void setSnackbar(final CoordinatorLayout coordinatorLayout) {
// Path: app/src/main/java/io/petros/posts/app/PostsApplication.java
// @SuppressWarnings("checkstyle:overloadmethodsdeclarationorder")
// public class PostsApplication extends Application {
// 
//     private static ApplicationComponent applicationComponent;
// 
//     static {
//         AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); // NOTE: This enables the "proxy" trick on the vector images.
//     }
// 
//     @Inject AppSnackbarActions appSnackbarActions;
// 
//     // HELPER // ************************************************************************************************************
// 
//     public static ApplicationComponent getApplicationComponent() {
//         return applicationComponent;
//     }
// 
//     public static SnackbarActions snackbar(final Activity activity) {
//         return ((PostsApplication) activity.getApplication()).snackbar();
//     }
// 
//     // APPLICATION // *******************************************************************************************************
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         initDagger();
//         initRealm();
//         initTimber();
//         Timber.i("Posts application created!");
//     }
// 
//     private void initDagger() {
//         applicationComponent = DaggerApplicationComponent.builder()
//                 .appModule(new AppModule(this))
//                 .netModule(new NetModule(BASE_URL))
//                 .dataModule(new DataModule())
//                 .serviceModule(new ServiceModule())
//                 .activityModule(new ActivityModule()).build();
//         applicationComponent.inject(this);
//     }
// 
//     private void initTimber() {
//         Timber.plant(new Timber.DebugTree());
//     }
// 
//     protected void initRealm() {
//         Realm.init(this);
//     }
// 
//     // GET // ***************************************************************************************************************
// 
//     public Realm getDefaultRealmInstance() {
//         return Realm.getDefaultInstance();
//     }
// 
//     // ACTIONS // ***********************************************************************************************************
// 
//     public SnackbarActions snackbar() {
//         return appSnackbarActions;
//     }
// 
// }


// Path: app/src/main/java/io/petros/posts/activity/AbstractAppActivity.java
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import javax.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.petros.posts.app.PostsApplication;
import timber.log.Timber;


    @Override
    protected void onStop() {
        Timber.d("%s stopped.", getClass().getSimpleName());
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        Timber.d("%s destroyed.", getClass().getSimpleName());
        super.onDestroy();
    }

    // TOOLBAR // ***********************************************************************************************************

    @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
    protected void setToolbar(final Toolbar toolbar) {
        setSupportActionBar(toolbar);
        @Nullable final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
        } else {
            Timber.w("Cannot get an action bar for this activity; verify that this activity has actually defined a toolbar.");
        }
    }

    // SNACKBAR // **********************************************************************************************************

    protected void setSnackbar(final CoordinatorLayout coordinatorLayout) {
        PostsApplication.snackbar(this).setCoordinatorLayout(coordinatorLayout);