Java Code Examples for android.support.constraint.ConstraintSet#clone()

The following examples show how to use android.support.constraint.ConstraintSet#clone() . 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: PairView.java    From justaline-android with Apache License 2.0 6 votes vote down vote up
private LottieAnimationView addNewLottieAnimationView(Animation animation) {
        animationImageView = new LottieAnimationView(getContext());
        animationImageView.setId(R.id.animation_view);
//        animationImageView.enableMergePathsForKitKatAndAbove(true);
        messageContainer.addView(animationImageView);

        ConstraintSet constraintSet = new ConstraintSet();
        constraintSet.clone(messageContainer);
        constraintSet.constrainWidth(R.id.animation_view, animation.width);
        constraintSet.constrainHeight(R.id.animation_view, animation.height);
        constraintSet.connect(R.id.animation_view, ConstraintSet.BOTTOM, R.id.message,
                ConstraintSet.TOP,
                getResources().getDimensionPixelSize(R.dimen.pair_animation_margin_bottom));
        constraintSet.connect(R.id.animation_view, ConstraintSet.LEFT, ConstraintSet.PARENT_ID,
                ConstraintSet.LEFT);
        constraintSet.connect(R.id.animation_view, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID,
                ConstraintSet.RIGHT);

        constraintSet.applyTo(messageContainer);

        return animationImageView;
    }
 
Example 2
Source File: DualNavigationMapActivity.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  setTheme(R.style.Theme_AppCompat_NoActionBar);
  super.onCreate(savedInstanceState);
  initializeViews(savedInstanceState);
  navigationView.initialize(this);
  navigationMapConstraint = new ConstraintSet();
  navigationMapConstraint.clone(dualNavigationMap);
  navigationMapExpandedConstraint = new ConstraintSet();
  navigationMapExpandedConstraint.clone(this, R.layout.activity_dual_navigation_map_expanded);

  constraintChanged = new boolean[] {false};
  launchNavigationFab.setOnClickListener(v -> {
    expandCollapse();
    launchNavigation();
  });
}
 
Example 3
Source File: EndNavigationActivity.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private void launchNavigation() {
  launchNavigationFab.hide();
  drawPaella();
  navigationView.setVisibility(View.VISIBLE);
  int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80, getResources().getDisplayMetrics());
  message.getLayoutParams().height = height;
  ConstraintSet constraintSet = new ConstraintSet();
  constraintSet.clone(endNavigationLayout);
  constraintSet.connect(R.id.message, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, 0);
  constraintSet.connect(R.id.message, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END, 0);
  constraintSet.connect(R.id.message, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, 0);
  constraintSet.applyTo(endNavigationLayout);
  NavigationViewOptions.Builder options = NavigationViewOptions.builder()
    .navigationListener(this)
    .progressChangeListener(this)
    .directionsRoute(route)
    .shouldSimulateRoute(true);
  navigationView.startNavigation(options.build());
  updateUiPickingUp();
}
 
Example 4
Source File: ConsumerCreditsFragment.java    From px-android with MIT License 5 votes vote down vote up
private void centerLogo() {
    final ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(creditsLagout);
    constraintSet.connect(logo.getId(), ConstraintSet.LEFT, creditsLagout.getId(), ConstraintSet.LEFT, 0);
    constraintSet.connect(logo.getId(), ConstraintSet.RIGHT, creditsLagout.getId(), ConstraintSet.RIGHT, 0);
    constraintSet.connect(logo.getId(), ConstraintSet.TOP, creditsLagout.getId(), ConstraintSet.TOP, 0);
    constraintSet.connect(logo.getId(), ConstraintSet.BOTTOM, creditsLagout.getId(), ConstraintSet.BOTTOM, 0);
    constraintSet.applyTo(creditsLagout);
}
 
Example 5
Source File: MainActivity.java    From journaldev with MIT License 5 votes vote down vote up
private void showAnimation() {
    show = true;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main_animation);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);
}
 
Example 6
Source File: MainActivity.java    From journaldev with MIT License 5 votes vote down vote up
private void revertAnimation() {
    show = false;

    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(this, R.layout.activity_main);

    ChangeBounds transition = new ChangeBounds();
    transition.setInterpolator(new AnticipateInterpolator(1.0f));
    transition.setDuration(1200);

    TransitionManager.beginDelayedTransition(cc1, transition);
    constraintSet.applyTo(cc1);

}
 
Example 7
Source File: InstructionView.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private void updateLandscapeConstraintsTo(int layoutRes) {
  ConstraintSet collapsed = new ConstraintSet();
  collapsed.clone(getContext(), layoutRes);
  collapsed.applyTo(instructionLayout);
}