本文整理汇总了Java中com.facebook.rebound.SpringConfigRegistry类的典型用法代码示例。如果您正苦于以下问题:Java SpringConfigRegistry类的具体用法?Java SpringConfigRegistry怎么用?Java SpringConfigRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpringConfigRegistry类属于com.facebook.rebound包,在下文中一共展示了SpringConfigRegistry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SpringConfiguratorView
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的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: SpringConfiguratorView
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
@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);
}
示例3: SpringOverScroller
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
public SpringOverScroller(Context context, Interpolator interpolator, boolean flywheel) {
mSpringSystem = SpringSystem.create();
mSpringX = mSpringSystem
.createSpring()
.addListener(this);
mSpringY = mSpringSystem
.createSpring()
.addListener(this);
SpringConfigRegistry
.getInstance()
.addSpringConfig(RUBBERBANDING_CONFIG, "rubber-banding");
SpringConfigRegistry
.getInstance()
.addSpringConfig(COASTING_CONFIG, "coasting");
}
示例4: SpringConfiguratorView
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
@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);
}
示例5: init
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
private void init(Context context, ChatHeadConfig chatHeadDefaultConfig) {
chatHeadContainer.onInitialized(this);
DisplayMetrics metrics = new DisplayMetrics();
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getMetrics(metrics);
this.displayMetrics = metrics;
this.config = chatHeadDefaultConfig; //TODO : needs cleanup
chatHeads = new ArrayList<>(5);
arrowLayout = new UpArrowLayout(context);
arrowLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
chatHeadContainer.addView(arrowLayout, arrowLayout.getLayoutParams());
arrowLayout.setVisibility(View.GONE);
springSystem = SpringSystem.create();
closeButton = new ChatHeadCloseButton(context, this, maxHeight, maxWidth);
ViewGroup.LayoutParams layoutParams = chatHeadContainer.createLayoutParams(chatHeadDefaultConfig.getCloseButtonHeight(), chatHeadDefaultConfig.getCloseButtonWidth(), Gravity.TOP | Gravity.START, 0);
closeButton.setListener(this);
chatHeadContainer.addView(closeButton, layoutParams);
closeButtonShadow = new ImageView(getContext());
ViewGroup.LayoutParams shadowLayoutParams = chatHeadContainer.createLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.BOTTOM, 0);
closeButtonShadow.setImageResource(R.drawable.dismiss_shadow);
closeButtonShadow.setVisibility(View.GONE);
chatHeadContainer.addView(closeButtonShadow, shadowLayoutParams);
arrangements.put(MinimizedArrangement.class, new MinimizedArrangement(this));
arrangements.put(MaximizedArrangement.class, new MaximizedArrangement<T>(this));
setupOverlay(context);
setConfig(chatHeadDefaultConfig);
SpringConfigRegistry.getInstance().addSpringConfig(SpringConfigsHolder.DRAGGING, "dragging mode");
SpringConfigRegistry.getInstance().addSpringConfig(SpringConfigsHolder.NOT_DRAGGING, "not dragging mode");
}
示例6: OrigamiExample
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
public OrigamiExample(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// Inflate the layout.
LayoutInflater inflater = LayoutInflater.from(context);
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.origami_example, this, false);
addView(root);
// Listen for clicks on the root view.
root.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
handleClick(v);
}
});
// Get references to our views.
mPhotoGrid = root.findViewById(R.id.grid);
mSelectedPhoto = root.findViewById(R.id.selection);
mFeedbackBar = root.findViewById(R.id.feedback);
mSpringConfiguratorView = (SpringConfiguratorView) root.findViewById(R.id.spring_configurator);
// Setup the Spring by creating a SpringSystem adding a SimpleListener that renders the
// animation whenever the spring is updated.
mSpring = SpringSystem
.create()
.createSpring()
.setSpringConfig(ORIGAMI_SPRING_CONFIG)
.addListener(new SimpleSpringListener() {
@Override
public void onSpringUpdate(Spring spring) {
// Just tell the UI to update based on the springs current state.
render();
}
});
// Here we just wait until the first layout pass finishes and call our render method to update
// the animation to the initial resting state of the spring.
mPhotoGrid.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
render();
mPhotoGrid.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
/** Optional - Live Spring Tuning **/
// Put our config into a registry. This is optional, but it gives you the ability to live tune
// the spring using the SpringConfiguratorView which will show up at the bottom of the screen.
SpringConfigRegistry.getInstance().addSpringConfig(ORIGAMI_SPRING_CONFIG, "origami animation spring");
// Tell the SpringConfiguratorView that we've updated the registry to allow you to live tune the animation spring.
mSpringConfiguratorView.refreshSpringConfigurations();
// Uncomment this line to actually show the SpringConfiguratorView allowing you to live tune
// the Spring constants as you manipulate the UI.
mSpringConfiguratorView.setVisibility(View.VISIBLE);
}
示例7: OrigamiExample
import com.facebook.rebound.SpringConfigRegistry; //导入依赖的package包/类
public OrigamiExample(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// Inflate the layout.
LayoutInflater inflater = LayoutInflater.from(context);
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.origami_example, this, false);
addView(root);
// Listen for clicks on the root view.
root.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
handleClick(v);
}
});
// Get references to our views.
mPhotoGrid = root.findViewById(R.id.grid);
mSelectedPhoto = root.findViewById(R.id.selection);
mFeedbackBar = root.findViewById(R.id.feedback);
mSpringConfiguratorView = (SpringConfiguratorView) root.findViewById(R.id.spring_configurator);
// Setup the Spring by creating a SpringSystem adding a SimpleListener that renders the
// animation whenever the spring is updated.
mSpring = SpringSystem
.create()
.createSpring()
.setSpringConfig(ORIGAMI_SPRING_CONFIG)
.addListener(new SimpleSpringListener() {
@Override
public void onSpringUpdate(Spring spring) {
// Just tell the UI to update based on the springs current state.
render();
}
});
// Here we just wait until the first layout pass finishes and call our render method to update
// the animation to the initial resting state of the spring.
mPhotoGrid.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
render();
mPhotoGrid.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
/** Optional - Live Spring Tuning **/
// Put our config into a registry. This is optional, but it gives you the ability to live tune
// the spring using the SpringConfiguratorView which will show up at the bottom of the screen.
SpringConfigRegistry.getInstance().addSpringConfig(ORIGAMI_SPRING_CONFIG, "origami animation spring");
// Tell the SpringConfiguratorView that we've updated the registry to allow you to live tune the animation spring.
mSpringConfiguratorView.refreshSpringConfigurations();
// Uncomment this line to actually show the SpringConfiguratorView allowing you to live tune
// the Spring constants as you manipulate the UI.
mSpringConfiguratorView.setVisibility(View.VISIBLE);
}