From 479859d730150fa52f901adeab8b5e617a74b667 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 28 Jul 2019 07:50:22 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/base/BaseActivity.kt | 10 ++++++---- .../legado/app/ui/sourcedebug/SourceDebugActivity.kt | 6 ++++++ .../main/java/io/legado/app/utils/ViewExtensions.kt | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index 79c289194..be1b4061a 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -11,10 +11,7 @@ import androidx.lifecycle.ViewModel import io.legado.app.R import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.ThemeStore -import io.legado.app.utils.disableAutoFill -import io.legado.app.utils.getCompatColor -import io.legado.app.utils.getPrefBoolean -import io.legado.app.utils.setIconColor +import io.legado.app.utils.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel @@ -97,4 +94,9 @@ abstract class BaseActivity(private val fullScreen: Boolean = tr open fun observeLiveBus() { } + + override fun finish() { + currentFocus?.hideSoftInput() + super.finish() + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt index 9cbfd10e5..cac4f8943 100644 --- a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt @@ -69,6 +69,7 @@ class SourceDebugActivity : BaseActivity(), SourceDebug.Callba adapter.logList.clear() adapter.notifyDataSetChanged() bookSource?.let { + SourceDebug.debugSource = it.bookSourceUrl rotate_loading.visibility = View.VISIBLE if (key.isAbsUrl()) { val book = Book() @@ -89,4 +90,9 @@ class SourceDebugActivity : BaseActivity(), SourceDebug.Callba rotate_loading.visibility = View.GONE } } + + override fun onDestroy() { + SourceDebug.debugSource = null + super.onDestroy() + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/utils/ViewExtensions.kt b/app/src/main/java/io/legado/app/utils/ViewExtensions.kt index 18c802010..0275e057e 100644 --- a/app/src/main/java/io/legado/app/utils/ViewExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ViewExtensions.kt @@ -6,7 +6,7 @@ import android.view.View import android.view.inputmethod.InputMethodManager import io.legado.app.App -fun View.hidehideSoftInput() = run { +fun View.hideSoftInput() = run { val imm = App.INSTANCE.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager imm?.let { imm.hideSoftInputFromWindow(this.windowToken, 0)