Example usage for android.view.animation Animation setStartOffset

List of usage examples for android.view.animation Animation setStartOffset

Introduction

In this page you can find the example usage for android.view.animation Animation setStartOffset.

Prototype

public void setStartOffset(long startOffset) 

Source Link

Document

When this animation should start relative to the start time.

Usage

From source file:com.libreteam.driver.Driver_RideOffer.java

private void blinkCountDown() {
    //      MediaPlayer  mp = MediaPlayer.create(getActivity(), R.raw.alert);
    //      mp.start();
    Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setDuration(150);//from   w ww .  j a  va2 s . c  o m
    anim.setStartOffset(120);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);
    txtCountDown.startAnimation(anim);
}

From source file:com.dbeginc.dbweather.utils.animations.widgets.RainFallView.java

@Override
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
    super.onSizeChanged(width, height, oldWidth, oldHeight);
    SecureRandom random = new SecureRandom();
    Interpolator interpolator = new LinearInterpolator();

    mRainFlakeCount = Math.max(width, height) / 20;
    coords = new int[mRainFlakeCount][];
    drawables.clear();//from  ww w.  j a  v  a 2  s  .  co m
    for (int i = 0; i < mRainFlakeCount; i++) {
        Animation animation = new TranslateAnimation(0, height / 10 - random.nextInt(height / 5), 0,
                height + 30);
        animation.setDuration(10 * height + random.nextInt(5 * height));
        animation.setRepeatCount(-1);
        animation.initialize(10, 10, 10, 10);
        animation.setInterpolator(interpolator);

        coords[i] = new int[] { random.nextInt(width - 30), -30 };

        drawables.add(new AnimateDrawable(mRainDrop, animation));
        animation.setStartOffset(random.nextInt(20 * height));
        animation.startNow();
        int y;
        y = random.nextInt(2);
        if (y == 0) {
            drawables.add(new AnimateDrawable(mRainDrop, animation));
        } else {
            drawables.add(new AnimateDrawable(mRainDrop));
        }
    }
}

From source file:com.dbeginc.dbweather.utils.animations.widgets.SnowFallView.java

@Override
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
    super.onSizeChanged(width, height, oldWidth, oldHeight);
    Random random = new SecureRandom();
    Interpolator interpolator = new LinearInterpolator();

    snow_flake_count = Math.max(width, height) / 20;
    coords = new int[snow_flake_count][];
    drawables.clear();//from  w w w  .j ava  2  s. c o  m
    for (int i = 0; i < snow_flake_count; i++) {
        Animation animation = new TranslateAnimation(0, height / 10 - random.nextInt(height / 5), 0,
                height + 30);
        animation.setDuration(10 * height + random.nextInt(5 * height));
        animation.setRepeatCount(-1);
        animation.initialize(10, 10, 10, 10);
        animation.setInterpolator(interpolator);

        coords[i] = new int[] { random.nextInt(width - 30), -30 };

        drawables.add(new AnimateDrawable(snow_flake, animation));
        animation.setStartOffset(random.nextInt(20 * height));
        animation.startNow();
        int y;
        y = random.nextInt(2);
        if (y == 0) {
            drawables.add(new AnimateDrawable(snow_flake, animation));
        } else {
            drawables.add(new AnimateDrawable(snow_flake));
        }
    }
}

From source file:com.glabs.homegenie.StartActivity.java

public void showLogo() {
    _islogovisible = true;//from   ww  w  .  j ava 2s  .co m
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Animation fadeIn = new AlphaAnimation(0, 0.8f);
            fadeIn.setInterpolator(new AccelerateInterpolator()); //and this
            fadeIn.setStartOffset(0);
            fadeIn.setDuration(500);
            //
            AnimationSet animation = new AnimationSet(false); //change to false
            animation.addAnimation(fadeIn);
            animation.setFillAfter(true);
            RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo);
            ivlogo.startAnimation(animation);
        }
    });
}

From source file:com.glabs.homegenie.StartActivity.java

public void hideLogo() {
    _islogovisible = false;/*from  w w  w .j a v a2s  .c  o  m*/
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Animation fadeOut = new AlphaAnimation(0.8f, 0);
            fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
            fadeOut.setStartOffset(0);
            fadeOut.setDuration(500);
            //
            AnimationSet animation = new AnimationSet(false); //change to false
            animation.addAnimation(fadeOut);
            animation.setFillAfter(true);
            RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo);
            ivlogo.startAnimation(animation);
        }
    });
}

From source file:org.zywx.wbpalmstar.engine.EBrowserWidgetPool.java

public void showWidget() {
    if (null != mAppCenter && mAppCenter.isShown()) {
        mAppCenter.notifyWidgetLoadFinish();
    }//w w w  .ja  v  a 2 s.  c o m
    final EBrowserWidget showWidget = mWgtStack.peek();
    final EBrowserWidget hiddenWidget = mWgtStack.prev();
    int animiId = 0;
    long duration = 0;
    EWgtResultInfo inResult = showWidget.getResult();
    if (null != inResult) {
        animiId = inResult.getAnimiId();
        duration = inResult.getDuration();
    }
    Animation[] animPair = EBrowserAnimation.getAnimPair(animiId, duration);
    Animation showAnim = animPair[0];
    Animation hiddenAnim = animPair[1];
    showAnim.setStartOffset(500);
    hiddenAnim.setStartOffset(500);
    hiddenAnim.setAnimationListener(new AnimationListener() {
        public void onAnimationStart(Animation animation) {
        }

        public void onAnimationRepeat(Animation animation) {
        }

        public void onAnimationEnd(Animation animation) {
            hiddenWidget.setVisibility(View.GONE);
            showWidget.notifyVisibilityChanged(0);
            hiddenWidget.notifyVisibilityChanged(1);
            showHover(true);
            WWidgetData wgtData = showWidget.getWidget();
            int wgtOrientation = wgtData.m_orientation;
            mContext.changeConfiguration(wgtOrientation);
        }
    });
    showWidget.setVisibility(View.VISIBLE);
    hiddenWidget.startAnimation(hiddenAnim);
    showWidget.startAnimation(showAnim);
}

