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


Java Movie.decodeStream方法代碼示例

本文整理匯總了Java中android.graphics.Movie.decodeStream方法的典型用法代碼示例。如果您正苦於以下問題:Java Movie.decodeStream方法的具體用法?Java Movie.decodeStream怎麽用?Java Movie.decodeStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Movie的用法示例。


在下文中一共展示了Movie.decodeStream方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

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

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

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

示例10: setAnimatedGif

import android.graphics.Movie; //導入方法依賴的package包/類
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();
}
 
開發者ID:alefesouza,項目名稱:droidex,代碼行數:18,代碼來源:AnimatedGifImageView.java

示例11: 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.drawable.start_play);
				setOnClickListener(this);
			}
		}
	}
}
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:31,代碼來源:PowerImageView.java

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

示例13: 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:sbakhtiarov,項目名稱:gif-movie-view,代碼行數:24,代碼來源:GifMovieView.java

示例14: setGifResource

import android.graphics.Movie; //導入方法依賴的package包/類
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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:WoWoGifView.java

示例15: setMovieResource

import android.graphics.Movie; //導入方法依賴的package包/類
/**
 * 設置gif圖資源
 *
 * @param movieResId
 */
public void setMovieResource(int movieResId) {
    this.mMovieResourceId = movieResId;
    mMovie = Movie.decodeStream(getResources().openRawResource(
            mMovieResourceId));
    requestLayout();
}
 
開發者ID:abook23,項目名稱:godlibrary,代碼行數:12,代碼來源:GifView.java


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