Java Code Examples for android.view.animation.AlphaAnimation

The following are top voted examples for showing how to use android.view.animation.AlphaAnimation. 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: Pocket-Plays-for-Twitch   File: AnimationService.java   View source code 7 votes vote down vote up
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
	final int ANIMATION_DURATION = 650;
	final int BASE_DELAY = 50;

	TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);

	AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

	final AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(translationAnimation);
	animationSet.addAnimation(alphaAnimation);
	animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
	animationSet.setFillAfter(true);
	animationSet.setFillBefore(true);
	animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

	aCard.setAnimation(animationSet);
}
 
Example 2
Project: YMenuView   File: Circle8YMenu.java   View source code 6 votes vote down vote up
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
            ,0);
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    //为不同的Option设置延时
    if (index % 2 == 1) {
        animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
    }
    return animationSet;
}
 
Example 3
Project: GitHub   File: ViewHolder.java   View source code 6 votes vote down vote up
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
    {
        getView(viewId).setAlpha(value);
    } else
    {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 4
Project: GitHub   File: ViewHolder.java   View source code 6 votes vote down vote up
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
    {
        getView(viewId).setAlpha(value);
    } else
    {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 5
Project: YMenuView   File: TreeYMenu.java   View source code 6 votes vote down vote up
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {

    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            0
            ,getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
    );
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());

    animationSet.addAnimation(translateAnimation);
    animationSet.addAnimation(alphaAnimation);
    //设置动画延时
    animationSet.setStartOffset(60*(getOptionPositionCount() - index));
    return animationSet;
}
 
Example 6
Project: letv   File: BottomRedPointView.java   View source code 6 votes vote down vote up
private void init(Context context, View target) {
    this.context = context;
    this.target = target;
    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(200);
    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(200);
    this.isShown = false;
    if (this.target != null) {
        applyTo(this.target);
    } else {
        show();
    }
}
 
Example 7
Project: RLibrary   File: UIIDialogImpl.java   View source code 6 votes vote down vote up
/**
 * 对话框结束时的动画
 */
@Override
public Animation loadFinishAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
    setDefaultConfig(translateAnimation, true);
    setDefaultConfig(alphaAnimation, true);

    translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
    alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
Example 8
Project: BottomMenu   File: BottomMenu.java   View source code 6 votes vote down vote up
private Animation scaleSmallAnim(int duration, final View child) {

        AnimationSet animationSet = new AnimationSet(true);

        ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                0.5f);
        AlphaAnimation alphaAnim = new AlphaAnimation(1f, 0.0f);
        alphaAnim.setFillAfter(true);
        animationSet.addAnimation(scaleAnim);
        animationSet.addAnimation(alphaAnim);
        animationSet.setDuration(duration);

        return animationSet;

    }
 
Example 9
Project: AndroidBasicLibs   File: DrawerToast.java   View source code 6 votes vote down vote up
/**
 * 获得离场动画
 *
 * @return
 */
protected Animation getEndAnimation() {
    AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
    animAlpha.setDuration(TIME_END_ANIM);
    animAlpha.setFillAfter(true);

    TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, -1.5f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f);
    animTrans.setDuration(TIME_END_ANIM);
    animTrans.setFillAfter(true);
    animTrans.setInterpolator(new AccelerateInterpolator());

    AnimationSet sets = new AnimationSet(true);
    sets.addAnimation(animAlpha);
    sets.addAnimation(animTrans);

    return sets;
}
 
Example 10
Project: QMUI_Android   File: QMUIBottomSheet.java   View source code 6 votes vote down vote up
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
 
Example 11
Project: Nimbus   File: CoreTeamEventActivity.java   View source code 6 votes vote down vote up
public static void startAlphaAnimation(View v, long duration, int visibility) {
    AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
            ? new AlphaAnimation(0f, 1f)
            : new AlphaAnimation(1f, 0f);

    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    v.startAnimation(alphaAnimation);
}
 
Example 12
Project: buildAPKsSamples   File: ListViewItemAnimations.java   View source code 6 votes vote down vote up
/**
 * Sets the horizontal position and translucency of the view being swiped.
 */
