mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
show keyboard bug
This commit is contained in:
parent
ccca80656b
commit
466cbb4019
@ -19,6 +19,8 @@ import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
@ -81,6 +83,12 @@ class PlayerFragment : Fragment() {
|
||||
arguments?.let {
|
||||
videoId = it.getString("videoId")
|
||||
}
|
||||
closeKeyboard()
|
||||
}
|
||||
private fun closeKeyboard() {
|
||||
val inputMethodManager: InputMethodManager =
|
||||
requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
|
@ -1,31 +1,31 @@
|
||||
package com.github.libretube
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.AutoCompleteTextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.libretube.adapters.SearchAdapter
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import retrofit2.HttpException
|
||||
import com.github.libretube.adapters.SearchAdapter
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
class SearchFragment : Fragment() {
|
||||
|
||||
private val TAG = "SearchFragment"
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
@ -61,7 +61,7 @@ class SearchFragment : Fragment() {
|
||||
if(s!! != ""){
|
||||
GlobalScope.launch {
|
||||
fetchSuggestions(s.toString(), autoTextView)
|
||||
delay(2000)
|
||||
delay(3000)
|
||||
fetchSearch(s.toString(),recyclerView)
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ class SearchFragment : Fragment() {
|
||||
RetrofitInstance.api.getSearchResults(query, "all")
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
Log.e(TAG, "IOException, you might not have internet connection "+e.toString())
|
||||
Log.e(TAG, "IOException, you might not have internet connection $e")
|
||||
return@launchWhenCreated
|
||||
} catch (e: HttpException) {
|
||||
Log.e(TAG, "HttpException, unexpected response")
|
||||
@ -117,4 +117,10 @@ class SearchFragment : Fragment() {
|
||||
if (!isAdded) return // Fragment not attached to an Activity
|
||||
activity?.runOnUiThread(action)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SearchFragment"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
|
Loading…
Reference in New Issue
Block a user