/** 启动淡出动画</br> */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void startFadeOutAnimForTopicTipView() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (mTopicTipView.getAlpha() < 0.1f) { return; } } AlphaAnimation alphaAnimationOut = new AlphaAnimation(1.0f, 0); alphaAnimationOut.setDuration(300); alphaAnimationOut.setFillAfter(true); mTopicTipView.startAnimation(alphaAnimationOut); }
/** 初始化相关View */ protected void initViews() { // 发送和回退按钮 findViewById(ResFinder.getId("umeng_comm_post_ok_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_post_back_btn")).setOnClickListener(this); mLocProgressBar = (ProgressBar) findViewById(ResFinder.getId("umeng_comm_post_loc_progressbar")); mLocIcon = (ImageView) findViewById(ResFinder.getId("umeng_comm_post_loc_icon")); mLocIcon.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { initLocationLayout(); } }); mLocationTv = (TextView) findViewById(ResFinder.getId("umeng_comm_location_text")); mLocationLayout = findViewById(ResFinder.getId("umeng_community_loc_layout")); initEditView(); // 以下四个按钮分别是选择话题、添加图片、选择位置、@好友 findViewById(ResFinder.getId("umeng_comm_take_photo_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_select_location_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_at_friend_btn")).setOnClickListener(this); mPhotoButton = (ImageButton) findViewById(ResFinder.getId("umeng_comm_add_image_btn")); mPhotoButton.setOnClickListener(this); mTopicButton = (ToggleButton) findViewById(ResFinder.getId("umeng_comm_pick_topic_btn")); mTopicButton.setOnClickListener(this); mFragmentLatout = (FrameLayout) findViewById(ResFinder.getId("umeng_comm_select_layout")); mGridView = (GridView) findViewById(ResFinder.getId("umeng_comm_prev_images_gv")); initSelectedImageAdapter(); mTopicTipView = (TopicTipView) findViewById(ResFinder.getId("umeng_comm_topic_tip")); if (CommConfig.getConfig().loginedUser.gender == Gender.FEMALE) { // 根据性别做不同的提示 mTopicTipView.setText(ResFinder.getString("umeng_comm_topic_tip_female")); } if (!isForwardFeed) { startAnimationForTopicTipView(); } }
/** 为话题提示VIew绑定动画</br> */ private void startAnimationForTopicTipView() { int timePiece = 500; int repeatCount = 4; int startDeny = 50; TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 10, 0); translateAnimation.setRepeatMode(Animation.REVERSE); // translateAnimation.setStartOffset(startDeny * repeatCount+timePiece); translateAnimation.setRepeatCount(Integer.MAX_VALUE); translateAnimation.setDuration(timePiece); AlphaAnimation alphaAnimationIn = new AlphaAnimation(0, 1.0f); alphaAnimationIn.setDuration(timePiece); alphaAnimationIn.setStartOffset(startDeny * repeatCount); AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(alphaAnimationIn); animationSet.addAnimation(translateAnimation); // animationSet.addAnimation(alphaAnimationOut); // animationSet.setFillAfter(true); mTopicTipView.startAnimation(animationSet); }