Cleanup in ColorPicker code

This commit is contained in:
Peter Osterlund 2020-03-21 19:38:46 +01:00
parent b35437dd3e
commit 4b9eb9ba6a
4 changed files with 7 additions and 38 deletions

View File

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

View File

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

View File

@ -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("#", "");

View File

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