com.hippo.yorozuya.MathUtils Java Examples

The following examples show how to use com.hippo.yorozuya.MathUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddDeleteDrawable.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
@Override
public void draw(Canvas canvas) {
    Rect bounds = getBounds();
    float canvasRotate;
    if (mVerticalMirror) {
        canvasRotate = MathUtils.lerp(270, 135f, mProgress);
    } else {
        canvasRotate = MathUtils.lerp(0f, 135f, mProgress);
    }

    canvas.save();
    canvas.translate(bounds.centerX(), bounds.centerY());
    canvas.rotate(canvasRotate);
    canvas.drawPath(mPath, mPaint);
    canvas.restore();
}
 
Example #2
Source File: Slider.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
public void setProgress(int progress) {
    progress = MathUtils.clamp(progress, mStart, mEnd);
    int oldProgress = mProgress;
    if (mProgress != progress) {
        mProgress = progress;
        mPercent = MathUtils.delerp(mStart, mEnd, mProgress);
        mTargetProgress = progress;

        if (mProgressAnimation == null) {
            // For init
            mDrawPercent = mPercent;
            mDrawProgress = mProgress;
            updateBubblePosition();
            mBubble.setProgress(mDrawProgress);
        } else {
            startProgressAnimation(mPercent);
        }
        invalidate();
    }
    if (mListener != null) {
        mListener.onSetProgress(this, progress, oldProgress, false, true);
    }
}
 
Example #3
Source File: GalleryActivity.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
/**
 * @param lightness 0 - 200
 */
private void setScreenLightness(boolean enable, int lightness) {
    if (null == mMaskView) {
        return;
    }

    Window w = getWindow();
    WindowManager.LayoutParams lp = w.getAttributes();
    if (enable) {
        lightness = MathUtils.clamp(lightness, 0, 200);
        if (lightness > 100) {
            mMaskView.setColor(0);
            // Avoid BRIGHTNESS_OVERRIDE_OFF,
            // screen may be off when lp.screenBrightness is 0.0f
            lp.screenBrightness = Math.max((lightness - 100) / 100.0f, 0.01f);
        } else {
            mMaskView.setColor(MathUtils.lerp(0xde, 0x00, lightness / 100.0f) << 24);
            lp.screenBrightness = 0.01f;
        }
    } else {
        mMaskView.setColor(0);
        lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
    }
    w.setAttributes(lp);
}
 
Example #4
Source File: FixedAspectImageView.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
private int resolveAdjustedSize(int desiredSize, int minSize, int maxSize,
        int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize =  MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case MeasureSpec.UNSPECIFIED:
            // Parent says we can be as big as we want. Just don't be smaller
            // than min size, and don't be larger than max size.
            result = MathUtils.clamp(desiredSize, minSize, maxSize);
            break;
        case MeasureSpec.AT_MOST:
            // Parent says we can be as big as we want, up to specSize.
            // Don't be larger than specSize, and don't be smaller
            // than min size, and don't be larger than max size.
            result = Math.min(MathUtils.clamp(desiredSize, minSize, maxSize), specSize);
            break;
        case MeasureSpec.EXACTLY:
            // No choice. Do what we are told.
            result = specSize;
            break;
    }
    return result;
}
 
Example #5
Source File: PreciselyClipDrawable.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
public PreciselyClipDrawable(Drawable drawable, int offsetX, int offsetY, int width, int height) {
    super(drawable);
    float originWidth = drawable.getIntrinsicWidth();
    float originHeight = drawable.getIntrinsicHeight();

    if (originWidth <= 0 || originHeight <= 0) {
        // Can not clip
        mClip = false;
    } else {
        mClip = true;
        mScale = new RectF();
        mScale.set(MathUtils.clamp(offsetX / originWidth, 0.0f, 1.0f),
                MathUtils.clamp(offsetY / originHeight, 0.0f, 1.0f),
                MathUtils.clamp((offsetX + width) / originWidth, 0.0f, 1.0f),
                MathUtils.clamp((offsetY + height) / originHeight, 0.0f, 1.0f));
        mTemp = new Rect();
    }
}
 
