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


Java TranslateAnimation.setRepeatMode方法代码示例

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


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

示例1: ScanManager

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
 * 用于启动照相机扫描二维码,在activity的onCreate里面构造出来
 * 在activity的生命周期中调用此类相对应的生命周期方法
 *
 * @param activity      扫描的activity
 * @param scanPreview   预览的SurfaceView
 * @param scanContainer 扫描的布局,全屏布局
 * @param scanCropView  扫描的矩形区域
 * @param scanLine      扫描线
 */
public ScanManager(Activity activity, SurfaceView scanPreview, View scanContainer,
                   View scanCropView, ImageView scanLine, int scanMode, ScanListener listener) {
    this.activity = activity;
    this.scanPreview = scanPreview;
    this.scanContainer = scanContainer;
    this.scanCropView = scanCropView;
    this.scanLine = scanLine;
    this.listener = listener;
    this.scanMode = scanMode;
    //启动动画
    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);

}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:29,代码来源:ScanManager.java

示例2: ScanManager

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
 * 用于启动照相机扫描二维码,在activity的onCreate里面构造出来
 * 在activity的生命周期中调用此类相对应的生命周期方法
 * @param activity   扫描的activity
 * @param scanPreview  预览的SurfaceView
 * @param scanContainer  扫描的布局,全屏布局
 * @param scanCropView  扫描的矩形区域
 * @param scanLine  扫描线
 * 
 * 
 */
public ScanManager(Activity activity, SurfaceView scanPreview, View scanContainer,
                      View scanCropView, ImageView scanLine, int scanMode, ScanListener listener) {
	this.activity=activity;
	this.scanPreview=scanPreview;
	this.scanContainer=scanContainer;
	this.scanCropView=scanCropView;
	this.scanLine=scanLine;
	this.listener=listener;
	this.scanMode=scanMode;
	//启动动画
	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);
	
}
 
开发者ID:AnyRTC,项目名称:anyRTC-RTCP-Android,代码行数:30,代码来源:ScanManager.java

示例3: onCreate

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);

    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);
}
 
开发者ID:Hultron,项目名称:LifeHelper,代码行数:25,代码来源:CaptureActivity.java

示例4: initAnimation

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void initAnimation() {
    paint.setStrokeWidth(getHeight() * 0.01f);
    paint.setAntiAlias(true);
    paint.setDither(true);
    paint.setColor(Color.argb(248, 255, 255, 255));
    paint.setStrokeWidth(20f);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);

    paintGlow.set(paint);
    paintGlow.setColor(Color.argb(235, 74, 138, 255));
    paintGlow.setStrokeWidth(30f);
    paintGlow.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.NORMAL));

    float deltaY = (CameraOverlayView.PADDING * 2) * getHeight();
    Log.i(TAG, String.format("Delta Y : %s", deltaY));

    TranslateAnimation mAnimation = new TranslateAnimation(0f, 0f, 0f, deltaY);
    mAnimation.setDuration(3000);
    mAnimation.setRepeatCount(-1);
    mAnimation.setRepeatMode(Animation.REVERSE);
    mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    setAnimation(mAnimation);
}
 
开发者ID:jorenham,项目名称:fingerblox,代码行数:26,代码来源:ScannerOverlayView.java

示例5: onCreate

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_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);

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

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:28,代码来源:CaptureActivity.java

示例6: onCreate

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
	super.onCreate(icicle);
	Window window = getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_capture);

	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);
	
	findViewById(R.id.capture_flashlight).setOnClickListener(this);
	findViewById(R.id.capture_scan_photo).setOnClickListener(this);
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:26,代码来源:CaptureActivity.java

示例7: initAnimations

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void initAnimations() {
    searchAnimation = ValueAnimator.ofFloat(0f, 1f);
    searchAnimation.setDuration(50000);
    searchAnimation.setRepeatCount(ValueAnimator.INFINITE);
    searchAnimation.setRepeatMode(ValueAnimator.RESTART);
    searchAnimation.setInterpolator(new LinearInterpolator());
    searchAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float angle = (valueAnimator.getAnimatedFraction() * 360);
            ViewHelper.setTranslationX(ivSearch, (float) Math.sin(angle) * radius);
            ViewHelper.setTranslationY(ivSearch, (float) Math.cos(angle) * radius);
        }
    });


    scanAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.61f);
    scanAnimation.setDuration(2000);
    scanAnimation.setRepeatCount(TranslateAnimation.INFINITE);
    scanAnimation.setRepeatMode(TranslateAnimation.RESTART);
}
 
开发者ID:piyell,项目名称:NeteaseCloudMusic,代码行数:22,代码来源:ScanMusicActivity.java

示例8: initCamera

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void initCamera() {
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    ImageView 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);

    cameraManager = new CameraManager(getApplication());
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:23,代码来源:CaptureActivity.java

示例9: randomTranslateX

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private TranslateAnimation randomTranslateX() {
	TranslateAnimation trans = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, (float) ((Math.random() > 0.5f ? 1 : -1) * Math.random()),
			Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);
	trans.setInterpolator(this, android.R.anim.accelerate_decelerate_interpolator);
	trans.setRepeatCount(Animation.INFINITE);
	trans.setRepeatMode(Animation.REVERSE);
	trans.setStartOffset(0);
	trans.setDuration((int) (Math.random() * 2000 + 1000));
	return trans;
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:11,代码来源:WelcomeSnowActy.java

示例10: initCamera

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void initCamera() {
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    ImageView scanLine = (ImageView) findViewById(R.id.capture_scan_line);
    mFlash = (ImageView) findViewById(R.id.capture_flash);
    mFlash.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            light();
        }
    });

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

    cameraManager = new CameraManager(getApplication());
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:28,代码来源:CaptureActivity.java

示例11: translateYYAnimation

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
 * 上下移动的循环动画
 */
public static Animation translateYYAnimation(float toYValue) {
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, toYValue);
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setDuration(300);
    return animation;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:13,代码来源:AnimUtil.java

示例12: shakeView

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
 * 抖动IView
 */
public void shakeView() {
    if (mRootView == null) {
        return;
    }

    AnimationSet animationSet = new AnimationSet(true);
    float fx, tx;
    float fy, ty;

    long millis = System.currentTimeMillis();
    if (millis / 1000 % 2 == 0) {
        fx = -.02f;
        tx = .02f;

    } else {
        fx = .02f;
        tx = -.02f;
    }
    fy = tx;
    ty = fx;

    TranslateAnimation translateAnimationX = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, fx, Animation.RELATIVE_TO_SELF, tx,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f);
    translateAnimationX.setInterpolator(new CycleInterpolator(1f));
    translateAnimationX.setRepeatCount(2);
    translateAnimationX.setRepeatMode(Animation.REVERSE);
    translateAnimationX.setDuration(160);
    translateAnimationX.setFillAfter(false);
    //translateAnimation.start();
    TranslateAnimation translateAnimationY = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, fy, Animation.RELATIVE_TO_SELF, ty);
    translateAnimationY.setInterpolator(new CycleInterpolator(1f));
    translateAnimationY.setRepeatCount(2);
    translateAnimationY.setRepeatMode(Animation.REVERSE);
    translateAnimationY.setDuration(160);
    translateAnimationY.setFillAfter(false);

    //L.e("call: shakeView([])-> fx:" + fx + " fy:" + fy + " tx:" + tx + " ty:" + ty);

    animationSet.addAnimation(translateAnimationX);
    animationSet.addAnimation(translateAnimationY);

    mRootView.startAnimation(animationSet);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:50,代码来源:UIBaseView.java


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