From 9eeebc67ee676593ac0ecca5271f0a69d10df1d2 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Sun, 31 May 2020 02:21:59 -0400 Subject: [PATCH] Extract common parts from if statements --- .../org/mariotaku/twidere/view/HeaderDrawerLayout.java | 6 ++---- .../java/org/mariotaku/twidere/view/ShapedImageView.java | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java index f565663ac..97cf52fc3 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/HeaderDrawerLayout.java @@ -409,13 +409,11 @@ public class HeaderDrawerLayout extends ViewGroup { if (dy > 0 && mDrawer.canScrollCallback(-dy) && mDrawer.isTouchingScrollableContent()) { if (!mDrawer.isUsingDragHelper()) { // Scrolling up while list still has space to scroll, so make header still - mScrollingHeaderByHelper = false; - return current; } else { mDrawer.scrollByCallback(-dy); - mScrollingHeaderByHelper = false; - return current; } + mScrollingHeaderByHelper = false; + return current; } final int min = mDrawer.getHeaderTopMinimum(), max = mDrawer.getHeaderTopMaximum(); if (top < min && mDrawer.isTouchingScrollableContent() && mDrawer.isUsingDragHelper()) { diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ShapedImageView.java b/twidere/src/main/java/org/mariotaku/twidere/view/ShapedImageView.java index 36870e253..82b92bfc0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ShapedImageView.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ShapedImageView.java @@ -196,17 +196,14 @@ public class ShapedImageView extends AppCompatImageView { contentHeight = contentBottom - contentTop; final int size = Math.min(contentWidth, contentHeight); - if (OUTLINE_DRAW) { - drawShape(canvas, mDestination, 0, mBackgroundPaint); - super.onDraw(canvas); - } else { + if (!OUTLINE_DRAW) { if (mShadowBitmap != null && mDrawShadow) { canvas.drawBitmap(mShadowBitmap, contentLeft + (contentWidth - size) / 2 - mShadowRadius, contentTop + (contentHeight - size) / 2 - mShadowRadius, null); } - drawShape(canvas, mDestination, 0, mBackgroundPaint); - super.onDraw(canvas); } + drawShape(canvas, mDestination, 0, mBackgroundPaint); + super.onDraw(canvas); // Then draw the border. if (mBorderEnabled) { drawBorder(canvas, mDestination);