本文整理匯總了Java中com.facebook.rebound.SpringSystem類的典型用法代碼示例。如果您正苦於以下問題:Java SpringSystem類的具體用法?Java SpringSystem怎麽用?Java SpringSystem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SpringSystem類屬於com.facebook.rebound包,在下文中一共展示了SpringSystem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SpringConfiguratorView
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
@TargetApi(11)
public SpringConfiguratorView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.mSpringConfigs = new ArrayList();
this.mTextColor = Color.argb(255, Opcodes.SHR_INT_LIT8, Opcodes.SHR_INT_LIT8, Opcodes
.SHR_INT_LIT8);
SpringSystem springSystem = SpringSystem.create();
this.springConfigRegistry = SpringConfigRegistry.getInstance();
this.spinnerAdapter = new SpinnerAdapter(context);
Resources resources = getResources();
this.mRevealPx = (float) Util.dpToPx(40.0f, resources);
this.mStashPx = (float) Util.dpToPx(280.0f, resources);
this.mRevealerSpring = springSystem.createSpring();
this.mRevealerSpring.setCurrentValue(PathListView.NO_ZOOM).setEndValue(PathListView
.NO_ZOOM).addListener(new RevealerSpringListener());
addView(generateHierarchy(context));
SeekbarListener seekbarListener = new SeekbarListener();
this.mTensionSeekBar.setMax(MAX_SEEKBAR_VAL);
this.mTensionSeekBar.setOnSeekBarChangeListener(seekbarListener);
this.mFrictionSeekBar.setMax(MAX_SEEKBAR_VAL);
this.mFrictionSeekBar.setOnSeekBarChangeListener(seekbarListener);
this.mSpringSelectorSpinner.setAdapter(this.spinnerAdapter);
this.mSpringSelectorSpinner.setOnItemSelectedListener(new SpringSelectedListener());
refreshSpringConfigurations();
setTranslationY(this.mStashPx);
}
示例2: PopMenu
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private PopMenu(Builder builder) {
this.mMenuItems = new ArrayList();
this.isShowing = false;
this.mSpringSystem = SpringSystem.create();
this.mActivity = builder.activity;
this.mMenuItems.clear();
this.mMenuItems.addAll(builder.itemList);
this.mColumnCount = builder.columnCount;
this.mDuration = builder.duration;
this.mTension = builder.tension;
this.mFriction = builder.friction;
this.mHorizontalPadding = builder.horizontalPadding;
this.mVerticalPadding = builder.verticalPadding;
this.mPopMenuItemListener = builder.popMenuItemListener;
this.mScreenWidth = this.mActivity.getResources().getDisplayMetrics().widthPixels;
this.mScreenHeight = this.mActivity.getResources().getDisplayMetrics().heightPixels;
}
示例3: setSpringSystem
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void setSpringSystem() {
mSpringSystem = SpringSystem.create();
mSpringsAlpha = mSpringSystem.createSpring()
.setSpringConfig(alphaconfig)
.setCurrentValue(1);
mSpringsAlpha.addListener(new SimpleSpringListener() {
@Override
public void onSpringUpdate(Spring mSpring) {
float value = (float) mSpring.getCurrentValue();
mLockView.setAlpha(value);
}
});
}
示例4: Floating
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
public Floating(Activity activity){
if (activity == null){
throw new NullPointerException("Activity should not be null");
}
ViewGroup rootView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);
View decorView = rootView.findViewById(R.id.floating_decor);
if (decorView instanceof FloatingDecorView){
mFloatingDecorView = (FloatingDecorView) decorView;
}else {
mFloatingDecorView = new FloatingDecorView(activity);
mFloatingDecorView.setId(R.id.floating_decor);
rootView.addView(mFloatingDecorView);
}
if (mSpringSystem == null){
mSpringSystem = SpringSystem.create();
}
}
示例5: setup
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
springSystem = SpringSystem.create();
spring = springSystem.createSpring();
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.IOSToggleButton);
offBorderColor = typedArray.getColor(R.styleable.IOSToggleButton_btnOffBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.IOSToggleButton_btnOnColor, onColor);
spotColor = typedArray.getColor(R.styleable.IOSToggleButton_btnSpotColor, spotColor);
offColor = typedArray.getColor(R.styleable.IOSToggleButton_btnOffColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.IOSToggleButton_btnBorderWidth, borderWidth);
typedArray.recycle();
}
示例6: applyBloomOpenAnimation
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void applyBloomOpenAnimation() {
final SpringSystem springSystem = SpringSystem.create();
for (int i = 0; i < mMenuItemCount; i++) {
// create the springs that control movement
final Spring springX = springSystem.createSpring();
final Spring springY = springSystem.createSpring();
MenuItemView menuItemView = mMenuItemViews.get(i);
springX.addListener(new MapPerformer(menuItemView, View.X, mFAB.getLeft(), menuItemView.getLeft()));
springY.addListener(new MapPerformer(menuItemView, View.Y, mFAB.getTop(), menuItemView.getTop()));
DestroySelfSpringListener destroySelfSpringListener = new DestroySelfSpringListener(this,mContainerView,true);
springX.addListener(destroySelfSpringListener);
springY.addListener(destroySelfSpringListener);
springX.setEndValue(1);
springY.setEndValue(1);
}
}
示例7: applyBloomCloseAnimation
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void applyBloomCloseAnimation() {
final SpringSystem springSystem = SpringSystem.create();
for (int i = 0; i < mMenuItemCount; i++) {
// create the springs that control movement
final Spring springX = springSystem.createSpring();
final Spring springY = springSystem.createSpring();
MenuItemView menuItemView = mMenuItemViews.get(i);
springX.addListener(new MapPerformer(menuItemView, View.X, menuItemView.getLeft(), mFAB.getLeft()));
springY.addListener(new MapPerformer(menuItemView, View.Y, menuItemView.getTop(), mFAB.getTop()));
DestroySelfSpringListener destroySelfSpringListener = new DestroySelfSpringListener(this,mContainerView,false);
springX.addListener(destroySelfSpringListener);
springY.addListener(destroySelfSpringListener);
springX.setEndValue(1);
springY.setEndValue(1);
}
}
示例8: applyPressAnimation
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void applyPressAnimation() {
SpringSystem springSystem = SpringSystem.create();
final Spring spring = springSystem.createSpring();
spring.addListener(new Performer(mBtn, View.SCALE_X));
spring.addListener(new Performer(mBtn, View.SCALE_Y));
mBtn.setOnTouchListener(new ToggleImitator(spring, 1, 1.2){
@Override
public void imitate(MotionEvent event) {
super.imitate(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_UP:
callOnClick();
break;
default:
}
}
});
spring.setCurrentValue(1);
}
示例9: YOLOComboView
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
public YOLOComboView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
BaseSpringSystem springSystem = SpringSystem.create();
mComboSpring = springSystem.createSpring();
mComboSpring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(600, 9));
mYOLOLogo = new ImageView(context);
FrameLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mYOLOLogo.setLayoutParams(params);
mYOLOLogo.setImageResource(R.drawable.ic_yolo);
addView(mYOLOLogo);
mComboText = new TextView(context);
params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.RIGHT);
params.rightMargin = 30;
mComboText.setLayoutParams(params);
mComboText.setTextColor(context.getResources().getColor(android.R.color.holo_red_light));
mComboText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
addView(mComboText);
mSpringListener = new ComboSpringListener(mComboText);
setAlpha(0);
}
示例10: setup
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
springSystem = SpringSystem.create();
spring = springSystem.createSpring();
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_borderWidth, borderWidth);
typedArray.recycle();
}
示例11: initializeMotionPhysics
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
protected void initializeMotionPhysics() {
SpringConfig config = getSpringConfig();
SpringSystem springSystem = getSpringSystem();
xSpring = createXSpring(springSystem, config);
ySpring = createYSpring(springSystem, config);
motionImitatorX =
new MagnetImitator(MotionProperty.X, Imitator.TRACK_ABSOLUTE, Imitator.FOLLOW_SPRING, 0, 0);
motionImitatorY =
new MagnetImitator(MotionProperty.Y, Imitator.TRACK_ABSOLUTE, Imitator.FOLLOW_SPRING, 0, 0);
xWindowManagerPerformer = new WindowManagerPerformer(MotionProperty.X);
yWindowManagerPerformer = new WindowManagerPerformer(MotionProperty.Y);
actor = new Actor.Builder(springSystem, iconView).addMotion(xSpring, motionImitatorX,
xWindowManagerPerformer)
.addMotion(ySpring, motionImitatorY, yWindowManagerPerformer)
.onTouchListener(this)
.build();
iconView.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
示例12: init
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void init(int startAnim, int endAnim) {
this.time_start_animation = startAnim;
this.time_end_animation = endAnim;
springSystem = SpringSystem.create();
mSpring = springSystem.createSpring();
SpringConfig config = new SpringConfig(TENSION, DAMPER);
mSpring.setSpringConfig(config);
}
示例13: SpringyAnimator
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
/**
* Constructor for with Animation Type + Spring config + animation Values
* * @param springConfig config class for the spring
* @param type SpringyAnimationType instance for animation type
* @param tension Spring tension for animation type
* @param fraction Spring fraction value for animation
* @param startValue where animation start from
* @param endValue where animation ends to
* **/
public SpringyAnimator(SpringAnimationType type, double tension,
double fraction, float startValue, float endValue) {
this.tension = tension;
this.fraction = fraction;
this.startValue = startValue;
this.endValue = endValue;
springSystem = SpringSystem.create();
animationType = type;
}
示例14: init
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
private void init(int startAnim, int endAnim) {
this.timeStartAnimation = startAnim;
this.timeEndAnimation = endAnim;
springSystem = SpringSystem.create();
mSpring = springSystem.createSpring();
SpringConfig config = new SpringConfig(TENSION, DAMPER);
mSpring.setSpringConfig(config);
}
示例15: start
import com.facebook.rebound.SpringSystem; //導入依賴的package包/類
public void start(){
SpringSystem springSystem = SpringSystem.create();
Spring spring = springSystem.createSpring();
if (mConfig == 0){
spring.setSpringConfig(SpringConfig.fromBouncinessAndSpeed(mConfigValueOne, mConfigValueTwo));
}else if (mConfig == 1){
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(mConfigValueOne, mConfigValueTwo));
}
start(spring);
}