Beispiel #1
0
 /**
  * Configured the sliding menu view to peek the content or not.
  *
  * @param slidingTabEnabled true to peek the content
  */
 public void setSlidingTabEnabled(boolean slidingTabEnabled) {
   if (slidingTabEnabled) {
     mSlidingMenu.setBehindOffset(Units.dpToPx(this, 48));
   } else {
     mSlidingMenu.setBehindOffset(0);
   }
 }
Beispiel #2
0
  private void updateButtonState(SendButtonState buttonState) {
    if (mButtonState != buttonState) {
      mButtonState = buttonState;

      float translation = Units.dpToPx(mContext, 14) / 3;
      float barRotation1 = mButtonBar1.getRotation();
      float barTranslation1 = mButtonBar1.getTranslationY();
      float barRotation2 = mButtonBar2.getRotation();
      float barTranslation2 = mButtonBar2.getTranslationY();
      float barRotationTarget1 = mButtonState == SendButtonState.ATTACH ? 0 : 225;
      float barTranslationTarget1 = mButtonState == SendButtonState.SEND ? -translation : 0;
      float barRotationTarget2 = mButtonState == SendButtonState.ATTACH ? 90 : 135;
      float barTranslationTarget2 = mButtonState == SendButtonState.SEND ? translation : 0;

      ObjectAnimator.ofFloat(mButtonBar1, "rotation", barRotation1, barRotationTarget1)
          .setDuration(ANIMATION_DURATION)
          .start();
      ObjectAnimator.ofFloat(mButtonBar2, "rotation", barRotation2, barRotationTarget2)
          .setDuration(ANIMATION_DURATION)
          .start();
      ObjectAnimator.ofFloat(mButtonBar1, "translationY", barTranslation1, barTranslationTarget1)
          .setDuration(ANIMATION_DURATION)
          .start();
      ObjectAnimator.ofFloat(mButtonBar2, "translationY", barTranslation2, barTranslationTarget2)
          .setDuration(ANIMATION_DURATION)
          .start();
    }
  }