package com.sakurafish.parrot.callconfirm;

import android.app.Application;
import android.content.Context;

import com.crashlytics.android.Crashlytics;
import com.sakurafish.parrot.callconfirm.Pref.Pref;
import com.sakurafish.parrot.callconfirm.config.Config;
import com.sakurafish.parrot.callconfirm.utils.SoundManager;

import io.fabric.sdk.android.Fabric;
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;

public class MyApplication extends Application {

    private static MyApplication application;
    private static SoundManager sSoundManager;
    private static int[] sSoundIds = new int[5];

    public MyApplication() {
        super();
        application = this;
    }

    public static MyApplication getInstance() {
        return application;
    }

    public static Context getContext() {
        return application.getApplicationContext();
    }

    public static SoundManager getSoundManager() {
        return sSoundManager;
    }

    public static int[] getSoundIds() {
        return sSoundIds;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());

        int launchCount = Pref.getPrefInt(getApplicationContext(), Config.PREF_LAUNCH_COUNT);
        Pref.setPref(getApplicationContext(), Config.PREF_LAUNCH_COUNT, ++launchCount);

        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                        .setDefaultFontPath("fonts/GenShinGothic-Regular.ttf")
                        .setFontAttrId(R.attr.fontPath)
                        .build()
        );
        setupSounds();
    }

    private void setupSounds() {
        sSoundManager = SoundManager.getInstance(getContext());
        sSoundIds[0] = sSoundManager.load(R.raw.inco1);
        sSoundIds[1] = sSoundManager.load(R.raw.inco2);
        sSoundIds[2] = sSoundManager.load(R.raw.inco3);
        sSoundIds[3] = sSoundManager.load(R.raw.inco4);
        sSoundIds[4] = sSoundManager.load(R.raw.inco5);
    }
}

@@ -146,16 +146,61 @@
 lytics;%0A
+import com.google.android.gms.ads.MobileAds;%0A
 import c
@@ -1136,24 +1136,25 @@
 onCreate();%0A
+%0A
         Fabr
@@ -1453,32 +1453,24 @@
             
-        
 .setDefaultF
@@ -1524,32 +1524,24 @@
             
-       
- 
 .setFontAttr
@@ -1560,24 +1560,16 @@
 ntPath)%0A
-        
         
@@ -1618,16 +1618,109 @@
 ounds();
+%0A%0A        // adMob%0A        MobileAds.initialize(this, getString(R.string.banner_ad_unit_id));
 %0A    %7D%0A%0A

Update adMob setup