public void postEnd() { isStart = false; funGameView.postStatus(FunGameView.STATUS_GAME_PREPAR); topMaskView.setTranslationY(topMaskView.getTranslationY() + halfHitBlockHeight); bottomMaskView.setTranslationY(bottomMaskView.getTranslationY() - halfHitBlockHeight); maskReLayout.setAlpha(1.f); topMaskView.setVisibility(View.VISIBLE); bottomMaskView.setVisibility(View.VISIBLE); maskReLayout.setVisibility(View.VISIBLE); }
private void doStart(long delay) { ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight); ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight); ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator); animatorSet.setDuration(800); animatorSet.setStartDelay(delay); animatorSet.start(); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { topMaskView.setVisibility(View.GONE); bottomMaskView.setVisibility(View.GONE); maskReLayout.setVisibility(View.GONE); funGameView.postStatus(FunGameView.STATUS_GAME_PLAY); } }); }
public class OptionBindingAdapter { private boolean mOptionsShowing; @BindingAdapter("android:text") public void setOption(TextView button, String text) { if (text == null) { return; } if (button.getTranslationY() > 0) { button.setText(text); button.setVisibility(View.VISIBLE); button.animate() .translationY(0) .start(); } else { button.animate() .translationY(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, button.getResources().getDisplayMetrics())) .start(); } } }
final TextView tv = (TextView) findViewById(R.id.textView); tv.setTranslationX(tv.getTranslationX() + 10); tv.setTranslationY(tv.getTranslationY() + 10); tv.invalidate();
(mToolbarTextView.getWidth() > newTextWidth ? (originTextWidth - newTextWidth) / 2f : 0); mTitleTextViewPoint[1] = titleTextViewPoint[1] - mTitleTextView.getTranslationY();