aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt8
2 files changed, 7 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
index 42a0f6bb..0fb24f7e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
@@ -41,7 +41,6 @@ import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.profilePictureUrl
import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp
-import com.pitchedapps.frost.glide.transform
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Showcase
import com.pitchedapps.frost.utils.frostEvent
@@ -87,9 +86,6 @@ class LoginActivity : BaseActivity() {
toolbar(toolbar)
}
profileLoader = GlideApp.with(profile)
- swipeRefresh.setOnChildScrollUpCallback { parent, child ->
- web.canScrollVertically(-1)
- }
launch {
for (refreshing in refreshChannel.uniqueOnly(this)) {
if (refreshing) swipeRefresh.isEnabled = true
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
index 0ab11fc6..451f3948 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
@@ -24,11 +24,13 @@ class SwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: Attr
private var downY: Float = -1f
private val touchSlop = ViewConfiguration.get(context).scaledTouchSlop
+ private var nestedCanChildScrollUp: OnChildScrollUpCallback? = null
+
/**
* Copy of [canChildScrollUp], with additional support if necessary
*/
private val canChildScrollUp = OnChildScrollUpCallback { parent, child ->
- when (child) {
+ nestedCanChildScrollUp?.canChildScrollUp(parent, child) ?: when (child) {
is WebView -> child.canScrollVertically(-1).apply {
L.d { "Webview can scroll up $this" }
}
@@ -42,6 +44,10 @@ class SwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: Attr
setOnChildScrollUpCallback(canChildScrollUp)
}
+ override fun setOnChildScrollUpCallback(callback: OnChildScrollUpCallback?) {
+ this.nestedCanChildScrollUp = callback
+ }
+
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
if (ev.action != MotionEvent.ACTION_DOWN && preventRefresh) {
return false