package com.xhly.manageapp.utils

import android.content.Context
import android.graphics.drawable.Drawable
import androidx.appcompat.content.res.AppCompatResources
import com.xhkjedu.manageapp.R
import com.xhly.corelib.Const
import com.xhly.corelib.bean.AppInfo

//用来创建一键加速，清除缓存，和自动旋转的appbean类
class CustomAppUtils {
    public fun getCustomAppList(context: Context): ArrayList<AppInfo> {
        val appList= arrayListOf<AppInfo>()
        appList.add(getCusomAppBean(
            context.getString(R.string.appstore),
            Const.STOREAPPPKG,
            AppCompatResources.getDrawable(context,R.drawable.icon_store)!!
        ))
        appList.add(getCusomAppBean(
            context.getString(R.string.speed),
            Const.CUSTOMSPEEDAPP,
           AppCompatResources.getDrawable(context,R.drawable.icon_speed)!!
        ))
        appList.add(getCusomAppBean(
            context.getString(R.string.clear),
            Const.CUSTOMCLEARAPP,
            AppCompatResources.getDrawable(context,R.drawable.icon_clear)!!
        ))
        appList.add(getCusomAppBean(
            context.getString(R.string.rotation),
            Const.CUSTOMROTATIONAPP,
            AppCompatResources.getDrawable(context,R.drawable.icon_rotation)!!
        ))
        appList.add(getCusomAppBean(
            context.getString(R.string.changepsd),
            Const.CUSTOMCHANGEPSD,
            AppCompatResources.getDrawable(context,R.drawable.icon_changepwd)!!
        ))
        appList.add(getCusomAppBean(
            context.getString(R.string.updatestrategy),
            Const.UPDATESTRATEGYPKGNAME,
            AppCompatResources.getDrawable(context,R.drawable.icon_updatestrategy)!!
        ))
      /*  appList.add(getCusomAppBean(
            context.getString(R.string.netset),
            Const.WIFISEETTINGPKG,
            AppCompatResources.getDrawable(context,R.drawable.icon_netset)!!
        ))*/
        return appList
    }

    public fun getCusomAppBean(name: String, pkg: String, icon: Drawable):AppInfo{
        val appInfo = AppInfo()
        appInfo.name = name
        appInfo.packageName = pkg
        appInfo.ico = icon
        return appInfo
    }
}