Java Code Examples for com.facebook.rebound.SpringConfigRegistry#getInstance()

The following examples show how to use com.facebook.rebound.SpringConfigRegistry#getInstance() . 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: SpringConfiguratorView.java    From KugouLayout with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public SpringConfiguratorView(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);

  SpringSystem springSystem = SpringSystem.create();
  springConfigRegistry = SpringConfigRegistry.getInstance();
  spinnerAdapter = new SpinnerAdapter(context);

  Resources resources = getResources();
  mRevealPx = dpToPx(40, resources);
  mStashPx = dpToPx(280, resources);

  mRevealerSpring = springSystem.createSpring();
  SpringListener revealerSpringListener = new RevealerSpringListener();
  mRevealerSpring
      .setCurrentValue(1)
      .setEndValue(1)
      .addListener(revealerSpringListener);

  addView(generateHierarchy(context));

  SeekbarListener seekbarListener = new SeekbarListener();
  mTensionSeekBar.setMax(MAX_SEEKBAR_VAL);
  mTensionSeekBar.setOnSeekBarChangeListener(seekbarListener);

  mFrictionSeekBar.setMax(MAX_SEEKBAR_VAL);
  mFrictionSeekBar.setOnSeekBarChangeListener(seekbarListener);

  mSpringSelectorSpinner.setAdapter(spinnerAdapter);
  mSpringSelectorSpinner.setOnItemSelectedListener(new SpringSelectedListener());
  refreshSpringConfigurations();

  this.setTranslationY(mStashPx);
}
 
Example 2
Source File: SpringConfiguratorView.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public SpringConfiguratorView(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);

  SpringSystem springSystem = SpringSystem.create();
  springConfigRegistry = SpringConfigRegistry.getInstance();
  spinnerAdapter = new SpinnerAdapter(context);

  Resources resources = getResources();
  mRevealPx = dpToPx(40, resources);
  mStashPx = dpToPx(280, resources);

  mRevealerSpring = springSystem.createSpring();
  SpringListener revealerSpringListener = new RevealerSpringListener();
  mRevealerSpring
      .setCurrentValue(1)
      .setEndValue(1)
      .addListener(revealerSpringListener);

  addView(generateHierarchy(context));

  SeekbarListener seekbarListener = new SeekbarListener();
  mTensionSeekBar.setMax(MAX_SEEKBAR_VAL);
  mTensionSeekBar.setOnSeekBarChangeListener(seekbarListener);

  mFrictionSeekBar.setMax(MAX_SEEKBAR_VAL);
  mFrictionSeekBar.setOnSeekBarChangeListener(seekbarListener);

  mSpringSelectorSpinner.setAdapter(spinnerAdapter);
  mSpringSelectorSpinner.setOnItemSelectedListener(new SpringSelectedListener());
  refreshSpringConfigurations();

  this.setTranslationY(mStashPx);
}