Exemplo n.º 1
0
 // robi
 public void showFloater() {
   if (!isInEditMode()) {
     mThumb.animateToPressed();
     mIndicator.showIndicator(this, mThumb.getBounds());
     notifyBubble(true);
   }
 }
Exemplo n.º 2
0
 private void updateProgressFromAnimation(float scale) {
   Rect bounds = mThumb.getBounds();
   int halfThumb = bounds.width() / 2;
   int addedThumb = mAddedTouchBounds;
   int left = getPaddingLeft() + halfThumb + addedThumb;
   int right = getWidth() - (getPaddingRight() + halfThumb + addedThumb);
   int available = right - left;
   int progress = Math.round((scale * (mMax - mMin)) + mMin);
   // we don't want to just call setProgress here to avoid the animation
   // being cancelled,
   // and this position is not bound to a real progress value but
   // interpolated
   if (progress != getProgress()) {
     mValue = progress;
     notifyProgress(mValue, true);
     updateProgressMessage(progress);
   }
   final int thumbPos = (int) (scale * available + 0.5f);
   updateThumbPos(thumbPos);
 }
Exemplo n.º 3
0
  private void updateDragging(MotionEvent ev) {
    setHotspot(ev.getX(), ev.getY());
    int x = (int) ev.getX();
    Rect oldBounds = mThumb.getBounds();
    int halfThumb = oldBounds.width() / 2;
    int addedThumb = mAddedTouchBounds;
    int newX = x - mDraggOffset + halfThumb;
    int left = getPaddingLeft() + halfThumb + addedThumb;
    int right = getWidth() - (getPaddingRight() + halfThumb + addedThumb);
    if (newX < left) {
      newX = left;
    } else if (newX > right) {
      newX = right;
    }

    int available = right - left;
    float scale = (float) (newX - left) / (float) available;
    if (isRtl()) {
      scale = 1f - scale;
    }
    int progress = Math.round((scale * (mMax - mMin)) + mMin);
    setProgress(progress, true);
  }