package com.hi.music.player;

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

import androidx.annotation.OptIn;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.database.StandaloneDatabaseProvider;
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor;
import androidx.media3.datasource.cache.SimpleCache;

import com.hi.music.player.api.MediaControllerStatusListener;
import com.hi.music.player.firebase.RemoteConfigJava;
import com.hi.music.player.firebase.Sp;
import com.hi.music.player.helper.CommonUtils;
import com.hi.music.player.media3.MyDownloadService;
import com.hi.music.player.media3.MyMediaControllerManager;
import com.hi.music.player.objectbox.ObjectBoxManager;

public class MusicApplication extends Application {

    public static Context myApplication;

    public static String visitorData;




    public static void setVisitorData(String visitorData) {
        MusicApplication.visitorData = visitorData;
    }

    public static String getVisitorData() {
        return visitorData;
    }

    @OptIn(markerClass = UnstableApi.class)
    @Override
    public void onCreate() {
        super.onCreate();
        myApplication = this;
        Sp.init(this);
        RemoteConfigJava.getInstance().init(this);
        ObjectBoxManager.init(this);

        StandaloneDatabaseProvider databaseProvider = new  StandaloneDatabaseProvider(this);
        MyDownloadService.init(this,databaseProvider);
        MyMediaControllerManager.getInstance().init(new MediaControllerStatusListener() {
            @Override
            public void onMediaControllerComplete(boolean isOk) {
                CommonUtils.LogMsg("=-----mediaController+" + isOk);
            }
        });
    }


}
