Android TransitionDrawable - 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 TransitionDrawable class.

This code example shows how to use the following methods:startTransition
        super(context, attrs, defStyle);
    } 
  
    @Override 
    public void setImageBitmap(Bitmap bm) {
        TransitionDrawable td = new TransitionDrawable(new Drawable[]{
                new ColorDrawable(android.R.color.transparent),
                new BitmapDrawable(getContext().getResources(), bm)
        }); 
  
        setImageDrawable(td);
        td.startTransition(FADE_IN_TIME_MS);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:startTransition
	@SuppressWarnings("deprecation") 
	private void setImageBitmap(ImageSwitcher imageSwitcher, Bitmap bitmap) {
		if (fadeIn) {
			// Transition drawable with a transparent drwabale and the final 
			// bitmap 
			final TransitionDrawable td = new TransitionDrawable(
					new Drawable[] {
							new ColorDrawable(android.R.color.transparent),
							new BitmapDrawable(context.getResources(), bitmap) });
			// Set background to loading bitmap 
			imageSwitcher.setBackgroundDrawable(new BitmapDrawable(context
					.getResources(), loadingBitmap));
 
			imageSwitcher.setImageDrawable(td);
			td.startTransition(FADE_IN_TIME);
		} else { 
			imageSwitcher.setImageDrawable(new BitmapDrawable(context
					.getResources(), bitmap));
		} 
	} 
7
CodeRank
This code example shows how to use the following methods:startTransition
This code example shows how to use the following methods:setCrossFadeEnabled, startTransition
This code example shows how to use the following methods:startTransition
This code example shows how to use the following methods:startTransition
        } else { 
            // Set up a transition from the previous Drawable to the new one. 
            final Drawable[] beforeAndAfter = new Drawable[2];
            beforeAndAfter[0] = mPreviousDrawable;
            beforeAndAfter[1] = newDrawable;
            final TransitionDrawable transition = new TransitionDrawable(beforeAndAfter);
            mTarget.setImageDrawable(transition);
            transition.startTransition(mDurationInMillis);
        } 
 
        // Remember this for next time, so that we can transition from it to the 
        // new one. 
        mPreviousDrawable = newDrawable;
 
        return previousBitmap(); 
    } 
 
    private Bitmap previousBitmap() {
        return (mPreviousDrawable == null)
                ? null 
6
CodeRank
This code example shows how to use the following methods:setCrossFadeEnabled, startTransition
	public void setHighlight(int position, int millis) {
		hlPosition = position;
		 
		TransitionDrawable d = hlDrawable;
		if (d == null) {
			d = new TransitionDrawable(
				new Drawable [] {
						new ColorDrawable(0xffFCD87A),
						new ColorDrawable(0x00000000)
				} 
			); 
			d.setCrossFadeEnabled(true);
			hlDrawable = d;
		} 
		updateHighlightRect(); 
		 
		d.startTransition(millis);
		 
		if (hlTimer != null) hlTimer.cancel();
		hlTimer = new HighlightTimer(millis+1, 1000/15);

6
CodeRank
This code example shows how to use the following methods:startTransition
This code example shows how to use the following methods:setCrossFadeEnabled, startTransition
        } 
    } 
 
    @Override 
    public void setImageBitmap(Bitmap bm) {
        TransitionDrawable td = new TransitionDrawable(new Drawable[]{
                new ColorDrawable(android.R.color.transparent),
                new BitmapDrawable(getContext().getResources(), bm)
        }); 
        td.setCrossFadeEnabled(true);
        setImageDrawable(td);
        td.startTransition(FADE_IN_TIME_MS);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:startTransition
        } else { 
            // Set up a transition from the previous Drawable to the new one. 
            final Drawable[] beforeAndAfter = new Drawable[2];
            beforeAndAfter[0] = mPreviousDrawable;
            beforeAndAfter[1] = newDrawable;
            final TransitionDrawable transition = new TransitionDrawable(beforeAndAfter);
            mTarget.setImageDrawable(transition);
            transition.startTransition(mDurationInMillis);
        } 
 
        // Remember this for next time, so that we can transition from it to the 
        // new one. 
        mPreviousDrawable = newDrawable;
 
        return previousBitmap(); 
    } 
 
    private Bitmap previousBitmap() {
        return (mPreviousDrawable == null)
                ? null 
6
CodeRank

Related Android TransitionDrawable Questions & Answers:

See Code Examples for Android TransitionDrawable Methods: