Adapts the background of the dialog's header.

@param animation
The animation, which should be used to change the background, as an instance of the
class {@link BackgroundAnimation} or null, if no animation should be used
968968
private void adaptHeaderBackground(@Nullable final BackgroundAnimation animation) {
        if (headerBackgroundImageView != null) {
            Drawable newBackground = headerBackground;

            if (animation != null && newBackground != null) {
                Drawable previousBackground = headerBackgroundImageView.getDrawable();

                if (previousBackground != null) {
                    if (previousBackground instanceof AbstractTransitionDrawable) {
                        previousBackground =
                                ((AbstractTransitionDrawable) previousBackground).getDrawable(1);
                    }

                    if (animation instanceof CircleTransitionAnimation) {
                        CircleTransitionAnimation circleTransitionAnimation =
                                (CircleTransitionAnimation) animation;
                        CircleTransitionDrawable transition = new CircleTransitionDrawable(
                                new Drawable[]{previousBackground, newBackground});
                        transition.setRadius(circleTransitionAnimation.getRadius());
                        transition.setListener(circleTransitionAnimation.getListener());

                        if (circleTransitionAnimation.getX() != null) {
                            transition.setX(circleTransitionAnimation.getX());
                        }

                        if (circleTransitionAnimation.getY() != null) {
                            transition.setY(circleTransitionAnimation.getY());
                        }

                        transition.startTransition(circleTransitionAnimation.getDuration());
                        newBackground = transition;
                    } else if (animation instanceof CrossFadeTransitionAnimation) {
                        CrossFadeTransitionDrawable transition = new CrossFadeTransitionDrawable(
                                new Drawable[]{previousBackground, newBackground});
                        transition.setListener(animation.getListener());
                        transition.startTransition(animation.getDuration());
                        newBackground = transition;
                    } else {
                        throw new RuntimeException("Unknown type of animation: " +
                                animation.getClass().getSimpleName());
                    }
                }
            }

            headerBackgroundImageView.setImageDrawable(newBackground);
        }
    }
111493
public ViewTransitionBuilder animator(@NonNull Context context, int animatorId) {
        animator(AnimatorInflater.loadAnimator(context, animatorId));
        return this;
    }
245863
public void startForegroundIconRotateAnimation() {
        // init infinite animation of no animation was previously configured.
        if (foregroundRotateAnimation == null) {
            startForegroundIconRotateAnimation(0d, 360d, Animation.INDEFINITE, JFXConstants.ANIMATION_DURATION_ROTATION_DEFAULT, Interpolator.LINEAR, false);
            return;
        }
        foregroundRotateAnimation.play();
    }
680599
public AppMsg setAnimation(Animation inAnimation, Animation outAnimation) {
        mInAnimation = inAnimation;
        mOutAnimation = outAnimation;
        return this;
    }
1351398
private boolean shouldUseAnimations() {
        SharedPreferences sharedPreferences =
                PreferenceManager.getDefaultSharedPreferences(getActivity());
        String key = getString(R.string.animation_preference_key);
        boolean defaultValue = getResources().getBoolean(R.bool.animation_preference_default_value);
        return sharedPreferences.getBoolean(key, defaultValue);
    }
92045
private void addBackground(VisualizerContext context) {
    // Make a background
    CSSClass cls = new CSSClass(this, "background");
    cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, context.getStyleLibrary().getBackgroundColor(StyleLibrary.PAGE));
    addCSSClassOrLogError(cls);
    Element bg = this.svgElement(SVGConstants.SVG_RECT_TAG, cls.getName());
    SVGUtil.setAtt(bg, SVGConstants.SVG_X_ATTRIBUTE, "0");
    SVGUtil.setAtt(bg, SVGConstants.SVG_Y_ATTRIBUTE, "0");
    SVGUtil.setAtt(bg, SVGConstants.SVG_WIDTH_ATTRIBUTE, "100%");
    SVGUtil.setAtt(bg, SVGConstants.SVG_HEIGHT_ATTRIBUTE, "100%");
    SVGUtil.setAtt(bg, NO_EXPORT_ATTRIBUTE, NO_EXPORT_ATTRIBUTE);

    // Note that we rely on this being called before any other drawing routines.
    getRoot().appendChild(bg);
  }
