当前位置: 首页>>代码示例>>Java>>正文


Java ObjectAnimator.setStartDelay方法代码示例

本文整理汇总了Java中android.animation.ObjectAnimator.setStartDelay方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.setStartDelay方法的具体用法?Java ObjectAnimator.setStartDelay怎么用?Java ObjectAnimator.setStartDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.ObjectAnimator的用法示例。


在下文中一共展示了ObjectAnimator.setStartDelay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showContent

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override public void showContent() {

    if (adapter.getItemCount() == 0) {
      if (isRestoringViewState()) {
        emptyView.setVisibility(View.VISIBLE);
      } else {
        ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
        anim.setStartDelay(250);
        anim.addListener(new AnimatorListenerAdapter() {

          @Override public void onAnimationStart(Animator animation) {
            emptyView.setVisibility(View.VISIBLE);
          }
        });
        anim.start();
      }
    } else {
      emptyView.setVisibility(View.GONE);
    }

    super.showContent();
  }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:AuthRefreshRecyclerFragment.java

示例2: testAnim

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@NonNull
    private AnimatorSet testAnim(GiftFrameLayout giftFrameLayout) {
        PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0, -50);
        PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.5f);
        ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator.setStartDelay(0);
        animator.setDuration(1500);

        translationY = PropertyValuesHolder.ofFloat("translationY", -50, -100);
        alpha = PropertyValuesHolder.ofFloat("alpha", 0.5f, 0f);
        ObjectAnimator animator1 = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator1.setStartDelay(0);
        animator1.setDuration(1500);

        // 复原
//        ObjectAnimator fadeAnimator2 = GiftAnimationUtil.createFadeAnimator(giftFrameLayout, 0, 0, 0, 0);

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(animator1).after(animator);
//        animatorSet.play(fadeAnimator2).after(animator1);
        animatorSet.start();
        return animatorSet;
    }
 
开发者ID:DyncKathline,项目名称:LiveGiftLayout,代码行数:24,代码来源:CustormAnim.java

示例3: prepareAnimators

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void prepareAnimators(DepthRelativeLayout target, int index, int animationDelay) {
    final TimeInterpolator interpolator = new ExpoIn();

    final float finalTranslationY = exitConfiguration.getFinalYPercent() * target.getResources().getDisplayMetrics().heightPixels;
    final float finalTranslationX = exitConfiguration.getFinalXPercent() * target.getResources().getDisplayMetrics().widthPixels;

    final long totalDuration = exitConfiguration.getDuration();

    final ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, finalTranslationY);
    translationY2.setDuration(totalDuration);
    //translationY2.setInterpolator(new AccelerateInterpolator());
    translationY2.setInterpolator(interpolator);
    translationY2.setStartDelay(animationDelay);
    attachListener(translationY2);
    add(translationY2);

    final ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, finalTranslationX);
    translationX2.setDuration(totalDuration);
    translationX2.setInterpolator(interpolator);
    translationX2.setStartDelay(animationDelay);
    add(translationX2);
}
 
开发者ID:florent37,项目名称:Depth,代码行数:24,代码来源:ExitAnimation.java

示例4: onSnippetBound

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * To be triggered when a snippet is bound to a ViewHolder.
 */