Example #6
Source File: SpiderQueen.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private SpiderQueen(EhApplication application, @NonNull GalleryInfo galleryInfo) {
    mHttpClient = EhApplication.getOkHttpClient(application);
    mSpiderInfoCache = EhApplication.getSpiderInfoCache(application);
    mGalleryInfo = galleryInfo;
    mSpiderDen = new SpiderDen(mGalleryInfo);

    mWorkerMaxCount = MathUtils.clamp(Settings.getMultiThreadDownload(), 1, 10);
    mPreloadNumber = MathUtils.clamp(Settings.getPreloadImage(), 0, 100);

    for (int i = 0; i < DECODE_THREAD_NUM; i++) {
        mDecodeIndexArray[i] = GalleryPageView.INVALID_INDEX;
    }

    mWorkerPoolExecutor = new ThreadPoolExecutor(mWorkerMaxCount, mWorkerMaxCount,
            0, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>(),
            new PriorityThreadFactory(SpiderWorker.class.getSimpleName(), Process.THREAD_PRIORITY_BACKGROUND));
}
 
Example #7
Source File: AddDeleteDrawable.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
@Override
public void draw(Canvas canvas) {
    Rect bounds = getBounds();
    float canvasRotate;
    if (mVerticalMirror) {
        canvasRotate = MathUtils.lerp(270, 135f, mProgress);
    } else {
        canvasRotate = MathUtils.lerp(0f, 135f, mProgress);
    }

    canvas.save();
    canvas.translate(bounds.centerX(), bounds.centerY());
    canvas.rotate(canvasRotate);


    canvas.drawPath(mPath, mPaint);
    canvas.restore();
}
 
Example #8
Source File: FixedAspectImageView.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
private int resolveAdjustedSize(int desiredSize, int minSize, int maxSize,
        int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize =  MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case MeasureSpec.UNSPECIFIED:
            // Parent says we can be as big as we want. Just don't be smaller
            // than min size, and don't be larger than max size.
            result = MathUtils.clamp(desiredSize, minSize, maxSize);
            break;
        case MeasureSpec.AT_MOST:
            // Parent says we can be as big as we want, up to specSize.
            // Don't be larger than specSize, and don't be smaller
            // than min size, and don't be larger than max size.
            result = Math.min(MathUtils.clamp(desiredSize, minSize, maxSize), specSize);
            break;
        case MeasureSpec.EXACTLY:
            // No choice. Do what we are told.
            result = specSize;
            break;
    }
    return result;
}
 
Example #9
Source File: ImageDrawable.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
private List<Tile> createTileArray() {
    int width = mImageWrapper.getWidth();
    int height = mImageWrapper.getHeight();
    int capacity = MathUtils.clamp(MathUtils.ceilDivide(width, TILE_SIZE) *
            MathUtils.ceilDivide(height, TILE_SIZE), 0, 100);
    List<Tile> tiles = new ArrayList<>(capacity);

    for (int x = 0; x < width; x += TILE_SIZE) {
        int w = Math.min(TILE_SIZE, width - x);
        for (int y = 0; y < height; y += TILE_SIZE) {
            int h = Math.min(TILE_SIZE, height - y);
            Tile tile = new Tile();
            tile.x = x;
            tile.y = y;
            tile.w = w;
            tile.h = h;
            tile.bitmap = sBitmapPool.get(w, h);
            tiles.add(tile);
        }
    }

    return tiles;
}
 
Example #10
Source File: Slider.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
public void setProgress(int progress) {
    progress = MathUtils.clamp(progress, mStart, mEnd);
    int oldProgress = mProgress;
    if (mProgress != progress) {
        mProgress = progress;
        mPercent = MathUtils.delerp(mStart, mEnd, mProgress);
        mTargetProgress = progress;

        if (mProgressAnimation == null) {
            // For init
            mDrawPercent = mPercent;
            mDrawProgress = mProgress;
            updateBubblePosition();
            mBubble.setProgress(mDrawProgress);
        } else {
            startProgressAnimation(mPercent);
        }
        invalidate();
    }
    if (mListener != null) {
        mListener.onSetProgress(this, progress, oldProgress, false, true);
    }
}
 
Example #11
Source File: PreciselyClipDrawable.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public PreciselyClipDrawable(Drawable drawable, int offsetX, int offsetY, int width, int height) {
    super(drawable);
    float originWidth = drawable.getIntrinsicWidth();
    float originHeight = drawable.getIntrinsicHeight();

    if (originWidth <= 0 || originHeight <= 0) {
        // Can not clip
        mClip = false;
    } else {
        mClip = true;
        mScale = new RectF();
        mScale.set(MathUtils.clamp(offsetX / originWidth, 0.0f, 1.0f),
                MathUtils.clamp(offsetY / originHeight, 0.0f, 1.0f),
                MathUtils.clamp((offsetX + width) / originWidth, 0.0f, 1.0f),
                MathUtils.clamp((offsetY + height) / originHeight, 0.0f, 1.0f));
        mTemp = new Rect();
    }
}
 
