use of android.graphics.drawable.TransitionDrawable in project firefox-tv by mozilla-mobile.
the class TransitionDrawableGroupTest method testStartIsCalledOnAllItems.
@Test
public void testStartIsCalledOnAllItems() {
final TransitionDrawable transitionDrawable1 = mock(TransitionDrawable.class);
final TransitionDrawable transitionDrawable2 = mock(TransitionDrawable.class);
final TransitionDrawableGroup group = new TransitionDrawableGroup(transitionDrawable1, transitionDrawable2);
group.startTransition(2500);
verify(transitionDrawable1).startTransition(2500);
verify(transitionDrawable2).startTransition(2500);
}
use of android.graphics.drawable.TransitionDrawable in project remusic by aa112901.
the class PlayingActivity method setDrawable.
private void setDrawable(Drawable result) {
if (result != null) {
if (mBackAlbum.getDrawable() != null) {
final TransitionDrawable td = new TransitionDrawable(new Drawable[] { mBackAlbum.getDrawable(), result });
mBackAlbum.setImageDrawable(td);
// 去除过度绘制
td.setCrossFadeEnabled(true);
td.startTransition(200);
} else {
mBackAlbum.setImageDrawable(result);
}
}
}
use of android.graphics.drawable.TransitionDrawable in project AnExplorer by 1hakr.
the class DocumentsActivity method changeActionBarColor.
private void changeActionBarColor() {
int color = SettingsActivity.getPrimaryColor(this);
Drawable colorDrawable = new ColorDrawable(color);
if (oldBackground == null) {
getSupportActionBar().setBackgroundDrawable(colorDrawable);
} else {
TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, colorDrawable });
getSupportActionBar().setBackgroundDrawable(td);
td.startTransition(200);
}
oldBackground = colorDrawable;
setUpStatusBar();
}
use of android.graphics.drawable.TransitionDrawable in project android_packages_apps_Snap by LineageOS.
the class RotateImageView method setBitmap.
public void setBitmap(Bitmap bitmap) {
// non-null.
if (bitmap == null) {
mThumb = null;
mThumbs = null;
setImageDrawable(null);
setVisibility(GONE);
return;
}
LayoutParams param = getLayoutParams();
final int miniThumbWidth = param.width - getPaddingLeft() - getPaddingRight();
final int miniThumbHeight = param.height - getPaddingTop() - getPaddingBottom();
mThumb = ThumbnailUtils.extractThumbnail(bitmap, miniThumbWidth, miniThumbHeight);
Drawable drawable;
if (mThumbs == null || !mEnableAnimation) {
mThumbs = new Drawable[2];
mThumbs[1] = new BitmapDrawable(getContext().getResources(), mThumb);
setImageDrawable(mThumbs[1]);
} else {
mThumbs[0] = mThumbs[1];
mThumbs[1] = new BitmapDrawable(getContext().getResources(), mThumb);
mThumbTransition = new TransitionDrawable(mThumbs);
setImageDrawable(mThumbTransition);
mThumbTransition.startTransition(500);
}
setVisibility(VISIBLE);
}
use of android.graphics.drawable.TransitionDrawable in project Rocket by mozilla-tw.
the class DrawableCrossFadeTransition method transition.
/**
* Animates from the previous drawable to the current drawable in one of two ways.
*
* <ol> <li>Using the default animation provided in the constructor if the previous drawable is
* null</li> <li>Using the cross fade animation with the duration provided in the constructor if
* the previous drawable is non null</li> </ol>
*
* @param current {@inheritDoc}
* @param adapter {@inheritDoc}
* @return {@inheritDoc}
*/
@Override
public boolean transition(Drawable current, ViewAdapter adapter) {
Drawable previous = adapter.getCurrentDrawable();
if (previous == null) {
previous = new ColorDrawable(Color.TRANSPARENT);
}
TransitionDrawable transitionDrawable = new TransitionDrawable(new Drawable[] { previous, current });
transitionDrawable.setCrossFadeEnabled(isCrossFadeEnabled);
transitionDrawable.startTransition(duration);
adapter.setDrawable(transitionDrawable);
return true;
}
Aggregations