1
wxr
2023-04-23 2cd55265ccff3b0a267d7953b2dd9e5dca437aa6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*******************************************************************************
 * Copyright 2011, 2012 Chris Banes.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package com.videogo.widget.pulltorefresh;
 
import android.view.View;
import android.view.animation.Interpolator;
 
public interface IPullToRefresh<T extends View> {
 
    public static enum Mode {
 
        DISABLED(0x0),
 
        PULL_FROM_START(0x1),
 
        PULL_FROM_END(0x2),
 
        BOTH(0x3),
 
        MANUAL_REFRESH_ONLY(0x4);
 
        static Mode mapIntToValue(final int modeInt) {
            for (Mode value : Mode.values()) {
                if (modeInt == value.getIntValue()) {
                    return value;
                }
            }
 
            // If not, return default
            return getDefault();
        }
 
        static Mode getDefault() {
            return DISABLED;
        }
 
        private int mIntValue;
 
        // The modeInt values need to match those from attrs.xml
        Mode(int modeInt) {
            mIntValue = modeInt;
        }
 
        boolean permitsPullToRefresh() {
            return !(this == DISABLED || this == MANUAL_REFRESH_ONLY);
        }
 
        public boolean showHeaderLoadingLayout() {
            return this == PULL_FROM_START || this == BOTH;
        }
 
        public boolean showFooterLoadingLayout() {
            return this == PULL_FROM_END || this == BOTH || this == MANUAL_REFRESH_ONLY;
        }
 
        int getIntValue() {
            return mIntValue;
        }
    }
 
    public static enum State {
 
        RESET(0x0),
 
        PULL_TO_REFRESH(0x1),
 
        RELEASE_TO_REFRESH(0x2),
 
        REFRESHING(0x8),
 
        MANUAL_REFRESHING(0x9),
 
        OVERSCROLLING(0x10);
 
        static State mapIntToValue(final int stateInt) {
            for (State value : State.values()) {
                if (stateInt == value.getIntValue()) {
                    return value;
                }
            }
 
            // If not, return default
            return RESET;
        }
 
        private int mIntValue;
 
        State(int intValue) {
            mIntValue = intValue;
        }
 
        int getIntValue() {
            return mIntValue;
        }
    }
 
    public static interface OnRefreshListener<V extends View> {
 
        public void onRefresh(final PullToRefreshBase<V> refreshView, boolean headerOrFooter);
 
    }
 
    public static interface OnPullEventListener<V extends View> {
 
        public void onPullEvent(final PullToRefreshBase<V> refreshView, State state, Mode direction);
 
    }
 
    public boolean demo();
 
    public Mode getCurrentMode();
 
    public boolean getFilterTouchEvents();
 
    public LoadingLayoutProxy getLoadingLayoutProxy();
 
    public LoadingLayoutProxy getLoadingLayoutProxy(boolean includeStart, boolean includeEnd);
 
    public Mode getMode();
 
    public T getRefreshableView();
 
    public boolean getShowViewWhileRefreshing();
 
    public State getState();
 
    public boolean isPullToRefreshEnabled();
 
    public boolean isPullToRefreshOverScrollEnabled();
 
    public boolean isRefreshing();
 
    public boolean isScrollingWhileRefreshingEnabled();
 
    public void onRefreshComplete();
 
    public void setFilterTouchEvents(boolean filterEvents);
 
    public void setMode(Mode mode);
 
    public void setOnPullEventListener(OnPullEventListener<T> listener);
 
    public void setOnRefreshListener(OnRefreshListener<T> listener);
 
    public void setPullToRefreshOverScrollEnabled(boolean enabled);
 
    public void setRefreshing();
 
    public void setRefreshing(boolean doScroll);
 
    public void setScrollAnimationInterpolator(Interpolator interpolator);
 
    public void setScrollingWhileRefreshingEnabled(boolean scrollingWhileRefreshingEnabled);
 
    public void setShowViewWhileRefreshing(boolean showView);
 
}