Example #12
Source File: GalleryActivity.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
/**
 * @param lightness 0 - 200
 */
private void setScreenLightness(boolean enable, int lightness) {
    if (null == mMaskView) {
        return;
    }

    Window w = getWindow();
    WindowManager.LayoutParams lp = w.getAttributes();
    if (enable) {
        lightness = MathUtils.clamp(lightness, 0, 200);
        if (lightness > 100) {
            mMaskView.setColor(0);
            // Avoid BRIGHTNESS_OVERRIDE_OFF,
            // screen may be off when lp.screenBrightness is 0.0f
            lp.screenBrightness = Math.max((lightness - 100) / 100.0f, 0.01f);
        } else {
            mMaskView.setColor(MathUtils.lerp(0xde, 0x00, lightness / 100.0f) << 24);
            lp.screenBrightness = 0.01f;
        }
    } else {
        mMaskView.setColor(0);
        lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
    }
    w.setAttributes(lp);
}
 
Example #13
Source File: Slider.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public void setProgress(int progress) {
    progress = MathUtils.clamp(progress, mStart, mEnd);
    int oldProgress = mProgress;
    if (mProgress != progress) {
        mProgress = progress;
        mPercent = MathUtils.delerp(mStart, mEnd, mProgress);
        mTargetProgress = progress;

        if (mProgressAnimation == null) {
            // For init
            mDrawPercent = mPercent;
            mDrawProgress = mProgress;
            updateBubblePosition();
            mBubble.setProgress(mDrawProgress);
        } else {
            startProgressAnimation(mPercent);
        }
        invalidate();
    }
    if (mListener != null) {
        mListener.onSetProgress(this, progress, oldProgress, false, true);
    }
}
 
Example #14
Source File: FixedAspectImageView.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
private int resolveAdjustedSize(int desiredSize, int minSize, int maxSize,
        int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize =  MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case MeasureSpec.UNSPECIFIED:
            // Parent says we can be as big as we want. Just don't be smaller
            // than min size, and don't be larger than max size.
            result = MathUtils.clamp(desiredSize, minSize, maxSize);
            break;
        case MeasureSpec.AT_MOST:
            // Parent says we can be as big as we want, up to specSize.
            // Don't be larger than specSize, and don't be smaller
            // than min size, and don't be larger than max size.
            result = Math.min(MathUtils.clamp(desiredSize, minSize, maxSize), specSize);
            break;
        case MeasureSpec.EXACTLY:
            // No choice. Do what we are told.
            result = specSize;
            break;
    }
    return result;
}
 
Example #15
Source File: SpiderQueen.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
private SpiderQueen(EhApplication application, @NonNull GalleryInfo galleryInfo) {
    mHttpClient = EhApplication.getOkHttpClient(application);
    mSpiderInfoCache = EhApplication.getSpiderInfoCache(application);
    mGalleryInfo = galleryInfo;
    mSpiderDen = new SpiderDen(mGalleryInfo);

    mWorkerMaxCount = MathUtils.clamp(Settings.getMultiThreadDownload(), 1, 10);
    mPreloadNumber = MathUtils.clamp(Settings.getPreloadImage(), 0, 100);

    for (int i = 0; i < DECODE_THREAD_NUM; i++) {
        mDecodeIndexArray[i] = GalleryPageView.INVALID_INDEX;
    }

    mWorkerPoolExecutor = new ThreadPoolExecutor(mWorkerMaxCount, mWorkerMaxCount,
            0, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>(),
            new PriorityThreadFactory(SpiderWorker.class.getSimpleName(), Process.THREAD_PRIORITY_BACKGROUND));
}
 
Example #16
Source File: TileThumb.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
public void setThumbSize(int thumbWidth, int thumbHeight) {
    float aspect;
    if (thumbWidth > 0 && thumbHeight > 0) {
        aspect = MathUtils.clamp(thumbWidth / (float) thumbHeight, MIN_ASPECT, MAX_ASPECT);
    } else {
        aspect = DEFAULT_ASPECT;
    }
    setAspect(aspect);
}
 
Example #17
Source File: PostLayout.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
@Override
public int clampViewPositionVertical(View child, int top, int dy) {
    if (child.getId() == R.id.type_send) {
        View view = child.findViewById(R.id.toolbar);
        if (view != null) {
            return MathUtils.clamp(top, 0, getHeight() - view.getHeight());
        }
    }
    return top;
}
 
