Skip to content

Commit 12ce825

Browse files
committed
code simplified.
1 parent 54c1708 commit 12ce825

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

library/src/main/java/io/syslogic/colorpicker/AlphaPatternDrawable.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@ public void setColorFilter(@Nullable ColorFilter cf) {
6060
@Override
6161
protected void onBoundsChange(@NonNull Rect bounds) {
6262
super.onBoundsChange(bounds);
63-
int height = bounds.height();
64-
int width = bounds.width();
65-
//noinspection IntegerDivisionInFloatingPointContext
66-
numRectanglesHorizontal = (int) Math.ceil(width / mRectangleSize);
67-
//noinspection IntegerDivisionInFloatingPointContext
68-
numRectanglesVertical = (int) Math.ceil(height / mRectangleSize);
63+
numRectanglesHorizontal = bounds.width() / mRectangleSize;
64+
numRectanglesVertical = bounds.height() / mRectangleSize;
6965
generatePatternBitmap();
7066
}
7167

library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
/**
2929
* The Color-Picker {@link View} (refactored version).
30-
*
3130
* It displays a color picker to the user and allow them to select a color.
3231
* the slider for the alpha-channel can be enabled setAlphaSliderVisible(true).
3332
*
@@ -190,7 +189,7 @@ private int[] getHueColors() {
190189
}
191190

192191
@Override
193-
protected void onDraw(Canvas canvas) {
192+
protected void onDraw(@NonNull Canvas canvas) {
194193
if (mDrawingRect.width() <= 0 || mDrawingRect.height() <= 0) {
195194
return;
196195
}

0 commit comments

Comments
 (0)