CursorAdapter.java
8.62 KB
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
package android.support.v4.widget;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.os.Handler;
import android.support.annotation.RestrictTo;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.FilterQueryProvider;
import android.widget.Filterable;
import ev;
import ev.a;
public abstract class CursorAdapter
extends BaseAdapter
implements Filterable, ev.a
{
@Deprecated
public static final int FLAG_AUTO_REQUERY = 1;
public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected boolean mAutoRequery;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected a mChangeObserver;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected Context mContext;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected Cursor mCursor;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected ev mCursorFilter;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected DataSetObserver mDataSetObserver;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected boolean mDataValid;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected FilterQueryProvider mFilterQueryProvider;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected int mRowIDColumn;
@Deprecated
public CursorAdapter(Context paramContext, Cursor paramCursor)
{
a(paramContext, paramCursor, 1);
}
public CursorAdapter(Context paramContext, Cursor paramCursor, int paramInt)
{
a(paramContext, paramCursor, paramInt);
}
public CursorAdapter(Context paramContext, Cursor paramCursor, boolean paramBoolean)
{
if (paramBoolean) {}
for (int i = 1;; i = 2)
{
a(paramContext, paramCursor, i);
return;
}
}
private void a(Context paramContext, Cursor paramCursor, int paramInt)
{
boolean bool = true;
label23:
int i;
if ((paramInt & 0x1) == 1)
{
paramInt |= 0x2;
this.mAutoRequery = true;
if (paramCursor == null) {
break label139;
}
this.mCursor = paramCursor;
this.mDataValid = bool;
this.mContext = paramContext;
if (!bool) {
break label145;
}
i = paramCursor.getColumnIndexOrThrow("_id");
label54:
this.mRowIDColumn = i;
if ((paramInt & 0x2) != 2) {
break label151;
}
this.mChangeObserver = new a();
}
for (this.mDataSetObserver = new b();; this.mDataSetObserver = null)
{
if (bool)
{
if (this.mChangeObserver != null) {
paramCursor.registerContentObserver(this.mChangeObserver);
}
if (this.mDataSetObserver != null) {
paramCursor.registerDataSetObserver(this.mDataSetObserver);
}
}
return;
this.mAutoRequery = false;
break;
label139:
bool = false;
break label23;
label145:
i = -1;
break label54;
label151:
this.mChangeObserver = null;
}
}
public abstract void bindView(View paramView, Context paramContext, Cursor paramCursor);
public void changeCursor(Cursor paramCursor)
{
paramCursor = swapCursor(paramCursor);
if (paramCursor != null) {
paramCursor.close();
}
}
public CharSequence convertToString(Cursor paramCursor)
{
if (paramCursor == null) {
return "";
}
return paramCursor.toString();
}
public int getCount()
{
if ((this.mDataValid) && (this.mCursor != null)) {
return this.mCursor.getCount();
}
return 0;
}
public Cursor getCursor()
{
return this.mCursor;
}
public View getDropDownView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
if (this.mDataValid)
{
this.mCursor.moveToPosition(paramInt);
View localView = paramView;
if (paramView == null) {
localView = newDropDownView(this.mContext, this.mCursor, paramViewGroup);
}
bindView(localView, this.mContext, this.mCursor);
return localView;
}
return null;
}
public Filter getFilter()
{
if (this.mCursorFilter == null) {
this.mCursorFilter = new ev(this);
}
return this.mCursorFilter;
}
public FilterQueryProvider getFilterQueryProvider()
{
return this.mFilterQueryProvider;
}
public Object getItem(int paramInt)
{
if ((this.mDataValid) && (this.mCursor != null))
{
this.mCursor.moveToPosition(paramInt);
return this.mCursor;
}
return null;
}
public long getItemId(int paramInt)
{
long l2 = 0L;
long l1 = l2;
if (this.mDataValid)
{
l1 = l2;
if (this.mCursor != null)
{
l1 = l2;
if (this.mCursor.moveToPosition(paramInt)) {
l1 = this.mCursor.getLong(this.mRowIDColumn);
}
}
}
return l1;
}
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
{
if (!this.mDataValid) {
throw new IllegalStateException("this should only be called when the cursor is valid");
}
if (!this.mCursor.moveToPosition(paramInt)) {
throw new IllegalStateException("couldn't move cursor to position " + paramInt);
}
View localView = paramView;
if (paramView == null) {
localView = newView(this.mContext, this.mCursor, paramViewGroup);
}
bindView(localView, this.mContext, this.mCursor);
return localView;
}
public boolean hasStableIds()
{
return true;
}
@Deprecated
protected void init(Context paramContext, Cursor paramCursor, boolean paramBoolean)
{
if (paramBoolean) {}
for (int i = 1;; i = 2)
{
a(paramContext, paramCursor, i);
return;
}
}
public View newDropDownView(Context paramContext, Cursor paramCursor, ViewGroup paramViewGroup)
{
return newView(paramContext, paramCursor, paramViewGroup);
}
public abstract View newView(Context paramContext, Cursor paramCursor, ViewGroup paramViewGroup);
protected void onContentChanged()
{
if ((this.mAutoRequery) && (this.mCursor != null) && (!this.mCursor.isClosed())) {
this.mDataValid = this.mCursor.requery();
}
}
public Cursor runQueryOnBackgroundThread(CharSequence paramCharSequence)
{
if (this.mFilterQueryProvider != null) {
return this.mFilterQueryProvider.runQuery(paramCharSequence);
}
return this.mCursor;
}
public void setFilterQueryProvider(FilterQueryProvider paramFilterQueryProvider)
{
this.mFilterQueryProvider = paramFilterQueryProvider;
}
public Cursor swapCursor(Cursor paramCursor)
{
if (paramCursor == this.mCursor) {
return null;
}
Cursor localCursor = this.mCursor;
if (localCursor != null)
{
if (this.mChangeObserver != null) {
localCursor.unregisterContentObserver(this.mChangeObserver);
}
if (this.mDataSetObserver != null) {
localCursor.unregisterDataSetObserver(this.mDataSetObserver);
}
}
this.mCursor = paramCursor;
if (paramCursor != null)
{
if (this.mChangeObserver != null) {
paramCursor.registerContentObserver(this.mChangeObserver);
}
if (this.mDataSetObserver != null) {
paramCursor.registerDataSetObserver(this.mDataSetObserver);
}
this.mRowIDColumn = paramCursor.getColumnIndexOrThrow("_id");
this.mDataValid = true;
notifyDataSetChanged();
return localCursor;
}
this.mRowIDColumn = -1;
this.mDataValid = false;
notifyDataSetInvalidated();
return localCursor;
}
final class a
extends ContentObserver
{
a()
{
super();
}
public final boolean deliverSelfNotifications()
{
return true;
}
public final void onChange(boolean paramBoolean)
{
CursorAdapter.this.onContentChanged();
}
}
final class b
extends DataSetObserver
{
b() {}
public final void onChanged()
{
CursorAdapter.this.mDataValid = true;
CursorAdapter.this.notifyDataSetChanged();
}
public final void onInvalidated()
{
CursorAdapter.this.mDataValid = false;
CursorAdapter.this.notifyDataSetInvalidated();
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/widget/CursorAdapter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/