Java Code Examples for android.view.animation.AlphaAnimation#setRepeatCount()

The following examples show how to use android.view.animation.AlphaAnimation#setRepeatCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RippleImageView.java    From RippleImageView with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化动画集
 * @return
 */
private AnimationSet initAnimationSet() {
    AnimationSet as = new AnimationSet(true);
    //缩放度:变大两倍
    ScaleAnimation sa = new ScaleAnimation(1f, 2f, 1f, 2f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    sa.setDuration(show_spacing_time * 3);
    sa.setRepeatCount(Animation.INFINITE);// 设置循环
    //透明度
    AlphaAnimation aa = new AlphaAnimation(1, 0.1f);
    aa.setDuration(show_spacing_time * 3);
    aa.setRepeatCount(Animation.INFINITE);//设置循环
    as.addAnimation(sa);
    as.addAnimation(aa);
    return as;
}
 
Example 2
Source File: ProgressButton.java    From progress-button with Apache License 2.0 6 votes vote down vote up
private void configureLoadingDrawables()
{
	int i;
	Drawable d;
	for (i=0; i < loadingDrawables.length; i++)
	{
		d = loadingDrawables[i];
		if (d != null)
		{
			d.setBounds( 0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight() );
			if ( !(d instanceof Animatable) )
			{
				animation = new AlphaAnimation( 0f, 1f );
				animation.setRepeatMode( Animation.RESTART );
				animation.setRepeatCount( Animation.INFINITE );
				animation.setDuration( 1000 );
				animation.setInterpolator( new LinearInterpolator() );
				animation.setStartTime( Animation.START_ON_FIRST_FRAME );
			}
		}
	}
	transformation = new Transformation();
}
 
Example 3
Source File: ViewAnimation.java    From geopackage-mapcache-android with MIT License 6 votes vote down vote up
/**
 * Assign a "scale to 120% and back bounce + fade out and in" animation to the given view
 * @param view the view to animate
 * @param duration duration of the animation
 */
public static void setBounceAnimatiom(View view, long duration){
    ScaleAnimation grow = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    grow.setDuration(duration);
    ScaleAnimation shrink = new ScaleAnimation(1.0f, 0.8f, 1.0f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    shrink.setDuration(duration);
    shrink.setStartOffset(duration);

    // Fade out then repeat to fade back in
    AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.3f);
    fadeOut.setInterpolator(new DecelerateInterpolator()); //and this
    fadeOut.setDuration(100);
    fadeOut.setRepeatMode(Animation.REVERSE);
    fadeOut.setRepeatCount(1);

    AnimationSet set = new AnimationSet(false);
    set.addAnimation(grow);
    set.addAnimation(shrink);
    set.addAnimation(fadeOut);
    view.startAnimation(set);
}
 
Example 4
Source File: CalibrationErrorView.java    From VIA-AI with MIT License 6 votes vote down vote up
/**
 @brief Hide the wrapper.
 */
private void hide()
{
    if(Looper.myLooper() == Looper.getMainLooper()) {
        AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
        anim.setDuration(1000);
        anim.setRepeatCount(0);
        this.startAnimation(anim);
        this.setVisibility(View.INVISIBLE);
    }
    else {
        ((Activity)mContext).runOnUiThread(new Runnable() {
            @Override
            public void run() {
                hide();
            }
        });
    }
}
 
Example 5
Source File: FakeLoadingWithLogoView.java    From CommonUtils with Apache License 2.0 5 votes vote down vote up
public void startIndeterminate() {
    AlphaAnimation animation = new AlphaAnimation(1, 0);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(-1);
    animation.setInterpolator(new AccelerateInterpolator());
    animation.setDuration(1500);

    startAnimationInternal(animation);
}
 
Example 6
Source File: SimpleChatManager.java    From SimpleChatView with Apache License 2.0 5 votes vote down vote up
private void showTipsAnimation(TextView newsView) {
    AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.1f);
    alphaAnimation.setDuration(1100);
    alphaAnimation.setRepeatMode(Animation.RESTART);
    alphaAnimation.setRepeatCount(Animation.INFINITE);
    newsView.startAnimation(alphaAnimation);
}
 
Example 7
Source File: CommonViewAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 5 votes vote down vote up
private Animation getAlphaAnimation() {
    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f);
    alphaAnimation.setDuration(2000);
    alphaAnimation.setRepeatCount(1);
    alphaAnimation.setFillAfter(true);
    alphaAnimation.setFillBefore(false);
    alphaAnimation.setRepeatMode(Animation.REVERSE);
    return alphaAnimation;
}
 