Example #18
Source File: GalleryListScene.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Nullable
private static String getSuitableTitleForUrlBuilder(
        Resources resources, ListUrlBuilder urlBuilder, boolean appName) {
    String keyword = urlBuilder.getKeyword();
    int category = urlBuilder.getCategory();

    if (ListUrlBuilder.MODE_NORMAL == urlBuilder.getMode() &&
            EhUtils.NONE == category &&
            TextUtils.isEmpty(keyword) &&
            urlBuilder.getAdvanceSearch() == -1 &&
            urlBuilder.getMinRating() == -1 &&
            urlBuilder.getPageFrom() == -1 &&
            urlBuilder.getPageTo() == -1) {
        return resources.getString(appName ? R.string.app_name : R.string.homepage);
    } else if (ListUrlBuilder.MODE_SUBSCRIPTION == urlBuilder.getMode() &&
        EhUtils.NONE == category &&
        TextUtils.isEmpty(keyword) &&
        urlBuilder.getAdvanceSearch() == -1 &&
        urlBuilder.getMinRating() == -1 &&
        urlBuilder.getPageFrom() == -1 &&
        urlBuilder.getPageTo() == -1) {
        return resources.getString(R.string.subscription);
    } else if (ListUrlBuilder.MODE_WHATS_HOT == urlBuilder.getMode()) {
        return resources.getString(R.string.whats_hot);
    } else if (!TextUtils.isEmpty(keyword)) {
        return keyword;
    } else if (MathUtils.hammingWeight(category) == 1) {
        return EhUtils.getCategory(category);
    } else {
        return null;
    }
}
 
Example #19
Source File: SearchBar.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void draw(@NonNull Canvas canvas) {
    if (mInAnimation) {
        final int state = canvas.save();
        int bottom = MathUtils.lerp(mBaseHeight, mHeight, mProgress);
        mRect.set(0, 0, mWidth, bottom);
        canvas.clipRect(mRect);
        super.draw(canvas);
        canvas.restoreToCount(state);
    } else {
        super.draw(canvas);
    }
}
 
Example #20
Source File: Settings.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
public static @NonNull String getRandomFeedId() {
    int length = 20;
    StringBuilder sb = new StringBuilder(length);

    for (int i = 0; i < length; i++) {
        if (MathUtils.random(0, 1 + 1) == 0) {
            sb.append((char) MathUtils.random('a', 'z' + 1));
        } else {
            sb.append((char) MathUtils.random('0', '9' + 1));
        }
    }

    return sb.toString();
}
 
Example #21
Source File: SimpleRatingView.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
public void setRating(float rating) {
    if (mRating != rating) {
        mRating = rating;
        int ratingInt = MathUtils.clamp((int) Math.ceil(rating * 2), 0, 10);
        if (mRatingInt != ratingInt) {
            mRatingInt = ratingInt;
            invalidate();
        }
    }
}
 
Example #22
Source File: Settings.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@NonNull
private static String generateUserID() {
    int length = LENGTH_USER_ID;
    StringBuilder sb = new StringBuilder(length);

    for (int i = 0; i < length; i++) {
        if (MathUtils.random(0, ('9' - '0' + 1) + ('z' - 'a' + 1)) <= '9' - '0') {
            sb.append((char) MathUtils.random('0', '9' + 1));
        } else {
            sb.append((char) MathUtils.random('a', 'z' + 1));
        }
    }

    return sb.toString();
}
 
Example #23
Source File: BatteryDrawable.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
/**
 * How to draw:<br>
 * |------------------------------|<br>
 * |\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|<br>
 * |------------------------------|---|<br>
 * |/////////////////|         |//|\\\|<br>
 * |/////////////////|         |//|\\\|<br>
 * |------------------------------|---|<br>
 * |\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|<br>
 * |------------------------------|
 */
@Override
public void draw(Canvas canvas) {
    if (mElect == -1) {
        return;
    }

    mElectRect.right = MathUtils.lerp(mStart, mStop, mElect / 100.0f);

    canvas.drawRect(mTopRect, mPaint);
    canvas.drawRect(mBottomRect, mPaint);
    canvas.drawRect(mRightRect, mPaint);
    canvas.drawRect(mHeadRect, mPaint);
    canvas.drawRect(mElectRect, mPaint);
}
 
