summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-05-29 14:17:40 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-06-02 16:32:17 +0000
commita9705fc7c54b3277a71aec995e3ef2355d7b15a9 (patch)
tree602fb74413da690cb3502a329a5dec2c7d58cf21 /android
parent7fce9b0e1c98d322a4fa1c01113e42178ec0fbaa (diff)
downloadmullvadvpn-a9705fc7c54b3277a71aec995e3ef2355d7b15a9.tar.xz
mullvadvpn-a9705fc7c54b3277a71aec995e3ef2355d7b15a9.zip
Create `ListenableScrollView` widget
Diffstat (limited to 'android')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt30
1 files changed, 30 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt
new file mode 100644
index 0000000000..95fdeebc63
--- /dev/null
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/ListenableScrollView.kt
@@ -0,0 +1,30 @@
+package net.mullvad.mullvadvpn.ui.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import android.widget.ScrollView
+
+class ListenableScrollView : ScrollView {
+ var onScrollListener: ((Int, Int, Int, Int) -> Unit)? = null
+
+ constructor(context: Context) : super(context) {}
+
+ constructor(context: Context, attributes: AttributeSet) : super(context, attributes) {}
+
+ constructor(context: Context, attributes: AttributeSet, defaultStyleAttribute: Int) :
+ super(context, attributes, defaultStyleAttribute) {
+ }
+
+ constructor(
+ context: Context,
+ attributes: AttributeSet,
+ defaultStyleAttribute: Int,
+ defaultStyleResource: Int
+ ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) {
+ }
+
+ override fun onScrollChanged(left: Int, top: Int, oldLeft: Int, oldTop: Int) {
+ super.onScrollChanged(left, top, oldLeft, oldTop)
+ onScrollListener?.invoke(left, top, oldLeft, oldTop)
+ }
+}