/**
* 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;
}
java类android.view.animation.AnimationUtils的实例源码
LauncherEdgeEffect.java 文件源码
项目:SimpleUILauncher
阅读 39
收藏 0
点赞 0
评论 0
LoginFragment.java 文件源码
项目:LabDayApp
阅读 61
收藏 0
点赞 0
评论 0
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);
}
LauncherEdgeEffect.java 文件源码
项目:FlickLauncher
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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;
}
FancyShowCaseView.java 文件源码
项目:FancyShowCaseView
阅读 35
收藏 0
点赞 0
评论 0
/**
* 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();
}
AnimatedImageButton.java 文件源码
项目:chromium-swe-updater
阅读 34
收藏 0
点赞 0
评论 0
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();
}
EliminateMainActivity.java 文件源码
项目:FreeStreams-TVLauncher
阅读 41
收藏 0
点赞 0
评论 0
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();
}
});
}
ImageFetcher.java 文件源码
项目:cordova-plugin-image-picker
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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();
}
}
ScrollAwareFABBehavior.java 文件源码
项目:editor-sql
阅读 38
收藏 0
点赞 0
评论 0
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);
}
}
CustomLoadDialog.java 文件源码
项目:JKApp
阅读 35
收藏 0
点赞 0
评论 0
/**
* 当窗口焦点改变时调用
*/
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();
}
MemeItemAdapter.java 文件源码
项目:memetastic
阅读 37
收藏 0
点赞 0
评论 0
@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);
}
ChatSDKMessagesListAdapter.java 文件源码
项目:AndroidBackendlessChat
阅读 40
收藏 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();
}
MainActivity.java 文件源码
项目:GracefulMovies
阅读 32
收藏 0
点赞 0
评论 0
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);
}
}
Utils.java 文件源码
项目:betterHotels
阅读 30
收藏 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);
}
HeaderLayout.java 文件源码
项目:HiBangClient
阅读 34
收藏 0
点赞 0
评论 0
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;
}
}
LauncherEdgeEffect.java 文件源码
项目:LaunchEnr
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
CSSListFragment.java 文件源码
项目:CSipSimple
阅读 58
收藏 0
点赞 0
评论 0
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);
}
}
}
AlbumPictureController.java 文件源码
项目:Musicoco
阅读 37
收藏 0
点赞 0
评论 0
public int[] next(@NonNull SongInfo song, boolean updateColors) {
Animation in = AnimationUtils.loadAnimation(context, R.anim.slide_in_right);
Animation out = AnimationUtils.loadAnimation(context, R.anim.slide_out_left);
view.setInAnimation(in);
view.setOutAnimation(out);
rotateAnim.cancel();
view.getNextView().setRotation(0.0f);
Bitmap bitmap = bitmapProducer.getBitmapForVisualizer(cache, song.getAlbum_path(), size, defaultColor);
if (bitmap != null) {
if (updateColors) {
ColorUtils.get4DarkColorWithTextFormBitmap(bitmap, defaultColor, defaultTextColor, this.colors);
}
view.setImageDrawable(new BitmapDrawable(context.getResources(), bitmap));
} else {
try {
view.setImageDrawable(new BitmapDrawable(context.getResources(), cache.getDefaultBitmap()));
} catch (Exception e) {
Bitmap b = Init.initAlbumVisualizerImageCache((Activity) context);
view.setImageDrawable(new BitmapDrawable(context.getResources(), b));
}
}
if (isSpin()) {
startSpin();
}
return colors;
}
LoginActivity.java 文件源码
项目:TestChat
阅读 36
收藏 0
点赞 0
评论 0
@Override
public void initData() {
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
Animation animation = AnimationUtils.loadAnimation(LoginActivity.this, R.anim.translate_anim);
bg.startAnimation(animation);
}
}, 200);
}
SlidingPanelRelative.java 文件源码
项目:SlidingPanel
阅读 44
收藏 0
点赞 0
评论 0
/**
* Default constructor for this custom view class.
*
* @param context - activity or application context for obtaining custom attributes.
* @param attrs - AttributeSet parameter which allows to obtain attributes and use them in java code.
*/
public SlidingPanelRelative(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SettingsPanel,
0, 0);
attrSpeed = a.getInt(R.styleable.SettingsPanel_speed, Utilities.DEFAULT_ANIMATION_SPEED);
a.recycle();
fadeAnimation = AnimationUtils.loadAnimation(context, R.anim.fade);
}
OutToBottomAnimation.java 文件源码
项目:yyox
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void onAnimationEnd(Animation animation) {
if (animView.isShown()) {
animView.setVisibility(View.GONE);
}
if (!nextView.isShown()) {
nextView.setVisibility(View.VISIBLE);
}
Animation nextAnimation = AnimationUtils.loadAnimation(context, R.anim.kf5_anim_in_from_bottom);
nextAnimation.setFillAfter(true);
nextView.startAnimation(nextAnimation);
}
BarLineChartTouchListener.java 文件源码
项目:GitHub
阅读 46
收藏 0
点赞 0
评论 0
public void computeScroll() {
if (mDecelerationVelocity.x == 0.f && mDecelerationVelocity.y == 0.f)
return; // There's no deceleration in progress
final long currentTime = AnimationUtils.currentAnimationTimeMillis();
mDecelerationVelocity.x *= mChart.getDragDecelerationFrictionCoef();
mDecelerationVelocity.y *= mChart.getDragDecelerationFrictionCoef();
final float timeInterval = (float) (currentTime - mDecelerationLastTime) / 1000.f;
float distanceX = mDecelerationVelocity.x * timeInterval;
float distanceY = mDecelerationVelocity.y * timeInterval;
mDecelerationCurrentPoint.x += distanceX;
mDecelerationCurrentPoint.y += distanceY;
MotionEvent event = MotionEvent.obtain(currentTime, currentTime, MotionEvent.ACTION_MOVE, mDecelerationCurrentPoint.x,
mDecelerationCurrentPoint.y, 0);
performDrag(event);
event.recycle();
mMatrix = mChart.getViewPortHandler().refresh(mMatrix, mChart, false);
mDecelerationLastTime = currentTime;
if (Math.abs(mDecelerationVelocity.x) >= 0.01 || Math.abs(mDecelerationVelocity.y) >= 0.01)
Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google
else {
// Range might have changed, which means that Y-axis labels
// could have changed in size, affecting Y-axis size.
// So we need to recalculate offsets.
mChart.calculateOffsets();
mChart.postInvalidate();
stopDeceleration();
}
}
ProgressButton.java 文件源码
项目:Phoenix-for-VK
阅读 43
收藏 0
点赞 0
评论 0
private void resolveViews(){
mProgressIcon.setVisibility(mProgressNow ? View.VISIBLE : View.INVISIBLE);
mTitleRoot.setVisibility(mProgressNow ? View.INVISIBLE : View.VISIBLE);
if (mProgressNow) {
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.anim_button_progress);
mProgressIcon.startAnimation(animation);
} else {
mProgressIcon.clearAnimation();
}
}
CoverFlowView.java 文件源码
项目:Hotspot-master-devp
阅读 36
收藏 0
点赞 0
评论 0
private void driveAnimation() {
float elapsed = (AnimationUtils.currentAnimationTimeMillis() - mStartTime) / 1000.0f;
if (elapsed >= mDuration) {
endAnimation();
onTouchMove = false;
} else {
updateAnimationAtElapsed(elapsed);
post(mAnimationRunnable);
}
}
MainActivity.java 文件源码
项目:VirtualLocation
阅读 32
收藏 0
点赞 0
评论 0
@Override
protected void IniView() {
bt_Ok = (Button) findViewById(R.id.bt_Ok);
tv_location = (TextView) findViewById(R.id.tv_location);
mDrawerLayout = (DrawerLayout) findViewById(R.id.dl_left);
mTopbanner = (TopBanner) findViewById(R.id.topbanner);
mAboutAuthor = (TextView) findViewById(R.id.tv_about_me);
mCurrentLocation = (ImageView)findViewById(R.id.iv_location);
mStopMock = (ImageView)findViewById(R.id.iv_stop_location);
mPreciseLocation = (TextView)findViewById(R.id.tv_precise);
mAddProcess = (TextView) findViewById(R.id.tv_add_app);
//加载旋转动画
mOperatingAnim = AnimationUtils.loadAnimation(this, R.anim.spinloaing);
LinearInterpolator lin = new LinearInterpolator();
mOperatingAnim.setInterpolator(lin);
// 地图初始化
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
//隐藏地图比例尺
mMapView.showScaleControl(false);
//关闭缩放放大控件
mMapView.showZoomControls(false);
mMapView.removeViewAt(1);
// 定位初始化
mLocClient = new LocationClient(this);
}
ProgressView.java 文件源码
项目:QRCodeScanner
阅读 40
收藏 0
点赞 0
评论 0
public void startAnimation(final int frameCount, final int duration) {
Animation a = AnimationUtils.loadAnimation(getContext(), R.anim.progress_anim);
a.setDuration(duration);
a.setInterpolator(new Interpolator() {
@Override
public float getInterpolation(float input) {
// return (float) Math.floor(input * frameCount) / frameCount;
return input;
}
});
startAnimation(a);
}
CommentsActivity.java 文件源码
项目:InstaFlickr
阅读 33
收藏 0
点赞 0
评论 0
private boolean validateComment() {
if (TextUtils.isEmpty(etComment.getText())) {
btnSendComment.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake_error));
return false;
}
return true;
}
SignUpActivity.java 文件源码
项目:mobile-app-dev-book
阅读 31
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
mAuth = FirebaseAuth.getInstance();
shake = AnimationUtils.loadAnimation(this, R.anim.shake);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
BookGridAdapter.java 文件源码
项目:BuddyBook
阅读 35
收藏 0
点赞 0
评论 0
private void setAnimation(View viewToAnimate, int position) {
// If the bound view wasn't previously displayed on screen, it's animated
if (position > lastPosition) {
Animation animation = AnimationUtils.loadAnimation(mContext, android.R.anim.slide_in_left);
viewToAnimate.startAnimation(animation);
lastPosition = position;
}
}
RegGetCodeActivity.java 文件源码
项目:GitHub
阅读 34
收藏 0
点赞 0
评论 0
@Override
public void showAnimation(String msg) {
Animation shake = AnimationUtils.loadAnimation(RegGetCodeActivity.this, R.anim.shake);
phone.startAnimation(shake);
text.setText("请输入正确的手机号!");
text.setTextColor(ContextCompat.getColor(RegGetCodeActivity.this, android.R.color.holo_red_light));
phone.setTextColor(ContextCompat.getColor(RegGetCodeActivity.this, android.R.color.holo_red_light));
}
BaseBottomWindow.java 文件源码
项目:GitHub
阅读 31
收藏 0
点赞 0
评论 0
/**
* 如果在子类中调用(即super.initView());则view必须含有initView中初始化用到的id(非@Nullable标记)且id对应的View的类型全部相同;
* 否则必须在子类initView中重写这个类中initView内的代码(所有id替换成可用id)
*/
@Override
public void initView() {// 必须调用
enterAnim = exitAnim = R.anim.null_anim;
vBaseBottomWindowRoot = findViewById(R.id.vBaseBottomWindowRoot);
vBaseBottomWindowRoot.startAnimation(AnimationUtils.loadAnimation(context, R.anim.bottom_window_enter));
}