707696
public void addAnimation(Element... elements) {
        if (elements == null || elements.length == 0) {
            throw new IllegalArgumentException("One or more elements must be specified.");
        }

        Set<String> elementIdsInPreviousAnimationSteps = new HashSet<>();
        Set<Element> elementsInThisAnimationStep = new HashSet<>();
        Set<Relationship> relationshipsInThisAnimationStep = new HashSet<>();

        for (Element element : elements) {
            if (isElementInView(element)) {
                elementIdsInPreviousAnimationSteps.add(element.getId());
                elementsInThisAnimationStep.add(element);
            }
        }

        if (elementsInThisAnimationStep.size() == 0) {
            throw new IllegalArgumentException("None of the specified elements exist in this view.");
        }

        for (Animation animationStep : animations) {
            elementIdsInPreviousAnimationSteps.addAll(animationStep.getElements());
        }

        for (RelationshipView relationshipView : this.getRelationships()) {
            if (
                    (elementsInThisAnimationStep.contains(relationshipView.getRelationship().getSource()) && elementIdsInPreviousAnimationSteps.contains(relationshipView.getRelationship().getDestination().getId())) ||
                    (elementIdsInPreviousAnimationSteps.contains(relationshipView.getRelationship().getSource().getId()) && elementsInThisAnimationStep.contains(relationshipView.getRelationship().getDestination()))
               ) {
                relationshipsInThisAnimationStep.add(relationshipView.getRelationship());
            }
        }

        animations.add(new Animation(animations.size() + 1, elementsInThisAnimationStep, relationshipsInThisAnimationStep));
    }
778565
@SuppressWarnings("deprecation")
	@SuppressLint("NewApi")
	private void setBackground(View view, Drawable drawable) {
        if (Build.VERSION.SDK_INT >= SET_DRAWABLE_MIN_SDK)
        	view.setBackground(drawable);
        else
        	view.setBackgroundDrawable(drawable);
	}
325794
@Override
    public void setAlpha(int alpha) {
        if (mAlpha != alpha) {
            mAlpha = alpha;
            if (mCurrDrawable != null) {
                if (mEnterAnimationEnd == 0) {
                    mCurrDrawable.setAlpha(alpha);
                } else {
                    animate(false);
                }
            }
        }
    }
684155
function (animation) {
            var chart = this,
              axes = chart.axes,
              series = chart.series,
              pointer = chart.pointer,
              legend = chart.legend,
              redrawLegend = chart.isDirtyLegend,
              hasStackedSeries,
              hasDirtyStacks,
              hasCartesianSeries = chart.hasCartesianSeries,
              isDirtyBox = chart.isDirtyBox, // todo: check if it has actually changed?
              seriesLength = series.length,
              i = seriesLength,
              serie,
              renderer = chart.renderer,
              isHiddenChart = renderer.isHidden(),
              afterRedraw = [];

            setAnimation(animation, chart);

            if (isHiddenChart) {
                chart.cloneRenderTo();
            }

            // Adjust title layout (reflow multiline text)
            chart.layOutTitles();

            // link stacked series
            while (i--) {
                serie = series[i];

                if (serie.options.stacking) {
                    hasStackedSeries = true;

                    if (serie.isDirty) {
                        hasDirtyStacks = true;
                        break;
                    }
                }
            }
            if (hasDirtyStacks) { // mark others as dirty
                i = seriesLength;
                while (i--) {
                    serie = series[i];
                    if (serie.options.stacking) {
                        serie.isDirty = true;
                    }
                }
            }

            // handle updated data in the series
            each(series, function (serie) {
                if (serie.isDirty) { // prepare the data so axis can read it
                    if (serie.options.legendType === 'point') {
                        redrawLegend = true;
                    }
                }
            });

            // handle added or removed series
            if (redrawLegend && legend.options.enabled) { // series or pie points are added or removed
                // draw legend graphics
                legend.render();

                chart.isDirtyLegend = false;
            }

            // reset stacks
            if (hasStackedSeries) {
                chart.getStacks();
            }


            if (hasCartesianSeries) {
                if (!chart.isResizing) {

                    // reset maxTicks
                    chart.maxTicks = null;

                    // set axes scales
                    each(axes, function (axis) {
                        axis.setScale();
                    });
                }

                chart.adjustTickAmounts();
            }

            chart.getMargins(); // #3098

            if (hasCartesianSeries) {
                // If one axis is dirty, all axes must be redrawn (#792, #2169)
                each(axes, function (axis) {
                    if (axis.isDirty) {
                        isDirtyBox = true;
                    }
                });

                // redraw axes
                each(axes, function (axis) {

                    // Fire 'afterSetExtremes' only if extremes are set
                    if (axis.isDirtyExtremes) { // #821
                        axis.isDirtyExtremes = false;
                        afterRedraw.push(function () { // prevent a recursive call to chart.redraw() (#1119)
                            fireEvent(axis, 'afterSetExtremes', extend(axis.eventArgs, axis.getExtremes())); // #747, #751
                            delete axis.eventArgs;
                        });
                    }

                    if (isDirtyBox || hasStackedSeries) {
                        axis.redraw();
                    }
                });
            }

            // the plot areas size has changed
            if (isDirtyBox) {
                chart.drawChartBox();
            }


            // redraw affected series
            each(series, function (serie) {
                if (serie.isDirty && serie.visible &&
                  (!serie.isCartesian || serie.xAxis)) { // issue #153
                    serie.redraw();
                }
            });

            // move tooltip or reset
            if (pointer) {
                pointer.reset(true);
            }

            // redraw if canvas
            renderer.draw();

            // fire the event
            fireEvent(chart, 'redraw'); // jQuery breaks this when calling it from addEvent. Overwrites chart.redraw

            if (isHiddenChart) {
                chart.cloneRenderTo(true);
            }

            // Fire callbacks that are put on hold until after the redraw
            each(afterRedraw, function (callback) {
                callback.call();
            });
        }
