當前位置: 首頁>>代碼示例>>Java>>正文


Java SpringConfig類代碼示例

本文整理匯總了Java中com.facebook.rebound.SpringConfig的典型用法代碼示例。如果您正苦於以下問題:Java SpringConfig類的具體用法?Java SpringConfig怎麽用?Java SpringConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SpringConfig類屬於com.facebook.rebound包,在下文中一共展示了SpringConfig類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: refreshSpringConfigurations

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
public void refreshSpringConfigurations() {
    Map<SpringConfig, String> springConfigMap = this.springConfigRegistry.getAllSpringConfig();
    this.spinnerAdapter.clear();
    this.mSpringConfigs.clear();
    for (Entry<SpringConfig, String> entry : springConfigMap.entrySet()) {
        if (entry.getKey() != SpringConfig.defaultConfig) {
            this.mSpringConfigs.add(entry.getKey());
            this.spinnerAdapter.add((String) entry.getValue());
        }
    }
    this.mSpringConfigs.add(SpringConfig.defaultConfig);
    this.spinnerAdapter.add((String) springConfigMap.get(SpringConfig.defaultConfig));
    this.spinnerAdapter.notifyDataSetChanged();
    if (this.mSpringConfigs.size() > 0) {
        this.mSpringSelectorSpinner.setSelection(0);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:SpringConfiguratorView.java

示例2: setup

import com.facebook.rebound.SpringConfig; //導入依賴的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();
}
 
開發者ID:CarlisleChan,項目名稱:Incubators,代碼行數:25,代碼來源:IOSToggleButton.java

示例3: bounceView

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
/**
 * Bounce the view. Will use the respective values for center and radial view
 * @param child
 *      The child that has to be bounced
 * @param springAnimator
 *      The spring animator with the listener to be invoked.
 *      Set null if you dont need to intercept the spring animation end
 *
 * @author Melvin Lobo
 */
private void bounceView(View child, SpringAnimator springAnimator) {
	LayoutParams params = (LayoutParams) child.getLayoutParams();

	if(params.getMenuType() == LayoutParams.CENTER) {
		Spring centerScaleSpring = mSpringSystem.createSpring();
		centerScaleSpring.setSpringConfig( new SpringConfig( CENTER_SCALE_TENSION, CENTER_SCALE_FRICTION ) );
		centerScaleSpring.setEndValue( 1 );
		centerScaleSpring.addListener( springAnimator );
	}
	else {
		Spring radialScaleSpring = mSpringSystem.createSpring();
		radialScaleSpring.setSpringConfig( new SpringConfig( RADIAL_SCALE_TENSION, RADIAL_SCALE_FRICTION ) );
		radialScaleSpring.setEndValue( 1 );
		radialScaleSpring.addListener( springAnimator );
	}
}
 
開發者ID:melvinjlobo,項目名稱:SpiderMenu,代碼行數:27,代碼來源:SpiderMenu.java

示例4: YOLOComboView

import com.facebook.rebound.SpringConfig; //導入依賴的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);
}
 
開發者ID:Piasy,項目名稱:RxComboDetector,代碼行數:26,代碼來源:YOLOComboView.java

示例5: refreshSpringConfigurations

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
/**
 * reload the springs from the registry and update the UI
 */
public void refreshSpringConfigurations() {
  Map<SpringConfig, String> springConfigMap = springConfigRegistry.getAllSpringConfig();

  spinnerAdapter.clear();
  mSpringConfigs.clear();

  for (Map.Entry<SpringConfig, String> entry : springConfigMap.entrySet()) {
    if (entry.getKey() == SpringConfig.defaultConfig) {
      continue;
    }
    mSpringConfigs.add(entry.getKey());
    spinnerAdapter.add(entry.getValue());
  }
  // Add the default config in last.
  mSpringConfigs.add(SpringConfig.defaultConfig);
  spinnerAdapter.add(springConfigMap.get(SpringConfig.defaultConfig));
  spinnerAdapter.notifyDataSetChanged();
  if (mSpringConfigs.size() > 0) {
    mSpringSelectorSpinner.setSelection(0);
  }
}
 
開發者ID:xujunbin,項目名稱:FloatWindow,代碼行數:25,代碼來源:SpringConfiguratorView.java

示例6: setup

import com.facebook.rebound.SpringConfig; //導入依賴的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();
}
 
