Java Code Examples for android.view.animation.AnimationUtils

The following are top voted examples for showing how to use android.view.animation.AnimationUtils. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: SimpleUILauncher   File: LauncherEdgeEffect.java   View source code 7 votes vote down vote up
/**
 * 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;
}
 
Example 2
Project: LabDayApp   File: LoginFragment.java   View source code 7 votes vote down vote up
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);
}
 
Example 3
Project: FlickLauncher   File: LauncherEdgeEffect.java   View source code 7 votes vote down vote up
/**
 * 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;
}
 
Example 4
Project: FancyShowCaseView   File: FancyShowCaseView.java   View source code 7 votes vote down vote up
/**
 * 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();


}
 
Example 5
Project: chromium-swe-updater   File: AnimatedImageButton.java   View source code 7 votes vote down vote up
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();
}
 
Example 6
Project: cordova-plugin-image-picker   File: ImageFetcher.java   View source code 7 votes vote down vote up
/**
 * 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();
    }
}
 
Example 7
Project: editor-sql   File: ScrollAwareFABBehavior.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 8
Project: JKApp   File: CustomLoadDialog.java   View source code 6 votes vote down vote up
/**
	 * 当窗口焦点改变时调用
	 */
	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();
	}
 
Example 9
Project: memetastic   File: MemeItemAdapter.java   View source code 6 votes vote down vote up
@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);
}
 
Example 10
Project: AndroidBackendlessChat   File: ChatSDKMessagesListAdapter.java   View source code 6 votes vote down vote up
/**
 * 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();
}
 
Example 11
Project: GracefulMovies   File: MainActivity.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 12
Project: betterHotels   File: Utils.java   View source code 6 votes vote down vote up
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);
}
 
Example 13
Project: HiBangClient   File: HeaderLayout.java   View source code 6 votes vote down vote up
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;
	}
}
 
Example 14
Project: LaunchEnr   File: LauncherEdgeEffect.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: CSipSimple   File: CSSListFragment.java   View source code 6 votes vote down vote up
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);
        }
    }
}
 
Example 16
Project: FreeStreams-TVLauncher   File: EliminateMainActivity.java   View source code 6 votes vote down vote up
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();	
	}
});
}
 
Example 17
Project: Musicoco   File: AlbumPictureController.java   View source code 5 votes vote down vote up
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;
    }
 
Example 18
Project: TestChat   File: LoginActivity.java   View source code 5 votes vote down vote up
@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);
}
 
Example 19
Project: SlidingPanel   File: SlidingPanelRelative.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 20
Project: yyox   File: OutToBottomAnimation.java   View source code 5 votes vote down vote up
@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);
}
 
Example 21
Project: GitHub   File: BarLineChartTouchListener.java   View source code 5 votes vote down vote up
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();
        }
    }
 
Example 22
Project: Phoenix-for-VK   File: ProgressButton.java   View source code 5 votes vote down vote up
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();
    }
}
 
Example 23
Project: Hotspot-master-devp   File: CoverFlowView.java   View source code 5 votes vote down vote up
private void driveAnimation() {
    float elapsed = (AnimationUtils.currentAnimationTimeMillis() - mStartTime) / 1000.0f;
    if (elapsed >= mDuration) {
        endAnimation();
        onTouchMove = false;
    } else {
        updateAnimationAtElapsed(elapsed);
        post(mAnimationRunnable);
    }
}
 
Example 24
Project: VirtualLocation   File: MainActivity.java   View source code 5 votes vote down vote up
@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);
}
 
Example 25
Project: QRCodeScanner   File: ProgressView.java   View source code 5 votes vote down vote up
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);
    }
 
Example 26
Project: InstaFlickr   File: CommentsActivity.java   View source code 5 votes vote down vote up
private boolean validateComment() {
    if (TextUtils.isEmpty(etComment.getText())) {
            btnSendComment.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake_error));
            return false;
        }

            return true;
}
 
Example 27
Project: mobile-app-dev-book   File: SignUpActivity.java   View source code 5 votes vote down vote up
@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);
}
 
Example 28
Project: BuddyBook   File: BookGridAdapter.java   View source code 5 votes vote down vote up
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;
    }
}
 
Example 29
Project: GitHub   File: RegGetCodeActivity.java   View source code 5 votes vote down vote up
@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));
}
 
Example 30
Project: GitHub   File: BaseBottomWindow.java   View source code 5 votes vote down vote up
/**
 * 如果在子类中调用(即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));
}
 
Example 31
Project: Android-Code-Demos   File: ResultAdapter.java   View source code 5 votes vote down vote up
public void bindHolder(String result, int position) {
    mTextView.setText(result);
    Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_item);
    animation.setStartOffset(position * 200);
    animation.setInterpolator(new AccelerateInterpolator());
    itemView.startAnimation(animation);
}
 
Example 32
Project: Lunary-Ethereum-Wallet   File: TokenAdapter.java   View source code 5 votes vote down vote up
private void setAnimation(View viewToAnimate, int position) {
    if (position > lastPosition) {
        Animation animation = AnimationUtils.loadAnimation(context, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_bottom);
        viewToAnimate.startAnimation(animation);
        lastPosition = position;
    }
}
 
Example 33
Project: mobile-app-dev-book   File: SignUpActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_up);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    shake = AnimationUtils.loadAnimation(this, R.anim.shake);
}
 
Example 34
Project: Multi-SwipeToRefreshLayout   File: QQHeader.java   View source code 5 votes vote down vote up
public QQHeader(Context context, AttributeSet attrs) {
    super(context, attrs);

    // 初始化动画
    rotate_up = AnimationUtils.loadAnimation(context , R.anim.rotate_up);
    rotate_down = AnimationUtils.loadAnimation(context , R.anim.rotate_down);
    rotate_infinite = AnimationUtils.loadAnimation(context , R.anim.rotate_infinite);

    inflate(context, R.layout.header_qq, this);

    textView = (TextView) findViewById(R.id.text);
    arrowIcon = findViewById(R.id.arrowIcon);
    successIcon = findViewById(R.id.successIcon);
    loadingIcon = findViewById(R.id.loadingIcon);
}
 
Example 35
Project: APIJSON-Android-RxJava   File: BaseBottomWindow.java   View source code 5 votes vote down vote up
/**带动画退出,并使退出事件只响应一次
 */
