[Android] Use built-in two way databinding
Habib Kazemi
git at videolan.org
Mon Aug 6 16:18:25 CEST 2018
vlc-android | branch: master | Habib Kazemi <kazemihabib1996 at gmail.com> | Mon Jul 30 19:34:35 2018 +0430| [db5fd7ccec16e28df72bafd22dd1b0774e8a167d] | committer: Geoffrey Métais
Use built-in two way databinding
Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>
> https://code.videolan.org/videolan/vlc-android/commit/db5fd7ccec16e28df72bafd22dd1b0774e8a167d
---
vlc-android/res/layout/mrl_panel.xml | 3 +--
vlc-android/src/org/videolan/vlc/viewmodels/MRLPanelModel.kt | 6 ------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/vlc-android/res/layout/mrl_panel.xml b/vlc-android/res/layout/mrl_panel.xml
index 22d6f98b6..3a496e57d 100644
--- a/vlc-android/res/layout/mrl_panel.xml
+++ b/vlc-android/res/layout/mrl_panel.xml
@@ -34,9 +34,8 @@
android:layout_alignParentTop="true"
android:hint="@string/open_mrl_dialog_msg"
android:inputType="textUri"
- android:text="@{viewmodel.observableSearchText}"
+ android:text="@={viewmodel.observableSearchText}"
android:textColor="?font_default"
- android:afterTextChanged="@{viewmodel::afterSearchTextChanged}"
android:maxLines="2"
android:layout_marginRight="8dp"
android:paddingTop="10dp"
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/MRLPanelModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/MRLPanelModel.kt
index 124d8629b..37ae748ed 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/MRLPanelModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/MRLPanelModel.kt
@@ -23,7 +23,6 @@ package org.videolan.vlc.viewmodels
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import android.databinding.ObservableField
-import android.text.Editable
import kotlinx.coroutines.experimental.withContext
import org.videolan.medialibrary.media.MediaWrapper
import org.videolan.vlc.VLCApplication
@@ -33,11 +32,6 @@ import org.videolan.vlc.util.uiJob
class MRLPanelModel: ViewModel() {
val observableSearchText = ObservableField<String>()
- fun afterSearchTextChanged(s: Editable?) {
- if (s.toString() != observableSearchText.get())
- observableSearchText.set(s.toString())
- }
-
val observableHistory = MutableLiveData<Array<MediaWrapper>>()
fun updateHistory() = uiJob {
More information about the Android
mailing list