Example 8
Source File: HomeScreenDockFragment.java    From paper-launcher with MIT License 5 votes vote down vote up
public void startIconsEditing() {
    mDockIconsEditAnimation = new AlphaAnimation(0.4f, 1.0f);
    mDockIconsEditAnimation.setDuration(260);
    mDockIconsEditAnimation.setRepeatMode(Animation.REVERSE);
    mDockIconsEditAnimation.setRepeatCount(Animation.INFINITE);

    iterateOverDockIcons((dockItem, dockIconColumn) -> {
        dockItem.setOnClickListener(view -> showSelectAppForIconAtColumn(dockIconColumn));

        dockItem.startAnimation(mDockIconsEditAnimation);
    });
}
 
Example 9
Source File: AnimationHelper.java    From RecordView with Apache License 2.0 5 votes vote down vote up
public void animateSmallMicAlpha() {
    alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(500);
    alphaAnimation.setRepeatMode(Animation.REVERSE);
    alphaAnimation.setRepeatCount(Animation.INFINITE);
    smallBlinkingMic.startAnimation(alphaAnimation);
}
 
Example 10
Source File: InputPanel.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private static Animation pulseAnimation() {
  AlphaAnimation animation = new AlphaAnimation(0, 1);

  animation.setInterpolator(pulseInterpolator());
  animation.setRepeatCount(Animation.INFINITE);
  animation.setDuration(1000);

  return animation;
}
 
Example 11
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public void alphaAnim_java(View view) {
	// 1.����AlphaAnimation
	AlphaAnimation animation = new AlphaAnimation(1f, 0f);
	// ���ó���ʱ��
	animation.setDuration(1000);
	// ����ѭ������
	animation.setRepeatCount(AlphaAnimation.INFINITE);
	// ����ѭ��ģʽ
	animation.setRepeatMode(AlphaAnimation.REVERSE);
	// 2.ͨ��View.startAnimation
	iv_rocket.startAnimation(animation);
}
 
Example 12
Source File: CommonViewAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private Animation getAlphaAnimation() {
    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f);
    alphaAnimation.setDuration(2000);
    alphaAnimation.setRepeatCount(1);
    alphaAnimation.setFillAfter(true);
    alphaAnimation.setFillBefore(false);
    alphaAnimation.setRepeatMode(Animation.REVERSE);
    return alphaAnimation;
}
 
Example 13
Source File: OrdersAdapter.java    From Pharmacy-Android with GNU General Public License v3.0 5 votes vote down vote up
private void fadeOnAck(@Order.Status String status, View view) {

        clearAnimation(view);

        if (status.equals(ACKNOWLEDGED)) {

            AlphaAnimation alphaAnimation = new AlphaAnimation(0.3f, 0.9f);
            alphaAnimation.setDuration(700);
            alphaAnimation.setRepeatMode(Animation.REVERSE);
            alphaAnimation.setRepeatCount(Animation.INFINITE);
            view.setAnimation(alphaAnimation);
            alphaAnimation.start();



            // color animation
/*        ObjectAnimator slide = ObjectAnimator.ofObject(view,
                "backgroundColor",
                new ArgbEvaluator(),
                ContextCompat.getColor(App.getContext(), R.color.white),
                ContextCompat.getColor(App.getContext(), R.color.md_deep_orange_50));*/

            /*     ObjectAnimator slide = ObjectAnimator.ofFloat(view,
                    "alpha", 0.3f, 0.9f);
            slide.setInterpolator(new AccelerateDecelerateInterpolator());
            slide.setDuration(700);
            slide.setRepeatCount(ValueAnimator.INFINITE);
            slide.setRepeatMode(ValueAnimator.REVERSE);
            slide.start();*/
        }
    }
 
Example 14
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 5 votes vote down vote up
public void alpha(View v){
	//0ȫ͸����1ȫ��͸��
	
	aa = new AlphaAnimation(0.2f, 1);
	aa.setDuration(2000);
	aa.setRepeatCount(1);
	aa.setRepeatMode(Animation.REVERSE);
	
	iv.startAnimation(aa);
}
 
Example 15
Source File: LoadingWrapper.java    From VIA-AI with MIT License 5 votes vote down vote up
/**
 @brief Hide the wrapper.
 */
public void hide()
{
    mUI_LoadingProgress.stop();
    AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(1000);
    anim.setRepeatCount(0);
    this.startAnimation(anim);
    this.setVisibility(View.INVISIBLE);
}
 
