public void hideMenu(View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      final int cx = (settingsMenuButton.getLeft() + settingsMenuButton.getRight()) / 2;
      final int cy =
          ((settingsMenuButton.getTop() + settingsMenuButton.getBottom()) / 2)
              - settingsMenu.getTop();

      Log.i("", "Circle center " + cx + ", " + cy + " width " + bottomView.getWidth());

      final Animator anim =
          ViewAnimationUtils.createCircularReveal(settingsMenu, cx, cy, bottomView.getWidth(), 0);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              settingsMenu.setVisibility(View.INVISIBLE);
              settingsMenuButton.setVisibility(View.VISIBLE);
            }
          });

      anim.start();
    } else {
      settingsMenuButton.setVisibility(View.VISIBLE);
      settingsMenu.setVisibility(View.INVISIBLE);
    }
  }
Esempio n. 2
0
 void hide() {
   Xlog.i(TAG, "bottom bar hide(), showing: " + mShowing);
   if (mUseQuickControls || mUseFullScreen) {
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
     this.setVisibility(View.GONE);
     mShowing = false;
     return;
   } else {
     this.setVisibility(View.VISIBLE);
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     Xlog.i(TAG, "hide(): visibleHeight: " + visibleHeight);
     Xlog.i(TAG, "hide(): startPos: " + startPos);
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
   }
   mShowing = false;
 }
Esempio n. 3
0
  public void swapPanels() {
    final View toShow, toHide;
    if (mSettingsView == null) {
      addSettingsView();
      toShow = mSettingsView;
      toHide = mNotificationScroller;
    } else {
      toShow = mNotificationScroller;
      toHide = mSettingsView;
    }
    Animator a = ObjectAnimator.ofFloat(toHide, "alpha", 1f, 0f).setDuration(PANEL_FADE_DURATION);
    a.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator _a) {
            toHide.setVisibility(View.GONE);
            if (toShow != null) {
              toShow.setVisibility(View.VISIBLE);
              if (toShow == mSettingsView || mNotificationCount > 0) {
                ObjectAnimator.ofFloat(toShow, "alpha", 0f, 1f)
                    .setDuration(PANEL_FADE_DURATION)
                    .start();
              }

              if (toHide == mSettingsView) {
                removeSettingsView();
              }
            }
            updateClearButton();
            updatePanelModeButtons();
          }
        });
    a.start();
  }
  private void animateDismiss(final Runnable doAfter) {
    // the animation can only work (and is only worth doing) if this fragment is added
    // reasons it may not be added: fragment is being destroyed, or in the process of being
    // restored
    if (!mFragment.isAdded()) {
      mBackgroundView.setVisibility(View.GONE);
      return;
    }

    UtilsEx.enableHardwareLayer(mBackgroundView);
    final Animator animator =
        AnimatorInflater.loadAnimator(
            mFragment.getActivity().getApplicationContext(), R.anim.fade_out);
    animator.setTarget(mBackgroundView);
    animator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mBackgroundView.setVisibility(View.GONE);
            mBackgroundView.setLayerType(View.LAYER_TYPE_NONE, null);
            if (doAfter != null) {
              doAfter.run();
            }
          }
        });
    animator.start();
  }
  private void hide(final View myView) {
    // get the center for the clipping circle
    int cx = myView.getWidth() / 2;
    int cy = myView.getHeight() / 2;

    // get the initial radius for the clipping circle
    int initialRadius = myView.getWidth();

    // create the animation (the final radius is zero)
    Animator anim = null;
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
      anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, 0);
    }

    // make the view invisible when the animation is done
    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
          }
        });

    // start the animation
    if (anim != null) {
      anim.start();
    }
  }