開發者ID:x251089003,項目名稱:EveryXDay,代碼行數:25,代碼來源:ToggleButton.java

示例7: onCreate

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bonus_animation);
    ButterKnife.bind(this);
    mScaleSpring = mSpringSystem.createSpring();
    mScaleSpring.addListener(mBonusMsgSpringListener);
    mScaleSpring.setCurrentValue(0.07);
    mScaleSpring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(QC_TENSION,
            QC_FRICTION));

    new Thread(new Runnable() {
        @Override
        public void run() {
            mBonusAnimationView.initResources(BonusAnimationActivity.this);
        }
    }).start();
}
 
開發者ID:Piasy,項目名稱:AndroidPlayground,代碼行數:19,代碼來源:BonusAnimationActivity.java

示例8: initializeMotionPhysics

import com.facebook.rebound.SpringConfig; //導入依賴的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);
}
 
開發者ID:premnirmal,項目名稱:Magnet,代碼行數:19,代碼來源:Magnet.java

示例9: init

import com.facebook.rebound.SpringConfig; //導入依賴的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);
}
 
開發者ID:harrylefit,項目名稱:eazycore,代碼行數:10,代碼來源:BaseAnimationDialog.java

示例10: init

import com.facebook.rebound.SpringConfig; //導入依賴的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);
}
 
開發者ID:harrylefit,項目名稱:EazyBaseMVP,代碼行數:10,代碼來源:BaseAnimationDialog.java

示例11: updateSeekBarsForSpringConfig

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
private void updateSeekBarsForSpringConfig(SpringConfig springConfig) {
    int scaledTension = Math.round(((((float) OrigamiValueConverter.origamiValueFromTension
            (springConfig.tension)) - 0.0f) * 100000.0f) / MAX_TENSION);
    int scaledFriction = Math.round(((((float) OrigamiValueConverter.origamiValueFromFriction
            (springConfig.friction)) - 0.0f) * 100000.0f) / 50.0f);
    this.mTensionSeekBar.setProgress(scaledTension);
    this.mFrictionSeekBar.setProgress(scaledFriction);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:SpringConfiguratorView.java

示例12: onProgressChanged

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekBar == mTensionbar) {
        mTvTension.setText("Tension:" + progress);
    } else {
        mTvFriction.setText("Fricsion:" + progress);
    }
    mSpringMenu.setMenuSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(mTensionbar.getProgress(), mFrictionBar.getProgress()));
}
 
開發者ID:peng8350,項目名稱:JPSpringMenu,代碼行數:10,代碼來源:MainActivity.java

示例13: start

import com.facebook.rebound.SpringConfig; //導入依賴的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);
}
 
開發者ID:UFreedom,項目名稱:FloatingView,代碼行數:11,代碼來源:SpringHelper.java

示例14: setup

import com.facebook.rebound.SpringConfig; //導入依賴的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(defaultAnimate);
        }
    });

    TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SwitchButton);
    offBorderColor = typedArray.getColor(R.styleable.SwitchButton_offBorderColor, offBorderColor);
    onColor = typedArray.getColor(R.styleable.SwitchButton_onColor, onColor);
    spotColor = typedArray.getColor(R.styleable.SwitchButton_spotColor, spotColor);
    offColor = typedArray.getColor(R.styleable.SwitchButton_offColor, offColor);
    borderWidth = typedArray.getDimensionPixelSize(R.styleable.SwitchButton_insetBorderWidth, borderWidth);
    defaultAnimate = typedArray.getBoolean(R.styleable.SwitchButton_animate, defaultAnimate);
    typedArray.recycle();

    borderColor = offBorderColor;
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:28,代碼來源:SwitchButton.java

示例15: setup

import com.facebook.rebound.SpringConfig; //導入依賴的package包/類
public void setup(AttributeSet attrs) {
	mDensity = getResources().getDisplayMetrics().density;

	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(defaultAnimate);
		}
	});
	
	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, (int)(borderWidth * mDensity));
	defaultAnimate = typedArray.getBoolean(R.styleable.ToggleButton_animate, defaultAnimate);
	typedArray.recycle();
	
	borderColor = offBorderColor;
}
 
開發者ID:xujunbin,項目名稱:FloatWindow,代碼行數:30,代碼來源:ToggleButton.java


注:本文中的com.facebook.rebound.SpringConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。