Extract common parts from if statements

This commit is contained in:
TacoTheDank 2020-05-31 02:21:59 -04:00
parent 5072e34900
commit 9eeebc67ee
2 changed files with 5 additions and 10 deletions

View File

@ -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()) {

View File

@ -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);