Esempio n. 6
0
  // Layout showing effect(using CircularReveal)
  private void showLayout(int viewId, int viewId2) {
    final View myView = findViewById(viewId);
    View myView2 = findViewById(viewId2);

    if (android.os.Build.VERSION.SDK_INT > 20) {

      int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

      int cx = (myView2.getLeft() + myView2.getRight()) / 2;
      int cy = (myView2.getTop() + myView2.getBottom()) / 2;

      Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
      anim.setDuration(500);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              if (gameStatus == GAME_GOGAME) {
                gameStatus = GAME_WAITING;
              }
            }
          });

      myView.setVisibility(View.VISIBLE);
      myView.setAlpha(1);
      anim.start();
    } else {
      myView.setVisibility(View.VISIBLE);
      if (gameStatus == GAME_GOGAME) {
        gameStatus = GAME_WAITING;
      }
    }
  }
Esempio n. 7
0
  public void propertyValuesHolder(View view) {
    Log.i("tag", "动画已经被执行");
    PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 1f);
    PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 1f);
    PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 1f);
    Animator objectAnimator =
        ObjectAnimator.ofPropertyValuesHolder(view, pvhX, pvhY, pvhZ).setDuration(2000);
    objectAnimator.start();
    objectAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            if (mFirst) {
              turn2Activity(New_login.this, WelcomeActivity.class);
            } else {
              turn2Activity(New_login.this, NewMain.class);
              overridePendingTransition(R.anim.push_center_in, R.anim.push_center_out);
            }
            finish();
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
  }
 public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
   if (mAnimator != null) {
     mAnimator.cancel();
   }
   final int w = mDetail.getWidth() - x;
   final int h = mDetail.getHeight() - y;
   int innerR = 0;
   if (x < 0 || w < 0 || y < 0 || h < 0) {
     innerR = Math.abs(x);
     innerR = Math.min(innerR, Math.abs(y));
     innerR = Math.min(innerR, Math.abs(w));
     innerR = Math.min(innerR, Math.abs(h));
   }
   int r = (int) Math.ceil(Math.sqrt(x * x + y * y));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + y * y)));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + h * h)));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(x * x + h * h)));
   if (in) {
     mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, innerR, r);
   } else {
     mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, innerR);
   }
   mAnimator.setDuration((long) (mAnimator.getDuration() * 1.5));
   if (listener != null) {
     mAnimator.addListener(listener);
   }
   if (in) {
     mBackground.startTransition((int) (mAnimator.getDuration() * 0.6));
     mAnimator.addListener(mVisibleOnStart);
   } else {
     mDetail.postDelayed(mReverseBackground, (long) (mAnimator.getDuration() * 0.65));
     mAnimator.addListener(mGoneOnEnd);
   }
   mAnimator.start();
 }
Esempio n. 9
0
  @Override
  public void call(final Subscriber<? super Void> subscriber) {
    checkUiThread();
    AnimatorListenerAdapter adapter =
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            subscriber.onNext(null);
            Logger.d("onAnimationStart");
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            subscriber.onCompleted();
            Logger.d("onAnimationEnd");
          }
        };

    animator.addListener(adapter);
    animator.start(); // 先绑定监听器再开始
    //        subscriber.add(new MainThreadSubscription() {
    //            @Override protected void onUnsubscribe() {
    //               animator.removeAllListeners();
    //            }
    //        });
  }
Esempio n. 10
0
 @Override
 public void onActivated(Uri rideUri) {
   if (!rideUri.equals(mRideUri)) return;
   mChkRecord.setChecked(true, false);
   mChkRecordText.setText(R.string.display_chkRecord_active);
   if (!mChkRecordTextAnimator.isStarted()) mChkRecordTextAnimator.start();
 }
 /**
  * make animation to start or end when target view was be Visible or Gone or Invisible. make
  * animation to cancel when target view be onDetachedFromWindow.
  *
  * @param animStatus
  */
 public void setAnimationStatus(AnimStatus animStatus) {
   if (mAnimators == null) {
     return;
   }
   int count = mAnimators.size();
   for (int i = 0; i < count; i++) {
     Animator animator = mAnimators.get(i);
     boolean isRunning = animator.isRunning();
     switch (animStatus) {
       case START:
         if (!isRunning) {
           animator.start();
         }
         break;
       case END:
         if (isRunning) {
           animator.end();
         }
         break;
       case CANCEL:
         if (isRunning) {
           animator.cancel();
         }
         break;
     }
   }
 }
