本文整理了Java中android.graphics.Movie.decodeStream()
方法的一些代码示例,展示了Movie.decodeStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Movie.decodeStream()
方法的具体详情如下:
包路径:android.graphics.Movie
类名称:Movie
方法名:decodeStream
暂无
代码示例来源:origin: Rajawali/Rajawali
private void loadGIF() {
Context context = TextureManager.getInstance().getContext();
mMovie = Movie.decodeStream(context.getResources().openRawResource(mResourceId));
mWidth = mMovie.width();
mHeight = mMovie.height();
mGIFBitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
mCanvas = new Canvas(mGIFBitmap);
mMovie.draw(mCanvas, 0, 0);
mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
}
代码示例来源:origin: huxq17/XRefreshView
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// 从描述文件中读出gif的值,创建出Movie实例
final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifView, defStyle,
R.style.Widget_GifView);
mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
代码示例来源:origin: huxq17/XRefreshView
/**
* 设置gif图资源
*
* @param movieResId
*/
public void setMovieResource(int movieResId) {
this.mMovieResourceId = movieResId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: Cutta/GifView
public void setGifResource(int movieResourceId) {
this.mMovieResourceId = movieResourceId;
movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: Cutta/GifView
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
/**
* Starting from HONEYCOMB(Api Level:11) have to turn off HW acceleration to draw
* Movie on Canvas.
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
final TypedArray array = context.obtainStyledAttributes(attrs,
R.styleable.GifView, defStyle, R.style.Widget_GifView);
//-1 is default value
mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
代码示例来源:origin: pili-engineering/PLDroidShortVideo
private PLComposeItem createGIFImageItem(String path) {
PLComposeItem item = new PLComposeItem(path);
item.setItemType(PLComposeItem.ItemType.GIF);
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream(item.getFilePath());
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
Movie movie = Movie.decodeStream(fileInputStream);
item.setDurationMs(movie.duration());
long transitionTimeMs = movie.duration() / 2;
transitionTimeMs = transitionTimeMs > 1000 ? 1000 : transitionTimeMs;
item.setTransitionTimeMs(transitionTimeMs);
return item;
}
代码示例来源:origin: smuyyh/SprintNBA
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// 从描述文件中读出gif的值,创建出Movie实例
final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifView, defStyle, R.style.AppBaseTheme);
mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
代码示例来源:origin: gizwits/GOpenSource_AppKit_Android_AS
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// 从描述文件中读出gif的值,创建出Movie实例
final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifView, defStyle,
R.style.Widget_GifView);
mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
代码示例来源:origin: xuhongv/SmartHome
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
// 从描述文件中读出gif的值,创建出Movie实例
final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifView, defStyle,
R.style.Widget_GifView);
mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
代码示例来源:origin: smuyyh/SprintNBA
/**
* 设置gif图资源
*
* @param movieResId
*/
public void setMovieResource(int movieResId) {
this.mMovieResourceId = movieResId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: adhishlal/GifLoader
public void setImageResource(int mvId){
this.mMovieResourceId = mvId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: xuhongv/SmartHome
/**
* 设置gif图资源
*
* @param movieResId
*/
public void setMovieResource(int movieResId) {
this.mMovieResourceId = movieResId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: gizwits/GOpenSource_AppKit_Android_AS
/**
* 设置gif图资源
*
* @param movieResId
*/
public void setMovieResource(int movieResId) {
this.mMovieResourceId = movieResId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
代码示例来源:origin: qiubiteme/android_api_demos
mMovie = Movie.decodeStream(is);
} else {
byte[] array = streamToBytes(is);
代码示例来源:origin: THEONE10211024/ApiDemos
mMovie = Movie.decodeStream(is);
} else {
byte[] array = streamToBytes(is);
代码示例来源:origin: pondurii/vrVideo
private void loadGIF() {
Context context = TextureManager.getInstance().getContext();
mMovie = Movie.decodeStream(context.getResources().openRawResource(mResourceId));
mWidth = mMovie.width();
mHeight = mMovie.height();
mGIFBitmap = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
mCanvas = new Canvas(mGIFBitmap);
mMovie.draw(mCanvas, 0, 0);
mBitmap = Bitmap.createScaledBitmap(mGIFBitmap, mTextureSize, mTextureSize, false);
}
代码示例来源:origin: cxMax/FloatingView
movie = Movie.decodeStream(is);//gif小电影
if (movie == null) {
throw new IllegalArgumentException("Illegal gif file");
代码示例来源:origin: JackWHLiu/jackknife
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = 0;
int height = 0;
try {
InputStream inputStream = getContext().getAssets().open(path);
mMovie = Movie.decodeStream(inputStream);
width = mMovie.width();
height = mMovie.height();
mHandler.post(r);
} catch(IOException e) {
e.printStackTrace();
}
setMeasuredDimension((int)(width*zoom),(int)(height*zoom));
}
代码示例来源:origin: renjianan/GifView
public void setGifResource(int movieResourceId, OnPlayListener onPlayListener) {
if (onPlayListener != null) {
mOnPlayListener = onPlayListener;
}
reset();
movie = Movie.decodeStream(getResources().openRawResource(movieResourceId));
if (movie == null) {
//如果movie为空,那么就不是gif文件,尝试转换为bitmap显示
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), movieResourceId);
if (bitmap != null) {
setImageBitmap(bitmap);
return;
}
}
movieDuration = movie.duration() == 0 ? DEFAULT_DURATION : movie.duration();
requestLayout();
}
内容来源于网络,如有侵权,请联系作者删除!