package com.ar.sketch.paint.drawing.tool;

import android.app.Application;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Typeface;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.applovin.sdk.AppLovinMediationProvider;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkConfiguration;
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
import com.ar.sketch.paint.drawing.dbmanager.MyDataBase;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MyArApp extends Application {
    public static String Key_ViewDir = "pre_dir";
    public static String Key_ISMAIN = "ismain";
    public static String Key_Camera = "camera_data";

    public static String TAG = "=============";


    public static MyArApp app;

    public static boolean initSDkOK = false;
    public static String initAction = "ACTION_INIT";
    private String SDK_KEY = "vNzLVnoFhzyl4hLzTNPEaBVQE8_Oz_8JkiuKmiRamrxGHN3WtWEGH7Mx20POJPvaycKl1PumsEVkJXhRAse1wn";
    public static Typeface defaultFont;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        AssetManager assets = getAssets();
        defaultFont = Typeface.createFromAsset(assets, "myfont.ttf");
        initMAxSDk();
        MyDataBase.init(this);

    }

    private void initMAxSDk() {

        AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(SDK_KEY, this)
                .setMediationProvider(AppLovinMediationProvider.MAX)
                .build();
        AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
            @Override
            public void onSdkInitialized(AppLovinSdkConfiguration appLovinSdkConfiguration) {
                initSDkOK = true;
                LocalBroadcastManager.getInstance(MyArApp.this).sendBroadcast(new Intent(initAction));
            }
        });
    }

    public static String Class_Animals = "res_Animals";
    public static String Class_birds = "res_Birds";
    public static String Class_butterfly = "res_Butterfly";
    public static String Class_cafe = "res_Cafe";
    public static String Class_cartoons = "res_Cartoons";
    public static String Class_christmas = "res_Christmas";
    public static String Class_festivals = "res_Festivals";
    public static String Class_flowers = "res_Flowers";
    public static String Class_fruits = "res_Fruits";
    public static String Class_general = "res_General";

    public static String Class_mehndi = "res_Mehndi";
    public static String Class_nature = "res_Nature";
    public static String Class_properties = "res_Properties";
    public static String Class_rangoli = "res_Rangoli";
    public static String Class_sports = "res_Sports";
    public static String Class_vehicles = "res_Vehicles";

    public static List<String> getAllDir() {
        ArrayList<String> list = new ArrayList<>();
        list.add(Class_Animals);
        list.add(Class_birds);
        list.add(Class_butterfly);
        list.add(Class_cafe);
        list.add(Class_cartoons);
        list.add(Class_christmas);
        list.add(Class_festivals);
        list.add(Class_flowers);
        list.add(Class_fruits);
        list.add(Class_general);
        list.add(Class_mehndi);
        list.add(Class_nature);
        list.add(Class_properties);
        list.add(Class_rangoli);
        list.add(Class_sports);
        list.add(Class_vehicles);
        Collections.shuffle(list);
        return list;


    }
}
