From 4afdb145d43cf42397ed47ecb1e85624ea39a81b Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Tue, 10 Mar 2015 13:07:09 -0700 Subject: [PATCH] [SetupWizardLib] Post checkScroll in BottomScrollView In BottomScrollView, post the checkScroll instead of running it immediately from onLayout, so that views that change within the callbacks will be re-laid-out. Bug: 19635676 Change-Id: I0c8b47abd8c40c0c44da8498e1397b1940cce0b3 --- .../setupwizardlib/view/BottomScrollView.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library/src/com/android/setupwizardlib/view/BottomScrollView.java b/library/src/com/android/setupwizardlib/view/BottomScrollView.java index 5593456..806ecf4 100644 --- a/library/src/com/android/setupwizardlib/view/BottomScrollView.java +++ b/library/src/com/android/setupwizardlib/view/BottomScrollView.java @@ -37,6 +37,13 @@ public class BottomScrollView extends ScrollView { private int mScrollThreshold; private boolean mRequiringScroll = false; + private final Runnable mCheckScrollRunnable = new Runnable() { + @Override + public void run() { + checkScroll(); + } + }; + public BottomScrollView(Context context) { super(context); } @@ -62,7 +69,10 @@ public class BottomScrollView extends ScrollView { - getPaddingBottom()); } if (b - t > 0) { - checkScroll(); + // Post check scroll in the next run loop, so that the callback methods will be invoked + // after the layout pass. This way a new layout pass will be scheduled if view + // properties are changed in the callbacks. + post(mCheckScrollRunnable); } }