mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:55:09 +01:00
Dismiss keybaord when long pressing manga while searching
This commit is contained in:
parent
a8a9d699b2
commit
2d80f6f26b
@ -259,6 +259,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
is LibrarySelectionEvent.Cleared -> {
|
||||
adapter.mode = SelectableAdapter.Mode.SINGLE
|
||||
adapter.clearSelection()
|
||||
adapter.notifyDataSetChanged()
|
||||
lastClickPosition = -1
|
||||
adapter.isLongPressDragEnabled = canDrag()
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.library
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
@ -13,9 +14,11 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowInsets
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
@ -89,8 +92,6 @@ class LibraryController(
|
||||
*/
|
||||
private var query = ""
|
||||
|
||||
private var searchItem:MenuItem? = null
|
||||
|
||||
/**
|
||||
* Currently selected mangas.
|
||||
*/
|
||||
@ -361,7 +362,10 @@ class LibraryController(
|
||||
fun createActionModeIfNeeded() {
|
||||
if (actionMode == null) {
|
||||
actionMode = (activity as AppCompatActivity).startSupportActionMode(this)
|
||||
searchItem?.collapseActionView()
|
||||
val view = activity?.window?.currentFocus ?: return
|
||||
val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as?
|
||||
InputMethodManager ?: return
|
||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +385,6 @@ class LibraryController(
|
||||
val searchItem = menu.findItem(R.id.action_search)
|
||||
val searchView = searchItem.actionView as SearchView
|
||||
searchView.queryHint = resources?.getString(R.string.search_hint)
|
||||
this.searchItem = searchItem
|
||||
|
||||
searchItem.collapseActionView()
|
||||
if (!query.isEmpty()) {
|
||||
|
@ -6,21 +6,22 @@ import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.Point
|
||||
import android.graphics.Typeface
|
||||
import android.os.Build
|
||||
import androidx.annotation.Px
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.view.WindowInsets
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.Px
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.WhichButton
|
||||
import com.afollestad.materialdialogs.actions.getActionButton
|
||||
import com.afollestad.materialdialogs.actions.hasActionButton
|
||||
import com.amulyakhare.textdrawable.TextDrawable
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator
|
||||
import eu.kanade.tachiyomi.R
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user