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


Java AnimationUtils类代码示例

本文整理汇总了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;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:24,代码来源:LauncherEdgeEffect.java

示例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);
}
 
开发者ID:jakdor,项目名称:LabDayApp,代码行数:21,代码来源:LoginFragment.java

示例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;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:34,代码来源:LauncherEdgeEffect.java

示例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();


}
 
开发者ID:faruktoptas,项目名称:FancyShowCaseView,代码行数:25,代码来源:FancyShowCaseView.java

示例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();
}
 
开发者ID:bamless,项目名称:chromium-swe-updater,代码行数:21,代码来源:AnimatedImageButton.java

示例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();
    }
}
 
开发者ID:abelabbesnabi,项目名称:cordova-plugin-image-picker,代码行数:23,代码来源:ImageFetcher.java

示例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);
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:18,代码来源:ScrollAwareFABBehavior.java

示例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();
	}
 
开发者ID:dufangyu1990,项目名称:JKApp,代码行数:19,代码来源:CustomLoadDialog.java

示例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);
}
 
开发者ID:gsantner,项目名称:memetastic,代码行数:19,代码来源:MemeItemAdapter.java

示例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();
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:15,代码来源:ChatSDKMessagesListAdapter.java

示例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);
    }
}
 
开发者ID:woxingxiao,项目名称:GracefulMovies,代码行数:30,代码来源:MainActivity.java

示例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);
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:12,代码来源:Utils.java

示例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;
	}
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:19,代码来源:HeaderLayout.java

示例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);
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:CSSListFragment.java

示例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();	
	}
});
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:23,代码来源:EliminateMainActivity.java


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