Fixed dialer input cursor being moved to start when using digits from numpad

This commit is contained in:
Sylvain Berfini 2020-11-06 11:44:48 +01:00
parent e19ab356d4
commit 1eb4d3f4ec
2 changed files with 8 additions and 0 deletions

View file

@ -22,6 +22,7 @@ package org.linphone.activities.main.dialer.viewmodels
import android.content.Context import android.content.Context
import android.os.Vibrator import android.os.Vibrator
import android.provider.Settings import android.provider.Settings
import android.widget.EditText
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences import org.linphone.LinphoneApplication.Companion.corePreferences
@ -140,6 +141,11 @@ class DialerViewModel : LogsUploadViewModel() {
super.onCleared() super.onCleared()
} }
// This is to workaround the cursor being set to the start when pressing a digit
fun onUriChanged(input: EditText) {
input.setSelection(input.text.length)
}
fun updateShowVideoPreview() { fun updateShowVideoPreview() {
val videoPreview = corePreferences.videoPreview val videoPreview = corePreferences.videoPreview
showPreview.value = videoPreview showPreview.value = videoPreview

View file

@ -42,7 +42,9 @@
android:src="@drawable/backspace" /> android:src="@drawable/backspace" />
<EditText <EditText
android:id="@+id/sip_uri_input"
android:text="@={viewModel.enteredUri}" android:text="@={viewModel.enteredUri}"
android:onTextChanged="@{(text, start, before, count) -> viewModel.onUriChanged(sipUriInput)}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_centerVertical="true" android:layout_centerVertical="true"