This source file includes following definitions.
- getColumnNames
- getCount
- getString
- isNull
- getLong
- getShort
- getDouble
- getInt
- getFloat
- onMove
package org.chromium.chrome.browser;
import android.app.SearchManager;
import android.content.Intent;
import android.database.AbstractCursor;
import android.database.Cursor;
import android.provider.BaseColumns;
import android.provider.Browser.BookmarkColumns;
import org.chromium.chrome.R;
class ChromeBrowserProviderSuggestionsCursor extends AbstractCursor {
private static final String[] COLS = new String [] {
BaseColumns._ID,
SearchManager.SUGGEST_COLUMN_INTENT_ACTION,
SearchManager.SUGGEST_COLUMN_INTENT_DATA,
SearchManager.SUGGEST_COLUMN_TEXT_1,
SearchManager.SUGGEST_COLUMN_TEXT_2,
SearchManager.SUGGEST_COLUMN_TEXT_2_URL,
SearchManager.SUGGEST_COLUMN_ICON_1,
SearchManager.SUGGEST_COLUMN_LAST_ACCESS_HINT
};
private static final int COLUMN_ID = 0;
private static final int COLUMN_SUGGEST_INTENT_ACTION = 1;
private static final int COLUMN_SUGGEST_INTENT_DATA = 2;
private static final int COLUMN_SUGGEST_TEXT_1 = 3;
private static final int COLUMN_SUGGEST_TEXT_2 = 4;
private static final int COLUMN_SUGGEST_TEXT_2_URL = 5;
private static final int COLUMN_SUGGEST_ICON_1 = 6;
private static final int COLUMN_SUGGEST_LAST_ACCESS_HINT = 7;
private final Cursor mCursor;
public ChromeBrowserProviderSuggestionsCursor(Cursor c) {
mCursor = c;
}
@Override
public String[] getColumnNames() {
return COLS;
}
@Override
public int getCount() {
return mCursor.getCount();
}
@Override
public String getString(int column) {
switch (column) {
case COLUMN_ID:
return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns._ID));
case COLUMN_SUGGEST_INTENT_ACTION:
return Intent.ACTION_VIEW;
case COLUMN_SUGGEST_INTENT_DATA:
return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL));
case COLUMN_SUGGEST_TEXT_1:
return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.TITLE));
case COLUMN_SUGGEST_TEXT_2:
case COLUMN_SUGGEST_TEXT_2_URL:
return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL));
case COLUMN_SUGGEST_ICON_1:
return Integer.toString(R.mipmap.app_icon);
case COLUMN_SUGGEST_LAST_ACCESS_HINT:
long lastAccess = mCursor.getLong(
mCursor.getColumnIndex(BookmarkColumns.DATE));
return lastAccess < 0 ? "0" : "" + lastAccess;
default:
throw new UnsupportedOperationException();
}
}
@Override
public boolean isNull(int c) {
return mCursor.isNull(c);
}
@Override
public long getLong(int c) {
switch (c) {
case 7:
long lastAccess = mCursor.getLong(
mCursor.getColumnIndex(BookmarkColumns.DATE));
return lastAccess < 0 ? 0 : lastAccess;
default:
throw new UnsupportedOperationException();
}
}
@Override
public short getShort(int c) {
throw new UnsupportedOperationException();
}
@Override
public double getDouble(int c) {
throw new UnsupportedOperationException();
}
@Override
public int getInt(int c) {
throw new UnsupportedOperationException();
}
@Override
public float getFloat(int c) {
throw new UnsupportedOperationException();
}
@Override
public boolean onMove(int oldPosition, int newPosition) {
return mCursor.moveToPosition(newPosition);
}
}