// Path: app/src/main/java/eu/se_bastiaan/tvnl/TVNLApplication.java
// public class TVNLApplication extends MultiDexApplication {
// 
//     @Nullable
//     private volatile AppInjectionComponent appInjectionComponent;
//     private static TVNLApplication sThis;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         sThis = this;
// 
//         if(BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         } else {
//             //Timber.plant(new CrashlyticsLogTree(Log.INFO));
//         }
// 
//         CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
//                 .setDefaultFontPath("fonts/Regular.ttf")
//                 .setFontAttrId(R.attr.fontPath)
//                 .build()
//         );
// 
//         Intent recommendationIntent = new Intent(this, RecommendationService.class);
//         startService(recommendationIntent);
//     }
// 
//     public static TVNLApplication get() {
//         return sThis;
//     }
// 
//     @NonNull
//     public AppInjectionComponent appComponent() {
//         if (appInjectionComponent == null) {
//             synchronized (Application.class) {
//                 if (appInjectionComponent == null) {
//                     appInjectionComponent = AppInjectionComponent.Initializer.init(this);
//                 }
//             }
//         }
// 
//         //noinspection ConstantConditions
//         return appInjectionComponent;
//     }
// 
// }


import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import eu.se_bastiaan.tvnl.R;
import eu.se_bastiaan.tvnl.TVNLApplication;
                .setTitle(getArguments().getString(TITLE))
                .setMessage(getArguments().getString(MESSAGE));

        if(positiveOnClickListener != null)
            builder.setPositiveButton(R.string.ok, positiveOnClickListener);
        if(negativeOnClickListener != null)
            builder.setPositiveButton(R.string.close, negativeOnClickListener);

        if(getArguments().getBoolean(CANCELABLE, true)) {
            setCancelable(true);
        } else {
            setCancelable(false);
        }

        return builder.create();
    }

    public static void show(FragmentManager fm, String title, String message, Boolean cancelable, DialogInterface.OnClickListener positiveOnClickListener, DialogInterface.OnClickListener negativeOnClickListener) {
        MessageDialogFragment dialogFragment = new MessageDialogFragment();
        Bundle args = new Bundle();
        args.putString(TITLE, title);
        args.putString(MESSAGE, message);
        args.putBoolean(CANCELABLE, cancelable);
        dialogFragment.setArguments(args);
        dialogFragment.positiveOnClickListener = positiveOnClickListener;
        dialogFragment.negativeOnClickListener = negativeOnClickListener;
        dialogFragment.show(fm, "MessageDialogFragment");
    }

    public static void show(FragmentManager fm, int titleRes, int messageRes, Boolean cancelable, DialogInterface.OnClickListener positiveOnClickListener, DialogInterface.OnClickListener negativeOnClickListener) {
// Path: app/src/main/java/eu/se_bastiaan/tvnl/TVNLApplication.java
// public class TVNLApplication extends MultiDexApplication {
// 
//     @Nullable
//     private volatile AppInjectionComponent appInjectionComponent;
//     private static TVNLApplication sThis;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         sThis = this;
// 
//         if(BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         } else {
//             //Timber.plant(new CrashlyticsLogTree(Log.INFO));
//         }
// 
//         CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
//                 .setDefaultFontPath("fonts/Regular.ttf")
//                 .setFontAttrId(R.attr.fontPath)
//                 .build()
//         );
// 
//         Intent recommendationIntent = new Intent(this, RecommendationService.class);
//         startService(recommendationIntent);
//     }
// 
//     public static TVNLApplication get() {
//         return sThis;
//     }
// 
//     @NonNull
//     public AppInjectionComponent appComponent() {
//         if (appInjectionComponent == null) {
//             synchronized (Application.class) {
//                 if (appInjectionComponent == null) {
//                     appInjectionComponent = AppInjectionComponent.Initializer.init(this);
//                 }
//             }
//         }
// 
//         //noinspection ConstantConditions
//         return appInjectionComponent;
//     }
// 
// }


// Path: app/src/main/java/eu/se_bastiaan/tvnl/ui/dialog/MessageDialogFragment.java
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import eu.se_bastiaan.tvnl.R;
import eu.se_bastiaan.tvnl.TVNLApplication;

                .setTitle(getArguments().getString(TITLE))
                .setMessage(getArguments().getString(MESSAGE));

        if(positiveOnClickListener != null)
            builder.setPositiveButton(R.string.ok, positiveOnClickListener);
        if(negativeOnClickListener != null)
            builder.setPositiveButton(R.string.close, negativeOnClickListener);

        if(getArguments().getBoolean(CANCELABLE, true)) {
            setCancelable(true);
        } else {
            setCancelable(false);
        }

        return builder.create();
    }

    public static void show(FragmentManager fm, String title, String message, Boolean cancelable, DialogInterface.OnClickListener positiveOnClickListener, DialogInterface.OnClickListener negativeOnClickListener) {
        MessageDialogFragment dialogFragment = new MessageDialogFragment();
        Bundle args = new Bundle();
        args.putString(TITLE, title);
        args.putString(MESSAGE, message);
        args.putBoolean(CANCELABLE, cancelable);
        dialogFragment.setArguments(args);
        dialogFragment.positiveOnClickListener = positiveOnClickListener;
        dialogFragment.negativeOnClickListener = negativeOnClickListener;
        dialogFragment.show(fm, "MessageDialogFragment");
    }

    public static void show(FragmentManager fm, int titleRes, int messageRes, Boolean cancelable, DialogInterface.OnClickListener positiveOnClickListener, DialogInterface.OnClickListener negativeOnClickListener) {
        show(fm, TVNLApplication.get().getString(titleRes), TVNLApplication.get().getString(messageRes), cancelable, positiveOnClickListener, negativeOnClickListener);