1 // Copyright 2011 Google Inc. All Rights Reserved. 2 3 package com.android.mail.browse; 4 5 import android.content.Context; 6 import android.util.AttributeSet; 7 import android.view.View; 8 9 import com.android.mail.browse.ScrollNotifier.ScrollListener; 10 11 /** 12 * An overlay to sit on top of WebView, message headers, and snap header to display scrollbars. 13 * It has to sit on top of all other views that compose the conversation so that the scrollbars are 14 * not obscured. 15 * 16 */ 17 public class ScrollIndicatorsView extends View implements ScrollListener { 18 19 private ScrollNotifier mSource; 20 21 public ScrollIndicatorsView(Context context) { 22 super(context); 23 } 24 25 public ScrollIndicatorsView(Context context, AttributeSet attrs) { 26 super(context, attrs); 27 } 28 29 public void setSourceView(ScrollNotifier notifier) { 30 mSource = notifier; 31 mSource.addScrollListener(this); 32 } 33 34 @Override 35 protected int computeVerticalScrollRange() { 36 return mSource.computeVerticalScrollRange(); 37 } 38 39 @Override 40 protected int computeVerticalScrollOffset() { 41 return mSource.computeVerticalScrollOffset(); 42 } 43 44 @Override 45 protected int computeVerticalScrollExtent() { 46 return mSource.computeVerticalScrollExtent(); 47 } 48 49 @Override 50 protected int computeHorizontalScrollRange() { 51 return mSource.computeHorizontalScrollRange(); 52 } 53 54 @Override 55 protected int computeHorizontalScrollOffset() { 56 return mSource.computeHorizontalScrollOffset(); 57 } 58 59 @Override 60 protected int computeHorizontalScrollExtent() { 61 return mSource.computeHorizontalScrollExtent(); 62 } 63 64 @Override 65 public void onNotifierScroll(int left, int top) { 66 awakenScrollBars(); 67 } 68 } 69