/**
* 用于启动照相机扫描二维码,在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);
}
java类android.view.animation.TranslateAnimation的实例源码
ScanManager.java 文件源码
项目:ForeverLibrary
阅读 33
收藏 0
点赞 0
评论 0
ScanManager.java 文件源码
项目:anyRTC-RTCP-Android
阅读 33
收藏 0
点赞 0
评论 0
/**
* 用于启动照相机扫描二维码,在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);
}
Circle8YMenu.java 文件源码
项目:YMenuView
阅读 35
收藏 0
点赞 0
评论 0
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//为不同的Option设置延时
if (index % 2 == 0) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
EasyRecyclerView.java 文件源码
项目:GitHub
阅读 33
收藏 0
点赞 0
评论 0
public void showTipViewAndDelayClose(String tip) {
tipView.setText(tip);
Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(500);
tipView.startAnimation(mShowAction);
tipView.setVisibility(View.VISIBLE);
tipView.postDelayed(new Runnable() {
@Override
public void run() {
Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f);
mHiddenAction.setDuration(500);
tipView.startAnimation(mHiddenAction);
tipView.setVisibility(View.GONE);
}
}, 2200);
}
UltimateRecyclerView.java 文件源码
项目:GitHub
阅读 37
收藏 0
点赞 0
评论 0
/**
* Translates the adapter in Y
*
* @param of offset in px
*/
public void translateHeader(float of) {
float ofCalculated = of * mScrollMultiplier;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && of < mHeader.getHeight()) {
mHeader.setTranslationY(ofCalculated);
} else if (of < mHeader.getHeight()) {
TranslateAnimation anim = new TranslateAnimation(0, 0, ofCalculated, ofCalculated);
anim.setFillAfter(true);
anim.setDuration(0);
mHeader.startAnimation(anim);
}
mHeader.setClipY(Math.round(ofCalculated));
if (mParallaxScroll != null) {
final RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(0);
float left;
if (holder != null) {
left = Math.min(1, ((ofCalculated) / (mHeader.getHeight() * mScrollMultiplier)));
}else {
left = 1;
}
mParallaxScroll.onParallaxScroll(left, of, mHeader);
}
}
ScannerOverlayView.java 文件源码
项目:fingerblox
阅读 32
收藏 0
点赞 0
评论 0
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);
}
AnimUtil.java 文件源码
项目:RLibrary
阅读 36
收藏 0
点赞 0
评论 0
/**
* 结束时的动画 平移到底部
*/
public static Animation translateAlphaFinishAnimation() {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
setDefaultConfig(translateAnimation, true);
setDefaultConfig(alphaAnimation, true);
translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
CaptureActivity.java 文件源码
项目:Espresso
阅读 38
收藏 0
点赞 0
评论 0
@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);
}
FeedBackAnimFragment.java 文件源码
项目:letv
阅读 33
收藏 0
点赞 0
评论 0
private void startAnim(View widget) {
int distance = widget.getHeight();
widget.setVisibility(0);
this.mFloatLayout.setVisibility(0);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
alphaAnimation.setDuration(200);
alphaAnimation.setStartOffset(200);
this.mFloatLayout.setAnimation(alphaAnimation);
this.mAnimation = new TranslateAnimation(0.0f, 0.0f, (float) distance, 0.0f);
this.mAnimation.setDuration(200);
this.mAnimation.setStartOffset(200);
widget.setAnimation(this.mAnimation);
this.mAnimation.start();
alphaAnimation.start();
}
UIIDialogImpl.java 文件源码
项目:RLibrary
阅读 31
收藏 0
点赞 0
评论 0
/**
* 对话框的布局动画
*/
@Override
public Animation loadLayoutAnimation() {
if (layoutAnim) {
if (layoutAnimation == null) {
TranslateAnimation translateAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0f, Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 1f, Animation.RELATIVE_TO_PARENT, 0f);
setDefaultConfig(translateAnimation, false);
translateAnimation.setDuration(160);
return translateAnimation;
} else {
return layoutAnimation;
}
}
return null;
}
MicrophoneRecorderView.java 文件源码
项目:PeSanKita-android
阅读 32
收藏 0
点赞 0
评论 0
public void display(float x) {
this.startPositionX = x;
this.lastPositionX = x;
recordButtonFab.setVisibility(View.VISIBLE);
float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f));
animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
Animation.RELATIVE_TO_SELF, .5f,
Animation.RELATIVE_TO_SELF, .5f));
animation.setFillBefore(true);
animation.setFillAfter(true);
animation.setDuration(ANIMATION_DURATION);
animation.setInterpolator(new OvershootInterpolator());
recordButtonFab.startAnimation(animation);
}
MicrophoneRecorderView.java 文件源码
项目:PeSanKita-android
阅读 26
收藏 0
点赞 0
评论 0
public void moveTo(float x) {
this.lastPositionX = x;
float offset = getOffset(x);
int widthAdjustment = getWidthAdjustment();
Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, widthAdjustment + offset,
Animation.ABSOLUTE, widthAdjustment + offset,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f);
translateAnimation.setDuration(0);
translateAnimation.setFillAfter(true);
translateAnimation.setFillBefore(true);
recordButtonFab.startAnimation(translateAnimation);
}
CaptureActivity.java 文件源码
项目:LuaViewPlayground
阅读 34
收藏 0
点赞 0
评论 0
@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);
}
SegmentController.java 文件源码
项目:PDialogs-Android
阅读 25
收藏 0
点赞 0
评论 0
private void adjustSizes(boolean isAnimated) {
int width = getWidth();
if (width > 0 && this.items != null) {
LayoutParams viewLayoutParams = (LayoutParams) this.currentView.getLayoutParams();
viewLayoutParams.width = width / this.items.length;
this.currentView.setLayoutParams(viewLayoutParams);
if (!this.inAnimation) {
if (isAnimated) {
this.inAnimation = true;
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, this.currentIndex - this.lastIndex, 0, 0, 0, 0);
animation.setDuration(300);
animation.setAnimationListener(this);
this.currentView.startAnimation(animation);
return;
}
viewLayoutParams.leftMargin = this.currentIndex * viewLayoutParams.width;
this.currentView.setLayoutParams(viewLayoutParams);
}
}
}
SpringScrollView.java 文件源码
项目:BilibiliClient
阅读 31
收藏 0
点赞 0
评论 0
/**
* 将内容布局移动到原位置 可以在UP事件中调用, 也可以在其他需要的地方调用, 如手指移动到当前ScrollView外时
*/
private void boundBack() {
if (!isMoved) {
return; // 如果没有移动布局, 则跳过执行
}
// 开启动画
TranslateAnimation anim = new TranslateAnimation(0, 0, contentView.getTop(), originalRect.top);
anim.setDuration(ANIM_TIME);
contentView.startAnimation(anim);
// 设置回到正常的布局位置
contentView.layout(originalRect.left, originalRect.top, originalRect.right,
originalRect.bottom);
// 将标志位设回false
canPullDown = false;
canPullUp = false;
isMoved = false;
}
SpringScrollView.java 文件源码
项目:BilibiliClient
阅读 35
收藏 0
点赞 0
评论 0
/**
* 将内容布局移动到原位置 可以在UP事件中调用, 也可以在其他需要的地方调用, 如手指移动到当前ScrollView外时
*/
private void boundBack() {
if (!isMoved) {
return; // 如果没有移动布局, 则跳过执行
}
// 开启动画
TranslateAnimation anim = new TranslateAnimation(0, 0, contentView.getTop(), originalRect.top);
anim.setDuration(ANIM_TIME);
contentView.startAnimation(anim);
// 设置回到正常的布局位置
contentView.layout(originalRect.left, originalRect.top, originalRect.right,
originalRect.bottom);
// 将标志位设回false
canPullDown = false;
canPullUp = false;
isMoved = false;
}
ParallaxRecyclerAdapter.java 文件源码
项目:Bailan
阅读 31
收藏 0
点赞 0
评论 0
/**
* Translates the adapter in Y
*
* @param of offset in px
*/
public void translateHeader(float of) {
float ofCalculated = of * mScrollMultiplier;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && of < mHeader.getHeight()) {
mHeader.setTranslationY(ofCalculated);
} else if (of < mHeader.getHeight()) {
TranslateAnimation anim = new TranslateAnimation(0, 0, ofCalculated, ofCalculated);
anim.setFillAfter(true);
anim.setDuration(0);
mHeader.startAnimation(anim);
}
mHeader.setClipY(Math.round(ofCalculated));
if (mParallaxScroll != null) {
final RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(0);
float left;
if (holder != null) {
left = Math.min(1, ((ofCalculated) / (mHeader.getHeight() * mScrollMultiplier)));
}else {
left = 1;
}
mParallaxScroll.onParallaxScroll(left, of, mHeader);
}
}
PullRecyclerViewGroup.java 文件源码
项目:Bailan
阅读 26
收藏 0
点赞 0
评论 0
/**
* 位置还原
*/
private void recoverLayout() {
if (!isMoved) {
return;//如果没有移动布局,则跳过执行
}
for (int i = 0; i < mMoveViews.size(); i++) {
if (mMoveRects.get(i) != null) {
TranslateAnimation anims = new TranslateAnimation(0, 0, mMoveViews.get(i).getTop(), mMoveRects.get(i).top);
anims.setDuration(ANIM_TIME);
mMoveViews.get(i).startAnimation(anims);
mMoveViews.get(i).layout(mMoveRects.get(i).left, mMoveRects.get(i).top, mMoveRects.get(i).right, mMoveRects.get(i).bottom);
}
}
TranslateAnimation anim = new TranslateAnimation(0, 0, childView.getTop() - originalRect.top, 0);
anim.setDuration(ANIM_TIME);
childView.startAnimation(anim);
childView.layout(originalRect.left, originalRect.top, originalRect.right, originalRect.bottom);
isMoved = false;
}
Chess.java 文件源码
项目:gamecollection
阅读 26
收藏 0
点赞 0
评论 0
private boolean animatefigure(final Tuple<Integer, Integer> from, final Tuple<Integer, Integer> to, int speed) {
if (figuren[from.first][from.last] != null) {
Point rectFrom = chessboardView.getRectangleCoordinates(from);
Point rectTo = chessboardView.getRectangleCoordinates(to);
int deltaX = rectTo.x - rectFrom.x;
int deltaY = rectTo.y - rectFrom.y;
TranslateAnimation translateAnimation = new TranslateAnimation(0, deltaX, 0, deltaY);
translateAnimation.setDuration(speed);
translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
translateAnimation.setAnimationListener(new AnimationEndListener() {
@Override
public void onAnimationEnd(Animation animation) {
update();
if (aiGame && !board.isWhitesTurn()) {
aimove();
} else {
stateAllowClick = true;
}
}
});
figuren[from.first][from.last].startAnimation(translateAnimation);
return true;
}
return false;
}
QMUIBottomSheet.java 文件源码
项目:qmui
阅读 32
收藏 0
点赞 0
评论 0
/**
* BottomSheet升起动画
*/
private void animateUp() {
if (mContentView == null) {
return;
}
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet set = new AnimationSet(true);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setInterpolator(new DecelerateInterpolator());
set.setDuration(mAnimationDuration);
set.setFillAfter(true);
mContentView.startAnimation(set);
}
AnimationService.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 36
收藏 0
点赞 0
评论 0
public static void setActivityToolbarReset(Toolbar aMainToolbar, Toolbar aDecorativeToolbar, Activity aActivity, float fromToolbarPosition, float fromMainToolbarPosition) {
final int TOOLBAR_TRANSLATION_DURATION = 700;
float DECORATIVE_TOOLBAR_HEIGHT = -1 * aActivity.getResources().getDimension(R.dimen.additional_toolbar_height);
if(fromMainToolbarPosition == 0) {
DECORATIVE_TOOLBAR_HEIGHT += aActivity.getResources().getDimension(R.dimen.main_toolbar_height);
} else {
Animation moveMainToolbarAnimation = new TranslateAnimation(0, 0, fromMainToolbarPosition, 0);
moveMainToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveMainToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aMainToolbar.startAnimation(moveMainToolbarAnimation);
}
float fromTranslationY = (fromToolbarPosition < DECORATIVE_TOOLBAR_HEIGHT) ? DECORATIVE_TOOLBAR_HEIGHT : fromToolbarPosition;
Animation moveToolbarAnimation = new TranslateAnimation(0, 0, fromTranslationY, 0);
moveToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);
aDecorativeToolbar.startAnimation(moveToolbarAnimation);
}
EasyRecyclerView.java 文件源码
项目:TextReader
阅读 41
收藏 0
点赞 0
评论 0
public void showTipViewAndDelayClose(String tip) {
tipView.setText(tip);
Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(500);
tipView.startAnimation(mShowAction);
tipView.setVisibility(View.VISIBLE);
tipView.postDelayed(new Runnable() {
@Override
public void run() {
Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f);
mHiddenAction.setDuration(500);
tipView.startAnimation(mHiddenAction);
tipView.setVisibility(View.GONE);
}
}, 2200);
}
MicrophoneRecorderView.java 文件源码
项目:Cable-Android
阅读 35
收藏 0
点赞 0
评论 0
public void display(float x) {
this.startPositionX = x;
this.lastPositionX = x;
recordButtonFab.setVisibility(View.VISIBLE);
float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f));
animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
Animation.RELATIVE_TO_SELF, .5f,
Animation.RELATIVE_TO_SELF, .5f));
animation.setFillBefore(true);
animation.setFillAfter(true);
animation.setDuration(ANIMATION_DURATION);
animation.setInterpolator(new OvershootInterpolator());
recordButtonFab.startAnimation(animation);
}
MainActivity.java 文件源码
项目:JewelryUI
阅读 24
收藏 0
点赞 0
评论 0
private void slideInUp(View view, Animation.AnimationListener animationListener) {
AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
TranslateAnimation transIn = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);
final AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(fadeIn);
animationSet.addAnimation(transIn);
animationSet.setDuration(200);
if (animationListener != null) {
animationSet.setAnimationListener(animationListener);
}
view.setVisibility(View.VISIBLE);
view.clearAnimation();
view.startAnimation(animationSet);
}
PullDownListview.java 文件源码
项目:HiBangClient
阅读 28
收藏 0
点赞 0
评论 0
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int act = event.getAction();
if ((act == MotionEvent.ACTION_UP || act == MotionEvent.ACTION_CANCEL)
&& outBound) {
outBound = false;
// scroll back
}
if (!lisGestureDetector.onTouchEvent(event)) {
outBound = false;
} else {
outBound = true;
}
Rect rect = new Rect();
getLocalVisibleRect(rect);
TranslateAnimation am = new TranslateAnimation( 0, 0, -rect.top, 0);
am.setDuration(300);
startAnimation(am);
scrollTo(0, 0);
return super.dispatchTouchEvent(event);
}
MyScrollView.java 文件源码
项目:OpenEyesReading-android
阅读 31
收藏 0
点赞 0
评论 0
/***
* 回缩动画
*/
public void animation() {
TranslateAnimation taa = new TranslateAnimation(0, 0, top + 200, initTop + 200);
taa.setDuration(200);
imageView.startAnimation(taa);
imageView.layout(imageView.getLeft(), initTop, imageView.getRight(), initbottom);
// 开启移动动画
TranslateAnimation ta = new TranslateAnimation(0, 0, inner.getTop(), normal.top);
ta.setDuration(200);
inner.startAnimation(ta);
// 设置回到正常的布局位置
inner.layout(normal.left, normal.top, normal.right, normal.bottom);
normal.setEmpty();
/** line **/
TranslateAnimation taaa = new TranslateAnimation(0, 0, line.getTop(), init_line_bottom);
ta.setDuration(200);
line.startAnimation(ta);
line.layout(line.getLeft(), line.getTop(), line.getRight(), init_line_bottom);
isCount = false;
y = 0;// 手指松开要归0.
/** 动画执行 **/
if (top > -150)
turnListener.onTurn();
}
CaptureActivity.java 文件源码
项目:SmartButler
阅读 42
收藏 0
点赞 0
评论 0
@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);
}
EasyRecyclerView.java 文件源码
项目:GitHub
阅读 32
收藏 0
点赞 0
评论 0
public void showTipView(String tip) {
tipView.setText(tip);
Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(500);
tipView.startAnimation(mShowAction);
tipView.setVisibility(View.VISIBLE);
}
EasyRecyclerView.java 文件源码
项目:GitHub
阅读 35
收藏 0
点赞 0
评论 0
public void hideTipView(long delayMillis) {
tipView.postDelayed(new Runnable() {
@Override
public void run() {
Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
-1.0f);
mHiddenAction.setDuration(500);
tipView.startAnimation(mHiddenAction);
tipView.setVisibility(View.GONE);
}
}, delayMillis);
}
SubjectBookListActivity.java 文件源码
项目:GitHub
阅读 38
收藏 0
点赞 0
评论 0
private void showTagGroup() {
if (mTagList.isEmpty()) {
ToastUtils.showToast(getString(R.string.network_error_tips));
return;
}
Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(400);
rsvTags.startAnimation(mShowAction);
rsvTags.setVisibility(View.VISIBLE);
}