Esempio n. 12
0
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
    RideCursor c = (RideCursor) cursor;

    // Title (name / date)
    TextView txtTitle = ViewHolder.get(view, R.id.txtTitle);
    String name = c.getName();
    long createdDateLong = c.getCreatedDate().getTime();
    String createdDateTimeStr =
        DateUtils.formatDateTime(
            context, createdDateLong, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME);
    if (name == null) {
      txtTitle.setText(createdDateTimeStr);
    } else {
      txtTitle.setText(name + "\n" + createdDateTimeStr);
    }

    // Summary
    TextView txtSummary = ViewHolder.get(view, R.id.txtSummary);
    CharSequence details = null;
    Animator animator = (Animator) view.getTag(R.id.animator);
    // Cancel the animation / reset the alpha in any case
    if (animator != null) animator.cancel();
    txtSummary.setAlpha(1);
    RideState rideState = c.getState();
    switch (rideState) {
      case CREATED:
        details = context.getString(R.string.ride_list_notStarted);
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(false);
        break;

      case ACTIVE:
        details = context.getString(R.string.ride_list_active);
        if (animator == null) {
          animator = AnimatorInflater.loadAnimator(context, R.animator.blink);
          animator.setTarget(txtSummary);
          view.setTag(R.id.animator, animator);
        }
        animator.start();
        txtSummary.setTextColor(mColorActive);
        txtSummary.setEnabled(true);
        break;

      case PAUSED:
        // Distance
        float distance = c.getDistance();
        details = TextUtils.concat(UnitUtil.formatDistance(distance, true, .85f, false), "  -  ");

        // Duration
        long duration = c.getDuration();
        details = TextUtils.concat(details, DateTimeUtil.formatDuration(context, duration));
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(true);
        break;
    }
    txtSummary.setText(details);
  }
 private void showMessage(int duration) {
   if (duration > 0) {
     Animator anim = ObjectAnimator.ofFloat(this, "alpha", 1f);
     anim.setDuration(duration);
     anim.start();
   } else {
     setAlpha(1f);
   }
 }
Esempio n. 14
0
  /**
   * 根据当前scrollX的位置判断是展开还是折叠
   *
   * @param velocityX 如果不等于0那么这是一次fling事件,否则是一次ACTION_UP或者ACTION_CANCEL
   */
  private boolean smoothHorizontalExpandOrCollapse(float velocityX) {

    int scrollX = mTargetView.getScrollX();
    int scrollRange = getHorizontalRange();

    if (mExpandAndCollapseAnim != null) return false;

    int to = 0;
    int duration = DEFAULT_DURATION;

    if (velocityX == 0) {
      // 如果已经展一半,平滑展开
      if (scrollX > scrollRange / 2) {
        to = scrollRange;
      }
    } else {

      if (velocityX > 0) to = 0;
      else to = scrollRange;

      duration = (int) ((1.f - Math.abs(velocityX) / mMaxVelocity) * DEFAULT_DURATION);
    }

    if (to == scrollX) return false;

    mExpandAndCollapseAnim = ObjectAnimator.ofInt(mTargetView, "scrollX", to);
    mExpandAndCollapseAnim.setDuration(duration);
    mExpandAndCollapseAnim.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            mExpandAndCollapseAnim = null;
            if (isCollapsed()) mTargetView = null;

            Log.d(TAG, "onAnimationEnd");
          }

          @Override
          public void onAnimationCancel(Animator animation) {
            // onAnimationEnd(animation);
            mExpandAndCollapseAnim = null;

            Log.d(TAG, "onAnimationCancel");
          }

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    mExpandAndCollapseAnim.start();

    return true;
  }
  /** Redraws default text with circle animation. */
  private void reDrawDefaultLayout() {
    int cx = mDefaultText.getMeasuredWidth() / 2;
    int cy = mDefaultText.getMeasuredHeight() / 2;

    int finalRadius = Math.max(mDefaultText.getWidth(), mDefaultText.getHeight()) / 2;

    Animator anim = ViewAnimationUtils.createCircularReveal(mDefaultText, cx, cy, 0, finalRadius);

    mDefaultText.setVisibility(View.VISIBLE);
    anim.start();
  }
 protected void play(Animator animator) {
   mCurrentAnimator = animator;
   animator.addListener(
       new AnimationFinishedListener() {
         @Override
         public void onAnimationFinished() {
           mCurrentAnimator = null;
         }
       });
   animator.start();
 }
  // testing animation class
  private void animateRevealShow(View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
    viewRoot.setVisibility(View.VISIBLE);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
  }
 @Override
 public void start() {
   final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
   final int size = animators.size();
   for (int i = 0; i < size; i++) {
     final Animator animator = animators.get(i);
     if (!animator.isStarted()) {
       animator.start();
     }
   }
   invalidateSelf();
 }
