Example usage for android.view.animation TranslateAnimation setRepeatMode

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

Introduction

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

Prototype

public void setRepeatMode(int repeatMode) 

Source Link

Document

Defines what this animation should do when it reaches the end.

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();//w w  w.  j a  va 2  s . com
}

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);//from  w ww. j av 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);//from   w  ww  .ja  v  a  2 s . co 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 w  w w.j a v  a2  s .c o  m*/
    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 w  w .  j  a v  a  2  s . co  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  ava 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 ww .  ja v a2s.  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();// www.  j  a va 2s . c o m
    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) {
        //??/* w  w w . j av  a2  s  .  c  om*/
        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 ava  2s  . com
    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);
}