am 1c0012e1: Merge "Ensure that the column is valid before querying." into honeycomb
* commit '1c0012e103a380489fe4a150247cd226de9a89a6': Ensure that the column is valid before querying.
This commit is contained in:
@@ -78,15 +78,15 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
// URL color
|
// URL color
|
||||||
private ColorStateList mUrlColor;
|
private ColorStateList mUrlColor;
|
||||||
|
|
||||||
// Cached column indexes, updated when the cursor changes.
|
static final int INVALID_INDEX = -1;
|
||||||
private int mText1Col;
|
|
||||||
private int mText2Col;
|
|
||||||
private int mText2UrlCol;
|
|
||||||
private int mIconName1Col;
|
|
||||||
private int mIconName2Col;
|
|
||||||
private int mFlagsCol;
|
|
||||||
|
|
||||||
static final int NONE = -1;
|
// Cached column indexes, updated when the cursor changes.
|
||||||
|
private int mText1Col = INVALID_INDEX;
|
||||||
|
private int mText2Col = INVALID_INDEX;
|
||||||
|
private int mText2UrlCol = INVALID_INDEX;
|
||||||
|
private int mIconName1Col = INVALID_INDEX;
|
||||||
|
private int mIconName2Col = INVALID_INDEX;
|
||||||
|
private int mFlagsCol = INVALID_INDEX;
|
||||||
|
|
||||||
private final Runnable mStartSpinnerRunnable;
|
private final Runnable mStartSpinnerRunnable;
|
||||||
private final Runnable mStopSpinnerRunnable;
|
private final Runnable mStopSpinnerRunnable;
|
||||||
@@ -308,7 +308,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
ChildViewCache views = (ChildViewCache) view.getTag();
|
ChildViewCache views = (ChildViewCache) view.getTag();
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (mFlagsCol != -1) {
|
if (mFlagsCol != INVALID_INDEX) {
|
||||||
flags = cursor.getInt(mFlagsCol);
|
flags = cursor.getInt(mFlagsCol);
|
||||||
}
|
}
|
||||||
if (views.mText1 != null) {
|
if (views.mText1 != null) {
|
||||||
@@ -391,7 +391,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getIcon1(Cursor cursor) {
|
private Drawable getIcon1(Cursor cursor) {
|
||||||
if (mIconName1Col < 0) {
|
if (mIconName1Col == INVALID_INDEX) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String value = cursor.getString(mIconName1Col);
|
String value = cursor.getString(mIconName1Col);
|
||||||
@@ -403,7 +403,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getIcon2(Cursor cursor) {
|
private Drawable getIcon2(Cursor cursor) {
|
||||||
if (mIconName2Col < 0) {
|
if (mIconName2Col == INVALID_INDEX) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String value = cursor.getString(mIconName2Col);
|
String value = cursor.getString(mIconName2Col);
|
||||||
@@ -687,7 +687,7 @@ class SuggestionsAdapter extends ResourceCursorAdapter implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getStringOrNull(Cursor cursor, int col) {
|
private static String getStringOrNull(Cursor cursor, int col) {
|
||||||
if (col == NONE) {
|
if (col == INVALID_INDEX) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user