类android.graphics.Movie源码实例Demo

下面列出了怎么用android.graphics.Movie的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: imsdk-android   文件: GifView.java
@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));
    }
}
 
源代码2 项目: video-transcoder   文件: FFmpegUtil.java
private static MediaInfo mediaInfoFixup(MediaInfo info)
{
    if(info.container != null && info.container == MediaContainer.GIF)
    {
        // ffprobe will not report the duration of GIF files. The duration will
        // need to be determined another way

        Movie gifMovie = Movie.decodeFile(info.file.getAbsolutePath());
        int durationMs = gifMovie.duration();

        info = new MediaInfo(info.file, durationMs, info.container, info.videoCodec, info.videoResolution,
                info.videoBitrateK, info.videoFramerate, info.audioCodec, info.audioSampleRate, info.audioBitrateK, info.audioChannels);
    }

    return info;
}
 
源代码3 项目: Wifi-Connect   文件: AnimationView.java
@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));
    }
}
 
源代码4 项目: Simpler   文件: GifMovieView.java
@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));
    }
}
 
源代码5 项目: DialogUtil   文件: GifMovieView.java
@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));
    }
}
 
源代码6 项目: DialogUtil   文件: GifMovieView.java
@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));
    }
}
 
源代码7 项目: RichText   文件: GifDrawable.java
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);
            }
        }
    };
}
 
源代码8 项目: BlackLight   文件: GifView.java
@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));
	}
}
 
源代码9 项目: misound   文件: GifView.java
@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));
    }
}
 
源代码10 项目: gif-movie-view   文件: GifMovieView.java
@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));
	}
}
 
源代码11 项目: android_9.0.0_r45   文件: Resources.java
/**
 * 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;
}
 
源代码12 项目: VoIpUSSD   文件: GifImageView.java
private void init() {
    setFocusable(true);
    mMovie = Movie.decodeStream(mInputStream);
    mWidth = mMovie.width();
    mHeight = mMovie.height();

    requestLayout();
}
 
源代码13 项目: Neptune   文件: ResourcesProxy.java
@Override
public Movie getMovie(int id) throws NotFoundException {
    try {
        return super.getMovie(id);
    } catch (NotFoundException e) {
        return mHostResources.getMovie(id);
    }
}
 
源代码14 项目: GPT   文件: ResourcesProxy.java
@Override
public Movie getMovie(int id) throws NotFoundException {
    try {
        return super.getMovie(id);
    } catch (NotFoundException e) {
        return mHostResources.getMovie(id);
    }
}
 
源代码15 项目: Android   文件: GifView.java
public void setGifResource(int movieResourceId) {
    /**
     * 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);
    }

    movie = Movie.decodeStream(getResources().openRawResource(movieResourceId));
    requestLayout();
}
 
源代码16 项目: Android   文件: GifView.java
public void setGifResource(String filepath) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    InputStream inputStream = ResourceUtil.getAssetsStream(filepath);
    if (inputStream != null) {
        movie = Movie.decodeStream(inputStream);
        requestLayout();
    }
}
 
源代码17 项目: Yahala-Messenger   文件: GifMovieView.java
public void setMovieResource(InputStream inputStream) {

        //this.mMovieResourceId = movieResId;
        //  mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
        mMovie = Movie.decodeStream(inputStream);
        requestLayout();
    }
 
源代码18 项目: SprintNBA   文件: GifView.java
@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));
    }
}
 
源代码19 项目: GOpenSource_AppKit_Android_AS   文件: GifView.java
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));
	}
}
 
源代码20 项目: Gizwits-SmartBuld_Android   文件: GifView.java
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));
	}
}
 
源代码21 项目: xposed-art   文件: XResources.java
@Override
public Movie getMovie(int id) throws NotFoundException {
	Object replacement = getReplacement(id);
	if (replacement instanceof XResForwarder) {
		Resources repRes = ((XResForwarder) replacement).getResources();
		int repId = ((XResForwarder) replacement).getId();
		return repRes.getMovie(repId);
	}
	return super.getMovie(id);
}
 
源代码22 项目: gokit-android   文件: GifView.java
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));
	}
}
 
源代码23 项目: BlackLight   文件: ImageActivity.java
@Override
protected void onPostExecute(Object[] result) {
	super.onPostExecute(result);
	ViewGroup v = (ViewGroup) result[0];
	Object img = result[1];
	
	if (img != null) {
		v.removeAllViews();
		if (img instanceof Bitmap) {
			PhotoView p = new PhotoView(ImageActivity.this);
			
			// Disable hardware acceleration if too large
			Bitmap image = (Bitmap) img;
			int maxSize = Utility.getSupportedMaxPictureSize();
			if (image.getWidth() > maxSize || image.getHeight() > maxSize) {
				p.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
				
				if (DEBUG) {
					Log.d(TAG, "Image too large, hardware acceleration disabled. max size: " + maxSize);
				}
			}
			
			p.setImageBitmap(image);
			p.setOnPhotoTapListener(ImageActivity.this);
			v.addView(p, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
		} else if (img instanceof Movie) {
			GifView g = new GifView(ImageActivity.this);
			g.setMovie((Movie) img);
			v.addView(g, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
		}
	}
}
 
源代码24 项目: zen4android   文件: GifMovieView.java
@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));
	}
}
 
源代码25 项目: AnimeTaste   文件: GifMovieView.java
@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));
	}
}
 
源代码26 项目: RedReader   文件: GIFView.java
public GIFView(Context context, @NonNull final byte[] data) {
	super(context);

	setLayerType(View.LAYER_TYPE_SOFTWARE, null);

	mMovie = Movie.decodeByteArray(data, 0, data.length);

	if(mMovie.duration() < 1) {
		throw new RuntimeException("Invalid GIF");
	}

	paint.setAntiAlias(true);
	paint.setFilterBitmap(true);
}
 
源代码27 项目: imsdk-android   文件: GifView.java
public void setMovieStream(InputStream in,int mf)
{
    this.multiFrame = mf;
    mMovie = Movie.decodeStream(in);
    requestLayout();
}
 
源代码28 项目: imsdk-android   文件: GifView.java
public Movie getMovie() {
    return mMovie;
}
 
源代码29 项目: PowerFileExplorer   文件: ResourcesUtil.java
public static Movie getMovie(@RawRes int rawRes) {
    return Base.getResources().getMovie(rawRes);
}
 
源代码30 项目: Wifi-Connect   文件: AnimationView.java
public void setMovieResource(int movieResId) {
    this.mMovieResourceId = movieResId;
    mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    requestLayout();
}
 
 类所在包
 类方法
 同包方法