SimpleCursorAdapter.java
5.03 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
package android.support.v4.widget;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.RestrictTo;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class SimpleCursorAdapter
extends ResourceCursorAdapter
{
String[] a;
private int b = -1;
private CursorToStringConverter c;
private ViewBinder d;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected int[] mFrom;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected int[] mTo;
@Deprecated
public SimpleCursorAdapter(Context paramContext, int paramInt, Cursor paramCursor, String[] paramArrayOfString, int[] paramArrayOfInt)
{
super(paramContext, paramInt, paramCursor);
this.mTo = paramArrayOfInt;
this.a = paramArrayOfString;
a(paramCursor, paramArrayOfString);
}
public SimpleCursorAdapter(Context paramContext, int paramInt1, Cursor paramCursor, String[] paramArrayOfString, int[] paramArrayOfInt, int paramInt2)
{
super(paramContext, paramInt1, paramCursor, paramInt2);
this.mTo = paramArrayOfInt;
this.a = paramArrayOfString;
a(paramCursor, paramArrayOfString);
}
private void a(Cursor paramCursor, String[] paramArrayOfString)
{
if (paramCursor != null)
{
int j = paramArrayOfString.length;
if ((this.mFrom == null) || (this.mFrom.length != j)) {
this.mFrom = new int[j];
}
int i = 0;
while (i < j)
{
this.mFrom[i] = paramCursor.getColumnIndexOrThrow(paramArrayOfString[i]);
i += 1;
}
}
this.mFrom = null;
}
public void bindView(View paramView, Context paramContext, Cursor paramCursor)
{
ViewBinder localViewBinder = this.d;
int j = this.mTo.length;
int[] arrayOfInt1 = this.mFrom;
int[] arrayOfInt2 = this.mTo;
int i = 0;
View localView;
if (i < j)
{
localView = paramView.findViewById(arrayOfInt2[i]);
if (localView != null) {
if (localViewBinder == null) {
break label185;
}
}
}
label129:
label150:
label185:
for (boolean bool = localViewBinder.setViewValue(localView, paramCursor, arrayOfInt1[i]);; bool = false)
{
if (!bool)
{
String str = paramCursor.getString(arrayOfInt1[i]);
paramContext = str;
if (str == null) {
paramContext = "";
}
if (!(localView instanceof TextView)) {
break label129;
}
setViewText((TextView)localView, paramContext);
}
for (;;)
{
i += 1;
break;
if (!(localView instanceof ImageView)) {
break label150;
}
setViewImage((ImageView)localView, paramContext);
}
throw new IllegalStateException(localView.getClass().getName() + " is not a view that can be bounds by this SimpleCursorAdapter");
return;
}
}
public void changeCursorAndColumns(Cursor paramCursor, String[] paramArrayOfString, int[] paramArrayOfInt)
{
this.a = paramArrayOfString;
this.mTo = paramArrayOfInt;
a(paramCursor, this.a);
super.changeCursor(paramCursor);
}
public CharSequence convertToString(Cursor paramCursor)
{
if (this.c != null) {
return this.c.convertToString(paramCursor);
}
if (this.b >= 0) {
return paramCursor.getString(this.b);
}
return super.convertToString(paramCursor);
}
public CursorToStringConverter getCursorToStringConverter()
{
return this.c;
}
public int getStringConversionColumn()
{
return this.b;
}
public ViewBinder getViewBinder()
{
return this.d;
}
public void setCursorToStringConverter(CursorToStringConverter paramCursorToStringConverter)
{
this.c = paramCursorToStringConverter;
}
public void setStringConversionColumn(int paramInt)
{
this.b = paramInt;
}
public void setViewBinder(ViewBinder paramViewBinder)
{
this.d = paramViewBinder;
}
public void setViewImage(ImageView paramImageView, String paramString)
{
try
{
paramImageView.setImageResource(Integer.parseInt(paramString));
return;
}
catch (NumberFormatException localNumberFormatException)
{
paramImageView.setImageURI(Uri.parse(paramString));
}
}
public void setViewText(TextView paramTextView, String paramString)
{
paramTextView.setText(paramString);
}
public Cursor swapCursor(Cursor paramCursor)
{
a(paramCursor, this.a);
return super.swapCursor(paramCursor);
}
public static abstract interface CursorToStringConverter
{
public abstract CharSequence convertToString(Cursor paramCursor);
}
public static abstract interface ViewBinder
{
public abstract boolean setViewValue(View paramView, Cursor paramCursor, int paramInt);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/widget/SimpleCursorAdapter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/