From 4b9eb9ba6a98feb74a0c33ef8d6cbf6e4dadfe85 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sat, 21 Mar 2020 19:38:46 +0100 Subject: [PATCH] Cleanup in ColorPicker code --- .../colorpicker/ColorPickerDialog.java | 7 ------ .../colorpicker/ColorPickerPanelView.java | 3 --- .../colorpicker/ColorPickerPreference.java | 12 ---------- .../colorpicker/ColorPickerView.java | 23 ++++++------------- 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerDialog.java b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerDialog.java index b95fea7..c013e53 100644 --- a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerDialog.java +++ b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerDialog.java @@ -86,12 +86,6 @@ public class ColorPickerDialog @Override public void onColorChanged(int color) { mNewColor.setColor(color); - - /* - if (mListener != null) { - mListener.onColorChanged(color); - } - */ } public void setAlphaSliderVisible(boolean visible) { @@ -101,7 +95,6 @@ public class ColorPickerDialog /** * Set a OnColorChangedListener to get notified when the color * selected by the user has changed. - * @param listener */ public void setOnColorChangedListener(OnColorChangedListener listener) { mListener = listener; diff --git a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPanelView.java b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPanelView.java index 5001aee..a2f4fee 100644 --- a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPanelView.java +++ b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPanelView.java @@ -131,7 +131,6 @@ public class ColorPickerPanelView extends View { /** * Set the color that should be shown by this view. - * @param color */ public void setColor(int color) { mColor = color; @@ -140,7 +139,6 @@ public class ColorPickerPanelView extends View { /** * Get the color currently show by this view. - * @return */ public int getColor() { return mColor; @@ -148,7 +146,6 @@ public class ColorPickerPanelView extends View { /** * Set the color of the border surrounding the panel. - * @param color */ public void setBorderColor(int color) { mBorderColor = color; diff --git a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java index 7f08048..0f5a662 100644 --- a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java +++ b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java @@ -204,17 +204,11 @@ public class ColorPickerPreference /** * Toggle Alpha Slider visibility (by default it's disabled) - * @param enable */ public void setAlphaSliderEnabled(boolean enable) { mAlphaSliderEnabled = enable; } - /** - * For custom purposes. Not used by ColorPickerPreference - * @param color - * @author Unknown - */ private static String convertToARGB(int color) { String alpha = Integer.toHexString(Color.alpha(color)); String red = Integer.toHexString(Color.red(color)); @@ -240,12 +234,6 @@ public class ColorPickerPreference return "#" + alpha + red + green + blue; } - /** - * For custom purposes. Not used by ColorPickerPreference - * @param argb - * @throws NumberFormatException - * @author Unknown - */ private static int convertToColorInt(String argb) throws NumberFormatException { if (argb.startsWith("#")) { argb = argb.replace("#", ""); diff --git a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerView.java b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerView.java index c51baf4..65f9b7a 100644 --- a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerView.java +++ b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerView.java @@ -317,9 +317,9 @@ public class ColorPickerView extends View { canvas.drawRect(rect, mAlphaPaint); - if (mAlphaSliderText != null && mAlphaSliderText!= "") { - canvas.drawText(mAlphaSliderText, rect.centerX(), rect.centerY() + 4 * mDensity, mAlphaTextPaint); - } + if (mAlphaSliderText != null && !mAlphaSliderText.isEmpty()) + canvas.drawText(mAlphaSliderText, rect.centerX(), rect.centerY() + 4 * mDensity, + mAlphaTextPaint); float rectWidth = 4 * mDensity / 2; @@ -677,7 +677,6 @@ public class ColorPickerView extends View { /** * Set a OnColorChangedListener to get notified when the color * selected by the user has changed. - * @param listener */ public void setOnColorChangedListener(OnColorChangedListener listener) { mListener = listener; @@ -685,7 +684,6 @@ public class ColorPickerView extends View { /** * Set the color of the border surrounding all panels. - * @param color */ public void setBorderColor(int color) { mBorderColor = color; @@ -718,8 +716,7 @@ public class ColorPickerView extends View { /** * Set the color this view should show. * @param color The color that should be selected. - * @param callback If you want to get a callback to - * your OnColorChangedListener. + * @param callback If you want to get a callback to your OnColorChangedListener. */ public void setColor(int color, boolean callback) { int alpha = Color.alpha(color); @@ -757,7 +754,6 @@ public class ColorPickerView extends View { /** * Set if the user is allowed to adjust the alpha panel. Default is false. * If it is set to false no alpha will be set. - * @param visible */ public void setAlphaSliderVisible(boolean visible) { if (mShowAlphaPanel != visible) { @@ -788,8 +784,7 @@ public class ColorPickerView extends View { } /** - * Set the text that should be shown in the - * alpha slider. Set to null to disable text. + * Set the text that should be shown in the alpha slider. Set to null to disable text. * @param res string resource id. */ public void setAlphaSliderText(int res) { @@ -798,8 +793,7 @@ public class ColorPickerView extends View { } /** - * Set the text that should be shown in the - * alpha slider. Set to null to disable text. + * Set the text that should be shown in the alpha slider. Set to null to disable text. * @param text Text that should be shown. */ public void setAlphaSliderText(String text) { @@ -808,10 +802,7 @@ public class ColorPickerView extends View { } /** - * Get the current value of the text - * that will be shown in the alpha - * slider. - * @return + * Get the current value of the text that will be shown in the alpha slider. */ public String getAlphaSliderText() { return mAlphaSliderText;