diff options
Diffstat (limited to 'src/com/android/browser/NavTabScroller.java')
| -rw-r--r-- | src/com/android/browser/NavTabScroller.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/browser/NavTabScroller.java b/src/com/android/browser/NavTabScroller.java index 9434ff09e..bd26df704 100644 --- a/src/com/android/browser/NavTabScroller.java +++ b/src/com/android/browser/NavTabScroller.java @@ -192,10 +192,22 @@ public class NavTabScroller extends FrameLayout { int midy = getScrollY() + getHeight() / 2; int sel = -1; for (int i = 0; i < mContentView.getChildCount(); i++) { - View child = mContentView.getChildAt(i); - if (child.getTop() <= midy && child.getBottom() >= midy) { + NavTabView child = (NavTabView) mContentView.getChildAt(i); + int top = child.getTop(); + int bottom = child.getBottom(); + if (top <= midy && bottom >= midy) { sel = i; - break; + } else { + // check if on screen + if (top > getScrollY() + getHeight() || bottom < getScrollY()) { + if (!child.isPaused()) { + child.pause(); + } + } else { + if (child.isPaused()) { + child.resume(); + } + } } } if (sel != -1) { |
