use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowTime method set.
@Implementation(maxSdk = KITKAT_WATCH)
public void set(long millis) {
Calendar c = getCalendar();
c.setTimeInMillis(millis);
set(c.get(Calendar.SECOND), c.get(Calendar.MINUTE), c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.MONTH), c.get(Calendar.YEAR));
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowToast method makeText.
@Implementation
public static Toast makeText(Context context, CharSequence text, int duration) {
Toast toast = new Toast(context);
toast.setDuration(duration);
shadowOf(toast).text = text.toString();
return toast;
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowTypeface method createFromAsset.
@Implementation
public static Typeface createFromAsset(AssetManager mgr, String path) {
AndroidManifest appManifest = Shadows.shadowOf(RuntimeEnvironment.application).getAppManifest();
ArrayList<String> paths = new ArrayList<>();
paths.add(getAssetsPath(appManifest, path));
List<AndroidManifest> libraryManifests = appManifest.getLibraryManifests();
for (AndroidManifest libraryManifest : libraryManifests) {
paths.add(getAssetsPath(libraryManifest, path));
}
for (String assetPath : paths) {
if (new File(assetPath).exists()) {
return createUnderlyingTypeface(path, Typeface.NORMAL);
}
}
throw new RuntimeException("Font not found at " + paths);
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowCamera method open.
@Implementation
public static Camera open() {
lastOpenedCameraId = 0;
Camera camera = newInstanceOf(Camera.class);
Shadows.shadowOf(camera).id = 0;
return camera;
}
use of org.robolectric.annotation.Implementation in project robolectric by robolectric.
the class ShadowCamera method open.
@Implementation
public static Camera open(int cameraId) {
lastOpenedCameraId = cameraId;
Camera camera = newInstanceOf(Camera.class);
Shadows.shadowOf(camera).id = cameraId;
return camera;
}
Aggregations