@SuppressLint("NewApi")
private void setSwipePosition(View view, float deltaX) {
    float fraction = Math.abs(deltaX) / view.getWidth();
    if (isRuntimePostGingerbread()) {
        view.setTranslationX(deltaX);
        view.setAlpha(1 - fraction);
    } else {
        // Hello, Gingerbread!
        TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
        mCurrentX = deltaX;
        mCurrentAlpha = (1 - fraction);
        AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
        AnimationSet set = new AnimationSet(true);
        set.addAnimation(swipeAnim);
        set.addAnimation(alphaAnim);
        set.setFillAfter(true);
        set.setFillEnabled(true);
        view.startAnimation(set);
    }
}
 
Example 13
Project: RealmTasks   File: ItemViewHolder.java   View source code 6 votes vote down vote up
void setHintPanelVisible(boolean visible)
{
    final int visibility = hintPanel.getVisibility();
    boolean previousVisible = visibility == View.VISIBLE;
    if (previousVisible == visible)
    {
        return;
    }
    if (visible)
    {
        hintPanel.setVisibility(View.VISIBLE);
        final AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
        alphaAnimation.setDuration(150);
        hintPanel.setAnimation(alphaAnimation);
        final RotateAnimation rotateAnimation = new RotateAnimation(
                -90, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        rotateAnimation.setDuration(500);
        arrow.startAnimation(rotateAnimation);
    }
    else
    {
        hintPanel.setVisibility(View.GONE);
    }
}
 
Example 14
Project: showroom-android   File: ItemsCountView.java   View source code 5 votes vote down vote up
private Animation createPositionAnimation(int fromY, int toY, float fromAlpha, float toAlpha, int duration) {
    TranslateAnimation translate = new TranslateAnimation(0, 0, fromY, toY);
    translate.setDuration(duration);

    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(duration);

    AnimationSet set = new AnimationSet(true);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(translate);
    set.addAnimation(alpha);
    return set;
}
 
Example 15
Project: GitHub   File: BaseAdapterHelper.java   View source code 5 votes vote down vote up
/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.
 * 设置控件的显示的透明度
 */
public BaseAdapterHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        retrieveView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        retrieveView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 16
Project: RLibrary   File: UIIDialogImpl.java   View source code 5 votes vote down vote up
/**
 * 对话框启动时的动画
 */
@Override
public Animation loadStartAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
    setDefaultConfig(translateAnimation, false);
    setDefaultConfig(alphaAnimation, false);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
Example 17
Project: GitHub   File: SimpleActivity.java   View source code 5 votes vote down vote up
@Override public void apply(@NonNull View view, int index) {
  AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
  alphaAnimation.setFillBefore(true);
  alphaAnimation.setDuration(500);
  alphaAnimation.setStartOffset(index * 100);
  view.startAnimation(alphaAnimation);
}
 
Example 18
Project: GitHub   File: FlashActivity.java   View source code 5 votes vote down vote up
@Bus(EventTags.FLASH_INIT_UI)
public void initUI() {
    AlphaAnimation anim = new AlphaAnimation(0.8f, 0.1f);
    anim.setDuration(5000);
    mViewBinding.view.startAnimation(anim);
    AnimationUtil.setAnimationListener(anim, () -> OkBus.getInstance().onEvent(EventTags.JUMP_TO_MAIN));
}
 
Example 19
Project: GitHub   File: BaseViewHolder.java   View source code 5 votes vote down vote up
/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.
 */
public BaseViewHolder setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 20
Project: GitHub   File: EasyRVHolder.java   View source code 5 votes vote down vote up
@Override
public EasyRVHolder setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 21
Project: JueDiQiuSheng   File: SplashActivity.java   View source code 5 votes vote down vote up
private void btnAlpha(View view,long duration) {
    //透明度动画 public AlphaAnimation(float fromAlpha, float toAlpha){}
    AlphaAnimation aa = new AlphaAnimation(0, 1);
    //持续时间
    aa.setDuration(duration);
    view.startAnimation(aa);
}
 
Example 22
Project: SDCardCleaner   File: MainActivity.java   View source code 5 votes vote down vote up
private AnimationSet createQuitAnimation(View _view, long _offSet) {
    AnimationSet _set = new AnimationSet(true);

    _set.addAnimation(new AlphaAnimation(1, 0));
    _set.addAnimation(new ScaleAnimation(1, 2, 1, 2));
    _set.addAnimation(new TranslateAnimation(0, -_view.getWidth() / 2, 0, -_view.getHeight() / 2));

    _set.setDuration(150);
    _set.setStartOffset(_offSet);
    _set.setFillAfter(true);
    return _set;
}
 
Example 23
Project: GitHub   File: BaseViewHolder.java   View source code 5 votes vote down vote up
/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.
 */
public BaseViewHolder setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 24
Project: WelcomeView   File: WelcomeUtil.java   View source code 5 votes vote down vote up
public static void open(final Activity activity, String imageUrl, final OnWelcomeDone onWelcomeDone) {
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    final View welcome = LayoutInflater.from(activity).inflate(R.layout.welcome, null);
    final AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(1000);
    welcome.startAnimation(alphaAnimation);
    Glide.with(activity).load(imageUrl).into(((ImageView) welcome.findViewById(R.id.iv_welcome)));
    activity.setContentView(welcome);
    final TextView skipView = (TextView) welcome.findViewById(R.id.tv_skip);

    final CountDownTimer start = new CountDownTimer(5000, 1000) {
        @Override
        public void onTick(long millisUntilFinished) {
            skipView.setText("跳过" + ((millisUntilFinished / 1000) - 1));
        }

        @Override
        public void onFinish() {
            AlphaAnimation alphaAnimation1 = new AlphaAnimation(1.0f, 0.0f);
            alphaAnimation1.setDuration(1000);
            welcome.startAnimation(alphaAnimation1);
            if (onWelcomeDone != null) {
                onWelcomeDone.onDone();
            }
        }
    }.start();
    skipView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            start.onFinish();
        }
    });

}
 
