package com.atmob.keyboard_android.util

import android.app.ActivityManager
import android.content.Context
import android.content.Context.ACTIVITY_SERVICE

/**
 * Activity工具类
 */
class ActivityUtil private constructor() {
    companion object {
        /**
         * 将Activity从后台，移动到前台
         */
        fun moveToFront(context: Context) {
            val activityManager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
            val taskList = activityManager.getAppTasks() ?: listOf<ActivityManager.AppTask>()
            if (taskList.isNotEmpty()) {
                taskList.first().moveToFront()
            }
        }
    }
}