package com.doverfuelingsolutions.issp.receiver

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.doverfuelingsolutions.issp.utils.DFSToastUtil

class HomeAndMenuReceiver: BroadcastReceiver() {

    private val SYSTEM_DIALOG_REASON_KEY = "reason";
    private val SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";
    private val SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";

    override fun onReceive(context: Context?, intent: Intent?) {
        if (intent?.action?.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS) == true) {
            val reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY)
            if (reason != null) {
                when(reason) {
                    SYSTEM_DIALOG_REASON_HOME_KEY -> {
                        DFSToastUtil.warn("按了 home")
                    }
                    SYSTEM_DIALOG_REASON_RECENT_APPS -> {
                        DFSToastUtil.warn("按了 nenu")
                    }
                }
            }
        }
    }
}