Search in sources :

Example 16 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowContentResolver method delete.

@Implementation
public final int delete(Uri url, String where, String[] selectionArgs) {
    ContentProvider provider = getProvider(url);
    if (provider != null) {
        return provider.delete(url, where, selectionArgs);
    } else {
        DeleteStatement deleteStatement = new DeleteStatement(url, where, selectionArgs);
        deleteStatements.add(deleteStatement);
        return 1;
    }
}
Also used : IContentProvider(android.content.IContentProvider) ContentProvider(android.content.ContentProvider) Implementation(org.robolectric.annotation.Implementation)

Example 17 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowContentResolver method query.

@Implementation
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) {
    ContentProvider provider = getProvider(uri);
    if (provider != null) {
        return provider.query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal);
    } else {
        BaseCursor returnCursor = getCursor(uri);
        if (returnCursor == null) {
            return null;
        }
        returnCursor.setQuery(uri, projection, selection, selectionArgs, sortOrder);
        return returnCursor;
    }
}
Also used : BaseCursor(org.robolectric.fakes.BaseCursor) IContentProvider(android.content.IContentProvider) ContentProvider(android.content.ContentProvider) Implementation(org.robolectric.annotation.Implementation)

Example 18 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowContentResolver method addPeriodicSync.

@Implementation
public static void addPeriodicSync(Account account, String authority, Bundle extras, long pollFrequency) {
    validateSyncExtrasBundle(extras);
    removePeriodicSync(account, authority, extras);
    getStatus(account, authority, true).syncs.add(new PeriodicSync(account, authority, extras, pollFrequency));
}
Also used : PeriodicSync(android.content.PeriodicSync) Implementation(org.robolectric.annotation.Implementation)

Example 19 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowContentResolver method update.

@Implementation
public int update(Uri uri, ContentValues values, String where, String[] selectionArgs) {
    ContentProvider provider = getProvider(uri);
    if (provider != null) {
        return provider.update(uri, values, where, selectionArgs);
    } else {
        UpdateStatement updateStatement = new UpdateStatement(uri, new ContentValues(values), where, selectionArgs);
        updateStatements.add(updateStatement);
        return ++nextDatabaseIdForUpdates;
    }
}
Also used : ContentValues(android.content.ContentValues) IContentProvider(android.content.IContentProvider) ContentProvider(android.content.ContentProvider) Implementation(org.robolectric.annotation.Implementation)

Example 20 with Implementation

use of org.robolectric.annotation.Implementation in project robolectric by robolectric.

the class ShadowResources method loadDrawable.

@Implementation
public Drawable loadDrawable(TypedValue value, int id, Resources.Theme theme) throws Resources.NotFoundException {
    Drawable drawable = directlyOn(realResources, Resources.class, "loadDrawable", ClassParameter.from(TypedValue.class, value), ClassParameter.from(int.class, id), ClassParameter.from(Resources.Theme.class, theme));
    setCreatedFromResId(realResources, id, drawable);
    return drawable;
}
Also used : Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) TypedValue(android.util.TypedValue) Implementation(org.robolectric.annotation.Implementation)

Aggregations

Implementation (org.robolectric.annotation.Implementation)114 Bitmap (android.graphics.Bitmap)17 HiddenApi (org.robolectric.annotation.HiddenApi)10 BitmapDrawable (android.graphics.drawable.BitmapDrawable)6 View (android.view.View)6 IOException (java.io.IOException)6 ContentProvider (android.content.ContentProvider)5 IContentProvider (android.content.IContentProvider)5 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)5 Rect (android.graphics.Rect)4 Message (android.os.Message)4 RealObject (org.robolectric.annotation.RealObject)4 FileTypedResource (org.robolectric.res.FileTypedResource)4 Point (android.graphics.Point)3 AccessibilityWindowInfo (android.view.accessibility.AccessibilityWindowInfo)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 LinkedList (java.util.LinkedList)3 Activity (android.app.Activity)2 Dialog (android.app.Dialog)2