public static final String TAG = "FLYSCREENTHEME";
public static final Uri CONTENT_URI = Uri
.parse("content://com.companyx.flyscreentheme/items");
private static final UriMatcher uriMatcher;
private static final int SINGLE_ROW = 2;
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("com.companyx.flyscreentheme", "items", SINGLE_ROW);
uriMatcher.addURI("com.companyx.flyscreentheme", "raw", 3);
uriMatcher.addURI("*", "*", 4);
}
public static final String[] rows = { "name","version", "background1","background2","background3",
"leftIcon1", "leftIcon2", "rightIcon1", "rightIcon2", "header1", "header2", "body1", "body2", "footer1", "footer2" };
@Override
public int delete(Uri arg0, String arg1, String[] arg2) {
throw new SQLException("This operation is now allowed");
}
@Override
public String getType(Uri _uri) {
Log.d(TAG, "cursor4");
switch (uriMatcher.match(_uri)) {
case SINGLE_ROW:
Log.d(TAG, "cursor6");
return "vnd.companyx.cursor.item/vnd.companyx.item";
default:
throw new IllegalArgumentException("Unsupported URI: " + _uri);
}
}
@Override
public Uri insert(Uri arg0, ContentValues arg1) {
throw new SQLException("This operation is now allowed");
}
@Override
public boolean onCreate() {
return true;
}
@Override
public Cursor query(Uri uri, String[] arg1, String arg2, String[] arg3,
String arg4) {
switch (uriMatcher.match(uri)) {
case SINGLE_ROW:
MatrixCursor c = new MatrixCursor(rows);
Object[] columnValues = new Object[rows.length];
// "name",
columnValues[0] = "Classic";
//version
columnValues[1] = "2";
// "background",
columnValues[2] = "android.resource://com.companyx.flyscreentheme/raw/background1";
columnValues[3] = "android.resource://com.companyx.flyscreentheme/raw/background2";
columnValues[4] = "android.resource://com.companyx.flyscreentheme/raw/background3";
columnValues[5] = "android.resource://com.companyx.flyscreentheme/raw/lefticon1";
columnValues[6] = "android.resource://com.companyx.flyscreentheme/raw/lefticon2";
columnValues[7] = "android.resource://com.companyx.flyscreentheme/raw/righticon1";
columnValues[8] = "android.resource://com.companyx.flyscreentheme/raw/righticon2";
columnValues[9] = "android.resource://com.companyx.flyscreentheme/raw/header1";
columnValues[10] = "android.resource://com.companyx.flyscreentheme/raw/header2";
columnValues[11] = "android.resource://com.companyx.flyscreentheme/raw/body1";
columnValues[12] = "android.resource://com.companyx.flyscreentheme/raw/body2";
columnValues[13] = "android.resource://com.companyx.flyscreentheme/raw/footer1";
columnValues[14] = "android.resource://com.companyx.flyscreentheme/raw/footer2";
c.addRow(columnValues);
return c;
}
return null;
}
@Override
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
throw new SQLException("This operation is now allowed");
}
@Override
public AssetFileDescriptor openAssetFile(Uri uri, String mode)
throws FileNotFoundException {
return super.openAssetFile(uri, mode);
}
Comments (0)
You don't have permission to comment on this page.