public void onSnippetBound(View cardView) {
    // We only run if the feature is enabled and once per NTP.
    if (!SnippetsConfig.isIncreasedCardVisibilityEnabled() || mFirstCardAnimationRun) return;
    mFirstCardAnimationRun = true;

    // We only want an animation to run if we are not scrolled.
    if (computeVerticalScrollOffset() != 0) return;

    // We only show the animation a certain number of times to a user.
    ChromePreferenceManager manager = ChromePreferenceManager.getInstance(getContext());
    int animCount = manager.getNewTabPageFirstCardAnimationRunCount();
    if (animCount > CardsVariationParameters.getFirstCardAnimationMaxRuns()) return;
    manager.setNewTabPageFirstCardAnimationRunCount(animCount + 1);

    // We do not show the animation if the user has previously seen it then scrolled.
    if (manager.getCardsImpressionAfterAnimation()) return;

    // The peeking card bounces up twice from its position.
    ObjectAnimator animator = ObjectAnimator.ofFloat(cardView, View.TRANSLATION_Y,
            0f, -mPeekingCardBounceDistance, 0f, -mPeekingCardBounceDistance, 0f);
    animator.setStartDelay(PEEKING_CARD_ANIMATION_START_DELAY_MS);
    animator.setDuration(PEEKING_CARD_ANIMATION_TIME_MS);
    animator.setInterpolator(PEEKING_CARD_INTERPOLATOR);
    animator.start();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:NewTabPageRecyclerView.java

示例5: exitAnimate

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
static ValueAnimator exitAnimate(final DepthRelativeLayout target, final float moveY, final float customElevation, long delay, int subtractDelay, boolean continueOffscreen) {

        target.setPivotY(getDistanceToCenter(target));
        target.setPivotX(getDistanceToCenterX(target));
        target.setCameraDistance(10000 * target.getResources().getDisplayMetrics().density);

        ObjectAnimator rotationX = ObjectAnimator.ofFloat(target, View.ROTATION_X, TARGET_ROTATION_X).setDuration(DURATION);
        rotationX.setInterpolator(VALUEinterpolator);
        rotationX.setStartDelay(delay);
        rotationX.start();

        ObjectAnimator elevation = ObjectAnimator.ofFloat(target, "CustomShadowElevation", target.getCustomShadowElevation(), customElevation * target.getResources().getDisplayMetrics().density).setDuration(DURATION);
        elevation.setInterpolator(VALUEinterpolator);
        elevation.setStartDelay(delay);
        elevation.start();

        ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, TARGET_SCALE).setDuration(DURATION);
        scaleX.setInterpolator(new QuintOut());
        scaleX.setStartDelay(delay);
        scaleX.start();

        ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, TARGET_SCALE).setDuration(DURATION);
        scaleY.setInterpolator(new QuintOut());
        scaleY.setStartDelay(delay);
        scaleY.start();

        ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, TARGET_ROTATION).setDuration(1600);
        rotation.setInterpolator(VALUEinterpolator);
        rotation.setStartDelay(delay);
        rotation.start();

        ObjectAnimator translationY = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, -moveY * target.getResources().getDisplayMetrics().density).setDuration(subtractDelay);
        translationY.setInterpolator(VALUEinterpolator);
        translationY.setStartDelay(delay);
        translationY.start();
        if (continueOffscreen) {
            continueOutToRight(target, moveY, subtractDelay);
        }
        return scaleY;
    }
 
开发者ID:florent37,项目名称:Depth,代码行数:41,代码来源:TransitionHelper.java

示例6: setCurrentItemShowing

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void setCurrentItemShowing(int index, boolean animateCircle, boolean
        delayLabelAnimate, boolean announce) {
    TextView labelToAnimate;
    this.mTimePicker.setCurrentItemShowing(index, animateCircle);
    if (index == 0) {
        int hours = this.mTimePicker.getHours();
        if (!this.mIs24HourMode) {
            hours %= 12;
        }
        this.mTimePicker.setContentDescription(this.mHourPickerDescription + ": " + hours);
        if (announce) {
            Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mSelectHours);
        }
        labelToAnimate = this.mHourView;
    } else {
        this.mTimePicker.setContentDescription(this.mMinutePickerDescription + ": " + this
                .mTimePicker.getMinutes());
        if (announce) {
            Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mSelectMinutes);
        }
        labelToAnimate = this.mMinuteView;
    }
    int hourColor = index == 0 ? this.mSelectedColor : this.mUnselectedColor;
    int minuteColor = index == 1 ? this.mSelectedColor : this.mUnselectedColor;
    this.mHourView.setTextColor(hourColor);
    this.mMinuteView.setTextColor(minuteColor);
    ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
    if (delayLabelAnimate) {
        pulseAnimator.setStartDelay(300);
    }
    pulseAnimator.start();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:TimePickerDialog.java

示例7: fadeAndRemoveEmptyScreen

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
        final boolean stripEmptyScreens) {
    // XXX: Do we need to update LM workspace screens below?
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);

    final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);

    mRemoveEmptyScreenRunnable = new Runnable() {
        @Override
        public void run() {
            if (hasExtraEmptyScreen()) {
                mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
                mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
                removeView(cl);
                if (stripEmptyScreens) {
                    stripEmptyScreens();
                }
                // Update the page indicator to reflect the removed page.
                showPageIndicatorAtCurrentScroll();
            }
        }
    };

    ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
    oa.setDuration(duration);
    oa.setStartDelay(delay);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mRemoveEmptyScreenRunnable != null) {
                mRemoveEmptyScreenRunnable.run();
            }
            if (onComplete != null) {
                onComplete.run();
            }
        }
    });
    oa.start();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:41,代码来源:Workspace.java

