hide keyboard

This commit is contained in:
LagradOst 2021-08-04 15:30:34 +02:00
parent 3f8229756d
commit 0f6dbb160f
5 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick
import com.lagradost.cloudstream3.utils.DOWNLOAD_EPISODE_CACHE
import com.lagradost.cloudstream3.utils.DataStore.getFolderName
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import com.lagradost.cloudstream3.utils.VideoDownloadManager
import kotlinx.android.synthetic.main.fragment_downloads.*
@ -88,6 +89,8 @@ class DownloadFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
hideKeyboard()
val adapter: RecyclerView.Adapter<RecyclerView.ViewHolder> =
DownloadHeaderAdapter(
ArrayList(),

View File

@ -94,7 +94,6 @@ import kotlin.math.abs
import kotlin.math.ceil
import kotlin.properties.Delegates
//http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
const val STATE_RESUME_WINDOW = "resumeWindow"
const val STATE_RESUME_POSITION = "resumePosition"

View File

@ -23,6 +23,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import kotlinx.android.synthetic.main.fragment_search.*
class SearchFragment : Fragment() {
@ -60,7 +61,7 @@ class SearchFragment : Fragment() {
}
override fun onDestroyView() {
main_search?.clearFocus()
hideKeyboard()
super.onDestroyView()
}

View File

@ -3,9 +3,11 @@ package com.lagradost.cloudstream3.ui.settings
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
hideKeyboard()
setPreferencesFromResource(R.xml.settings, rootKey)
}
}

View File

@ -61,6 +61,7 @@ object UIHelper {
}
fun Fragment.hideKeyboard() {
activity?.window?.decorView?.clearFocus()
view.let {
if (it != null) {
activity?.hideKeyboard(it)