use of android.graphics.Movie in project android_frameworks_base by crdroidandroid.
the class Resources method getMovie.
/**
* Return a movie object associated with the particular resource ID.
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public Movie getMovie(@RawRes int id) throws NotFoundException {
final InputStream is = openRawResource(id);
final Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (IOException e) {
// No one cares.
}
return movie;
}
use of android.graphics.Movie in project platform_frameworks_base by android.
the class Resources method getMovie.
/**
* Return a movie object associated with the particular resource ID.
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public Movie getMovie(@RawRes int id) throws NotFoundException {
final InputStream is = openRawResource(id);
final Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (IOException e) {
// No one cares.
}
return movie;
}
use of android.graphics.Movie in project android_frameworks_base by AOSPA.
the class Resources method getMovie.
/**
* Return a movie object associated with the particular resource ID.
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public Movie getMovie(@RawRes int id) throws NotFoundException {
final InputStream is = openRawResource(id);
final Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (IOException e) {
// No one cares.
}
return movie;
}
use of android.graphics.Movie in project 9GAG by Mixiaoxiao.
the class ImageViewEx method setSourceBlocking.
/**
* Sets the image from a byte array in a blocking, CPU-consuming way.
* Will handle itself referring back to the UI thread when needed.
*
* @param src The byte array containing the image to set into the ImageViewEx.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setSourceBlocking(final byte[] src) {
if (src == null) {
try {
stop();
mGif = null;
setTag(null);
} catch (Throwable ignored) {
}
return;
}
Movie gif = null;
// decoding into a Movie is pointless (read: expensive)
if (internalCanAnimate()) {
gif = Movie.decodeByteArray(src, 0, src.length);
}
// If gif is null, it's probably not a gif
if (gif == null || !internalCanAnimate()) {
// If not a gif and if on Android 3+, enable HW acceleration
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
// Sets the image as a regular Drawable
setTag(null);
final Drawable d = Converters.byteArrayToDrawable(src, mOptions, getContext());
// We need to run this on the UI thread
stopLoading();
mSetDrawableRunnable.setDrawable(d);
mHandler.post(mSetDrawableRunnable);
} else {
// Disables the HW acceleration when viewing a GIF on Android 3+
if (Build.VERSION.SDK_INT >= 11) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// We need to run this on the UI thread
stopLoading();
mSetGifRunnable.setGif(gif);
mHandler.post(mSetGifRunnable);
}
}
Aggregations