示例8: continueOutToRight

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private static void continueOutToRight(DepthFAB target, float moveY, int subtractDelay) 
{
       ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, -moveY * target.getResources().getDisplayMetrics().density, -target.getResources().getDisplayMetrics().heightPixels).setDuration(900);
       translationY2.setInterpolator(new ExpoIn());
       translationY2.setStartDelay(0 + subtractDelay);

       translationY2.start();

       ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, target.getTranslationX(), target.getResources().getDisplayMetrics().widthPixels).setDuration(900);
       translationX2.setInterpolator(new ExpoIn());
       translationX2.setStartDelay(0 + subtractDelay);
       translationX2.start();
   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:14,代码来源:TransitionHelper.java

示例9: continueOutToRight

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private static void continueOutToRight(DepthLayout target, float moveY, int subtractDelay) 
{
       ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, -moveY * target.getResources().getDisplayMetrics().density, -target.getResources().getDisplayMetrics().heightPixels).setDuration(900);
       translationY2.setInterpolator(new ExpoIn());
       translationY2.setStartDelay(0 + subtractDelay);

       translationY2.start();

       ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, target.getTranslationX(), target.getResources().getDisplayMetrics().widthPixels).setDuration(900);
       translationX2.setInterpolator(new ExpoIn());
       translationX2.setStartDelay(0 + subtractDelay);
       translationX2.start();
   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:14,代码来源:TransitionHelperWallpaper.java

示例10: createShowButtonAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * @param button The {@link View} of the button to show.
 * @return An animator to run for the given view when showing buttons in the unfocused location
 *         bar. This should also be used to create animators for showing toolbar buttons.
 */
public ObjectAnimator createShowButtonAnimator(View button) {
    if (button.getVisibility() != View.VISIBLE) {
        button.setAlpha(0.f);
    }
    ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(button, View.ALPHA, 1.f);
    buttonAnimator.setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE);
    buttonAnimator.setStartDelay(ICON_FADE_ANIMATION_DELAY_MS);
    buttonAnimator.setDuration(ICON_FADE_ANIMATION_DURATION_MS);
    return buttonAnimator;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:LocationBarTablet.java

示例11: introAnimate

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
static ObjectAnimator introAnimate(final DepthRelativeLayout target, final float moveY, final float customElevation, long delay, int subtractDelay) {

        target.setPivotY(getDistanceToCenter(target));
        target.setPivotX(getDistanceToCenterX(target));
        target.setCameraDistance(10000 * target.getResources().getDisplayMetrics().density);

        ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, target.getResources().getDisplayMetrics().heightPixels, -moveY * target.getResources().getDisplayMetrics().density).setDuration(800);
        translationY2.setInterpolator(new ExpoOut());
        translationY2.setStartDelay(700 + subtractDelay);
        translationY2.start();
        target.setTranslationY(target.getResources().getDisplayMetrics().heightPixels);

        ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, -target.getResources().getDisplayMetrics().widthPixels, 0).setDuration(800);
        translationX2.setInterpolator(new ExpoOut());
        translationX2.setStartDelay(700 + subtractDelay);
        translationX2.start();
        target.setTranslationX(-target.getResources().getDisplayMetrics().widthPixels);

        ObjectAnimator translationY = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, 0).setDuration(700);
        translationY.setInterpolator(new BackOut());
        translationY.setStartDelay(700 + 800);
        translationY.start();


        ObjectAnimator rotationX = ObjectAnimator.ofFloat(target, View.ROTATION_X, TARGET_ROTATION_X, 0).setDuration(1000);
        rotationX.setInterpolator(new QuintInOut());
        rotationX.setStartDelay(700 + FISRTDELAY + subtractDelay);
        rotationX.start();
        target.setRotationX(TARGET_ROTATION_X);

        ObjectAnimator elevation = ObjectAnimator.ofFloat(target, "CustomShadowElevation", customElevation * target.getResources().getDisplayMetrics().density, target.getCustomShadowElevation()).setDuration(1000);
        elevation.setInterpolator(new QuintInOut());
        elevation.setStartDelay(700 + FISRTDELAY + subtractDelay * 2);
        elevation.start();
        target.setCustomShadowElevation(customElevation * target.getResources().getDisplayMetrics().density);

        ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, TARGET_SCALE, target.getScaleX()).setDuration(1000);
        scaleX.setInterpolator(new CircInOut());
        scaleX.setStartDelay(700 + FISRTDELAY + subtractDelay);
        scaleX.start();
        target.setScaleX(TARGET_SCALE);

        ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, TARGET_SCALE, target.getScaleY()).setDuration(1000);
        scaleY.setInterpolator(new CircInOut());
        scaleY.setStartDelay(700 + FISRTDELAY + subtractDelay);
        scaleY.start();
        target.setScaleY(TARGET_SCALE);

        ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, TARGET_ROTATION, 0).setDuration(1400);
        rotation.setInterpolator(new QuadInOut());
        rotation.setStartDelay(FISRTDELAY + subtractDelay);
        rotation.start();
        target.setRotation(TARGET_ROTATION);
        rotation.addListener(getShowStatusBarListener(target));
        return scaleY;
    }
 