Example 16
Source File: SplashActivity.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
@Override
public void initView() {
    presenter.checkToken();

    //是否关闭启动页
    if (AppConfig.getInstance().isCloseSplashPage()) {
        launchActivity();
        return;
    }

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
    alphaAnimation.setRepeatCount(Animation.ABSOLUTE);
    alphaAnimation.setInterpolator(new LinearInterpolator());
    alphaAnimation.setDuration(2000);

    String appName = "弹弹play 概念版 v" + AppUtils.getAppVersionName();
    appNameTv.setText(appName);

    textPathView.setAnimListener(new TextPathAnimView.AnimListener() {
        @Override
        public void onStart() {

        }

        @Override
        public void onEnd() {
            if (textPathView != null)
                textPathView.postDelayed(() -> launchActivity(), 350);
        }

        @Override
        public void onLoop() {

        }
    });

    textPathView.startAnim();
    iconSvgView.start();
    addressLl.startAnimation(alphaAnimation);
}
 
Example 17
Source File: InputBarFragment.java    From actor-platform with GNU Affero General Public License v3.0 4 votes vote down vote up
protected void showAudio() {
    if (Build.VERSION.SDK_INT >= 23) {
        if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED ||
                ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) {
            requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.VIBRATE}, PERMISSION_REQUEST_RECORD_AUDIO);
            return;
        }
    }

    if (isAudioVisible) {
        return;
    }
    isAudioVisible = true;

    hideView(attachButton);
    hideView(messageEditText);
    hideView(emojiButton);

    audioFile = ActorSDK.sharedActor().getMessenger().getInternalTempFile("voice_msg", "opus");

    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);

    voiceRecordActor.send(new VoiceCaptureActor.Start(audioFile));

    slideAudio(0);
    audioTimer.setText("00:00");

    TranslateAnimation animation = new TranslateAnimation(Screen.getWidth(), 0, 0, 0);
    animation.setDuration(160);
    audioContainer.clearAnimation();
    audioContainer.setAnimation(animation);
    audioContainer.animate();
    audioContainer.setVisibility(View.VISIBLE);


    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0.2f);
    alphaAnimation.setDuration(800);
    alphaAnimation.setRepeatMode(AlphaAnimation.REVERSE);
    alphaAnimation.setRepeatCount(AlphaAnimation.INFINITE);
    recordPoint.clearAnimation();
    recordPoint.setAnimation(alphaAnimation);
    recordPoint.animate();
}
 
Example 18
Source File: BluetoothHidEmuActivity.java    From BluetoothHidEmu with Apache License 2.0 4 votes vote down vote up
/**
 * Updates UI
 * @param state
 */
private void setStatusIconState(StatusIconStates state) {

    if (state == mStatusState) {
        return;
    }
    
       Animation animation = null;
    switch (state) {
    case ON:
        if ((animation = mStatusTextView.getAnimation()) != null) {
            animation.cancel();
            mStatusTextView.setAnimation(null);
        }
        mStatusTextView.setTextColor(Color.GREEN);
        mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK);
        mStatusTextView.setText(getResources().getString(R.string.msg_status_connected));
        
        if (mUiControls != null) mUiControls.animate(View.VISIBLE);
        
        break;
    case OFF:
           if ((animation = mStatusTextView.getAnimation()) != null) {
               animation.cancel();
               mStatusTextView.setAnimation(null);
           }
           mStatusTextView.setTextColor(Color.RED);
           mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK);
           mStatusTextView.setText(getResources().getString(R.string.msg_status_disconnected));
           
           if (mUiControls != null) mUiControls.animate(View.INVISIBLE);

        break;
    case INTERMEDIATE:
        
        mStatusTextView.setTextColor(0xffffff00);
        mStatusTextView.setShadowLayer(6, 0f, 0f, Color.BLACK);
           mStatusTextView.setText(getResources().getString(R.string.msg_status_connecting));
        
           AlphaAnimation alphaAnim = new AlphaAnimation(1, 0.2f);
           alphaAnim.setDuration(250);
           alphaAnim.setInterpolator(new DecelerateInterpolator(10f));
           alphaAnim.setRepeatCount(Animation.INFINITE);
           alphaAnim.setRepeatMode(Animation.REVERSE);
           
           mStatusTextView.startAnimation(alphaAnim);
           
           if (mUiControls != null) mUiControls.animate(View.INVISIBLE);
        break;
    }
    mStatusState = state;

}