|
|
@ -1,11 +1,9 @@ |
|
|
|
package io.legado.app.help.permission |
|
|
|
package io.legado.app.help.permission |
|
|
|
|
|
|
|
|
|
|
|
import android.os.Build |
|
|
|
|
|
|
|
import androidx.annotation.StringRes |
|
|
|
import androidx.annotation.StringRes |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
import androidx.fragment.app.Fragment |
|
|
|
import androidx.fragment.app.Fragment |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import java.util.* |
|
|
|
import java.util.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PermissionsCompat private constructor() { |
|
|
|
class PermissionsCompat private constructor() { |
|
|
|
|
|
|
|
|
|
|
@ -18,7 +16,7 @@ class PermissionsCompat private constructor() { |
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
// 检查权限, 如果已经拥有返回 true |
|
|
|
// 检查权限, 如果已经拥有返回 true |
|
|
|
fun check(activity: AppCompatActivity, vararg permissions: String): Boolean { |
|
|
|
fun check(activity: AppCompatActivity, vararg permissions: String): Boolean { |
|
|
|
var request: Request = Request(activity) |
|
|
|
var request = Request(activity) |
|
|
|
var pers = ArrayList<String>() |
|
|
|
var pers = ArrayList<String>() |
|
|
|
pers.addAll(listOf(*permissions)) |
|
|
|
pers.addAll(listOf(*permissions)) |
|
|
|
var data = request.getDeniedPermissions(pers.toTypedArray()) |
|
|
|
var data = request.getDeniedPermissions(pers.toTypedArray()) |
|
|
|