api-impl: misc additions for Oeffi

This commit is contained in:
Julian Winkler
2024-11-22 18:02:54 +01:00
committed by Mis012
parent 7626992241
commit f53ad02e6f
32 changed files with 265 additions and 15 deletions

View File

@@ -31,13 +31,15 @@ public abstract class ContentProvider {
public boolean onCreate() {return false;}
public Context getContext() {
return new Context();
return Context.this_application;
}
public abstract Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder);
public abstract Uri insert(Uri uri, ContentValues values);
public abstract int update(Uri uri, ContentValues values, String selection, String[] selectionArgs);
public abstract int delete(Uri uri, String selection, String[] selectionArgs);
public abstract String getType(Uri uri);

View File

@@ -69,4 +69,12 @@ public class ContentResolver {
else
return null;
}
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
if (provider != null)
return provider.update(uri, values, selection, selectionArgs);
else
return 0;
}
}

View File

@@ -17,6 +17,11 @@ public class SearchRecentSuggestionsProvider extends ContentProvider {
throw new UnsupportedOperationException("Unimplemented method 'insert'");
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("Unimplemented method 'update'");
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("Unimplemented method 'delete'");