/** Show the label using an animation */ private void showLabel() { mLabel.setVisibility(View.VISIBLE); mLabel.setAlpha(0f); mLabel.setTranslationY(mLabel.getHeight()); mLabel .animate() .alpha(1f) .translationY(0f) .setDuration(ANIMATION_DURATION) .setListener(null) .start(); }
/** Hide the label using an animation */ private void hideLabel() { mLabel.setAlpha(1f); mLabel.setTranslationY(0f); mLabel .animate() .alpha(0f) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLabel.setVisibility(View.GONE); } }) .start(); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onAnimationStart(Animation animation) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) indexText.setTranslationY(0); indexText.setVisibility(View.VISIBLE); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onAnimationEnd(Animation animation) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) indexText.setTranslationY(indexText.getHeight()); indexText.setVisibility(View.GONE); }