Example 25
Project: letv   File: FragmentManagerImpl.java   View source code 5 votes vote down vote up
static boolean modifiesAlpha(Animation anim) {
    if (anim instanceof AlphaAnimation) {
        return true;
    }
    if (anim instanceof AnimationSet) {
        List<Animation> anims = ((AnimationSet) anim).getAnimations();
        for (int i = 0; i < anims.size(); i++) {
            if (anims.get(i) instanceof AlphaAnimation) {
                return true;
            }
        }
    }
    return false;
}
 
Example 26
Project: GitHub   File: BaseViewHolder.java   View source code 5 votes vote down vote up
/**
 * Add an action to set the alpha of a view. Can be called multiple times.
 * Alpha between 0-1.
 */
public BaseViewHolder setAlpha(@IdRes int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 27
Project: MVPtemplate   File: ViewHolderHelper.java   View source code 5 votes vote down vote up
@SuppressLint("NewApi")
public ViewHolderHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        getView(viewId).startAnimation(alpha);
    }
    return this;
}
 
Example 28
Project: Pocket-Plays-for-Twitch   File: AnimationService.java   View source code 5 votes vote down vote up
/**
 * For the Card Views
 */
public static AnimationSet startAlphaRevealAnimation(int delay, final View VIEW, boolean includeTransition) {
	final int ANIMATION_DURATION = 300;

	final Animation mAlphaAnimation = new AlphaAnimation(0f, 1f);
	mAlphaAnimation.setDuration(ANIMATION_DURATION);
	mAlphaAnimation.setFillAfter(true);

	final AnimationSet mRevealAnimations = new AnimationSet(true);
	mRevealAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
	mRevealAnimations.addAnimation(mAlphaAnimation);
	mRevealAnimations.setFillAfter(true);

	if (includeTransition) {
		final Animation mTransitionAnimation = new TranslateAnimation(0, 0, VIEW.getHeight()/2, 0);
		mTransitionAnimation.setDuration(ANIMATION_DURATION);
		mTransitionAnimation.setFillAfter(false);

		mRevealAnimations.addAnimation(mTransitionAnimation);
	}

	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
               if(VIEW != null)
			    VIEW.startAnimation(mRevealAnimations);
		}
	}, delay);

	return mRevealAnimations;
}
 
Example 29
Project: QMark   File: WelcomeSnowActy.java   View source code 5 votes vote down vote up
private AlphaAnimation startAlpha() {
	AlphaAnimation alpha = new AlphaAnimation(0, 1);
	alpha.setInterpolator(this, android.R.anim.accelerate_interpolator);
	alpha.setStartOffset(0);
	alpha.setDuration(1500);
	return alpha;
}
 
Example 30
Project: QActionSheet   File: QActionSheet.java   View source code 5 votes vote down vote up
@Override
public void show() {
    super.show();
    getWindow().setContentView(mParent);

    AlphaAnimation anim = new AlphaAnimation(0, 1);
    anim.setDuration(ANIMATION_DURATION);
    mMaskView.setAnimation(anim);

    int type = TranslateAnimation.RELATIVE_TO_SELF;
    TranslateAnimation anim2 = new TranslateAnimation(type, 0, type, 0, type, 1, type, 0);
    anim2.setDuration(ANIMATION_DURATION);
    mPanel.setAnimation(anim2);
}
 
