Bläddra i källkod

Remove ScrollViewDelegate

It was mistakingly merged int.
Guy Carmeli 8 år sedan
förälder
incheckning
d5ff2ed27c

+ 0
- 59
android/app/src/main/java/com/reactnativenavigation/views/ScrollViewDelegate.java Visa fil

@@ -1,59 +0,0 @@
1
-package com.reactnativenavigation.views;
2
-
3
-import android.view.View;
4
-import android.view.ViewTreeObserver;
5
-import android.widget.ScrollView;
6
-
7
-import com.reactnativenavigation.utils.SdkSupports;
8
-
9
-public class ScrollViewDelegate implements ViewTreeObserver.OnScrollChangedListener {
10
-
11
-    public interface OnScrollListener {
12
-        void onScroll(ScrollView scrollView);
13
-    }
14
-
15
-    private ScrollView scrollView;
16
-    private OnScrollListener listener;
17
-
18
-    public ScrollViewDelegate() {
19
-    }
20
-
21
-    public void onViewAdded(View child) {
22
-        if (child instanceof ScrollView) {
23
-            detach();
24
-            scrollView = (ScrollView) child;
25
-            if (SdkSupports.marshmallow()) {
26
-                scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
27
-                    @Override
28
-                    public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
29
-                        ScrollViewDelegate.this.onScrollChanged();
30
-                    }
31
-                });
32
-            } else {
33
-                scrollView.getViewTreeObserver().addOnScrollChangedListener(this);
34
-            }
35
-        }
36
-    }
37
-
38
-    private void detach() {
39
-        if (scrollView != null) {
40
-            if (SdkSupports.marshmallow()) {
41
-                scrollView.setOnScrollChangeListener(null);
42
-            } else {
43
-                scrollView.getViewTreeObserver().removeOnScrollChangedListener(this);
44
-            }
45
-            scrollView = null;
46
-        }
47
-    }
48
-
49
-    public void setListener(OnScrollListener listener) {
50
-        this.listener = listener;
51
-    }
52
-
53
-    @Override
54
-    public void onScrollChanged() {
55
-        if (this.listener != null) {
56
-            this.listener.onScroll(scrollView);
57
-        }
58
-    }
59
-}