@Override
public void finish() {
	Log.d(TAG, "finish >>> isExit = " + isExit);
	if (isExit) {
		return;
	}
	isExit = true;

	vBaseBottomWindowRoot.startAnimation(AnimationUtils.loadAnimation(context, R.anim.bottom_window_exit));
	vBaseBottomWindowRoot.setVisibility(View.GONE);

	exitHandler.sendEmptyMessageDelayed(0, 200);
}
 
Example 36
Project: QSRefreshLayout   File: SwipeProgressBar.java   View source code 5 votes vote down vote up
/**
 * Start showing the progress animation.
 */
void start() {
    if (!mRunning) {
        mTriggerPercentage = 0;
        mStartTime = AnimationUtils.currentAnimationTimeMillis();
        mRunning = true;
        mParent.postInvalidate();
    }
}
 
Example 37
Project: PeSanKita-android   File: ConversationFragment.java   View source code 5 votes vote down vote up
private ConversationDateHeader(Context context, TextView textView) {
  super(textView);
  this.animateIn  = AnimationUtils.loadAnimation(context, R.anim.slide_from_top);
  this.animateOut = AnimationUtils.loadAnimation(context, R.anim.slide_to_top);

  this.animateIn.setDuration(100);
  this.animateOut.setDuration(100);
}
 
Example 38
Project: MaterialColorPickerDialog   File: ColorChooserDialog.java   View source code 5 votes vote down vote up
private void animator(final ImageButton imageButton){
    Animation animation = AnimationUtils.loadAnimation(getContext(),R.anim.color_item);
    animation.setInterpolator(new AccelerateInterpolator());
    imageButton.setAnimation(animation);
    imageButton.setVisibility(View.VISIBLE);
    animation.start();
}
 
Example 39
Project: mobile-app-dev-book   File: LoginActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    mAuth = FirebaseAuth.getInstance();

    shake = AnimationUtils.loadAnimation(this, R.anim.shake);
}
 
Example 40
Project: letv   File: OverScroller.java   View source code 5 votes vote down vote up
public boolean computeScrollOffset() {
    if (isFinished()) {
        return false;
    }
    switch (this.mMode) {
        case 0:
            long elapsedTime = AnimationUtils.currentAnimationTimeMillis() - SplineOverScroller.access$600(this.mScrollerX);
            int duration = SplineOverScroller.access$500(this.mScrollerX);
            if (elapsedTime >= ((long) duration)) {
                abortAnimation();
                break;
            }
            float q = ((float) elapsedTime) / ((float) duration);
            if (this.mInterpolator == null) {
                q = viscousFluid(q);
            } else {
                q = this.mInterpolator.getInterpolation(q);
            }
            this.mScrollerX.updateScroll(q);
            this.mScrollerY.updateScroll(q);
            break;
        case 1:
            if (!(SplineOverScroller.access$000(this.mScrollerX) || this.mScrollerX.update() || this.mScrollerX.continueWhenFinished())) {
                this.mScrollerX.finish();
            }
            if (!(SplineOverScroller.access$000(this.mScrollerY) || this.mScrollerY.update() || this.mScrollerY.continueWhenFinished())) {
                this.mScrollerY.finish();
                break;
            }
    }
    return true;
}