Example usage for android.view.animation TranslateAnimation setRepeatCount

List of usage examples for android.view.animation TranslateAnimation setRepeatCount

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation setRepeatCount.

Prototype

public void setRepeatCount(int repeatCount) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:Main.java

public static void startTranslationAnimation(View view) {
    TranslateAnimation translateAnimation = new TranslateAnimation(-50f, 50f, 0, 0);
    translateAnimation.setDuration(1000);
    translateAnimation.setRepeatCount(Animation.INFINITE);
    translateAnimation.setRepeatMode(Animation.REVERSE);
    view.setAnimation(translateAnimation);
    translateAnimation.start();//from ww w. j a va2  s  . co  m
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showOpenSettingsMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f, 0.0f, 0.0f);
    animation.setDuration(1000);/*  w w  w .ja v a  2  s  . c  o  m*/
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from left to right to open Settings");
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showCloseSettingsMenu() {
    TranslateAnimation animation = new TranslateAnimation(400.0f, 0.0f, 0.0f, 0.0f);
    animation.setDuration(1000);// ww  w .j ava2 s .c  o  m
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from right to left to close Settings");
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showOpenManualMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 0.0f, 400.0f, 0.0f);
    animation.setDuration(1000);//from   www  . j a  v a 2s . c  om
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText("Swipe from bottom to top to open Manuals");
}

From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java

private void showCloseManualMenu() {
    TranslateAnimation animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 400.0f);
    animation.setDuration(1000);//from w  ww . ja  v  a  2  s. c  o  m
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.INFINITE);
    animation.setFillAfter(true);
    finger.startAnimation(animation);
    description.setText(
            "Swipe from top to bottom to close Manuals\r\n\r\nif you can't the heat use Google camera :)");
    nextButton.setText("Close");
    dontshowagain.setVisibility(View.VISIBLE);
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateScroller() {
    Log.v(TAG, "animateScroller()");

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);/*from  w w  w  .j av  a 2 s.  c o m*/
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        private int repeatCounter = 0;

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (++repeatCounter % 2 == 0 && nextStatus != Status.INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateScroller() {
    Timber.v("animateScroller()");
    checkNotNull(progressBar);/*w w  w . j a  v  a 2 s  .  c om*/

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (nextProgress.getStatus() != INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.jiubai.jiubaijz.zxing.activity.CaptureActivity.java

private void initView() {
    Window window = getWindow();//from  w w w  . j ava  2s.c om
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.activity_capture);

    ButterKnife.bind(this);

    mInactivityTimer = new InactivityTimer(this);
    mBeepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    mScanLineImageView.startAnimation(animation);
}

From source file:com.xys.libzxing.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) //??
    != PackageManager.PERMISSION_GRANTED) {
        //??/*from  w  ww  .  j a  v  a2s .  co m*/
        ActivityCompat.requestPermissions(CaptureActivity.this, new String[] { Manifest.permission.CAMERA }, 1);
    }
    Window window = getWindow();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    m_oCaptureActivity = this;
    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);
    trunoff_on = (ImageView) findViewById(R.id.trunoff_on);
    trunoff_on.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (isOpen) {
                // ?
                cameraManager.offLight();
                isOpen = false;
            } else {
                //?
                cameraManager.openLight();
                isOpen = true;
            }
        }
    });
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}

From source file:com.melvin.share.zxing.activity.CaptureActivity.java

@Override
protected void initView() {
    Window window = getWindow();/* ww w.  j a v  a 2s.c  om*/
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    initWindow();
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    initToolbar(toolbar);
    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);

    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}