本文整理匯總了Java中android.graphics.Movie類的典型用法代碼示例。如果您正苦於以下問題:Java Movie類的具體用法?Java Movie怎麽用?Java Movie使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Movie類屬於android.graphics包,在下文中一共展示了Movie類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setViewAttributes
import android.graphics.Movie; //導入依賴的package包/類
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
/**
* Starting from HONEYCOMB 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.GifMoviewView, defStyle,
R.style.Widget_GifMoviewView);
mMovieResourceId = array.getResourceId(R.styleable.GifMoviewView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifMoviewView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
示例2: GifDrawable
import android.graphics.Movie; //導入依賴的package包/類
public GifDrawable(Movie movie, int height, int width) {
this.movie = movie;
this.height = height;
this.width = width;
setBounds(0, 0, width, height);
scaleX = scaleY = 1.0f;
paint = new Paint();
handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (msg.what == what && running && textView != null) {
textView.invalidate();
sendEmptyMessageDelayed(what, 33);
}
}
};
}
示例3: setViewAttributes
import android.graphics.Movie; //導入依賴的package包/類
@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, 0);
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));
}
}
示例4: setViewAttributes
import android.graphics.Movie; //導入依賴的package包/類
@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));
}
}
示例5: startSynchronously
import android.graphics.Movie; //導入依賴的package包/類
@Nullable
@Override
@AccessoryApi
public Movie startSynchronously() {
try {
return accessory.displayMovie(
mediaData,
noneNullSettable(),
option.or(sDefDisplayOption),
progressListener,
errorListener,
priority)
.get();
} catch (InterruptedException | ExecutionException | CancellationException ignored) {
}
return null;
}
示例6: onComplete
import android.graphics.Movie; //導入依賴的package包/類
@Override
public void onComplete(Movie result) {
callOnComplete(result);
if (result == null) {
return;
}
if (canceled) {
cacheManager.cache(url, result);
return;
}
final boolean isViewMaybeReused = option.isViewMaybeReused();
if (!isViewMaybeReused || !checkTaskDirty()) {
ViewAnimator<Movie> animator = (option == null ? null : option.getAnimator());
ArrayList<MediaArt<Movie>> handlers = (option == null ? null : option.getMediaArts());
UISettingApplier.getSharedApplier().applySettings(result, handlers, settable, animator);
}
cacheManager.cache(url, result);
}
示例7: fetchFromUrl
import android.graphics.Movie; //導入依賴的package包/類
@Override
public Movie fetchFromUrl(@NonNull String url, @NonNull DecodeSpec decodeSpec,
@Nullable ProgressListener<Movie> progressListener,
@Nullable ErrorListener errorListener) throws Exception {
super.fetchFromUrl(url, decodeSpec, progressListener, errorListener);
Resources resources = this.mContext.getResources();
int resId = resources.getIdentifier(mSplitter.getRealPath(url),
"drawable",
this.mContext.getPackageName());
if (resId <= 0) {
callOnError(errorListener, new Cause(new Resources.NotFoundException(String.format("Res of id-%s not found.", resId))));
return null;
}
callOnStart(progressListener);
@Cleanup
InputStream inputStream = resources.openRawResource(0);
Movie movie = Movie.decodeStream(inputStream);
callOnComplete(progressListener, movie);
return movie;
}
示例8: fetchFromUrl
import android.graphics.Movie; //導入依賴的package包/類
@Override
public Movie fetchFromUrl(@NonNull String url, @NonNull DecodeSpec decodeSpec,
@Nullable ProgressListener<Movie> progressListener,
@Nullable ErrorListener errorListener) throws Exception {
super.fetchFromUrl(url, decodeSpec, progressListener, errorListener);
String path = mSplitter.getRealPath(url);
synchronized (this) {
if (mAssets == null) mAssets = mContext.getAssets();
}
@Cleanup
InputStream in = null;
try {
in = mAssets.open(path);
callOnStart(progressListener);
Movie result = Movie.decodeStream(in);
callOnComplete(progressListener, result);
return result;
} catch (IOException e) {
callOnError(errorListener, new Cause(e));
return null;
}
}
示例9: fetchFromUrl
import android.graphics.Movie; //導入依賴的package包/類
@Override
public Movie fetchFromUrl(@NonNull String url, @NonNull DecodeSpec decodeSpec,
@Nullable ProgressListener<Movie> progressListener,
@Nullable ErrorListener errorListener) throws Exception {
super.fetchFromUrl(url, decodeSpec, progressListener, errorListener);
String path = mSplitter.getRealPath(url);
File file = new File(path);
if (!file.exists()) {
callOnError(errorListener, new Cause(new FileNotFoundException(String.format("File %s not found.", url))));
return null;
}
callOnStart(progressListener);
Movie movie = Movie.decodeFile(path);
callOnComplete(progressListener, movie);
return movie;
}
示例10: MovieDisplayTask
import android.graphics.Movie; //導入依賴的package包/類
public MovieDisplayTask(Context context,
LoaderConfig loaderConfig,
TaskInterrupter displayTaskMonitor,
MediaData<Movie> url,
DimenSpec spec,
MediaQuality quality,
ProgressListener<Movie> progressListener,
ErrorListener errorListener,
DisplayTaskRecord taskRecord) {
this.mContext = context;
this.mLoaderConfig = loaderConfig;
this.mDisplayTaskMonitor = displayTaskMonitor;
this.mMediaData = url;
this.mDimenSpec = spec;
this.mQuality = quality;
this.mProgressListener = progressListener;
this.mErrorListener = errorListener;
this.mTaskRecord = taskRecord;
}
示例11: setViewAttributes
import android.graphics.Movie; //導入依賴的package包/類
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
/**
* Starting from HONEYCOMB 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.GifMoviewView, defStyle,
R.style.Widget_GifMoviewView);
mMovieResourceId = array.getResourceId(R.styleable.GifMoviewView_gif, -1);
mPaused = array.getBoolean(R.styleable.GifMoviewView_paused, false);
array.recycle();
if (mMovieResourceId != -1) {
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}
示例12: PowerImageView
import android.graphics.Movie; //導入依賴的package包/類
/**
* PowerImageView構造函數,在這裏完成所有必要的初始化操作。
*
* @param context
*/
public PowerImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PowerImageView);
int resourceId = getResourceId(a, context, attrs);
if (resourceId != 0) {
// 當資源id不等於0時,就去獲取該資源的流
InputStream is = getResources().openRawResource(resourceId);
// 使用Movie類對流進行解碼
mMovie = Movie.decodeStream(is);
if (mMovie != null) {
// 如果返回值不等於null,就說明這是一個GIF圖片,下麵獲取是否自動播放的屬性
isAutoPlay = a.getBoolean(R.styleable.PowerImageView_auto_play, false);
Bitmap bitmap = BitmapFactory.decodeStream(is);
mImageWidth = bitmap.getWidth();
mImageHeight = bitmap.getHeight();
bitmap.recycle();
if (!isAutoPlay) {
// 當不允許自動播放的時候,得到開始播放按鈕的圖片,並注冊點擊事件
mStartButton = BitmapFactory.decodeResource(getResources(),
R.mipmap.ic_launcher);
setOnClickListener(this);
}
}
}
}
示例13: doInBackground
import android.graphics.Movie; //導入依賴的package包/類
@Override
protected Movie doInBackground(Context... params) {
Context context = null;
if (params != null && params.length > 0) {
context = params[0];
}
if (mMovieKey == null || mDecodeSource == null) {
return null;
}
Movie cachedMovie = MovieCacheManager.queryCachedMovie(mMovieKey);
if (cachedMovie != null) {
Logger.debug("SKIP DECODE EXIST MOVIE: thumbKey = %s",
mMovieKey);
return null;
}
return doDecodeMovie(context, mMovieKey, mDecodeSource);
}
示例14: doDecodeMovie
import android.graphics.Movie; //導入依賴的package包/類
@Override
protected Movie doDecodeMovie(Context context,
String thumbKey, String decodeSource) {
if (decodeSource == null) {
return null;
}
Movie movie = null;
try {
movie = Movie.decodeFile(decodeSource);
} catch (OutOfMemoryError e) {
Logger.debug("decode movie failure: %s", e.toString());
movie = null;
}
/* Logger.debug("DECODE THUMB: thumb = %s, movie = %s",
thumbPath,
movie);
*/
return movie;
}
示例15: setViewAttributes
import android.graphics.Movie; //導入依賴的package包/類
@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);
mScaleToFillWidth = array.getBoolean(R.styleable.GifView_scaleToFillWidth, false);
array.recycle();
if (mMovieResourceId != -1) {
movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
}
}