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:com.chiemy.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Window window = getWindow();//  www.  j  ava  2 s. co m
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(getLayoutId());

    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);

    getWindow().getDecorView().post(new Runnable() {
        @Override
        public void run() {
            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);
        }
    });

    redecodeHandler = new Handler();
    redecodeRunnable = new RedecodeRunnable(this);
}

From source file:com.kuaichumen.whistle.admin.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Window window = getWindow();/* w ww  .j a  v  a 2  s. co m*/
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    getSupportActionBar().hide();
    CameraManager.init(getApplication());
    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);
    title = (TextView) findViewById(R.id.title);
    flashLight = (LinearLayout) findViewById(R.id.flash_light);
    ll_back = (LinearLayout) findViewById(R.id.ll_back);
    flash = (ImageView) findViewById(R.id.flash);
    flashLight.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            light();
        }
    });
    ll_back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    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);
    EventBus.getDefault().register(this);
    InitData();
}

From source file:com.dtr.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Window window = getWindow();//  w  ww  . java  2 s  .  c  o  m
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_qr_scan);

    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);
    mFlash = (ImageView) findViewById(R.id.capture_flash);
    mFlash.setOnClickListener(this);

    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);
}