use of android.graphics.Movie in project xUtils3 by wyouflf.
the class ImageDecoder method decodeGif.
/**
* 转换文件为Movie, 可用于创建GifDrawable.
*
* @param file
* @param options
* @param cancelable
* @return
* @throws IOException
*/
public static Movie decodeGif(File file, ImageOptions options, Callback.Cancelable cancelable) throws IOException {
{
// check params
if (file == null || !file.exists() || file.length() < 1)
return null;
/*if (options == null) {
options = ImageOptions.DEFAULT; // not use
}
if (options.getMaxWidth() <= 0 || options.getMaxHeight() <= 0) {
options.optimizeMaxSize(null);
}*/
}
InputStream in = null;
try {
if (cancelable != null && cancelable.isCancelled()) {
throw new Callback.CancelledException("cancelled during decode image");
}
int buffSize = 1024 * 16;
in = new BufferedInputStream(new FileInputStream(file), buffSize);
in.mark(buffSize);
Movie movie = Movie.decodeStream(in);
if (movie == null) {
throw new IOException("decode image error");
}
return movie;
} catch (IOException ex) {
throw ex;
} catch (Throwable ex) {
LogUtil.e(ex.getMessage(), ex);
return null;
} finally {
IOUtil.closeQuietly(in);
}
}
use of android.graphics.Movie in project android_frameworks_base by ParanoidAndroid.
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(int id) throws NotFoundException {
InputStream is = openRawResource(id);
Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (java.io.IOException e) {
// don't care, since the return value is valid
}
return movie;
}
use of android.graphics.Movie in project android_frameworks_base by ResurrectionRemix.
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 DirtyUnicorns.
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 XobotOS by xamarin.
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(int id) throws NotFoundException {
InputStream is = openRawResource(id);
Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (java.io.IOException e) {
// don't care, since the return value is valid
}
return movie;
}
Aggregations