From 0f6dbb160f31e0bfed53eb6b5b8dc58141366ce2 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Wed, 4 Aug 2021 15:30:34 +0200 Subject: [PATCH] hide keyboard --- .../com/lagradost/cloudstream3/ui/download/DownloadFragment.kt | 3 +++ .../com/lagradost/cloudstream3/ui/player/PlayerFragment.kt | 1 - .../com/lagradost/cloudstream3/ui/search/SearchFragment.kt | 3 ++- .../com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt | 2 ++ app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt index ef3c1336..79a55e73 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt @@ -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 = DownloadHeaderAdapter( ArrayList(), diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt index be3c12c1..3bc7f80e 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt @@ -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" diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt index 89500368..f8c20b84 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt @@ -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() } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index 7024fe34..eecaf043 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -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) } } \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt index 8f7a22e3..aaac8b89 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt @@ -61,6 +61,7 @@ object UIHelper { } fun Fragment.hideKeyboard() { + activity?.window?.decorView?.clearFocus() view.let { if (it != null) { activity?.hideKeyboard(it)