开发者ID:florent37,项目名称:Depth,代码行数:57,代码来源:TransitionHelper.java

示例12: initAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private ObjectAnimator initAnimator(ObjectAnimator animator) {
    animator.setStartDelay(mDelay);
    return animator;
}
 
开发者ID:fergus825,项目名称:SmartOrnament,代码行数:5,代码来源:GuillotineAnimation.java

示例13: setCurrentItemShowing

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate,
        boolean announce) {
    mTimePicker.setCurrentItemShowing(index, animateCircle);

    TextView labelToAnimate;
    switch(index) {
        case HOUR_INDEX:
            int hours = mTimePicker.getHours();
            if (!mIs24HourMode) {
                hours = hours % 12;
            }
            mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours);
            if (announce) {
                Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours);
            }
            labelToAnimate = mHourView;
            break;
        case MINUTE_INDEX:
            int minutes = mTimePicker.getMinutes();
            mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes);
            if (announce) {
                Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes);
            }
            labelToAnimate = mMinuteView;
            break;
        default:
            int seconds = mTimePicker.getSeconds();
            mTimePicker.setContentDescription(mSecondPickerDescription + ": " + seconds);
            if (announce) {
                Utils.tryAccessibilityAnnounce(mTimePicker, mSelectSeconds);
            }
            labelToAnimate = mSecondView;
    }

    int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor;
    int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor;
    int secondColor = (index == SECOND_INDEX) ? mSelectedColor : mUnselectedColor;
    mHourView.setTextColor(hourColor);
    mMinuteView.setTextColor(minuteColor);
    mSecondView.setTextColor(secondColor);

    ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
    if (delayLabelAnimate) {
        pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
    }
    pulseAnimator.start();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:48,代码来源:TimePickerDialog.java

示例14: introAnimate

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
static ObjectAnimator introAnimate(final DepthLayout target, final float moveY, final float customElevation, long delay, int subtractDelay) 
{
       target.setPivotY(getDistanceToCenter(target));
       target.setPivotX(getDistanceToCenterX(target));
       target.setCameraDistance(10000 * target.getResources().getDisplayMetrics().density);

       ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, target.getResources().getDisplayMetrics().heightPixels, -moveY * target.getResources().getDisplayMetrics().density).setDuration(800);
       translationY2.setInterpolator(new ExpoOut());
       translationY2.setStartDelay(700 + subtractDelay);
       translationY2.start();
       target.setTranslationY(target.getResources().getDisplayMetrics().heightPixels);

       ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, -target.getResources().getDisplayMetrics().widthPixels, 0).setDuration(800);
       translationX2.setInterpolator(new ExpoOut());
       translationX2.setStartDelay(700 + subtractDelay);
       translationX2.start();
       target.setTranslationX(-target.getResources().getDisplayMetrics().widthPixels);

       ObjectAnimator translationY = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, 0).setDuration(700);
       translationY.setInterpolator(new BackOut());
       translationY.setStartDelay(700 + 800);
       translationY.start();

       ObjectAnimator rotationX = ObjectAnimator.ofFloat(target, View.ROTATION_X, TARGET_ROTATION_X, 0).setDuration(1000);
       rotationX.setInterpolator(new QuintInOut());
       rotationX.setStartDelay(700 + FISRTDELAY + subtractDelay);
       rotationX.start();
       target.setRotationX(TARGET_ROTATION_X);

       ObjectAnimator elevation = ObjectAnimator.ofFloat(target, "CustomShadowElevation", customElevation * target.getResources().getDisplayMetrics().density, target.getCustomShadowElevation()).setDuration(1000);
       elevation.setInterpolator(new QuintInOut());
       elevation.setStartDelay(700 + FISRTDELAY + subtractDelay * 2);
       elevation.start();
       target.setCustomShadowElevation(customElevation * target.getResources().getDisplayMetrics().density);

       ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, TARGET_SCALE, target.getScaleX()).setDuration(1000);
       scaleX.setInterpolator(new CircInOut());
       scaleX.setStartDelay(700 + FISRTDELAY + subtractDelay);
       scaleX.start();
       target.setScaleX(TARGET_SCALE);

       ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, TARGET_SCALE, target.getScaleY()).setDuration(1000);
       scaleY.setInterpolator(new CircInOut());
       scaleY.setStartDelay(700 + FISRTDELAY + subtractDelay);
       scaleY.start();
       target.setScaleY(TARGET_SCALE);

       ObjectAnimator rotation = ObjectAnimator.ofFloat(target, View.ROTATION, TARGET_ROTATION, 0).setDuration(1400);
       rotation.setInterpolator(new QuadInOut());
       rotation.setStartDelay(FISRTDELAY + subtractDelay);
       rotation.start();
       target.setRotation(TARGET_ROTATION);
       rotation.addListener(getShowStatusBarListener(target));
       return scaleY;
   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:56,代码来源:TransitionHelperAbout.java

