public void open() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
java类android.view.animation.Animation的实例源码
ExpandButtonLayout.java 文件源码
项目:ExpandButton
阅读 34
收藏 0
点赞 0
评论 0
HBButton.java 文件源码
项目:Hamburger-Button
阅读 37
收藏 0
点赞 0
评论 0
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {
final float currentLeft = rectF.left;
final float currentRight = rectF.right;
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
} else {
rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration());
animation.setStartOffset(offset);
return animation;
}
UILayoutImpl.java 文件源码
项目:RLibrary
阅读 35
收藏 0
点赞 0
评论 0
/**
* 销毁对话框的动画
*/
private void finishDialogAnim(final ViewPattern dialogPattern, final Animation animation, final Runnable end) {
/*是否变暗*/
if (dialogPattern.mIView.isDimBehind()) {
AnimUtil.startArgb(dialogPattern.mIView.getDialogDimView(),
dialogPattern.mIView.getDimColor(), Color.TRANSPARENT, DEFAULT_ANIM_TIME);
}
final View animView = dialogPattern.mIView.getAnimView();
final Runnable endRunnable = new Runnable() {
@Override
public void run() {
dialogPattern.mView.setAlpha(0);
dialogPattern.mView.setVisibility(INVISIBLE);
end.run();
}
};
safeStartAnim(animView, animation, endRunnable, true);
}
LockActivity.java 文件源码
项目:AppLocker
阅读 36
收藏 0
点赞 0
评论 0
protected void onPasscodeError() {
Encryptor.snackPeak(mActivity,getString(R.string.passcode_wrong));
Thread thread = new Thread() {
public void run() {
Animation animation = AnimationUtils.loadAnimation(
LockActivity.this, R.anim.shake);
findViewById(R.id.ll_applock).startAnimation(animation);
codeField1.setText("");
codeField2.setText("");
codeField3.setText("");
codeField4.setText("");
codeField1.requestFocus();
}
};
runOnUiThread(thread);
}
ExpandableLayout.java 文件源码
项目:boohee_v5.6
阅读 27
收藏 0
点赞 0
评论 0
private void expand(final View v) {
v.measure(-1, -2);
final int targetHeight = v.getMeasuredHeight();
v.getLayoutParams().height = 0;
v.setVisibility(0);
this.animation = new Animation() {
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1.0f) {
ExpandableLayout.this.isOpened = Boolean.valueOf(true);
}
v.getLayoutParams().height = interpolatedTime == 1.0f ? -2 : (int) (((float)
targetHeight) * interpolatedTime);
v.requestLayout();
}
public boolean willChangeBounds() {
return true;
}
};
this.animation.setDuration((long) this.duration.intValue());
v.startAnimation(this.animation);
}
ChatSDKMessagesListAdapter.java 文件源码
项目:AndroidBackendlessChat
阅读 49
收藏 0
点赞 0
评论 0
/**
* Animating the sides of the row, For example animating the user profile image and the message date.
* */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
if (!isScrolling)
return;
if (fromLeft)
view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));
view.getAnimation().setAnimationListener(animationListener);
view.animate();
}
FloatingActionButtonEclairMr1.java 文件源码
项目:boohee_v5.6
阅读 36
收藏 0
点赞 0
评论 0
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
if (this.mView.getVisibility() != 0 || this.mIsHiding) {
this.mView.clearAnimation();
this.mView.internalSetVisibility(0, fromUser);
Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
anim.setDuration(200);
anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
anim.setAnimationListener(new AnimationListenerAdapter() {
public void onAnimationEnd(Animation animation) {
if (listener != null) {
listener.onShown();
}
}
});
this.mView.startAnimation(anim);
} else if (listener != null) {
listener.onShown();
}
}
CustomRefreshLayout2.java 文件源码
项目:BrotherWeather
阅读 36
收藏 0
点赞 0
评论 0
private void startLoadingAnimation(ImageView imageView) {
RotateAnimation loadingAnimation =
new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
loadingAnimation.setDuration(1000);
loadingAnimation.setRepeatCount(-1);
loadingAnimation.setInterpolator(new LinearInterpolator());
imageView.setAnimation(loadingAnimation);
loadingAnimation.start();
}
SwipeRefreshLayout.java 文件源码
项目:GeekZone
阅读 56
收藏 0
点赞 0
评论 0
private void startScaleUpAnimation(AnimationListener listener) {
mCircleView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
// Pre API 11, alpha is used in place of scale up to show the
// progress circle appearing.
// Don't adjust the alpha during appearance otherwise.
mProgress.setAlpha(MAX_ALPHA);
}
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
if (listener != null) {
mCircleView.setAnimationListener(listener);
}
mCircleView.clearAnimation();
mCircleView.startAnimation(mScaleAnimation);
}
RotateLoadingLayout.java 文件源码
项目:ywApplication
阅读 29
收藏 0
点赞 0
评论 0
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
super(context, mode, scrollDirection, attrs);
mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
mHeaderImage.setScaleType(ScaleType.MATRIX);
mHeaderImageMatrix = new Matrix();
mHeaderImage.setImageMatrix(mHeaderImageMatrix);
mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
mRotateAnimation.setRepeatCount(Animation.INFINITE);
mRotateAnimation.setRepeatMode(Animation.RESTART);
}
ExpandTextView.java 文件源码
项目:Aurora
阅读 41
收藏 0
点赞 0
评论 0
public void expand() {
if (!isExpand) {
isExpand = true;
mText.setTextColor(Color.TRANSPARENT);
mExpandText.setTextColor(mTextColor);
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
setLayoutParams(params);
}
};
animation.setDuration(500);
startAnimation(animation);
}
}
RefreshViewHeader.java 文件源码
项目:iReading
阅读 36
收藏 0
点赞 0
评论 0
private void initView(Context context) {
mContent = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.rfv_header, this);
imgDirectionArrow = (ImageView) findViewById(R.id.imgDirectionArrow);
tvRefreshState = (TextView) findViewById(R.id.tvRefreshState);
tvLastRefreshTime = (TextView) findViewById(R.id.tvLastRefreshTime);
mProgressBar = (ProgressBar) findViewById(R.id.rfv_header_progressbar);
mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
}
WelcomeActivity.java 文件源码
项目:Pocket-Plays-for-Twitch
阅读 34
收藏 0
点赞 0
评论 0
private AnimationSet startShowContinueIconAnimations() {
Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
Animation mRotateAnimation = new RotateAnimation(
0, 360,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
);
mRotateAnimation.setRepeatCount(0);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
mAnimations.setFillAfter(true);
mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
mAnimations.addAnimation(mScaleAnimation);
mAnimations.addAnimation(mRotateAnimation);
mContinueIcon.startAnimation(mAnimations);
return mAnimations;
}
View10.java 文件源码
项目:PlusGram
阅读 39
收藏 0
点赞 0
评论 0
public static View10 wrap(View view) {
View10 proxy = PROXIES.get(view);
Animation animation = view.getAnimation();
if (proxy == null || proxy != animation && animation != null) {
proxy = new View10(view);
PROXIES.put(view, proxy);
} else if (animation == null) {
view.setAnimation(proxy);
}
return proxy;
}
Utils.java 文件源码
项目:betterHotels
阅读 36
收藏 0
点赞 0
评论 0
public static void animationIn(final View view, final int animation, int delayTime, final Context context) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Animation inAnimation = AnimationUtils.loadAnimation(
context.getApplicationContext(), animation);
view.setAnimation(inAnimation);
view.setVisibility(View.VISIBLE);
}
}, delayTime);
}
SwipeToRefreshLayout.java 文件源码
项目:AndroidOpen
阅读 36
收藏 0
点赞 0
评论 0
private void startScaleUpAnimation(Animation.AnimationListener listener) {
mLoadingView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
mProgress.setAlpha(255);
}
Animation mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
if (listener != null) {
mLoadingView.setAnimationListener(listener);
}
mLoadingView.clearAnimation();
mLoadingView.startAnimation(mScaleAnimation);
}
MainActivity.java 文件源码
项目:secretknock
阅读 25
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
editor = sharedPreferences.edit();
an = new RotateAnimation(0.0f,
360.0f,Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF,
0.5f);
// Set the animation's parameters
an.setInterpolator(new LinearInterpolator());
an.setDuration(7000); // duration in ms
an.setRepeatCount(-1); // -1 = infinite repeated
}
QMUIBottomSheet.java 文件源码
项目:QMUI_Android
阅读 38
收藏 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);
}
QMUIBottomSheet.java 文件源码
项目:qmui
阅读 34
收藏 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);
}
SwipeRefreshLayout.java 文件源码
项目:android-source-codes
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void onAnimationEnd(Animation animation) {
if (mRefreshing) {
// Make sure the progress view is fully visible
mProgress.setAlpha(MAX_ALPHA);
mProgress.start();
if (mNotify) {
if (mListener != null) {
mListener.onRefresh();
}
}
mCurrentTargetOffsetTop = mCircleView.getTop();
} else {
reset();
}
}
TransactionDelegate.java 文件源码
项目:XinFramework
阅读 35
收藏 0
点赞 0
评论 0
private void mockStartWithPopAnim(ISupportFragment from, ISupportFragment to, final Animation exitAnim) {
Fragment fromF = (Fragment) from;
final ViewGroup container = findContainerById(fromF, from.getSupportDelegate().mContainerId);
if (container == null) return;
from.getSupportDelegate().mLockAnim = true;
View fromView = fromF.getView();
container.removeViewInLayout(fromView);
final ViewGroup mock = addMockView(fromView, container);
to.getSupportDelegate().mEnterAnimListener = new SupportFragmentDelegate.EnterAnimListener() {
@Override
public void onEnterAnimStart() {
mock.startAnimation(exitAnim);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
container.removeView(mock);
}
}, exitAnim.getDuration() + BUFFER_TIME);
}
};
}
SuperSwipeRefreshLayout.java 文件源码
项目:LuaViewPlayground
阅读 40
收藏 0
点赞 0
评论 0
private void startScaleUpAnimation(AnimationListener listener) {
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime,
Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
if (listener != null) {
mHeadViewContainer.setAnimationListener(listener);
}
mHeadViewContainer.clearAnimation();
mHeadViewContainer.startAnimation(mScaleAnimation);
}
CodeDialog.java 文件源码
项目:SunmiUI
阅读 27
收藏 0
点赞 0
评论 0
public void showLoad() {
isReq = true;
load.setVisibility(View.VISIBLE);
clear.setVisibility(View.GONE);
Animation operatingAnim = AnimationUtils.loadAnimation(dialog.getContext(), R.anim.loading_anim);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
load.setAnimation(operatingAnim);
load.startAnimation(operatingAnim);
}
WelcomeSnowActy.java 文件源码
项目:QMark
阅读 34
收藏 0
点赞 0
评论 0
private ScaleAnimation randomScale() {
float scaleTo = (float) (0.3f + Math.random() * 0.5f);
ScaleAnimation scale = new ScaleAnimation(1, scaleTo, 1, scaleTo, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scale.setRepeatCount(Animation.INFINITE);
scale.setRepeatMode(Animation.REVERSE);
scale.setStartOffset(1000);
scale.setDuration((int) (Math.random() * 3000) + 1000);
return scale;
}
RayLayout.java 文件源码
项目:FLFloatingButton
阅读 29
收藏 0
点赞 0
评论 0
private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
animation.setStartOffset(startOffset);
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setFillAfter(true);
return animation;
}
ActionSheet.java 文件源码
项目:ForeverLibrary
阅读 37
收藏 0
点赞 0
评论 0
private Animation createTranslationOutAnimation() {
int type = TranslateAnimation.RELATIVE_TO_SELF;
TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type, 0, type, 1);
an.setDuration(TRANSLATE_DURATION);
an.setFillAfter(true);
return an;
}
AnimUtil.java 文件源码
项目:RLibrary
阅读 46
收藏 0
点赞 0
评论 0
/**
* 应用一个布局动画
*/
public static void applyLayoutAnimation(final ViewGroup viewGroup) {
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f, Animation.RELATIVE_TO_PARENT, 0f);
translateAnimation.setDuration(300);
applyLayoutAnimation(viewGroup, translateAnimation);
}
ViewAnimationUtils.java 文件源码
项目:android-mvvm-architecture
阅读 34
收藏 0
点赞 0
评论 0
public static void scaleAnimateView(View view) {
ScaleAnimation animation =
new ScaleAnimation(
1.15f, 1, 1.15f, 1,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
view.setAnimation(animation);
animation.setDuration(100);
animation.start();
}
MainActivity.java 文件源码
项目:iBeaconReader
阅读 26
收藏 0
点赞 0
评论 0
public void Evt(long number) {
Animation Animation = AnimationUtils.loadAnimation(this, R.anim.shake);
imageView.startAnimation(Animation);
Intent goToApp = new Intent(MainActivity.this, BeaconActivity.class);
// Create the AlertDialog for failed authentication
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage(R.string.fail)
.setNegativeButton(R.string.retry, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
Dialog auth_error = builder.create();
// Check if Izly card is authorized and passing tech id as parameter
boolean go = true;
if (number == -1971634176) {
goToApp.putExtra("tech", 1);
} else if (number == -2106576896) {
goToApp.putExtra("tech", 2);
} else {
go = false;
}
// Launch iBeacon activity or show error dialog
if(go){
startActivity(goToApp);
} else {
auth_error.show();
}
}
GestureRefreshLayout.java 文件源码
项目:gesture-refresh-layout
阅读 36
收藏 0
点赞 0
评论 0
private void startScaleDownAnimation(Animation.AnimationListener listener) {
mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
}
};
mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
mScaleDownAnimation.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleDownAnimation);
}