use of io.plaidapp.ui.widget.ParallaxScrimageView in project plaid by nickbutcher.
the class DeparallaxingChangeBounds method captureEndValues.
@Override
public void captureEndValues(TransitionValues transitionValues) {
super.captureEndValues(transitionValues);
if (!(transitionValues.view instanceof ParallaxScrimageView))
return;
ParallaxScrimageView psv = ((ParallaxScrimageView) transitionValues.view);
if (psv.getOffset() == 0)
return;
// as we're going to remove the offset (which drives the parallax) we need to
// compensate for this by adjusting the target bounds.
Rect bounds = (Rect) transitionValues.values.get(PROPNAME_BOUNDS);
bounds.offset(0, psv.getOffset());
transitionValues.values.put(PROPNAME_BOUNDS, bounds);
}
use of io.plaidapp.ui.widget.ParallaxScrimageView in project plaid by nickbutcher.
the class DeparallaxingChangeBounds method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || !(endValues.view instanceof ParallaxScrimageView))
return changeBounds;
ParallaxScrimageView psv = ((ParallaxScrimageView) endValues.view);
if (psv.getOffset() == 0)
return changeBounds;
Animator deparallax = ObjectAnimator.ofInt(psv, ParallaxScrimageView.OFFSET, 0);
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, deparallax);
return transition;
}
Aggregations