當前位置: 首頁>>代碼示例>>Java>>正文


Java Movie類代碼示例

本文整理匯總了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));
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:GifMovieView.java

示例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);
            }
        }
    };
}
 
開發者ID:nichbar,項目名稱:Aequorea,代碼行數:18,代碼來源:GifDrawable.java

示例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));
    }
}
 
開發者ID:abook23,項目名稱:godlibrary,代碼行數:18,代碼來源:GifView.java

示例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));
    }
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:25,代碼來源:SimpleGifView.java

示例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;
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:19,代碼來源:MovieTransaction.java

示例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);
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:24,代碼來源:MovieProgressListenerDelegate.java

示例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;
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:26,代碼來源:DrawableMediaFetcher.java

示例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;
    }
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:26,代碼來源:AssetsMediaFetcher.java

示例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;
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:21,代碼來源:FileMediaFetcher.java

示例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;
}
 
開發者ID:NickAndroid,項目名稱:Accessories_Android,代碼行數:20,代碼來源:MovieDisplayTask.java

示例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));
	}
}
 
開發者ID:orangecoder,項目名稱:AndroidFFmpegCMDTool,代碼行數:24,代碼來源:GifMovieView.java

示例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);
            }
        }
    }
}
 
開發者ID:mmdsyl,項目名稱:MusicOnlinePlayer,代碼行數:31,代碼來源:PowerImageView.java

示例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);
}
 
開發者ID:dailystudio,項目名稱:devbricks,代碼行數:22,代碼來源:MovieAsyncDecoder.java

示例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;
		}
 
開發者ID:dailystudio,項目名稱:devbricks,代碼行數:23,代碼來源:MovieAsyncDecoder.java

示例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));
    }
}
 
開發者ID:stanidesis,項目名稱:quotograph,代碼行數:26,代碼來源:GifView.java


注:本文中的android.graphics.Movie類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。