734421
public void setSelection(int position, boolean animate) {
        // Animate only if requested position is already on screen somewhere
        boolean shouldAnimate = animate && mFirstPosition <= position &&
                position <= mFirstPosition + getChildCount() - 1;
        setSelectionInt(position, shouldAnimate);
    }
798352
public final void setDialogHeaderBackgroundColor(@ColorInt final int color) {
        this.dialogHeaderBackground = new ColorDrawable(color);
        this.dialogHeaderBackgroundBitmap = null;
        this.dialogHeaderBackgroundId = -1;
        this.dialogHeaderBackgroundColor = color;
    }
960986
public T animate(int animId, Animation.AnimationListener listener) {
        Animation anim = AnimationUtils.loadAnimation(context, animId);
        anim.setAnimationListener(listener);
        return animate(anim);
    }
1142765
public void dismiss(boolean animated) {
        if (animated) {
            if (visibilityChangeListener != null) {
                visibilityChangeListener.onAlertDismissStarted(this);
            }
            startAnimation(fadeOutAnimation);
        }
        else {
            setVisibility(GONE);
        }
    }
1354161
function () {
              if (this$1._config.animation) {
                  var initConfigAnimation = this$1._config.animation || false;

                  if (getAttr(TPElement, 'x-placement') !== null) {
                      return
                  }

                  removeClass(TPElement, TP_STATE_CLASSES.FADE);
                  this$1._config.animation = false;
                  this$1.hide();
                  this$1.show();
                  this$1._config.animation = initConfigAnimation;
              }

              var prevHoverState = this$1._hoverState;
              this$1._hoverState = null;

              if (prevHoverState === TOOLTIP_HOVER_STATE_CLASSES.OUT) {
                  this$1._handleLeave(null);
              }

              var shownEvt = new CancelableEvent('shown', {
                  cancelable: false,
                  target: this$1._targetElement,
                  relatedTarget: TPElement
              });

              this$1._emitCustomEvent(shownEvt);
          }
391954
public void updateBackground( T frame , GrayU8 segment ) {
		updateBackground(frame);
		segment(frame,segment);
	}
563429
public void setAnimationBackend(@Nullable AnimationBackend animationBackend) {
    mAnimationBackend = animationBackend;
    if (mAnimationBackend != null) {
      mFrameScheduler = new DropFramesFrameScheduler(mAnimationBackend);
      mAnimationBackend.setBounds(getBounds());
      if (mDrawableProperties != null) {
        // re-apply to the same drawable so that the animation backend is updated.
        mDrawableProperties.applyTo(this);
      }
    }
    mFrameScheduler = createSchedulerForBackendAndDelayMethod(mAnimationBackend);
    stop();
  }