You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement ContentResolver
ContentUris.java and UriMatcher.java are copied from AOSP
This commit is contained in:
@@ -3,7 +3,6 @@ package android.content;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import android.database.AbstractCursor;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
@@ -28,17 +27,11 @@ public class ContentResolver {
|
||||
}
|
||||
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
return new AbstractCursor() {
|
||||
public int getCount() { return 0; }
|
||||
public String[] getColumnNames() { return new String[0]; }
|
||||
public String getString(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public short getShort(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public int getInt(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public long getLong(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public float getFloat(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public double getDouble(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public boolean isNull(int column) { throw new IndexOutOfBoundsException(); }
|
||||
};
|
||||
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
||||
if (provider != null)
|
||||
return provider.query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) {
|
||||
@@ -46,6 +39,18 @@ public class ContentResolver {
|
||||
}
|
||||
|
||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||
return 0;
|
||||
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
||||
if (provider != null)
|
||||
return provider.delete(uri, selection, selectionArgs);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
||||
if (provider != null)
|
||||
return provider.insert(uri, values);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user