Java Code Examples for android.graphics.Movie#decodeStream()

The following examples show how to use android.graphics.Movie#decodeStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GifView.java    From imsdk-android with MIT License 6 votes vote down vote up
@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));
    }
}
 
Example 2
Source File: GifMovieView.java    From DialogUtil with Apache License 2.0 6 votes vote down vote up
@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));
    }
}
 
Example 3
Source File: AnimationView.java    From Wifi-Connect with Apache License 2.0 6 votes vote down vote up
@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));
    }
}
 
Example 4
Source File: GifView.java    From BlackLight with GNU General Public License v3.0 6 votes vote down vote up
@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));
	}
}
 
Example 5
Source File: GifMovieView.java    From gif-movie-view with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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));
	}
}
 
Example 6
Source File: GifMovieView.java    From DialogUtil with Apache License 2.0 6 votes vote down vote up
@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));
    }
}
 
Example 7
Source File: GifView.java    From misound with Apache License 2.0 6 votes vote down vote up
@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));
    }
}
 
Example 8
Source File: Resources.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 9
Source File: GifView.java    From Android with MIT License 5 votes vote down vote up
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();
}
 
Example 10
Source File: GifMovieView.java    From zen4android with MIT License 5 votes vote down vote up
@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));
	}
}
 
Example 11
Source File: GifMovieView.java    From zen4android with MIT License 4 votes vote down vote up
public void setMovieResource(int movieResId) {
	this.mMovieResourceId = movieResId;
	mMovie = Movie.decodeStream(getResources().openRawResource(
			mMovieResourceId));
	requestLayout();
}
 
Example 12
Source File: GifView.java    From GOpenSource_AppKit_Android_AS with MIT License 4 votes vote down vote up
/**
 * 设置gif图资源
 * 
 * @param movieResId
 */
public void setMovieResource(int movieResId) {
	this.mMovieResourceId = movieResId;
	mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
	requestLayout();
}
 
Example 13
Source File: GifView.java    From BlackLight with GNU General Public License v3.0 4 votes vote down vote up
public void setMovieResource(int movieResId) {
	this.mMovieResourceId = movieResId;
	mMovie = Movie.decodeStream(getResources().openRawResource(
			mMovieResourceId));
	requestLayout();
}
 
Example 14
Source File: GifView.java    From SprintNBA with Apache License 2.0 4 votes vote down vote up
/**
 * 设置gif图资源
 *
 * @param movieResId
 */
public void setMovieResource(int movieResId) {
    this.mMovieResourceId = movieResId;
    mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    requestLayout();
}
 
Example 15
Source File: GifMovieView.java    From AnimeTaste with MIT License 4 votes vote down vote up
public void setMovieResource(int movieResId) {
	this.mMovieResourceId = movieResId;
	mMovie = Movie.decodeStream(getResources().openRawResource(
			mMovieResourceId));
	requestLayout();
}
 
Example 16
Source File: GifMovieView.java    From gif-movie-view with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setMovieResource(int movieResId) {
	this.mMovieResourceId = movieResId;
	mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
	requestLayout();
}
 
Example 17
Source File: GIFMediaMetadataRetriever.java    From MediaMetadataRetrieverCompat with MIT License 4 votes vote down vote up
@Override
public void setDataSource(@NonNull DataSource source) throws IOException {
    super.setDataSource(source);
    mMovie = Movie.decodeStream(getStream(false));
}
 
Example 18
Source File: AnimationView.java    From Wifi-Connect with Apache License 2.0 4 votes vote down vote up
public void setMovieResource(int movieResId) {
    this.mMovieResourceId = movieResId;
    mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    requestLayout();
}
 
Example 19
Source File: GifView.java    From imsdk-android with MIT License 4 votes vote down vote up
public void setMovieStream(InputStream in,int mf)
{
    this.multiFrame = mf;
    mMovie = Movie.decodeStream(in);
    requestLayout();
}
 
Example 20
Source File: GifMovieView.java    From zen4android with MIT License 4 votes vote down vote up
public void setMovieInputStream(InputStream fileInputStream) {
	InputStream is = new BufferedInputStream(fileInputStream, 100 * 1024);
	is.mark(100 * 1024);
	mMovie = Movie.decodeStream(is);
	requestLayout();
}