Esempio n. 19
0
 public void setQuiescentAlpha(float alpha, boolean animate) {
   mAnimateToQuiescent.cancel();
   alpha = Math.min(Math.max(alpha, 0), 1);
   if (alpha == mQuiescentAlpha && alpha == mDrawingAlpha) return;
   mQuiescentAlpha = alpha;
   if (DEBUG) Log.d(TAG, "New quiescent alpha = " + mQuiescentAlpha);
   if (animate) {
     mAnimateToQuiescent = animateToQuiescent();
     mAnimateToQuiescent.start();
   } else {
     setDrawingAlpha(mQuiescentAlpha);
   }
 }
  private void reveal(View toggleView, View btnView, int cx, int cy, int finalRadius) {
    // create the animator for this view (the start radius is zero)
    Animator anim = null;
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
      anim = ViewAnimationUtils.createCircularReveal(toggleView, cx, cy, 0, finalRadius);
    }

    // make the view visible and start the animation
    toggleView.setVisibility(View.VISIBLE);
    if (anim != null) {
      anim.start();
    }
  }
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  private Animator circularRevealActivity(View rootView, int cx, int cy, boolean show) {
    float maxRadius = Math.max(rootView.getWidth(), rootView.getHeight());
    float startRadius = show ? 0 : maxRadius;
    float endRadius = show ? maxRadius : 0;

    // create the animator for this view (the start radius is zero)
    Animator circularReveal =
        ViewAnimationUtils.createCircularReveal(rootView, cx, cy, startRadius, endRadius);
    circularReveal.setDuration(animationTime);

    // make the view visible and start the animation
    rootView.setVisibility(View.VISIBLE);
    circularReveal.start();
    return circularReveal;
  }
Esempio n. 22
0
  /** 为 myView 自身添加显示隐藏的动画 */
  @SuppressLint("NewApi")
  private static void actionVisible(
      final boolean isShow, final View myView, float miniRadius, long durationMills) {
    // 版本判断
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
      if (isShow) myView.setVisibility(View.VISIBLE);
      else myView.setVisibility(View.INVISIBLE);
      return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int maxRadius = (int) Math.sqrt(w * w + h * h) + 1;

    float startRadius, endRadius;
    if (isShow) {
      // -< 从小到大
      startRadius = miniRadius;
      endRadius = maxRadius;
    } else {
      // >- 从大到校
      startRadius = maxRadius;
      endRadius = miniRadius;
    }

    Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, endRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);

    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            // 无论显示还是隐藏,都应当在动画结束后执行。
            if (isShow) myView.setVisibility(View.VISIBLE);
            else myView.setVisibility(View.INVISIBLE);
          }
        });

    anim.start();
  }
 public void showVoteColor(boolean showAnimation) {
   final Animator animator;
   switch (voteState) {
     case UP:
       {
         animator = VoteAnimation.voteUpTextColorAnimation(this);
         break;
       }
     default:
       animator = VoteAnimation.voteUpReverseTextColorAnimation(this);
       break;
   }
   if (!showAnimation) {
     animator.setDuration(0);
   }
   animator.start();
 }
 private void runAnimation(
     final ViewGroup container,
     final View from,
     final View to,
     Flow.Direction direction,
     final Flow.TraversalCallback callback) {
   Animator animator = createSegue(from, to, direction);
   animator.addListener(
       new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
           container.removeView(from);
           callback.onTraversalCompleted();
         }
       });
   animator.start();
 }
 private void hide(boolean animate) {
   AnimatorListenerAdapter onEnd =
       new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator _a) {
           DropZone.this.setTranslationY(getHeight() + 2);
           DropZone.this.setAlpha(0f);
         }
       };
   if (animate) {
     Animator a = ObjectAnimator.ofFloat(this, "alpha", getAlpha(), 0f);
     a.addListener(onEnd);
     a.start();
   } else {
     onEnd.onAnimationEnd(null);
   }
 }
  public void fadeFrame(Object caller, boolean takeControl, float alpha, int duration) {
    if (takeControl) {
      mBgAlphaController = caller;
    }

    if (mBgAlphaController != caller && mBgAlphaController != null) {
      return;
    }

    if (mFrameFade != null) {
      mFrameFade.cancel();
      mFrameFade = null;
    }
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", alpha);
    mFrameFade = ObjectAnimator.ofPropertyValuesHolder(this, bgAlpha);
    mFrameFade.setDuration(duration);
    mFrameFade.start();
  }
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  private void contractLollipop(int x, int y, float startRadius, float endRadius) {

    Animator toolbarContractAnim =
        ViewAnimationUtils.createCircularReveal(mFabExpandLayout, x, y, startRadius, endRadius);
    toolbarContractAnim.setDuration(startAnimationDuration);

    toolbarContractAnim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            contractAnimationEnd();
          }
        });

    toolbarContractAnim.start();
  }
