diff --git a/build.gradle b/build.gradle index 1b6b868..190699e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.2.1' } } diff --git a/library/build.gradle b/library/build.gradle index 90a2ae6..68753d6 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { minSdkVersion 8 - targetSdkVersion 27 + targetSdkVersion 28 } } diff --git a/library/src/main/java/com/larswerkman/holocolorpicker/OpacityBar.java b/library/src/main/java/com/larswerkman/holocolorpicker/OpacityBar.java index fccac9a..54c9a7b 100644 --- a/library/src/main/java/com/larswerkman/holocolorpicker/OpacityBar.java +++ b/library/src/main/java/com/larswerkman/holocolorpicker/OpacityBar.java @@ -357,6 +357,9 @@ public boolean onTouchEvent(MotionEvent event) { mBarPointerPosition = Math.round(dimen); calculateColor(Math.round(dimen)); mBarPointerPaint.setColor(mColor); + if (mPicker != null) { + mPicker.setNewCenterColor(mColor); + } invalidate(); } break; diff --git a/library/src/main/java/com/larswerkman/holocolorpicker/SVBar.java b/library/src/main/java/com/larswerkman/holocolorpicker/SVBar.java index 352159f..01a804e 100644 --- a/library/src/main/java/com/larswerkman/holocolorpicker/SVBar.java +++ b/library/src/main/java/com/larswerkman/holocolorpicker/SVBar.java @@ -338,6 +338,10 @@ public boolean onTouchEvent(MotionEvent event) { mBarPointerPosition = Math.round(dimen); calculateColor(Math.round(dimen)); mBarPointerPaint.setColor(mColor); + if (mPicker != null) { + mPicker.setNewCenterColor(mColor); + mPicker.changeOpacityBarColor(mColor); + } invalidate(); } break; diff --git a/library/src/main/java/com/larswerkman/holocolorpicker/SaturationBar.java b/library/src/main/java/com/larswerkman/holocolorpicker/SaturationBar.java index fd736ea..e042307 100644 --- a/library/src/main/java/com/larswerkman/holocolorpicker/SaturationBar.java +++ b/library/src/main/java/com/larswerkman/holocolorpicker/SaturationBar.java @@ -357,6 +357,11 @@ public boolean onTouchEvent(MotionEvent event) { mBarPointerPosition = Math.round(dimen); calculateColor(Math.round(dimen)); mBarPointerPaint.setColor(mColor); + if (mPicker != null) { + mPicker.setNewCenterColor(mColor); + mPicker.changeValueBarColor(mColor); + mPicker.changeOpacityBarColor(mColor); + } invalidate(); } break; diff --git a/library/src/main/java/com/larswerkman/holocolorpicker/ValueBar.java b/library/src/main/java/com/larswerkman/holocolorpicker/ValueBar.java index 93e337e..3f7318e 100644 --- a/library/src/main/java/com/larswerkman/holocolorpicker/ValueBar.java +++ b/library/src/main/java/com/larswerkman/holocolorpicker/ValueBar.java @@ -42,13 +42,13 @@ public class ValueBar extends View { private static final String STATE_COLOR = "color"; private static final String STATE_VALUE = "value"; private static final String STATE_ORIENTATION = "orientation"; - + /** * Constants used to identify orientation. */ private static final boolean ORIENTATION_HORIZONTAL = true; private static final boolean ORIENTATION_VERTICAL = false; - + /** * Default orientation of the bar. */ @@ -108,7 +108,7 @@ public class ValueBar extends View { /** * {@code true} if the user clicked on the pointer to start the move mode.
* {@code false} once the user stops touching the screen. - * + * * @see #onTouchEvent(android.view.MotionEvent) */ private boolean mIsMovingPointer; @@ -143,13 +143,13 @@ public class ValueBar extends View { * Used to toggle orientation between vertical and horizontal. */ private boolean mOrientation; - + /** * Interface and listener so that changes in ValueBar are sent * to the host activity/fragment */ private OnValueChangedListener onValueChangedListener; - + /** * Value of the latest entry of the onValueChangedListener. */ @@ -329,7 +329,7 @@ protected void onDraw(Canvas canvas) { cX = mBarPointerHaloRadius; cY = mBarPointerPosition; } - + // Draw the pointer halo. canvas.drawCircle(cX, cY, mBarPointerHaloRadius, mBarPointerHaloPaint); // Draw the pointer. @@ -358,6 +358,10 @@ public boolean onTouchEvent(MotionEvent event) { mBarPointerPosition = Math.round(dimen); calculateColor(Math.round(dimen)); mBarPointerPaint.setColor(mColor); + if (mPicker != null) { + mPicker.setNewCenterColor(mColor); + mPicker.changeOpacityBarColor(mColor); + } invalidate(); } break; @@ -410,7 +414,7 @@ public boolean onTouchEvent(MotionEvent event) { * Set the bar color.
*
* Its discouraged to use this method. - * + * * @param color */ public void setColor(int color) { @@ -423,7 +427,7 @@ public void setColor(int color) { x1 = mBarThickness; y1 = (mBarLength + mBarPointerHaloRadius); } - + Color.colorToHSV(color, mHSVColor); shader = new LinearGradient(mBarPointerHaloRadius, 0, x1, y1, new int[] { @@ -441,7 +445,7 @@ public void setColor(int color) { /** * Set the pointer on the bar. With the opacity value. - * + * * @param value float between 0 and 1 */ public void setValue(float value) { @@ -456,10 +460,10 @@ public void setValue(float value) { } invalidate(); } - + /** * Calculate the color selected by the pointer on the bar. - * + * * @param coord Coordinate of the pointer. */ private void calculateColor(int coord) { @@ -476,7 +480,7 @@ private void calculateColor(int coord) { /** * Get the currently selected color. - * + * * @return The ARGB value of the currently selected color. */ public int getColor() { @@ -488,7 +492,7 @@ public int getColor() { *
* WARNING: Don't change the color picker. it is done already when the bar * is added to the ColorPicker - * + * * @see com.larswerkman.holocolorpicker.ColorPicker#addSVBar(com.larswerkman.holocolorpicker.SVBar) * @param picker */ diff --git a/settings.gradle b/settings.gradle index 87ed970..d8f14a1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':libary' +include ':library'