From source file:nu.yona.app.ui.pincode.BasePasscodeActivity.java

/**
 * Initialize animation./*from  w  w  w  .j  ava  2 s  . c o m*/
 */
protected void initializeAnimation() {
    final Animation in = new AlphaAnimation(0.0f, 1.0f);
    in.setDuration(AppConstant.ANIMATION_DURATION);
    animationView = new AnimationSet(true);
    in.setStartOffset(AppConstant.TIMER_DELAY);
    animationView.addAnimation(in);
}

From source file:org.secuso.privacyfriendlydicegame.MainActivity.java

public void hints(int position) {

    TextView hint = (TextView) findViewById(R.id.initialTextView);
    TextView initialText = (TextView) findViewById(R.id.initialTextTextView);
    TextView hint2 = (TextView) findViewById(R.id.initialTextView2);
    ImageView background = (ImageView) findViewById(R.id.backgroundImageView);

    Animation anim = new AlphaAnimation(0.0f, 1.0f);

    if (position == 0) {
        hint.setVisibility(View.VISIBLE);
        hint2.setVisibility(View.VISIBLE);
        background.setVisibility(View.VISIBLE);
        initialText.setVisibility(View.VISIBLE);

        anim.setDuration(1000);//from   w  ww .java2s  .  c  o m
        anim.setStartOffset(20);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setRepeatCount(Animation.INFINITE);
        hint.startAnimation(anim);
        hint2.startAnimation(anim);

    } else {
        hint.clearAnimation();
        hint2.clearAnimation();
        hint.setVisibility(View.INVISIBLE);
        hint2.setVisibility(View.INVISIBLE);
        background.setVisibility(View.INVISIBLE);
        initialText.setVisibility(View.INVISIBLE);
    }

}

From source file:ly.kite.journey.selection.ProductOverviewFragment.java

/*****************************************************
 *
 * Called when the details control is clicked.
 *
 *****************************************************/
private void toggleSliderState() {
    // We want to animation the following:
    //   - Overlaid start button fade in / out
    //   - Sliding drawer up / down
    //   - Open / close drawer icon rotation

    boolean sliderWillBeOpening = !mSlidingOverlayFrame.sliderIsExpanded();

    float overlaidComponentsInitialAlpha;
    float overlaidComponentsFinalAlpha;

    float openCloseIconInitialRotation;
    float openCloseIconFinalRotation;

    if (sliderWillBeOpening) {
        overlaidComponentsInitialAlpha = 1f;
        overlaidComponentsFinalAlpha = 0f;

        openCloseIconInitialRotation = OPEN_CLOSE_ICON_ROTATION_UP;
        openCloseIconFinalRotation = OPEN_CLOSE_ICON_ROTATION_DOWN;
    } else {/*from ww w. j  a  v  a  2 s. c  o m*/
        overlaidComponentsInitialAlpha = 0f;
        overlaidComponentsFinalAlpha = 1f;

        openCloseIconInitialRotation = OPEN_CLOSE_ICON_ROTATION_DOWN;
        openCloseIconFinalRotation = OPEN_CLOSE_ICON_ROTATION_UP;
    }

    // Create the overlaid components animation
    Animation overlaidComponentsAnimation = new AlphaAnimation(overlaidComponentsInitialAlpha,
            overlaidComponentsFinalAlpha);
    overlaidComponentsAnimation.setDuration(SLIDE_ANIMATION_DURATION_MILLIS);
    overlaidComponentsAnimation.setFillAfter(true);

    // Create the open/close icon animation.
    // The rotation is delayed, but will finish at the same time as the slide animation.
    Animation openCloseIconAnimation = new RotateAnimation(openCloseIconInitialRotation,
            openCloseIconFinalRotation, mOpenCloseDrawerIconImageView.getWidth() * 0.5f,
            mOpenCloseDrawerIconImageView.getHeight() * 0.5f);
    openCloseIconAnimation.setStartOffset(OPEN_CLOSE_ICON_ANIMATION_DELAY_MILLIS);
    openCloseIconAnimation.setDuration(OPEN_CLOSE_ICON_ANIMATION_DURATION_MILLIS);
    openCloseIconAnimation.setFillAfter(true);

    if (mOverlaidComponents != null) {
        mOverlaidComponents.setAlpha(1f); // Clear any alpha already applied
        mOverlaidComponents.startAnimation(overlaidComponentsAnimation);
    }

    if (mOpenCloseDrawerIconImageView != null) {
        mOpenCloseDrawerIconImageView.setRotation(0f); // Clear any rotation already applied
        mOpenCloseDrawerIconImageView.startAnimation(openCloseIconAnimation);
    }

    mSlidingOverlayFrame.animateToExpandedState(sliderWillBeOpening);
}

From source file:com.pitchedapps.primenumbercalculator.Calculator.java

License:asdf

public Animation fadeInAnimation() {
    Animation fadeInAnimation = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
    fadeInAnimation.setStartOffset(200);
    fadeInAnimation.setDuration(300);//from   w  ww  . j a  v  a 2  s .co m
    return fadeInAnimation;
}