Esempio n. 28
0
  // Layout hiding effect(using CircularReveal)
  private void hideLayout(int viewId, int viewId2) {

    final View myView = findViewById(viewId);
    View myView2 = findViewById(viewId2);

    if (android.os.Build.VERSION.SDK_INT > 20) {

      int initialRadius = myView.getWidth();

      int cx = (myView2.getLeft() + myView2.getRight()) / 2;
      int cy = (myView2.getTop() + myView2.getBottom()) / 2;

      Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, 0);
      // anim.setStartDelay(200);
      anim.setDuration(500);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              myView.setVisibility(View.INVISIBLE);
              if (gameStatus == GAME_LOADING) showMenu();
              else if (gameStatus == GAME_GOMENU) {
                hideView(R.id.back);
                hideView(R.id.restart);
                hideView(R.id.share);
                gameStatus = GAME_MENU;
              }
            }
          });

      anim.start();
    } else {
      myView.setVisibility(View.INVISIBLE);
      if (gameStatus == GAME_LOADING) showMenu();
      else if (gameStatus == GAME_GOMENU) {
        hideView(R.id.back);
        hideView(R.id.restart);
        hideView(R.id.share);
        gameStatus = GAME_MENU;
      }
    }
  }
Esempio n. 29
0
 void hide() {
   if (mUseQuickControls) {
     mParent.removeView(this);
   } else {
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       mTitleBarAnimator =
           ObjectAnimator.ofFloat(
               this, "translationY", getTranslationY(), (-getEmbeddedHeight() + visibleHeight));
       mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     } else {
       mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
     }
   }
   mShowing = false;
 }
Esempio n. 30
0
  /**
   * ***********************************
   *
   * <p>ActionsCode(author:hexibin, change_code)
   */
  void show() {
    cancelTitleBarAnimation(false);
    if (mUseQuickControls || mSkipTitleBarAnimations) {
      // ActionsCode(hexibin, bugfix BUG00297099)
      // this.setVisibility(View.VISIBLE);

      this.setTranslationY(0);
    } else {
      int visibleHeight = getVisibleTitleHeight();
      float startPos = (-getEmbeddedHeight() + visibleHeight);
      if (getTranslationY() != 0) {
        startPos = Math.max(startPos, getTranslationY());
      }
      mTitleBarAnimator = ObjectAnimator.ofFloat(this, "translationY", startPos, 0);
      setupTitleBarAnimator(mTitleBarAnimator);
      mTitleBarAnimator.start();
    }
    mShowing = true;
  }