Example #24
Source File: SearchBarMover.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    if (mHelper.isValidView(recyclerView)) {
        int oldBottom = (int) ViewUtils.getY2(mSearchBar);
        int offsetYStep = MathUtils.clamp(-dy, -oldBottom, -(int) mSearchBar.getTranslationY());
        if (offsetYStep != 0) {
            ViewUtils.translationYBy(mSearchBar, offsetYStep);
        }
    }
}
 
Example #25
Source File: CheckTextView.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void drawableHotspotChanged(float x, float y) {
    super.drawableHotspotChanged(x, y);

    mX = x;
    mY = y;
    mMaxRadius = MathUtils.coverageRadius(getWidth(), getHeight(), x, y);
}
 
Example #26
Source File: GalleryListScene.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@Nullable
private static String getSuitableTitleForUrlBuilder(
        Resources resources, ListUrlBuilder urlBuilder, boolean appName) {
    String keyword = urlBuilder.getKeyword();
    int category = urlBuilder.getCategory();

    if (ListUrlBuilder.MODE_NORMAL == urlBuilder.getMode() &&
            EhUtils.NONE == category &&
            TextUtils.isEmpty(keyword) &&
            urlBuilder.getAdvanceSearch() == -1 &&
            urlBuilder.getMinRating() == -1 &&
            urlBuilder.getPageFrom() == -1 &&
            urlBuilder.getPageTo() == -1) {
        return resources.getString(appName ? R.string.app_name : R.string.homepage);
    } else if (ListUrlBuilder.MODE_SUBSCRIPTION == urlBuilder.getMode() &&
            EhUtils.NONE == category &&
            TextUtils.isEmpty(keyword) &&
            urlBuilder.getAdvanceSearch() == -1 &&
            urlBuilder.getMinRating() == -1 &&
            urlBuilder.getPageFrom() == -1 &&
            urlBuilder.getPageTo() == -1) {
        return resources.getString(R.string.subscription);
    } else if (MODE_WHATS_HOT == urlBuilder.getMode()) {
        return resources.getString(R.string.whats_hot);
    } else if (!TextUtils.isEmpty(keyword)) {
        return keyword;
    } else if (MathUtils.hammingWeight(category) == 1) {
        return EhUtils.getCategory(category);
    } else {
        return null;
    }
}
 
Example #27
Source File: Settings.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@NonNull
private static String generateUserID() {
    int length = LENGTH_USER_ID;
    StringBuilder sb = new StringBuilder(length);

    for (int i = 0; i < length; i++) {
        if (MathUtils.random(0, ('9' - '0' + 1) + ('z' - 'a' + 1)) <= '9' - '0') {
            sb.append((char) MathUtils.random('0', '9' + 1));
        } else {
            sb.append((char) MathUtils.random('a', 'z' + 1));
        }
    }

    return sb.toString();
}
 
Example #28
Source File: SimpleRatingView.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
public void setRating(float rating) {
    if (mRating != rating) {
        mRating = rating;
        int ratingInt = MathUtils.clamp((int) Math.ceil(rating), 0, 10);
        if (mRatingInt != ratingInt) {
            mRatingInt = ratingInt;
            invalidate();
        }
    }
}
 
Example #29
Source File: BatteryDrawable.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
/**
 * How to draw:<br>
 * |------------------------------|<br>
 * |\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|<br>
 * |------------------------------|---|<br>
 * |/////////////////|         |//|\\\|<br>
 * |/////////////////|         |//|\\\|<br>
 * |------------------------------|---|<br>
 * |\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|<br>
 * |------------------------------|
 */
@Override
public void draw(Canvas canvas) {
    if (mElect == -1) {
        return;
    }

    mElectRect.right = MathUtils.lerp(mStart, mStop, mElect / 100.0f);

    canvas.drawRect(mTopRect, mPaint);
    canvas.drawRect(mBottomRect, mPaint);
    canvas.drawRect(mRightRect, mPaint);
    canvas.drawRect(mHeadRect, mPaint);
    canvas.drawRect(mElectRect, mPaint);
}
 
Example #30
Source File: SearchBarMover.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    if (mHelper.isValidView(recyclerView)) {
        int oldBottom = (int) ViewUtils.getY2(mSearchBar);
        int offsetYStep = MathUtils.clamp(-dy, -oldBottom, -(int) mSearchBar.getTranslationY());
        if (offsetYStep != 0) {
            ViewUtils.translationYBy(mSearchBar, offsetYStep);
        }
    }
}