package com.dankal.dankal_launcher;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.android.launcher3.debug.CustomDialog;
import com.android.launcher3.manager.LauncherManager;
import com.android.launcher3.util.Logger;
import com.android.launcher3.util.PermissionUtil;
import com.android.launcher3.util.SystemUtils;

/**
 * Author: roczheng
 * Date: 2020/7/10
 * Time: 17:37
 * Description:
 */
public class TestReceive extends BroadcastReceiver {

    final String SYSTEM_DIALOG_REASON_KEY = "reason";

    final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";

    final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";

    final String SYSTEM_DIALOG_REASON_GESTURE_KEY = "fs_gesture";


    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
            String reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY);
            if (reason != null) {
                if (reason.equals(SYSTEM_DIALOG_REASON_HOME_KEY)) {
                    Log.i("TestReceive", "Home键监听");
                } else if (reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS)) {//多任务监听
                    Log.i("TestReceive", "多任务按钮监听");
                } else if (reason.equals(SYSTEM_DIALOG_REASON_GESTURE_KEY)) {
                    Log.i("TestReceive", "手势");
                }
            }
        } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
            Log.i("TestReceive", "ACTION_SCREEN_OFF");
        } else if (Intent.ACTION_USER_PRESENT.equals(action)) {
            Log.i("TestReceive", "ACTION_USER_PRESENT");
        }
    }
}
