title: Animation on android make device to lag
body: <p>I need some information why my animation are making devices to lag. The current problem is seen in Samsung Galaxy Tab Pro 8.4'', but in all devices the are slight lags, kaing writing on keyboard heavy. Thank you for your cooperation !!! :)</p>
  
  <p>PS: Thanks Mikael :). Here is some code. Its complicated animation and it contains several parts very similar to this one with combine animation of several views. </p>
  
  <p>CODE :</p>
  
  <pre><code>    mTriangleButton.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
  
              mLearnMore = (LinearLayout) ((LoginActivity) context)
                      .findViewById(R.id.learn_more);
  
              if (mAccNameEmail.isShown()) {
                  // Slider
                  if (BookshelfApp.isTablet(context)) {
  
                      if(getActivity().getResources().getConfiguration().orientation==Configuration.ORIENTATION_LANDSCAPE) {
                          mDeseretLogo.setVisibility(View.VISIBLE);
                          mSquigle.setVisibility(View.VISIBLE);
                          mBorder.setVisibility(View.VISIBLE);
                          imm.toggleSoftInput(InputMethodManager.RESULT_HIDDEN, 0);
  
                      }
  
                      view.animate().translationX(0);
                      view.animate().setDuration(500);
                      mLearnMore.animate().translationX(0);
                      mLearnMore.animate().setDuration(500);
                      mLearnMore.animate().setListener(new Animator.AnimatorListener() {
  
                          @Override
                          public void onAnimationStart(Animator animation) {
                              mLearnMore.setVisibility(View.GONE);
                          }
  
                          @Override
                          public void onAnimationRepeat(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationCancel(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
                      });
  
                      //XXX
                  } else if (!BookshelfApp.isTablet(context)) {
                      mCreateAccFragment.animate().translationY(0);
                      mDeseretLogo.setVisibility(View.VISIBLE);
                      mSquigle.setVisibility(View.VISIBLE);
                      mBorder.setVisibility(View.VISIBLE);
  
                  }
                  mTextHint1.setVisibility(View.VISIBLE);
                  mTextHint2.setVisibility(View.VISIBLE);
                  mTriangleButton.animate().rotation(0);
                  mTriangleButton.animate().setDuration(500);
                  mAccPasswords.setVisibility(View.GONE);
                  mAccNameEmail.setVisibility(View.GONE);
                  mSignUpButton.setBackgroundDrawable(getResources()
                          .getDrawable(R.drawable.sign_up_shape));
                  mSignUpButton.setTextColor(getResources().getColor(
                          R.color.orange));
                  mLoginFormView.setVisibility(View.VISIBLE);
                  mSignInButton.setVisibility(View.VISIBLE);
                  mForgotPasswordView.setVisibility(View.VISIBLE);
                  mCreateAccountQuestion
                          .setText(R.string.acc_question_welcome);
                  mCreateAccountWord.setText(R.string.acc_welcome);
                  mHaveAccountButton.setVisibility(View.GONE);
              } else {
                  // Slider
                  if (BookshelfApp.isTablet(context)) {
  
                      if(getActivity().getResources().getConfiguration().orientation==Configuration.ORIENTATION_LANDSCAPE) {
                          mDeseretLogo.setVisibility(View.GONE);
                          mSquigle.setVisibility(View.GONE);
                          mBorder.setVisibility(View.GONE);
                          imm.toggleSoftInput(InputMethodManager.RESULT_SHOWN, 0);
  
                      }
  
                      view.animate().translationX(-view.getWidth() / 4);
                      view.animate().setDuration(500);
                      mLearnMore.animate().translationX(view.getWidth() / 2);
                      mLearnMore.animate().setDuration(500);
                      mLearnMore.animate().setListener(new Animator.AnimatorListener() {
  
                          @Override
                          public void onAnimationStart(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animator animation) {
                              mLearnMore.setVisibility(View.VISIBLE);
                          }
  
                          @Override
                          public void onAnimationCancel(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
                      });
                  }
                  //XXX
                  else if (!BookshelfApp.isTablet(context)) {
                      mDeseretLogo.setVisibility(View.GONE);
                      mSquigle.setVisibility(View.GONE);
                      mBorder.setVisibility(View.GONE);
  
                  }
                  mTextHint1.setVisibility(View.GONE);
                  mTextHint2.setVisibility(View.GONE);
                  mLoginFormView.setVisibility(View.GONE);
                  mSignInButton.setVisibility(View.GONE);
                  mForgotPasswordView.setVisibility(View.GONE);
                  mTriangleButton.animate().rotation(180);
                  mTriangleButton.animate().setDuration(300);
                  mAccPasswords.setVisibility(View.VISIBLE);
                  mAccNameEmail.setVisibility(View.VISIBLE);
                  mSignUpButton.setBackgroundDrawable(getResources()
                          .getDrawable(R.drawable.sign_in_shape));
                  mSignUpButton.setTextColor(getResources().getColor(
                          R.color.white));
                  mCreateAccountQuestion.setText(R.string.acc_question);
                  mCreateAccountWord.setText(R.string.acc_done);
                  mHaveAccountButton.setVisibility(View.VISIBLE);
  
              }
          }
      });
  </code></pre>