From d5266cb50ecd39a6e81ae3242e5385ccadf2ba25 Mon Sep 17 00:00:00 2001 From: Invinciblelee <1760316362@qq.com> Date: Wed, 29 May 2019 11:17:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 6 ------ .../io/legado/app/help/permission/Request.kt | 16 ++++------------ .../io/legado/app/ui/search/SearchActivity.kt | 1 - 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f1c81febc..c3d0fa13c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -41,12 +41,6 @@ kapt { } } -kotlin{ - experimental{ - coroutines "enable" - } -} - dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" diff --git a/app/src/main/java/io/legado/app/help/permission/Request.kt b/app/src/main/java/io/legado/app/help/permission/Request.kt index c5d389fa6..60db12240 100644 --- a/app/src/main/java/io/legado/app/help/permission/Request.kt +++ b/app/src/main/java/io/legado/app/help/permission/Request.kt @@ -14,8 +14,7 @@ import java.util.* internal class Request : OnRequestPermissionsResultCallback { - var startTime: Long = 0 - private set + val startTime: Long private var requestCode: Int = 0 private var source: RequestSource? = null private var permissions: ArrayList? = null @@ -28,22 +27,17 @@ internal class Request : OnRequestPermissionsResultCallback { private val deniedPermissions: Array? get() { - val permissions: Array? - val size = this.permissions?.size ?: 0 - if (size > 0) { - permissions = this.permissions?.toTypedArray() - } else { - permissions = null - } - return getDeniedPermissions(permissions) + return getDeniedPermissions(this.permissions?.toTypedArray()) } constructor(activity: AppCompatActivity) { + startTime = System.currentTimeMillis() source = ActivitySource(activity) permissions = ArrayList() } constructor(fragment: Fragment) { + startTime = System.currentTimeMillis() source = FragmentSource(fragment) permissions = ArrayList() } @@ -101,8 +95,6 @@ internal class Request : OnRequestPermissionsResultCallback { onPermissionsGranted(requestCode) } } - - startTime = System.currentTimeMillis() } fun clear() { diff --git a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt index c58c611a9..95f4c3be9 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt @@ -17,7 +17,6 @@ class SearchActivity : BaseActivity() { override fun onViewModelCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) { - startActivity() } }