本文整理汇总了Java中android.view.animation.AnimationUtils类的典型用法代码示例。如果您正苦于以下问题:Java AnimationUtils类的具体用法?Java AnimationUtils怎么用?Java AnimationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnimationUtils类属于android.view.animation包,在下文中一共展示了AnimationUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRelease
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* Call when the object is released after being pulled.
* This will begin the "decay" phase of the effect. After calling this method
* the host view should {@link android.view.View#invalidate()} and thereby
* draw the results accordingly.
*/
public void onRelease() {
mPullDistance = 0;
if (mState != STATE_PULL && mState != STATE_PULL_DECAY) {
return;
}
mState = STATE_RECEDE;
mGlowAlphaStart = mGlowAlpha;
mGlowScaleYStart = mGlowScaleY;
mGlowAlphaFinish = 0.f;
mGlowScaleYFinish = 0.f;
mStartTime = AnimationUtils.currentAnimationTimeMillis();
mDuration = RECEDE_TIME;
}
示例2: startAnimations
import android.view.animation.AnimationUtils; //导入依赖的package包/类
public void startAnimations(){
Glide.with(this)
.load(getString(R.string.login_background_url))
.apply(new RequestOptions().centerCrop())
.transition(withCrossFade())
.into(background);
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.login_anim);
animation.start();
Animation animation2 = AnimationUtils.loadAnimation(getContext(), R.anim.login_card_anim);
animation2.start();
Animation animation3 = AnimationUtils.loadAnimation(getContext(), R.anim.login_text_anim);
animation3.start();
loginLogo.startAnimation(animation);
loginCard.startAnimation(animation2);
logoText.startAnimation(animation3);
}
示例3: onAbsorb
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* Call when the effect absorbs an impact at the given velocity.
* Used when a fling reaches the scroll boundary.
*
* <p>When using a {@link android.widget.Scroller} or {@link android.widget.OverScroller},
* the method <code>getCurrVelocity</code> will provide a reasonable approximation
* to use here.</p>
*
* @param velocity Velocity at impact in pixels per second.
*/
public void onAbsorb(int velocity) {
mState = STATE_ABSORB;
velocity = Math.min(Math.max(MIN_VELOCITY, Math.abs(velocity)), MAX_VELOCITY);
mStartTime = AnimationUtils.currentAnimationTimeMillis();
mDuration = 0.15f + (velocity * 0.02f);
// The glow depends more on the velocity, and therefore starts out
// nearly invisible.
mGlowAlphaStart = 0.3f;
mGlowScaleYStart = Math.max(mGlowScaleY, 0.f);
// Growth for the size of the glow should be quadratic to properly
// respond
// to a user's scrolling speed. The faster the scrolling speed, the more
// intense the effect should be for both the size and the saturation.
mGlowScaleYFinish = Math.min(0.025f + (velocity * (velocity / 100) * 0.00015f) / 2, 1.f);
// Alpha should change for the glow as well as size.
mGlowAlphaFinish = Math.max(
mGlowAlphaStart, Math.min(velocity * VELOCITY_GLOW_FACTOR * .00001f, MAX_ALPHA));
mTargetDisplacement = 0.5f;
}
示例4: doCircularExitAnimation
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* Circular reveal exit animation
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doCircularExitAnimation() {
final int revealRadius = (int) Math.hypot(getWidth(), getHeight());
Animator exitAnimator = ViewAnimationUtils.createCircularReveal(this,
mCenterX, mCenterY, revealRadius, 0f);
exitAnimator.setDuration(mAnimationDuration);
exitAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
android.R.interpolator.decelerate_cubic));
exitAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
removeView();
if (mAnimationListener != null) {
mAnimationListener.onExitAnimationEnd();
}
}
});
exitAnimator.start();
}
示例5: AnimatedImageButton
import android.view.animation.AnimationUtils; //导入依赖的package包/类
public AnimatedImageButton(Context context, AttributeSet attrs) {
super(context, attrs);
//get attributes from xml
TypedArray a = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.AnimatedImageButton,
0, 0);
try {
if(!a.hasValue(R.styleable.AnimatedImageButton_animation))
throw new RuntimeException("animation attribute missing from " + getClass().getSimpleName()
+ ". This attribute is mandatory.");
animation = AnimationUtils.loadAnimation(context, a.
getResourceId(R.styleable.AnimatedImageButton_animation, 0));
defaultRepeatCount = animation.getRepeatCount();
} finally {
a.recycle();
}
defaultRepeatCount = animation.getRepeatCount();
}
示例6: onPostExecute
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* Once the image is downloaded, associates it to the imageView
*/
@Override
protected void onPostExecute(Bitmap bitmap) {
if (isCancelled()) {
bitmap = null;
}
addBitmapToCache(position, bitmap);
if (imageViewReference != null) {
ImageView imageView = imageViewReference.get();
BitmapFetcherTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
if (this == bitmapDownloaderTask) {
imageView.setImageBitmap(bitmap);
Animation anim = AnimationUtils.loadAnimation(imageView.getContext(), android.R.anim.fade_in);
imageView.setAnimation(anim);
anim.start();
}
} else {
setInvisible();
}
}
示例7: animateIn
import android.view.animation.AnimationUtils; //导入依赖的package包/类
private void animateIn(FloatingActionButton button) {
button.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT >= 14) {
ViewCompat.animate(button)
.translationY(0)
.setInterpolator(INTERPOLATOR)
.withLayer()
.setListener(null)
.start();
} else {
Animation anim = AnimationUtils.loadAnimation(button.getContext(),
android.support.design.R.anim.design_fab_in);
anim.setDuration(200L);
anim.setInterpolator(INTERPOLATOR);
button.startAnimation(anim);
}
}
示例8: onWindowFocusChanged
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* 当窗口焦点改变时调用
*/
public void onWindowFocusChanged(boolean hasFocus) {
imageView = (ImageView) findViewById(R.id.spinnerImageView);
//此方法是用xml文件方式来实现动画效果
animation = AnimationUtils.loadAnimation(getContext(), R.anim.spinner);
//动画完成后,是否保留动画最后的状态,设为true
animation.setFillAfter(true);
if(animation!=null)
{
imageView.startAnimation(animation);
}
// 获取ImageView上的动画背景(此方法是用一组图片来达到动画效果)
// AnimationDrawable spinner = (AnimationDrawable) imageView.getBackground();
// // 开始动画
// spinner.start();
}
示例9: onImageLoaded
import android.view.animation.AnimationUtils; //导入依赖的package包/类
@Override
public void onImageLoaded(Bitmap bitmap, final ViewHolder holder) {
MemeData.Image dataImage = (MemeData.Image) holder.imageView.getTag();
Animation animation = AnimationUtils.loadAnimation(_activity, R.anim.fadeinfast);
holder.imageView.startAnimation(animation);
if (dataImage.isTemplate) {
holder.imageButtonFav.startAnimation(animation);
holder.imageButtonFav.setVisibility(View.VISIBLE);
}
if (_app.settings.isHidden(dataImage.fullPath.getAbsolutePath())) {
holder.imageButtonFav.setVisibility(View.INVISIBLE);
holder.imageView.setOnClickListener(null);
preparePopupMenu(holder);
}
holder.imageView.setImageBitmap(bitmap);
holder.imageView.setVisibility(View.VISIBLE);
}
示例10: animateSides
import android.view.animation.AnimationUtils; //导入依赖的package包/类
/**
* 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();
}
示例11: showStatusView
import android.view.animation.AnimationUtils; //导入依赖的package包/类
private void showStatusView(boolean loading) {
if (mStatusView == null) {
mStatusView = ((ViewStub) findViewById(R.id.view_stub)).inflate();
mStatusLoadingImg = (ImageView) mStatusView.findViewById(R.id.status_loading_img);
mStatusReloadBtn = (Button) mStatusView.findViewById(R.id.status_reload_button);
mStatusNoDataImg = (ImageView) mStatusView.findViewById(R.id.status_no_data_img);
mStatusReloadBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showStatusView(true);
getPresenter().loadMovieData();
}
});
}
if (loading) {
Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim_rotate);
animation.setInterpolator(new LinearInterpolator());
mStatusLoadingImg.setAnimation(animation);
mStatusLoadingImg.setVisibility(View.VISIBLE);
mStatusReloadBtn.setVisibility(View.INVISIBLE);
mStatusNoDataImg.setVisibility(View.INVISIBLE);
} else {
mStatusLoadingImg.clearAnimation();
mStatusLoadingImg.setVisibility(View.INVISIBLE);
mStatusReloadBtn.setVisibility(View.VISIBLE);
mStatusNoDataImg.setVisibility(View.VISIBLE);
}
}
示例12: animationIn
import android.view.animation.AnimationUtils; //导入依赖的package包/类
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);
}
示例13: changeSearchState
import android.view.animation.AnimationUtils; //导入依赖的package包/类
public void changeSearchState(SearchState state) {
switch (state) {
case INPUT:
mBtnSearchClear.setVisibility(View.VISIBLE);
mIvSearchLoading.clearAnimation();
mIvSearchLoading.setVisibility(View.GONE);
break;
case SEARCH:
mBtnSearchClear.setVisibility(View.GONE);
Animation anim = AnimationUtils.loadAnimation(getContext(),
R.anim.loading);
mIvSearchLoading.clearAnimation();
mIvSearchLoading.startAnimation(anim);
mIvSearchLoading.setVisibility(View.VISIBLE);
break;
}
}
示例14: setListShown
import android.view.animation.AnimationUtils; //导入依赖的package包/类
private void setListShown(boolean shown, boolean animate) {
ensureCustomList();
if(mListShown == shown) {
return;
}
mListShown = shown;
if(mListContainer != null && mProgressContainer != null) {
if(shown) {
if(animate) {
mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
}
mListContainer.setVisibility(View.VISIBLE);
mProgressContainer.setVisibility(View.GONE);
}else {
if(animate) {
mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
}
mListContainer.setVisibility(View.GONE);
mProgressContainer.setVisibility(View.VISIBLE);
}
}
}
示例15: Init
import android.view.animation.AnimationUtils; //导入依赖的package包/类
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
finish();
}
});
}