當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。