com.facebook.rebound.SpringConfigRegistry Java Examples
The following examples show how to use
com.facebook.rebound.SpringConfigRegistry.
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 |
@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: DefaultChatHeadManager.java From springy-heads with Apache License 2.0 | 5 votes |
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"); }
Example #3
Source File: SpringConfiguratorView.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 5 votes |
@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); }