java类android.view.animation.AlphaAnimation的实例源码

TeamEventActivity.java 文件源码 项目:Nimbus 阅读 25 收藏 0 点赞 0 评论 0
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);
}
AlertView.java 文件源码 项目:mapbox-navigation-android 阅读 35 收藏 0 点赞 0 评论 0
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));
}
KJAnimations.java 文件源码 项目:OSchina_resources_android 阅读 32 收藏 0 点赞 0 评论 0
/**
 * 透明度 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;
}
DCWelcomeFragment.java 文件源码 项目:aftercare-app-android 阅读 29 收藏 0 点赞 0 评论 0
@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;
}
DCLoginFragment.java 文件源码 项目:aftercare-app-android 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
DCRoutineCompletedFragment.java 文件源码 项目:aftercare-app-android 阅读 30 收藏 0 点赞 0 评论 0
@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;
}
AlbumBaseControllerFragment.java 文件源码 项目:letv 阅读 31 收藏 0 点赞 0 评论 0
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);
    }
}
ExpandableTextView.java 文件源码 项目:social-app-android 阅读 28 收藏 0 点赞 0 评论 0
@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);
    }
}
DetailedChipView.java 文件源码 项目:MaterialChipsInput 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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);
}
ArcMenu.java 文件源码 项目:UiLib 阅读 29 收藏 0 点赞 0 评论 0
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;
}


问题


面经


文章

微信
公众号

扫码关注公众号