示例15: init

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    if (!isInEditMode()) {
        if (attrs == null) {
            throw new IllegalArgumentException("Attributes should be provided to this view,");
        }
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable
                .RippleBackground);
        this.rippleColor = typedArray.getColor(R.styleable.RippleBackground_rb_color,
                getResources().getColor(R.color.rippelColor));
        this.rippleStrokeWidth = typedArray.getDimension(R.styleable
                .RippleBackground_rb_strokeWidth, getResources().getDimension(R.dimen
                .rippleStrokeWidth));
        this.rippleRadius = typedArray.getDimension(R.styleable.RippleBackground_rb_radius,
                getResources().getDimension(R.dimen.rippleRadius));
        this.rippleDurationTime = typedArray.getInt(R.styleable.RippleBackground_rb_duration,
                3000);
        this.rippleAmount = typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount, 6);
        this.rippleScale = typedArray.getFloat(R.styleable.RippleBackground_rb_scale,
                DEFAULT_SCALE);
        this.rippleType = typedArray.getInt(R.styleable.RippleBackground_rb_type, 0);
        typedArray.recycle();
        this.rippleDelay = this.rippleDurationTime / this.rippleAmount;
        this.paint = new Paint();
        this.paint.setAntiAlias(true);
        if (this.rippleType == 0) {
            this.rippleStrokeWidth = 0.0f;
            this.paint.setStyle(Style.FILL);
        } else {
            this.paint.setStyle(Style.STROKE);
        }
        this.paint.setColor(this.rippleColor);
        this.rippleParams = new LayoutParams((int) (2.0f * (this.rippleRadius + this
                .rippleStrokeWidth)), (int) (2.0f * (this.rippleRadius + this
                .rippleStrokeWidth)));
        this.rippleParams.addRule(13, -1);
        this.animatorSet = new AnimatorSet();
        this.animatorSet.setDuration((long) this.rippleDurationTime);
        this.animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        this.animatorList = new ArrayList();
        for (int i = 0; i < this.rippleAmount; i++) {
            RippleView rippleView = new RippleView(getContext());
            addView(rippleView, this.rippleParams);
            this.rippleViewList.add(rippleView);
            ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", new
                    float[]{1.0f, this.rippleScale});
            scaleXAnimator.setRepeatCount(-1);
            scaleXAnimator.setRepeatMode(1);
            scaleXAnimator.setStartDelay((long) (this.rippleDelay * i));
            this.animatorList.add(scaleXAnimator);
            ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", new
                    float[]{1.0f, this.rippleScale});
            scaleYAnimator.setRepeatCount(-1);
            scaleYAnimator.setRepeatMode(1);
            scaleYAnimator.setStartDelay((long) (this.rippleDelay * i));
            this.animatorList.add(scaleYAnimator);
            ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", new
                    float[]{1.0f, 0.0f});
            alphaAnimator.setRepeatCount(-1);
            alphaAnimator.setRepeatMode(1);
            alphaAnimator.setStartDelay((long) (this.rippleDelay * i));
            this.animatorList.add(alphaAnimator);
        }
        this.animatorSet.playTogether(this.animatorList);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:66,代码来源:RippleBackground.java


注:本文中的android.animation.ObjectAnimator.setStartDelay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。