/** * Kicks off a scene transition that animates visibility changes of individual contact list items * via explode animation. * * @param show whether the contact lists are to be shown or hidden. */ private void startExplodeTransitionForContactLists(final boolean show) { if (!OsUtil.isAtLeastL()) { // Explode animation is not supported pre-L. return; } final Explode transition = new Explode(); final Rect epicenter = mPendingExplodeView == null ? null : UiUtils.getMeasuredBoundsOnScreen(mPendingExplodeView); transition.setDuration(UiUtils.COMPOSE_TRANSITION_DURATION); transition.setInterpolator(UiUtils.EASE_IN_INTERPOLATOR); transition.setEpicenterCallback( new EpicenterCallback() { @Override public Rect onGetEpicenter(final Transition transition) { return epicenter; } }); // Kick off the delayed scene explode transition. Anything happens after this line in this // method before the next frame will be tracked by the transition manager for visibility // changes and animated accordingly. TransitionManager.beginDelayedTransition(mCustomHeaderViewPager, transition); toggleContactListItemsVisibilityForPendingTransition(show); }
@Override public void onBackPressed() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { TransitionManager.beginDelayedTransition(mRoot, new Slide()); tvDescription.setVisibility(View.INVISIBLE); } super.onBackPressed(); }
private void setPitchBarPosition(double frequency) { View pitchBar = (View) findViewById(R.id.tune_view_current_pitch); int margin = 20; double leftDP = NoteCalculator.getPitchBarPosition(frequency, 560); Transition moveTransition = new ChangeBounds(); moveTransition.setDuration(300); moveTransition.setInterpolator(new LinearInterpolator()); TransitionManager.beginDelayedTransition((ViewGroup) pitchBar.getRootView(), moveTransition); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) (pitchBar.getLayoutParams()); Log.d(TAG, String.format("Current: %d New: %f", params.leftMargin, leftDP)); params.setMargins((int) leftDP, 0, 0, 0); pitchBar.setLayoutParams(params); }
public void moveButton() { View myButton = findViewById(R.id.myButton); TransitionManager.beginDelayedTransition(myLayout); // Change the position and the size of the button RelativeLayout.LayoutParams positionRules = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); positionRules.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); positionRules.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); myButton.setLayoutParams(positionRules); ViewGroup.LayoutParams sizeRules = myButton.getLayoutParams(); sizeRules.width = 450; sizeRules.height = 300; myButton.setLayoutParams(sizeRules); }
public void moveButton() { View buttonOne = findViewById(R.id.buttonOne); TransitionManager.beginDelayedTransition(mainLayout); // Change the position of the button, for this to make sense pretent "RelativeLayout" isnt there RelativeLayout.LayoutParams positionRules = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); positionRules.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); positionRules.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); buttonOne.setLayoutParams(positionRules); // Change the size of the button ViewGroup.LayoutParams sizeRules = buttonOne.getLayoutParams(); sizeRules.width = 450; sizeRules.height = 300; buttonOne.setLayoutParams(sizeRules); }
@Override public void onClick(View view) { TransitionManager.beginDelayedTransition(mRootView, new Fade()); toggleVisibility(mRedBox, mGreenBox, mBlueBox, mBlackBox); }