java类android.graphics.Movie的实例源码

GifMovieView.java 文件源码 项目:GitHub 阅读 28 收藏 0 点赞 0 评论 0
@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));
    }
}
GifDrawable.java 文件源码 项目:Aequorea 阅读 26 收藏 0 点赞 0 评论 0
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);
            }
        }
    };
}
GifView.java 文件源码 项目:godlibrary 阅读 26 收藏 0 点赞 0 评论 0
@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));
    }
}
GifMovieView.java 文件源码 项目:Simpler 阅读 46 收藏 0 点赞 0 评论 0
@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));
    }
}
SimpleGifView.java 文件源码 项目:Accessories_Android 阅读 24 收藏 0 点赞 0 评论 0
@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));
    }
}
MovieTransaction.java 文件源码 项目:Accessories_Android 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
MovieProgressListenerDelegate.java 文件源码 项目:Accessories_Android 阅读 23 收藏 0 点赞 0 评论 0
@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);
}
DrawableMediaFetcher.java 文件源码 项目:Accessories_Android 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
AssetsMediaFetcher.java 文件源码 项目:Accessories_Android 阅读 24 收藏 0 点赞 0 评论 0
@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;
    }
}
FileMediaFetcher.java 文件源码 项目:Accessories_Android 阅读 25 收藏 0 点赞 0 评论 0
@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;
}
MovieDisplayTask.java 文件源码 项目:Accessories_Android 阅读 26 收藏 0 点赞 0 评论 0
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;
}
GifMovieView.java 文件源码 项目:AndroidFFmpegCMDTool 阅读 28 收藏 0 点赞 0 评论 0
@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));
    }
}
PowerImageView.java 文件源码 项目:MusicOnlinePlayer 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 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);
            }
        }
    }
}
MovieAsyncDecoder.java 文件源码 项目:devbricks 阅读 27 收藏 0 点赞 0 评论 0
@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);
}
MovieAsyncDecoder.java 文件源码 项目:devbricks 阅读 25 收藏 0 点赞 0 评论 0
@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;
        }
GifMovieView.java 文件源码 项目:DialogUtil 阅读 26 收藏 0 点赞 0 评论 0
@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));
    }
}
GifMovieView.java 文件源码 项目:DialogUtil 阅读 27 收藏 0 点赞 0 评论 0
@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));
    }
}
GifView.java 文件源码 项目:quotograph 阅读 25 收藏 0 点赞 0 评论 0
@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));
    }
}
LoadingGifView.java 文件源码 项目:Android-PullToRefresh-Extention 阅读 29 收藏 0 点赞 0 评论 0
@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.PullToRefresh, defStyle, R.style.Widget_GifView);
    mMovieResourceId = array.getResourceId(R.styleable.PullToRefresh_ptrGifResource, -1);
    mPaused = array.getBoolean(R.styleable.PullToRefresh_ptrGifPaused, false);
    array.recycle();
    if (mMovieResourceId != -1) {
        mMovie = Movie.decodeStream(getResources().openRawResource(
                mMovieResourceId));
    }
}
GifView.java 文件源码 项目:Subreddit_Reader 阅读 23 收藏 0 点赞 0 评论 0
@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.GifView, defStyle,
            R.style.Widget_GifMoviewView);

    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));
    }
}
GifView.java 文件源码 项目:GifView 阅读 20 收藏 0 点赞 0 评论 0
@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));
    }
}
GifDrawable.java 文件源码 项目:RichText 阅读 27 收藏 0 点赞 0 评论 0
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);
            }
        }
    };
}
GifView.java 文件源码 项目:BlackLight 阅读 24 收藏 0 点赞 0 评论 0
@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);
    }
    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));
    }
}
AnimatedGifImageView.java 文件源码 项目:droidex 阅读 28 收藏 0 点赞 0 评论 0
public void setAnimatedGif(int rawResourceId, TYPE streachType) {
    setImageBitmap(null);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    mType = streachType;
    animatedGifImage = true;
    is = getContext().getResources().openRawResource(rawResourceId);
    try {
        mMovie = Movie.decodeStream(is);
    } catch (Exception e) {
        e.printStackTrace();
        byte[] array = streamToBytes(is);
        mMovie = Movie.decodeByteArray(array, 0, array.length);
    }
    p = new Paint();
}
AnimatedGifImageView.java 文件源码 项目:droidex 阅读 26 收藏 0 点赞 0 评论 0
public void setAnimatedGif(String filePath, TYPE streachType) throws FileNotFoundException {
    setImageBitmap(null);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    mType = streachType;
    animatedGifImage = true;
    InputStream is;
    try {
        mMovie = Movie.decodeFile(filePath);
    } catch (Exception e) {
        e.printStackTrace();
        is = new FileInputStream(filePath);
        byte[] array = streamToBytes(is);
        mMovie = Movie.decodeByteArray(array, 0, array.length);
    }
    p = new Paint();
}
PowerImageView.java 文件源码 项目:test4android 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 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.drawable.start_play);
                setOnClickListener(this);
            }
        }
    }
}
GifView.java 文件源码 项目:misound 阅读 25 收藏 0 点赞 0 评论 0
@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);
    }
    final TypedArray array = context.obtainStyledAttributes(attrs,
            R.styleable.GifView);
    mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
    mPaused = false;
    array.recycle();
    if (mMovieResourceId != -1) {
        mMovie = Movie.decodeStream(getResources().openRawResource(
                mMovieResourceId));
    }
}
GifMovieView.java 文件源码 项目:gif-movie-view 阅读 24 收藏 0 点赞 0 评论 0
@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));
    }
}
WoWoGifView.java 文件源码 项目:GitHub 阅读 27 收藏 0 点赞 0 评论 0
public void setGifResource(int movieResourceId) {
    this.mMovieResourceId = movieResourceId;
    movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    mDuration = movie.duration();
    if (mDuration == 0) mDuration = DEFAULT_MOVIE_VIEW_DURATION;
    requestLayout();
}
ComposedResources.java 文件源码 项目:SkinFramework 阅读 31 收藏 0 点赞 0 评论 0
@Override
public Movie getMovie(@RawRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getMovie(realId);
    }
    return super.getMovie(id);
}


问题


面经


文章

微信
公众号

扫码关注公众号