summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-06-23 20:27:02 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-07-01 19:12:29 +0000
commitb204c722d8293562e2739933ffaac3fae42022f8 (patch)
tree3998796ecaebe7d684bdd10f7caf03b131b665be /android/src
parent15c96cc9817bb9acfde73d7a76e84360908ea997 (diff)
downloadmullvadvpn-b204c722d8293562e2739933ffaac3fae42022f8.tar.xz
mullvadvpn-b204c722d8293562e2739933ffaac3fae42022f8.zip
Allow expanded title to be set later
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/CollapsibleTitleController.kt15
1 files changed, 10 insertions, 5 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/CollapsibleTitleController.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/CollapsibleTitleController.kt
index 05b952c9de..8c78f6aa16 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/CollapsibleTitleController.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/CollapsibleTitleController.kt
@@ -78,11 +78,6 @@ class CollapsibleTitleController(val parentView: View, scrollAreaId: Int = R.id.
scrollInterpolation.end = expandedTitleHeight + expandedTitleMarginTop
}
- private val expandedTitle = parentView.findViewById<View>(R.id.expanded_title).apply {
- addOnLayoutChangeListener(expandedTitleLayoutListener)
- visibility = View.INVISIBLE
- }
-
private val titleLayoutListener: LayoutListener = LayoutListener() {
val (x, y) = calculateViewCoordinates(title)
@@ -144,7 +139,17 @@ class CollapsibleTitleController(val parentView: View, scrollAreaId: Int = R.id.
val fullCollapseScrollOffset: Float
get() = scrollInterpolation.end
+ var expandedTitle by observable<View?>(null) { _, oldView, newView ->
+ oldView?.removeOnLayoutChangeListener(expandedTitleLayoutListener)
+ newView?.apply {
+ addOnLayoutChangeListener(expandedTitleLayoutListener)
+ expandedTitleLayoutListener.listener(this)
+ visibility = View.INVISIBLE
+ }
+ }
+
init {
+ expandedTitle = parentView.findViewById<View>(R.id.expanded_title)
update()
}