| 1 | /* This file is part of Aard Dictionary for Android <http://aarddict.org>. |
| 2 | * |
| 3 | * This program is free software: you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 3 |
| 5 | * as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License <http://www.gnu.org/licenses/gpl-3.0.txt> |
| 11 | * for more details. |
| 12 | * |
| 13 | * Copyright (C) 2010 Igor Tkach |
| 14 | */ |
| 15 | |
| 16 | package aarddict.android; |
| 17 | |
| 18 | import android.content.Context; |
| 19 | import android.util.AttributeSet; |
| 20 | import android.webkit.WebView; |
| 21 | |
| 22 | class ArticleView extends WebView { |
| 23 | |
| 24 | interface ScrollListener { |
| 25 | void onScroll(int l, int t, int oldl, int oldt); |
| 26 | } |
| 27 | |
| 28 | private ScrollListener scrollListener; |
| 29 | |
| 30 | public ArticleView(Context context) { |
| 31 | super(context); |
| 32 | } |
| 33 | |
| 34 | public ArticleView(Context context, AttributeSet attrs) { |
| 35 | super(context, attrs); |
| 36 | } |
| 37 | |
| 38 | public ArticleView(Context context, AttributeSet attrs, int defStyle) { |
| 39 | super(context, attrs, defStyle); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | protected void onScrollChanged(int l, int t, int oldl, int oldt) { |
| 44 | super.onScrollChanged(l, t, oldl, oldt); |
| 45 | if (scrollListener != null) { |
| 46 | scrollListener.onScroll(l, t, oldl, oldt); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | public void setOnScrollListener(ScrollListener l) { |
| 51 | this.scrollListener = l; |
| 52 | } |
| 53 | } |