Example 31
Project: Nimbus   File: TeamEventActivity.java   View source code 5 votes vote down vote up
public static void startAlphaAnimation(View v, long duration, int visibility) {
    AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
            ? new AlphaAnimation(0f, 1f)
            : new AlphaAnimation(1f, 0f);

    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    v.startAnimation(alphaAnimation);
}
 
Example 32
Project: mapbox-navigation-android   File: AlertView.java   View source code 5 votes vote down vote up
private void initAnimations() {
  fadeOut = new AlphaAnimation(1, 0);
  fadeOut.setInterpolator(new AccelerateInterpolator());
  fadeOut.setDuration(300);
  slideDownTop = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top);
  slideDownTop.setInterpolator(new OvershootInterpolator(2.0f));
}
 
Example 33
Project: OSchina_resources_android   File: KJAnimations.java   View source code 5 votes vote down vote up
/**
 * 透明度 Alpha
 */
public static Animation getAlphaAnimation(float fromAlpha, float toAlpha,
                                          long durationMillis) {
    AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
    alpha.setDuration(durationMillis);
    alpha.setFillAfter(true);
    return alpha;
}
 
Example 34
Project: aftercare-app-android   File: DCWelcomeFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_welcome, container, false);
    sdvWelcomeAvatar = (SimpleDraweeView) view.findViewById(R.id.sdv_welcome_avatar);
    tvWelcome = (DCTextView) view.findViewById(R.id.tv_welcome);
    tvWelcomeName = (DCTextView) view.findViewById(R.id.tv_welcome_name);

    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation avatarAnimation = new AlphaAnimation(0, 1);
    avatarAnimation.setDuration(2500);
    sdvWelcomeAvatar.startAnimation(avatarAnimation);

    TranslateAnimation welcomeAnimationTranslate = new TranslateAnimation(0, 0, translationPx, 0);
    welcomeAnimationTranslate.setDuration(1500);
    AlphaAnimation welcomeAnimationAlpha = new AlphaAnimation(0, 1);
    welcomeAnimationAlpha.setDuration(1500);

    AnimationSet welcomeAnimation = new AnimationSet(true);
    welcomeAnimation.addAnimation(welcomeAnimationAlpha);
    welcomeAnimation.addAnimation(welcomeAnimationTranslate);
    tvWelcome.startAnimation(welcomeAnimation);

    AlphaAnimation welcomeAnimationName = new AlphaAnimation(0, 1);
    welcomeAnimationName.setDuration(3000);
    tvWelcomeName.startAnimation(welcomeAnimationName);

    loadUser();

    DCSharedPreferences.saveBoolean(DCSharedPreferences.DCSharedKey.WELCOME_SCREEN, true);
    return view;
}
 
Example 35
Project: aftercare-app-android   File: DCLoginFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_login, container, false);

    ivLoginLogo = (ImageView) view.findViewById(R.id.iv_login_logo);

    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation logoAlphaAnimation = new AlphaAnimation(0, 1);
    logoAlphaAnimation.setDuration(500);

    TranslateAnimation logoTranslateAnimation = new TranslateAnimation(0, 0, translationPx, 0);
    logoTranslateAnimation.setDuration(500);

    AnimationSet logoAnimationSet = new AnimationSet(true);
    logoAnimationSet.addAnimation(logoAlphaAnimation);
    logoAnimationSet.addAnimation(logoTranslateAnimation);

    ivLoginLogo.startAnimation(logoAnimationSet);

    btnLoginFacebook = (DCButton) view.findViewById(R.id.btn_login_facebook);
    btnLoginFacebook.setOnClickListener(this);

    btnLoginGoogle = (DCButton) view.findViewById(R.id.btn_login_google);
    btnLoginGoogle.setOnClickListener(this);

    btnLoginTwitter = (DCButton) view.findViewById(R.id.btn_login_twitter);
    btnLoginTwitter.setOnClickListener(this);

    btnLogin = (DCButton) view.findViewById(R.id.btn_login_login);
    btnLogin.setOnClickListener(this);

    tilLoginEmail = (DCTextInputLayout) view.findViewById(R.id.til_login_email);
    tietLoginEmail = (DCTextInputEditText) view.findViewById(R.id.tiet_login_email);
    tietLoginEmail.setOnFocusChangeListener(this);

    tilLoginPassword = (DCTextInputLayout) view.findViewById(R.id.til_login_password);
    tietLoginPassword = (DCTextInputEditText) view.findViewById(R.id.tiet_login_password);

    tvLoginForgotPassword = (DCTextView) view.findViewById(R.id.tv_login_forgot_password);
    tvLoginForgotPassword.setOnClickListener(this);

    return view;
}
 
