summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorAleksandr Granin <aleksandr@mullvad.net>2021-08-18 12:13:44 +0200
committerAleksandr Granin <aleksandr@mullvad.net>2021-08-19 08:29:10 +0200
commitdb08d856a6dec637b23949b5988fe129729585f0 (patch)
treec647ac3ee3ef0bd275e5bf1b23ea8e4c25944a80 /android
parent107b4f3e1099e4fb601bbd23a44273d866152a5b (diff)
downloadmullvadvpn-db08d856a6dec637b23949b5988fe129729585f0.tar.xz
mullvadvpn-db08d856a6dec637b23949b5988fe129729585f0.zip
Fix focus issue when in some cases value of MTU was erased
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/MtuCell.kt4
-rw-r--r--android/src/main/res/layout/advanced_header.xml2
2 files changed, 4 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/MtuCell.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/MtuCell.kt
index 5c2e97bf20..93daba0856 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/MtuCell.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/MtuCell.kt
@@ -35,10 +35,10 @@ class MtuCell : Cell {
var onSubmit: ((Int?) -> Unit)? = null
var hasFocus by observable(false) { _, oldValue, newValue ->
- if (oldValue == true && newValue == false) {
+ if (oldValue && !newValue) {
val mtu = value
- if (mtu == null || (mtu >= MIN_MTU_VALUE && mtu <= MAX_MTU_VALUE)) {
+ if (mtu == null || (mtu in MIN_MTU_VALUE..MAX_MTU_VALUE)) {
onSubmit?.invoke(mtu)
}
}
diff --git a/android/src/main/res/layout/advanced_header.xml b/android/src/main/res/layout/advanced_header.xml
index 3a711d838c..eb04259b3d 100644
--- a/android/src/main/res/layout/advanced_header.xml
+++ b/android/src/main/res/layout/advanced_header.xml
@@ -16,6 +16,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/vertical_space"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
mullvad:text="@string/wireguard_mtu" />
<net.mullvad.mullvadvpn.ui.widget.NavigateCell android:id="@+id/wireguard_keys"
android:layout_width="match_parent"