pull/32/head
Invinciblelee 6 years ago
parent 09587ab92d
commit d5266cb50e
  1. 6
      app/build.gradle
  2. 16
      app/src/main/java/io/legado/app/help/permission/Request.kt
  3. 1
      app/src/main/java/io/legado/app/ui/search/SearchActivity.kt

@ -41,12 +41,6 @@ kapt {
} }
} }
kotlin{
experimental{
coroutines "enable"
}
}
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

@ -14,8 +14,7 @@ import java.util.*
internal class Request : OnRequestPermissionsResultCallback { internal class Request : OnRequestPermissionsResultCallback {
var startTime: Long = 0 val startTime: Long
private set
private var requestCode: Int = 0 private var requestCode: Int = 0
private var source: RequestSource? = null private var source: RequestSource? = null
private var permissions: ArrayList<String>? = null private var permissions: ArrayList<String>? = null
@ -28,22 +27,17 @@ internal class Request : OnRequestPermissionsResultCallback {
private val deniedPermissions: Array<String>? private val deniedPermissions: Array<String>?
get() { get() {
val permissions: Array<String>? return getDeniedPermissions(this.permissions?.toTypedArray())
val size = this.permissions?.size ?: 0
if (size > 0) {
permissions = this.permissions?.toTypedArray()
} else {
permissions = null
}
return getDeniedPermissions(permissions)
} }
constructor(activity: AppCompatActivity) { constructor(activity: AppCompatActivity) {
startTime = System.currentTimeMillis()
source = ActivitySource(activity) source = ActivitySource(activity)
permissions = ArrayList() permissions = ArrayList()
} }
constructor(fragment: Fragment) { constructor(fragment: Fragment) {
startTime = System.currentTimeMillis()
source = FragmentSource(fragment) source = FragmentSource(fragment)
permissions = ArrayList() permissions = ArrayList()
} }
@ -101,8 +95,6 @@ internal class Request : OnRequestPermissionsResultCallback {
onPermissionsGranted(requestCode) onPermissionsGranted(requestCode)
} }
} }
startTime = System.currentTimeMillis()
} }
fun clear() { fun clear() {

@ -17,7 +17,6 @@ class SearchActivity : BaseActivity<SearchDataBinding, SearchViewModel>() {
override fun onViewModelCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) { override fun onViewModelCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) {
startActivity<SearchActivity>()
} }
} }

Loading…
Cancel
Save