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 3f6873a44..8d86f5ccc 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -11,6 +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 @@ -23,6 +24,7 @@ abstract class BaseActivity : AppCompatActivity() { protected abstract val layoutID: Int override fun onCreate(savedInstanceState: Bundle?) { + window.decorView.disableAutoFill() initTheme() setupSystemBar() super.onCreate(savedInstanceState) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 8392c9686..55dc16106 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -17,6 +17,7 @@ import io.legado.app.base.BaseFragment import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookGroup import io.legado.app.lib.theme.ThemeStore +import io.legado.app.utils.disableAutoFill import kotlinx.android.synthetic.main.fragment_bookshelf.* import kotlinx.android.synthetic.main.view_title_bar.* import kotlinx.coroutines.GlobalScope @@ -51,6 +52,7 @@ class BookshelfFragment : BaseFragment(R.layout.fragment_bookshelf) { when (groupId) { -10 -> context?.let { MaterialDialog(it).show { + window?.decorView?.disableAutoFill() title(text = "新建分组") input(hint = "分组名称") { _, charSequence -> run { 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 ac26c4355..18c802010 100644 --- a/app/src/main/java/io/legado/app/utils/ViewExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ViewExtensions.kt @@ -1,6 +1,7 @@ package io.legado.app.utils import android.content.Context +import android.os.Build import android.view.View import android.view.inputmethod.InputMethodManager import io.legado.app.App @@ -10,4 +11,10 @@ fun View.hidehideSoftInput() = run { imm?.let { imm.hideSoftInputFromWindow(this.windowToken, 0) } +} + +fun View.disableAutoFill() = run { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + this.importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS + } } \ No newline at end of file