List of usage examples for android.graphics.drawable TransitionDrawable resetTransition
public void resetTransition()
From source file:org.getlantern.firetweet.view.MessageCardItemFrameLayout.java
@Override protected void drawableStateChanged() { super.drawableStateChanged(); final Drawable d = getBackground(); if (d != null && d.isStateful()) { final int[] state = getDrawableState(); d.setState(state);/*from w w w .j ava 2 s . com*/ final Drawable current = d.getCurrent(); if (current instanceof TransitionDrawable) { final TransitionDrawable td = (TransitionDrawable) current; if (ArrayUtils.contains(state, android.R.attr.state_pressed)) { td.startTransition(ViewConfiguration.getLongPressTimeout()); } else { td.resetTransition(); } } } }
From source file:com.medhdj.pagergallery.PagerGalleryContainer.java
@Override public void onPageSelected(int position) { if (position == mPreviousSelectedPosition) { return;//from w w w.j ava2 s .c o m } View v = mPager.getChildAt(position); if (v != null) { if (v.getBackground() instanceof TransitionDrawable) { TransitionDrawable transition = (TransitionDrawable) v.getBackground(); if (transition != null) { transition.startTransition(700); } } } View mprev = mPager.getChildAt(mPreviousSelectedPosition); if (mprev != null) { if (mprev.getBackground() instanceof TransitionDrawable) { TransitionDrawable transition = (TransitionDrawable) mprev.getBackground(); if (transition != null) { transition.reverseTransition(700); transition.resetTransition(); } } } if (mOnItemChangedListener != null) { mOnItemChangedListener.onItemSelected(v, position); mOnItemChangedListener.onItemUnSelected(mprev, mPreviousSelectedPosition); } mPreviousSelectedPosition = position; }