Created
December 9, 2017 22:30
-
-
Save tiwiz/85fdfdf37bb0d331da618252b97e8f51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class ObservableWebView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : WebView(context, attrs, defStyleAttr), ScrollableViewCompat { | |
private lateinit var listener : OnScrollChangeObserver | |
override fun addOnScrollChangeListener(l: OnScrollChangeObserver) { | |
listener = l | |
} | |
override fun getAttachedActivity() = context as AppCompatActivity | |
override fun onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int) { | |
super.onScrollChanged(l, t, oldl, oldt) | |
listener.onScrollChange(this, l, t, oldl, oldt) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment