mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Updated dependencies, better way to show/hide keyboard
This commit is contained in:
parent
30d03d280c
commit
c3de2e906b
7 changed files with 26 additions and 23 deletions
|
|
@ -73,14 +73,14 @@ dependencies {
|
|||
implementation "androidx.annotation:annotation:1.7.0"
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0-alpha03'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.core:core-ktx:1.10.1'
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation "androidx.core:core-telecom:1.0.0-alpha01"
|
||||
implementation 'androidx.media:media:1.6.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||
implementation 'androidx.window:window:1.1.0'
|
||||
|
||||
def nav_version = "2.7.2"
|
||||
def nav_version = "2.7.3"
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ abstract class AbstractNewTransferCallFragment : GenericCallFragment() {
|
|||
it.consume { show ->
|
||||
if (show) {
|
||||
// To automatically open keyboard
|
||||
binding.searchBar.showKeyboard(requireActivity().window)
|
||||
binding.searchBar.showKeyboard()
|
||||
} else {
|
||||
binding.searchBar.requestFocus()
|
||||
binding.searchBar.hideKeyboard()
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class ContactsListFragment : AbstractTopBarFragment() {
|
|||
it.consume { show ->
|
||||
if (show) {
|
||||
// To automatically open keyboard
|
||||
binding.topBar.search.showKeyboard(requireActivity().window)
|
||||
binding.topBar.search.showKeyboard()
|
||||
} else {
|
||||
binding.topBar.search.hideKeyboard()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class HistoryListFragment : AbstractTopBarFragment() {
|
|||
it.consume { show ->
|
||||
if (show) {
|
||||
// To automatically open keyboard
|
||||
binding.topBar.search.showKeyboard(requireActivity().window)
|
||||
binding.topBar.search.showKeyboard()
|
||||
} else {
|
||||
binding.topBar.search.hideKeyboard()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class StartCallFragment : GenericFragment() {
|
|||
it.consume { show ->
|
||||
if (show) {
|
||||
// To automatically open keyboard
|
||||
binding.searchBar.showKeyboard(requireActivity().window)
|
||||
binding.searchBar.showKeyboard()
|
||||
} else {
|
||||
binding.searchBar.requestFocus()
|
||||
binding.searchBar.hideKeyboard()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ import androidx.annotation.DimenRes
|
|||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.SoftwareKeyboardControllerCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.emoji2.text.EmojiCompat
|
||||
import java.util.Locale
|
||||
|
|
@ -46,6 +48,24 @@ import org.linphone.R
|
|||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ToastBinding
|
||||
|
||||
@UiThread
|
||||
fun View.showKeyboard() {
|
||||
this.requestFocus()
|
||||
/*val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)*/
|
||||
// WindowCompat.getInsetsController(window, this).show(WindowInsetsCompat.Type.ime())*/
|
||||
val compat = SoftwareKeyboardControllerCompat(this)
|
||||
compat.show()
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun View.hideKeyboard() {
|
||||
/*val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(this.windowToken, 0)*/
|
||||
val compat = SoftwareKeyboardControllerCompat(this)
|
||||
compat.hide()
|
||||
}
|
||||
|
||||
class AppUtils {
|
||||
companion object {
|
||||
const val TAG = "[App Utils]"
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ import android.text.TextWatcher
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.ColorInt
|
||||
|
|
@ -38,7 +36,6 @@ import androidx.appcompat.widget.AppCompatEditText
|
|||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.doOnLayout
|
||||
import androidx.databinding.BindingAdapter
|
||||
|
|
@ -96,20 +93,6 @@ fun <T> setEntries(
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun View.showKeyboard(window: Window) {
|
||||
this.requestFocus()
|
||||
/*val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)*/
|
||||
WindowCompat.getInsetsController(window, this).show(WindowInsetsCompat.Type.ime())
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun View.hideKeyboard() {
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(this.windowToken, 0)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun AppCompatEditText.removeCharacterAtPosition() {
|
||||
val start = selectionStart
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue