public void checkIfWon() { TextView winner = (TextView) findViewById(R.id.winnerText); for (int[] winningPositions : winningCombinations) { if (spots[winningPositions[0]] == spots[winningPositions[1]] && spots[winningPositions[1]] == spots[winningPositions[2]] && spots[winningPositions[0]] != 2) { String playerColor; if (spots[winningPositions[1]] == 1) { playerColor = "Red"; } else { playerColor = "Yellow"; } winningLayout.setVisibility(View.VISIBLE); winningLayout.animate().translationXBy(1000f).setDuration(200); winner.setText(playerColor + " Player Won!"); gameIsActive = false; } else { boolean gameIsOver = true; for (int i : spots) { if (i == 2) gameIsOver = false; } if (gameIsOver) { winningLayout.animate().translationXBy(1000f).setDuration(200); winner.setText("Draw, Play Again!"); } } } }
private void setControlVisibility(boolean visible) { mControlHolder.clearAnimation(); if (visible) { mControlHolder.animate().translationY(0).setDuration(300).start(); } else { mControlHolder.animate().translationY(mControlHolder.getHeight()).setDuration(300).start(); } }
public void closeRegisterAnimation() { rootForm.animate().scaleY(1f).start(); mEmail.animate().translationY(5).start(); mName .animate() .setListener( new AnimatorWithBeerListener() { @Override public void onAnimationStart(Animator animation) {} @Override public void onAnimationEnd(Animator animation) { LoginView.this.mName.setVisibility(GONE); } }) .alpha(0); mPhoneNumer .animate() .setListener( new AnimatorWithBeerListener() { @Override public void onAnimationStart(Animator animation) {} @Override public void onAnimationEnd(Animator animation) { LoginView.this.mPhoneNumer.setVisibility(GONE); } }) .alpha(0); mPassword.animate().translationY(-5).start(); buttonsPanel.animate().translationY(-5).start(); }
private void searchBarAnimation( final LinearLayout fadeoutElement, final LinearLayout fadeInElement) { fadeoutElement.setAlpha(1); fadeoutElement .animate() .setDuration(1000) .alpha(0) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { fadeoutElement.setVisibility(View.GONE); fadeInElement.setVisibility(View.VISIBLE); fadeInElement.setAlpha(0); fadeInElement .animate() .setDuration(1000) .alpha(1) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { fadeInElement.setVisibility(View.VISIBLE); } }); } }); }
private void animateContent() { botAdapter.updateItems(); llAddComment .animate() .translationY(0) .setInterpolator(new DecelerateInterpolator()) .setDuration(200) .start(); }
private void updateDetailsContent() { mProgressWheel.setVisibility(View.GONE); mContentView.setVisibility(View.VISIBLE); mContentView.animate().alphaBy(0f).alpha(1f).setDuration(1500).start(); mTitleText.setText(TextUtils.isEmpty(book.titleJP) ? book.title : book.titleJP); if (isFromExternal) { new CoverTask().execute(book); } checkIsDownloaded(); setUpShareAction(); updatePreviewList(); updateTagsContent(); }
@Override public void onBackPressed() { contentRoot .animate() .translationY(Utils.getScreenHeight(this)) .setDuration(200) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { BotActivity.super.onBackPressed(); overridePendingTransition(0, 0); } }) .start(); }
private void startIntroAnimation() { contentRoot.setScaleY(0.1f); contentRoot.setPivotY(drawingStartLocation); llAddComment.setTranslationY(200); contentRoot .animate() .scaleY(1) .setDuration(200) .setInterpolator(new AccelerateInterpolator()) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { animateContent(); } }) .start(); }
public void showProgress(final boolean show) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. // TODO // com.example.cherry_zhang.juver.Activities.Application.LoginAndRegistration.LoginAndRegistrationActivity.pageIndicator.setVisibility(show ? View.GONE : View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { LoginAndRegistrationActivity.pageIndicator.setVisibility(show ? View.GONE : View.VISIBLE); int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); LL_loginForm.setVisibility(show ? View.GONE : View.VISIBLE); LL_loginForm.animate() .setDuration(shortAnimTime) .alpha(show ? 0 : 1) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { LL_loginForm.setVisibility(show ? View.GONE : View.VISIBLE); } }); PV_progressBar.setVisibility(show ? View.VISIBLE : View.GONE); PV_progressBar.animate() .setDuration(shortAnimTime) .alpha(show ? 1 : 0) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { PV_progressBar.setVisibility(show ? View.VISIBLE : View.GONE); } }); } else { // The ViewPropertyAnimator APIs are not available, so simply show // and hide the relevant UI components. PV_progressBar.setVisibility(show ? View.VISIBLE : View.GONE); LL_loginForm.setVisibility(show ? View.GONE : View.VISIBLE); } }
/** Shows the progress UI and hides the register form. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) private void showProgress(final boolean show) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getContext().getResources().getInteger(android.R.integer.config_shortAnimTime); garageProgress.setVisibility(View.VISIBLE); garageProgress .animate() .setDuration(shortAnimTime) .alpha(show ? 1 : 0) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { garageProgress.setVisibility(show ? View.VISIBLE : View.GONE); } }); garageForm.setVisibility(View.VISIBLE); garageForm .animate() .setDuration(shortAnimTime) .alpha(show ? 0 : 1) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { garageForm.setVisibility(show ? View.GONE : View.VISIBLE); } }); } else { // The ViewPropertyAnimator APIs are not available, so simply show // and hide the relevant UI components. garageProgress.setVisibility(show ? View.VISIBLE : View.GONE); garageForm.setVisibility(show ? View.GONE : View.VISIBLE); } }