Android Movie - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Movie class.

This code example shows how to use the following methods:draw, duration, height, setTime, width
	protected void onDraw(final Canvas canvas) {
		canvas.drawColor(Color.TRANSPARENT);
		super.onDraw(canvas);
		long now = SystemClock.uptimeMillis();
 
		final float scale = Math.min((float)getWidth() / mMovie.width(), (float)getHeight() / mMovie.height());
 
		canvas.scale(scale, scale);
		canvas.translate(((float)getWidth() / scale - (float)mMovie.width())/2f,
				((float)getHeight() / scale - (float)mMovie.height())/2f);
 
 
		if(movieStart == 0) movieStart = (int)now;
 
		mMovie.setTime((int)((now - movieStart) % mMovie.duration()));
		mMovie.draw(canvas, 0, 0, paint);
 
		this.invalidate();
	} 
 
	private static byte[] streamToBytes(final InputStream is) {
8
CodeRank
This code example shows how to use the following methods:draw, duration, setTime
            } 
            long now = android.os.SystemClock.uptimeMillis();
            if (movieStart == 0) {
                movieStart = now;
            } 
            int relTime = (int) ((now - movieStart) % movie.duration());
            movie.setTime(relTime);
            movie.draw(canvas, 0, 0);
            this.invalidate();
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:draw, duration, height, setTime, width
        if (mMovie == null)
        	return; 
         
        canvas.translate(getWidth() / 2, getHeight() / 2);
       	float s;
       	s = (float)getWidth() / (float)mMovie.width();
       	if ((float)getHeight() / (float)mMovie.height() < s)
           	s =  (float)getHeight() / (float)mMovie.height();
       	if (s < 1.0f)
       		canvas.scale(s, s);
         
        final long now = SystemClock.uptimeMillis();
 
        if (mMoviestart == 0) { 
            mMoviestart = now;
        } 
 
        int relTime = 0;
        if (mMovie.duration() > 0) 
        	relTime = (int)((now - mMoviestart) % mMovie.duration());

6
CodeRank
This code example shows how to use the following methods:draw, duration, height, setTime, width
	   long now = android.os.SystemClock.uptimeMillis();
	         if (lStartTime == 0) {
	          lStartTime = now;
	         } 
	         if (gifMovie != null) {
	             int dur = gifMovie.duration();
	             if (dur == 0) {
	                 dur = 1000;
	             } 
	             int relTime = (int)((now - lStartTime) % dur);
	             gifMovie.setTime(relTime);
	             gifMovie.draw(canvas, getWidth() - gifMovie.width(),
	                         getHeight() - gifMovie.height());
	             invalidate();
	         } 
 
	} 
 
 
} 
6
CodeRank
This code example shows how to use the following methods:draw, duration, height, setTime, width
            long now = android.os.SystemClock.uptimeMillis();
            if (mMovieStart == 0) {
                mMovieStart = now;
            } 
            if (mMovie != null) {
                int dur = mMovie.duration();
                if (dur == 0) {
                    dur = 1000;
                } 
                int relTime = (int)((now - mMovieStart) % dur);
                mMovie.setTime(relTime);
                mMovie.draw(canvas, getWidth() - mMovie.width(), getHeight() - mMovie.height());
                invalidate();
            } 
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:draw, duration, setTime
       super.onDraw(canvas);
       final long now = SystemClock.uptimeMillis();
       if (mMoviestart == 0) {
          mMoviestart = now;
       } 
       final int relTime = (int)((now - mMoviestart) % mMovie.duration());
       mMovie.setTime(relTime);
       mMovie.draw(canvas, 10, 10);
       this.invalidate();
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:draw, duration, height, setTime, width
	    long now = android.os.SystemClock.uptimeMillis();
	    if (moviestart == 0) { // first time
	    	moviestart = now;
	    } 
	    if (movie != null) {
	        int dur = movie.duration();
	        if (dur == 0) {
	            dur = 1000;
	        } 
	        int relTime = (int) ((now - moviestart) % dur);
	        movie.setTime(relTime);
	        movie.draw(canvas, getWidth() / 2 - movie.width() / 2,
	                getHeight() / 2 - movie.height() / 2);
	        invalidate();
	    } 
			 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:draw, duration, height, setTime, width
        long now = android.os.SystemClock.uptimeMillis();
        if (mMovieStart == 0) {   // first time
            mMovieStart = now;
        } 
        if (mMovie != null) {
            int dur = mMovie.duration();
            if (dur == 0) {
                dur = 1000;
            } 
            int relTime = (int)((now - mMovieStart) % dur);
            mMovie.setTime(relTime);
//            canvas.scale( mMovie.width()/getWidth(),  mMovie.height()/getHeight()); 
            mMovie.draw(canvas, getWidth() - mMovie.width(),
                        getHeight() - mMovie.height());
//            canvas.scale(getWidth() / mMovie.width(), getHeight() / mMovie.height()); 
            invalidate();
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:draw, duration, setTime
 
		if (mMovieStart == 0) {
			mMovieStart = now;
		} 
 
		int dur = mMovie.duration();
 
		if (dur == 0) {
			dur = DEFAULT_MOVIEW_DURATION;
		} 
 
		mCurrentAnimationTime = (int) ((now - mMovieStart) % dur);
	} 
 
	/** 
	 * Draw current GIF frame 
	 */ 
	private void drawMovieFrame(Canvas canvas) {
 
		mMovie.setTime(mCurrentAnimationTime);

6
CodeRank
This code example shows how to use the following methods:draw, duration, setTime, width
		if (startTime == 0) {
			startTime = actualTime;
		} 
		if (movie != null) {
			final int relativeTime = (int) ((actualTime - startTime) % movie
					.duration());
			movie.setTime(relativeTime);
			double scaleFactorX = (double) getWidth() / (double) movie.width();
			canvas.scale((float) scaleFactorX, (float) scaleFactorX);
			movie.draw(canvas, (float) scaleFactorX, (float) scaleFactorX);
		} 
		invalidate();
	} 
 
	private void initializeView() { 
		if (drawableId != 0) {
			InputStream inputStream = getContext().getResources()
					.openRawResource(drawableId);
			initializeView(inputStream);
		} 
6
CodeRank

Related Android Movie Questions & Answers: