com.facebook.rebound.SimpleSpringListener Java Examples
The following examples show how to use
com.facebook.rebound.SimpleSpringListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChatHeadCloseButton.java From springy-heads with Apache License 2.0 | 8 votes |
public void disappear(boolean immediate, boolean animate) { ySpring.setEndValue(mParentHeight - centerY + chatHeadManager.getConfig().getCloseButtonHeight()); ySpring.setSpringConfig(SpringConfigsHolder.NOT_DRAGGING); xSpring.setEndValue(0); ySpring.addListener(new SimpleSpringListener() { @Override public void onSpringAtRest(Spring spring) { super.onSpringAtRest(spring); ySpring.removeListener(this); } }); scaleSpring.setEndValue(0.1f); if (!animate) { ySpring.setCurrentValue(mParentHeight, true); xSpring.setCurrentValue(0, true); } disappeared = true; if (listener != null) listener.onCloseButtonDisappear(); }
Example #2
Source File: FragmentSettings.java From Pixiv-Shaft with MIT License | 7 votes |
private void animate(LinearLayout linearLayout) { SpringChain springChain = SpringChain.create(40, 8, 60, 10); int childCount = linearLayout.getChildCount(); for (int i = 0; i < childCount; i++) { final View view = linearLayout.getChildAt(i); final int position = i; springChain.addSpring(new SimpleSpringListener() { @Override public void onSpringUpdate(Spring spring) { view.setTranslationX((float) spring.getCurrentValue()); if (position == 0) { Common.showLog(className + (float) spring.getCurrentValue()); } } }); } List<Spring> springs = springChain.getAllSprings(); for (int i = 0; i < springs.size(); i++) { springs.get(i).setCurrentValue(400); } springChain.setControlSpringIndex(0).getControlSpring().setEndValue(0); }
Example #3
Source File: ReboundModule.java From MediaPickerInstagram with Apache License 2.0 | 7 votes |
private void addListener(final ImageView imageView) { mSpring.addListener(new SimpleSpringListener() { @Override public void onSpringUpdate(Spring spring) { float value = (float) spring.getCurrentValue(); float scale = 1f - (value * 0.1f); imageView.setScaleX(scale); imageView.setScaleY(scale); } }); }
Example #4
Source File: PrismActivity.java From PrismView with Apache License 2.0 | 7 votes |
private void initializeListeners() { SimpleSpringListener simpleSpringListener = null; if (prismPosition == PrismPosition.RIGHT) { simpleSpringListener = translationRight; } else if (prismPosition == PrismPosition.LEFT) { simpleSpringListener = translationLeft; } else if (prismPosition == PrismPosition.TOP) { simpleSpringListener = translationTop; } else if (prismPosition == PrismPosition.BOTTOM) { simpleSpringListener = translationBottom; } if (simpleSpringListener != null) { moveSpring().removeAllListeners().addListener(simpleSpringListener); } }