use of androidx.transition.Transition in project Signal-Android by WhisperSystems.
the class WebRtcCallView method fadeControls.
private void fadeControls(int visibility) {
controlsVisible = visibility == VISIBLE;
Transition transition = new AutoTransition().setOrdering(TransitionSet.ORDERING_TOGETHER).setDuration(TRANSITION_DURATION_MILLIS);
TransitionManager.endTransitions(parent);
if (controlsListener != null) {
if (controlsVisible) {
controlsListener.showSystemUI();
} else {
controlsListener.hideSystemUI();
}
}
TransitionManager.beginDelayedTransition(parent, transition);
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(parent);
for (View view : controlsToFade()) {
constraintSet.setVisibility(view.getId(), visibility);
}
adjustParticipantsRecycler(constraintSet);
constraintSet.applyTo(parent);
layoutParticipants();
}
use of androidx.transition.Transition in project Signal-Android by WhisperSystems.
the class WebRtcCallView method layoutParticipants.
private void layoutParticipants() {
Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
TransitionManager.beginDelayedTransition(participantsParent, transition);
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(participantsParent);
constraintSet.setMargin(R.id.call_screen_participants_pager, ConstraintSet.BOTTOM, ViewUtil.dpToPx(withControlsHeight(pagerBottomMarginDp)));
constraintSet.applyTo(participantsParent);
}
use of androidx.transition.Transition in project Signal-Android by WhisperSystems.
the class WebRtcCallView method fadeInNewUiState.
private void fadeInNewUiState(boolean useSmallMargins, boolean showSmallHeader) {
Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
TransitionManager.beginDelayedTransition(parent, transition);
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(parent);
for (View view : SetUtil.difference(allTimeVisibleViews, visibleViewSet)) {
constraintSet.setVisibility(view.getId(), ConstraintSet.GONE);
}
for (View view : visibleViewSet) {
constraintSet.setVisibility(view.getId(), ConstraintSet.VISIBLE);
if (adjustableMarginsSet.contains(view)) {
constraintSet.setMargin(view.getId(), ConstraintSet.END, ViewUtil.dpToPx(useSmallMargins ? SMALL_ONGOING_CALL_BUTTON_MARGIN_DP : LARGE_ONGOING_CALL_BUTTON_MARGIN_DP));
}
}
adjustParticipantsRecycler(constraintSet);
constraintSet.applyTo(parent);
if (showSmallHeader) {
smallHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
smallHeaderConstraints.applyTo(toolbar);
} else {
largeHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
largeHeaderConstraints.applyTo(toolbar);
}
}
use of androidx.transition.Transition in project Transitions-Everywhere by andkulikov.
the class ExplodeAndEpicenterExample method letsExplodeIt.
private void letsExplodeIt(View clickedView) {
// save rect of view in screen coordinated
final Rect viewRect = new Rect();
clickedView.getGlobalVisibleRect(viewRect);
final Explode explode = new Explode();
explode.setEpicenterCallback(new Transition.EpicenterCallback() {
@Override
public Rect onGetEpicenter(Transition transition) {
return viewRect;
}
});
explode.excludeTarget(clickedView, true);
TransitionSet set = new TransitionSet().addTransition(explode).addTransition(new Fade().addTarget(clickedView)).addListener(new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
transition.removeListener(this);
getActivity().onBackPressed();
}
});
TransitionManager.beginDelayedTransition(mRecyclerView, set);
// remove all views from Recycler View
mRecyclerView.setAdapter(null);
}
use of androidx.transition.Transition in project Transitions-Everywhere by andkulikov.
the class Scale method createAnimation.
@Nullable
private Animator createAnimation(@NonNull final View view, float startScale, float endScale, @Nullable TransitionValues values) {
final float initialScaleX = view.getScaleX();
final float initialScaleY = view.getScaleY();
float startScaleX = initialScaleX * startScale;
float endScaleX = initialScaleX * endScale;
float startScaleY = initialScaleY * startScale;
float endScaleY = initialScaleY * endScale;
if (values != null) {
Float savedScaleX = (Float) values.values.get(PROPNAME_SCALE_X);
Float savedScaleY = (Float) values.values.get(PROPNAME_SCALE_Y);
// continue animation from the interrupted state
if (savedScaleX != null && savedScaleX != initialScaleX) {
startScaleX = savedScaleX;
}
if (savedScaleY != null && savedScaleY != initialScaleY) {
startScaleY = savedScaleY;
}
}
view.setScaleX(startScaleX);
view.setScaleY(startScaleY);
Animator animator = TransitionUtils.mergeAnimators(ObjectAnimator.ofFloat(view, View.SCALE_X, startScaleX, endScaleX), ObjectAnimator.ofFloat(view, View.SCALE_Y, startScaleY, endScaleY));
addListener(new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(@NonNull Transition transition) {
view.setScaleX(initialScaleX);
view.setScaleY(initialScaleY);
transition.removeListener(this);
}
});
return animator;
}
Aggregations