package kr.co.compcarecompany;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.app.NotificationManager;
import android.content.Context;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.lifecycle.ProcessLifecycleOwner;

import java.util.ArrayList;
import java.util.HashMap;

import kr.co.compcarecompany.Util.Service.AlarmThread;
import kr.co.compcarecompany.Util.Service.MonitoringThread;

public class MyApplication extends Application {
    @SuppressLint("StaticFieldLeak")
    public static Context context;
    public static Activity myActivity;
    public static HashMap<String, MonitoringThread> my_thread = new HashMap<>();
    public static boolean stop_ui_change = false;
    public static boolean doing_toggle = false;
    public static int position = -1;
    public static ArrayList<MonitoringThread> serviceThreads = new ArrayList<>();

    public static NotificationManager notify_manager;
    public static AlarmThread alarm_thread;

    //    private TerminateThread thread;
    private LifecycleObserver lifecycleObserver = new CycleListener();

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        notify_manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//        setupLifecycleObserver();
    }

    private void setupLifecycleObserver() {
        ProcessLifecycleOwner.get().getLifecycle().addObserver(lifecycleObserver);
    }

    class CycleListener implements LifecycleObserver {

        @OnLifecycleEvent(Lifecycle.Event.ON_START)
        public void onMoveToFoground() {

        }

        @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
        public void onMoveToBackground() {

        }
    }
}