Example 36
Project: aftercare-app-android   File: DCRoutineCompletedFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_routine_completed, container);
    fbShare = (ShareButton) view.findViewById(R.id.fb_share);
    tvMessage = (DCTextView) view.findViewById(R.id.tv_message);
    tvCompleted = (DCTextView) view.findViewById(R.id.tv_completed);
    ivTooth = (ImageView) view.findViewById(R.id.iv_tooth);

    if (getArguments() != null) {
        final Routine.Type routineType = (Routine.Type)getArguments().getSerializable(KEY_ROUTINE_TYPE);

        if (routineType != null) {
            AudibleMessage audibleMessage;
            String shareLinkMessage;

            switch (routineType) {
                case MORNING:
                    shareLinkMessage = getString(R.string.fb_share_morning_routine_completed);
                    audibleMessage = AudibleMessage.MORNING_ROUTINE_END;
                    break;
                default:
                    shareLinkMessage = getString(R.string.fb_share_evening_routine_completed);
                    audibleMessage = AudibleMessage.EVENING_ROUTINE_END;
                    break;
            }

            tvMessage.setText(audibleMessage.getMessage(getActivity()));

            ShareLinkContent shareLinkContent = new ShareLinkContent.Builder()
                    .setContentUrl(Uri.parse(DCConstants.DENTACARE_GOOGLE_PLAY))
                    .setShareHashtag(new ShareHashtag.Builder()
                            .setHashtag("#dentacoin")
                            .build())
                    .setQuote(shareLinkMessage)
                    .build();

            fbShare.setShareContent(shareLinkContent);

            if (audibleMessage.getVoices() != null && audibleMessage.getVoices().length > 0) {
                DCSoundManager.getInstance().playVoice(getActivity(), audibleMessage.getVoices()[0]);
            }
        }
    }

    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
    alphaAnimation.setDuration(1000);
    ivTooth.startAnimation(alphaAnimation);

    AlphaAnimation dayAlphaAnimation = new AlphaAnimation(0f, 1f);
    dayAlphaAnimation.setDuration(2000);
    tvCompleted.startAnimation(dayAlphaAnimation);

    AlphaAnimation alphaAnimationMessage = new AlphaAnimation(0f, 1f);
    alphaAnimationMessage.setDuration(1000);
    tvMessage.startAnimation(alphaAnimationMessage);

    return view;
}
 
Example 37
Project: letv   File: AlbumBaseControllerFragment.java   View source code 5 votes vote down vote up
protected void startBreath() {
    if (this.mVideoShotButton != null) {
        Animation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        alphaAnimation.setDuration(500);
        alphaAnimation.setInterpolator(new LinearInterpolator());
        alphaAnimation.setRepeatCount(-1);
        alphaAnimation.setRepeatMode(2);
        this.mVideoShotButton.startAnimation(alphaAnimation);
        this.mHandler.sendEmptyMessageDelayed(258, 10000);
    }
}
 
Example 38
Project: social-app-android   File: ExpandableTextView.java   View source code 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static void applyAlphaAnimation(View view, float alpha) {
    if (isPostHoneycomb()) {
        view.setAlpha(alpha);
    } else {
        AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
        // make it instant
        alphaAnimation.setDuration(0);
        alphaAnimation.setFillAfter(true);
        view.startAnimation(alphaAnimation);
    }
}
 
Example 39
Project: MaterialChipsInput   File: DetailedChipView.java   View source code 5 votes vote down vote up
/**
 * Fade out
 */
public void fadeOut() {
    AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(200);
    startAnimation(anim);
    setVisibility(GONE);
    // fix onclick issue
    clearFocus();
    setClickable(false);
}
 
Example 40
Project: UiLib   File: ArcMenu.java   View source code 5 votes vote down vote up
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);

    return animationSet;
}