diff --git a/README.md b/README.md index b9317f6..1c2c912 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ A simple, minimalistic and beautiful dialog color picker for Android 4.1+ devices. This color picker is easy-to-use and easy-to-integrate in your application to let users of your app choose color in a simple way. Features -- Get Hex & RGB color codes -- Set color using RGB values and get HEX codes -- Set colo using HEX value +- Get Hex and (A)RGB color codes +- Set color using (A)RGB values and get HEX codes +- Set color using HEX value - Separate UI for portrait and landscape devices - Support for pre-lollipop devices @@ -14,11 +14,13 @@ Design inspired from [Dribbble](https://dribbble.com/shots/1858968-Material-Desi Portrait -![portrait](/screenshots/main.jpg) +![Portrait RGB](screenshots/main_portrait_rgb.png) +![Portrait ARGB](screenshots/main_portrait_argb.png) Landscape -![landscape](/screenshots/main_land.jpg) +![Landscape RGB](screenshots/main_landscape_rgb.png) +![Landscape ARGB](screenshots/main_landscape_argb.png) ## HOW TO USE IT @@ -37,7 +39,7 @@ dependency in your `build.gradle`. (module) ```groovy dependencies { - compile 'com.pes.materialcolorpicker:library:1.0.+' + compile 'com.pes.materialcolorpicker:library:1.1.+' } ``` @@ -54,45 +56,41 @@ Create a color picker dialog object final ColorPicker cp = new ColorPicker(MainActivity.this, defaultColorR, defaultColorG, defaultColorB); ``` -defaultColorR, defaultColorG, defaultColorB are 3 integer ( value 0-255) for the initialization of the color picker with your custom color value. If you don't want to start with a color set them to 0 or use only the first argument +defaultColorR, defaultColorG, defaultColorB are 3 integer (value 0-255) for the initialization of the color picker with your custom color value. If you don't want to start with a color set them to 0 or use only the first argument. -Then show the dialog (when & where you want) and save the selected color +The library also supports alpha values. If no color or only red, green, and blue are specified, the alpha value is set to 255 (0xFF) and no slider is shown. -```java +Use the following constructor to specify an alternative alpha channel value (0..255). As soon as the alpha value constructor is used, a fourth slider will appear above the RGB sliders and the text input field will change from six HEX characters to eight. - /* Show color picker dialog */ - cp.show(); - - /* --- DEPRECATED, se below --- On Click listener for the dialog, when the user select the color */ - Button okColor = (Button)cp.findViewById(R.id.okColorButton); - okColor.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { +```java + final ColorPicker cp = new ColorPicker(MainActivity.this, defaultAlphaValue, defaultColorR, defaultColorG, defaultColorB); +``` - /* You can get single channel (value 0-255) */ - selectedColorR = cp.getRed(); - selectedColorG = cp.getGreen(); - selectedColorB = cp.getBlue(); - /* Or the android RGB Color (see the android Color class reference) */ - selectedColorRGB = cp.getColor(); +Then show the dialog (when and where you want) and save the selected color - cp.dismiss(); - } - }); +```java + /* Show color picker dialog */ + cp.show(); /* Set a new Listener called when user click "select" */ - cp.setOnColorSelected(new OnColorSelected() { + cp.setCallback(new ColorPickerCallback() { @Override - public void returnColor(int col) { - Log.d("Red", Integer.toString(Color.red(col))); - Log.d("Green", Integer.toString(Color.green(col))); - Log.d("Blue", Integer.toString(Color.blue(col))); + public void onColorChosen(@ColorInt int color) { + // Do whatever you want } }); ``` That's all :) + +### Transition from v1.0 to v1.1 + +Version 1.1 introduced some API changes---mainly a renaming of the `OnColorSelected` callback interface. This has been renamed to `ColorPickerCallback`. + +The old interface is still in the library but will be removed in the next version update. It has been marked as deprecated and isn't called by the library, therefore no values will appear in your app if you still rely on the old interface. + + ## Translations If you would like to help localise this library please fork the project, create and verify your language files, then create a pull request. @@ -110,7 +108,7 @@ Example app that use Android Material Color Picker Dialog to let users choose th ``` The MIT License (MIT) -Copyright (c) 2016 Simone Pessotto (http://www.simonepessotto.it) +Copyright (c) 2017 Simone Pessotto (http://www.simonepessotto.it) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/library/build.gradle b/library/build.gradle index bdf15da..bb552a3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -12,8 +12,8 @@ android { minSdkVersion 16 targetSdkVersion 25 - versionCode 6 - versionName "1.0.5" + versionCode 7 + versionName "1.1.0" } buildTypes { release { @@ -27,7 +27,7 @@ def siteUrl = 'https://github.com/Pes8/android-material-color-picker-dialog/' def gitUrl = 'https://github.com/Pes8/android-material-color-picker-dialog/' // Git repository URL group = "com.pes.materialcolorpicker" // Maven Group ID for the artifact // This is the library version used when deploying the artifact -version = "1.0.5" +version = "1.1.0" install { repositories.mavenInstaller { @@ -84,7 +84,7 @@ task javadoc(type: Javadoc) { task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' - from javadoc.destinationDir + from javadoc.getDestinationDir() } artifacts { diff --git a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorFormatHelper.java b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorFormatHelper.java index 58e2949..82ef45f 100644 --- a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorFormatHelper.java +++ b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorFormatHelper.java @@ -1,6 +1,5 @@ package com.pes.androidmaterialcolorpickerdialog; -import android.annotation.SuppressLint; import android.support.annotation.IntRange; final class ColorFormatHelper { @@ -16,32 +15,47 @@ static int assertColorValueInRange(@IntRange(from = 0, to = 255) int colorValue) } /** - * Left-pads the specified color value with 0 to 2 spaces, depending on the color value length + * Formats individual RGB values to be output as a HEX string. + *

+ * Beware: If color value is lower than 0 or higher than 255, it's reset to 0. * - * @param colorValue Color value - * @return Left-padded (with Strings) color value as a String + * @param red Red color value + * @param green Green color value + * @param blue Blue color value + * @return HEX String containing the three values */ - @SuppressLint("DefaultLocale") - static String leftPadColorValue(@IntRange(from = 0, to = 255) int colorValue) { - return String.format("%3d", colorValue); + static String formatColorValues( + @IntRange(from = 0, to = 255) int red, + @IntRange(from = 0, to = 255) int green, + @IntRange(from = 0, to = 255) int blue) { + + return String.format("%02X%02X%02X", + assertColorValueInRange(red), + assertColorValueInRange(green), + assertColorValueInRange(blue) + ); } /** - * Formats individual RGB values to be output as a HEX string. + * Formats individual ARGB values to be output as an 8 character HEX string. *

- * Beware: If color value is lower than 0 or higher than 255, it's reset to 0. + * Beware: If any value is lower than 0 or higher than 255, it's reset to 0. * + * @param alpha Alpha value * @param red Red color value * @param green Green color value * @param blue Blue color value * @return HEX String containing the three values + * @since v1.1.0 */ - static String formatRgbColorValues( + static String formatColorValues( + @IntRange(from = 0, to = 255) int alpha, @IntRange(from = 0, to = 255) int red, @IntRange(from = 0, to = 255) int green, @IntRange(from = 0, to = 255) int blue) { - return String.format("%02X%02X%02X", + return String.format("%02X%02X%02X%02X", + assertColorValueInRange(alpha), assertColorValueInRange(red), assertColorValueInRange(green), assertColorValueInRange(blue) diff --git a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPicker.java b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPicker.java index 3c488f0..87f626e 100644 --- a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPicker.java +++ b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPicker.java @@ -4,11 +4,13 @@ import android.app.Dialog; import android.content.Context; import android.graphics.Color; -import android.graphics.Rect; +import android.os.Build; import android.os.Bundle; import android.support.annotation.IntRange; +import android.text.InputFilter; import android.view.KeyEvent; import android.view.View; +import android.view.Window; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.Button; @@ -17,8 +19,7 @@ import android.widget.TextView; import static com.pes.androidmaterialcolorpickerdialog.ColorFormatHelper.assertColorValueInRange; -import static com.pes.androidmaterialcolorpickerdialog.ColorFormatHelper.formatRgbColorValues; -import static com.pes.androidmaterialcolorpickerdialog.ColorFormatHelper.leftPadColorValue; +import static com.pes.androidmaterialcolorpickerdialog.ColorFormatHelper.formatColorValues; /** * This is the only class of the project. It consists in a custom dialog that shows the GUI @@ -31,13 +32,12 @@ public class ColorPicker extends Dialog implements SeekBar.OnSeekBarChangeListen private final Activity activity; private View colorView; - private SeekBar redSeekBar, greenSeekBar, blueSeekBar; - private TextView redToolTip, greenToolTip, blueToolTip; + private SeekBar alphaSeekBar, redSeekBar, greenSeekBar, blueSeekBar; private EditText hexCode; - private int seekBarLeft; - private Rect thumbRect; - private int red, green, blue; - private OnColorSelected onColorSelectedListener; + private int alpha, red, green, blue; + private ColorPickerCallback callback; + + private boolean withAlpha; /** * Creator of the class. It will initialize the class with black color as default @@ -48,9 +48,17 @@ public ColorPicker(Activity activity) { super(activity); this.activity = activity; + + if (activity instanceof ColorPickerCallback) { + callback = (ColorPickerCallback) activity; + } + + this.alpha = 255; this.red = 0; this.green = 0; this.blue = 0; + + this.withAlpha = false; } /** @@ -61,24 +69,52 @@ public ColorPicker(Activity activity) { * @param green Green color for RGB values (0 - 255) * @param blue Blue color for RGB values (0 - 255) *

- * If the value of the colors it's not in the right range (0 - 255) it will be place at 0. + * If the value of the colors it's not in the right range (0 - 255) it will + * be place at 0. */ public ColorPicker(Activity activity, @IntRange(from = 0, to = 255) int red, @IntRange(from = 0, to = 255) int green, @IntRange(from = 0, to = 255) int blue) { - super(activity); + this(activity); - this.activity = activity; + this.red = assertColorValueInRange(red); + this.green = assertColorValueInRange(green); + this.blue = assertColorValueInRange(blue); + + } + + /** + * Creator of the class. It will initialize the class with the argb color passed as default + * + * @param activity The reference to the activity where the color picker is called + * @param alpha Alpha value (0 - 255) + * @param red Red color for RGB values (0 - 255) + * @param green Green color for RGB values (0 - 255) + * @param blue Blue color for RGB values (0 - 255) + *

+ * If the value of the colors it's not in the right range (0 - 255) it will + * be place at 0. + * @since v1.1.0 + */ + public ColorPicker(Activity activity, + @IntRange(from = 0, to = 255) int alpha, + @IntRange(from = 0, to = 255) int red, + @IntRange(from = 0, to = 255) int green, + @IntRange(from = 0, to = 255) int blue) { + this(activity); + this.alpha = assertColorValueInRange(alpha); this.red = assertColorValueInRange(red); this.green = assertColorValueInRange(green); this.blue = assertColorValueInRange(blue); + this.withAlpha = true; + } - public void setOnColorSelected(OnColorSelected listener) { - onColorSelectedListener = listener; + public void setCallback(ColorPickerCallback listener) { + callback = listener; } /** @@ -90,33 +126,42 @@ public void setOnColorSelected(OnColorSelected listener) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + requestWindowFeature(Window.FEATURE_NO_TITLE); + } + setContentView(R.layout.materialcolorpicker__layout_color_picker); colorView = findViewById(R.id.colorView); + colorView.setBackgroundColor(getColor()); + + hexCode = (EditText) findViewById(R.id.hexCode); + alphaSeekBar = (SeekBar) findViewById(R.id.alphaSeekBar); redSeekBar = (SeekBar) findViewById(R.id.redSeekBar); greenSeekBar = (SeekBar) findViewById(R.id.greenSeekBar); blueSeekBar = (SeekBar) findViewById(R.id.blueSeekBar); - seekBarLeft = redSeekBar.getPaddingLeft(); - - redToolTip = (TextView) findViewById(R.id.redToolTip); - greenToolTip = (TextView) findViewById(R.id.greenToolTip); - blueToolTip = (TextView) findViewById(R.id.blueToolTip); - - hexCode = (EditText) findViewById(R.id.codHex); - + alphaSeekBar.setOnSeekBarChangeListener(this); redSeekBar.setOnSeekBarChangeListener(this); greenSeekBar.setOnSeekBarChangeListener(this); blueSeekBar.setOnSeekBarChangeListener(this); + alphaSeekBar.setProgress(alpha); redSeekBar.setProgress(red); greenSeekBar.setProgress(green); blueSeekBar.setProgress(blue); - colorView.setBackgroundColor(getColor()); + if (!withAlpha) { + alphaSeekBar.setVisibility(View.GONE); + } + + hexCode.setFilters(new InputFilter[]{new InputFilter.LengthFilter(withAlpha ? 8 : 6)}); - hexCode.setText(formatRgbColorValues(red, green, blue)); + hexCode.setText(withAlpha + ? formatColorValues(alpha, red, green, blue) + : formatColorValues(red, green, blue) + ); hexCode.setOnEditorActionListener( new EditText.OnEditorActionListener() { @@ -127,7 +172,8 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { updateColorView(v.getText().toString()); - InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); + InputMethodManager imm = (InputMethodManager) activity + .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(hexCode.getWindowToken(), 0); return true; @@ -146,24 +192,26 @@ public void onClick(View view) { } private void sendColor() { - if (onColorSelectedListener != null) - onColorSelectedListener.returnColor(getColor()); + if (callback != null) + callback.onColorChosen(getColor()); } - /** - * Method that synchronizes the color between the bars, the view, and the HEC code text. + * Method that synchronizes the color between the bars, the view, and the HEX code text. * * @param input HEX Code of the color. */ private void updateColorView(String input) { try { final int color = Color.parseColor('#' + input); + alpha = Color.alpha(color); red = Color.red(color); green = Color.green(color); blue = Color.blue(color); colorView.setBackgroundColor(getColor()); + + alphaSeekBar.setProgress(alpha); redSeekBar.setProgress(red); greenSeekBar.setProgress(green); blueSeekBar.setProgress(blue); @@ -172,27 +220,6 @@ private void updateColorView(String input) { } } - - @Override - public void onWindowFocusChanged(boolean hasFocus) { - - thumbRect = redSeekBar.getThumb().getBounds(); - - redToolTip.setX(seekBarLeft + thumbRect.left); - redToolTip.setText(leftPadColorValue(red)); - - thumbRect = greenSeekBar.getThumb().getBounds(); - - greenToolTip.setX(seekBarLeft + thumbRect.left); - greenToolTip.setText(leftPadColorValue(green)); - - thumbRect = blueSeekBar.getThumb().getBounds(); - - blueToolTip.setX(seekBarLeft + thumbRect.left); - blueToolTip.setText(leftPadColorValue(blue)); - - } - /** * Method called when the user change the value of the bars. This sync the colors. * @@ -203,47 +230,50 @@ public void onWindowFocusChanged(boolean hasFocus) { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - if (seekBar.getId() == R.id.redSeekBar) { + if (seekBar.getId() == R.id.alphaSeekBar) { - red = progress; - thumbRect = seekBar.getThumb().getBounds(); + alpha = progress; + + } else if (seekBar.getId() == R.id.redSeekBar) { - redToolTip.setX(seekBarLeft + thumbRect.left); - redToolTip.setText(leftPadColorValue(red)); + red = progress; } else if (seekBar.getId() == R.id.greenSeekBar) { green = progress; - thumbRect = seekBar.getThumb().getBounds(); - - greenToolTip.setX(seekBar.getPaddingLeft() + thumbRect.left); - greenToolTip.setText(leftPadColorValue(green)); } else if (seekBar.getId() == R.id.blueSeekBar) { blue = progress; - thumbRect = seekBar.getThumb().getBounds(); - - blueToolTip.setX(seekBarLeft + thumbRect.left); - blueToolTip.setText(leftPadColorValue(blue)); } colorView.setBackgroundColor(getColor()); //Setting the inputText hex color - hexCode.setText(formatRgbColorValues(red, green, blue)); + hexCode.setText(withAlpha + ? formatColorValues(alpha, red, green, blue) + : formatColorValues(red, green, blue) + ); } @Override public void onStopTrackingTouch(SeekBar seekBar) { - } @Override public void onStartTrackingTouch(SeekBar seekBar) { + } + /** + * Getter for the ALPHA value of the ARGB selected color + * + * @return ALPHA Value Integer (0 - 255) + * @since v1.1.0 + */ + public int getAlpha() { + return alpha; } /** @@ -277,7 +307,8 @@ public int getBlue() { /** * Getter for the color as Android Color class value. *

- * From Android Reference: The Color class defines methods for creating and converting color ints. + * From Android Reference: The Color class defines methods for creating and converting color + * ints. * Colors are represented as packed ints, made up of 4 bytes: alpha, red, green, blue. * The values are unpremultiplied, meaning any transparency is stored solely in the alpha * component, and not in the color components. @@ -285,6 +316,6 @@ public int getBlue() { * @return Selected color as Android Color class value. */ public int getColor() { - return Color.rgb(red, green, blue); + return withAlpha ? Color.argb(alpha, red, green, blue) : Color.rgb(red, green, blue); } } \ No newline at end of file diff --git a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPickerCallback.java b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPickerCallback.java new file mode 100644 index 0000000..d576807 --- /dev/null +++ b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/ColorPickerCallback.java @@ -0,0 +1,20 @@ +package com.pes.androidmaterialcolorpickerdialog; + +import android.support.annotation.ColorInt; + +/** + * Created by Patrick Geselbracht on 2017-03-04 + * + * @author Patrick Geselbracht + */ +public interface ColorPickerCallback { + /** + * Gets called whenever a user chooses a color from the ColorPicker, i.e., presses the + * "Choose" button. + * + * @param color Color chosen + */ + + void onColorChosen(@ColorInt int color); +} + diff --git a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/MaterialColorPickerTextSeekBar.java b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/MaterialColorPickerTextSeekBar.java new file mode 100644 index 0000000..c3d735f --- /dev/null +++ b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/MaterialColorPickerTextSeekBar.java @@ -0,0 +1,116 @@ +package com.pes.androidmaterialcolorpickerdialog; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.Typeface; +import android.support.annotation.ColorInt; +import android.support.annotation.Dimension; +import android.support.annotation.Nullable; +import android.support.v7.widget.AppCompatSeekBar; +import android.util.AttributeSet; +import android.util.TypedValue; + +/** + * Created by Patrick Geselbracht on 2017-03-04 + * + * @author Patrick Geselbracht + * @since v1.1.0 + */ +class MaterialColorPickerTextSeekBar extends AppCompatSeekBar { + + private Paint textPaint; + private Rect textRect; + + @ColorInt + private int textColor; + + @Dimension(unit = 2) + private float textSize; + + private String text; + + public MaterialColorPickerTextSeekBar(Context context) { + super(context); + init(null); + } + + public MaterialColorPickerTextSeekBar(Context context, AttributeSet attrs) { + super(context, attrs); + init(attrs); + } + + public MaterialColorPickerTextSeekBar(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(attrs); + } + + private void init(@Nullable AttributeSet attrs) { + textPaint = new Paint(Paint.LINEAR_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); + textRect = new Rect(); + + if (attrs != null) { + + final TypedArray typedArray = getContext().obtainStyledAttributes( + attrs, R.styleable.MaterialColorPickerTextSeekBar + ); + + try { + + textColor = typedArray.getColor( + R.styleable.MaterialColorPickerTextSeekBar_android_textColor, + 0xff000000 + ); + + textSize = typedArray.getDimension( + R.styleable.MaterialColorPickerTextSeekBar_android_textSize, + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, + 18, getResources().getDisplayMetrics()) + ); + + text = typedArray.getString(R.styleable + .MaterialColorPickerTextSeekBar_android_text); + + } finally { + + typedArray.recycle(); + + } + + } + + textPaint.setColor(textColor); + textPaint.setTypeface(Typeface.DEFAULT_BOLD); + textPaint.setTextSize(textSize); + textPaint.setTextAlign(Paint.Align.CENTER); + + /* Measures 255 instead of the actual text because otherwise the padding would jump up + * and down each time the text with its ascender and descenders changes. + * + * -- + * + * Since we're only interested in a roundabout height depending on the text's font size + * anyway, calculating the text bounds of this value is enough in this case. + */ + textPaint.getTextBounds("255", 0, 3, textRect); + + setPadding(getPaddingLeft(), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + (float) (0.6 * textRect.height()), getResources().getDisplayMetrics()), + getPaddingRight(), getPaddingBottom()); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + canvas.drawText( + (text == null) ? String.valueOf(getProgress()) : text, + getThumb().getBounds().left + getPaddingLeft(), + textRect.height() + (getPaddingTop() >> 2), + textPaint + ); + + } +} diff --git a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/OnColorSelected.java b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/OnColorSelected.java index 35bb0e9..81c38ae 100644 --- a/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/OnColorSelected.java +++ b/library/src/main/java/com/pes/androidmaterialcolorpickerdialog/OnColorSelected.java @@ -2,7 +2,17 @@ /** * Created by Simone Pes on 26/01/2017. + * + * @deprecated Use {@link ColorPickerCallback} instead */ public interface OnColorSelected { + + /** + * Gets called whenever a user chooses a color from the ColorPicker, i.e., presses the + * "Choose" button. + * + * @param color Color chosen + * @deprecated Use {@link ColorPickerCallback#onColorChosen(int)} instead. + */ void returnColor(int color); } diff --git a/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_default.png b/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_default.png new file mode 100644 index 0000000..5a50be2 Binary files /dev/null and b/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_default.png differ diff --git a/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_pressed.png b/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_pressed.png new file mode 100644 index 0000000..e69f996 Binary files /dev/null and b/library/src/main/res/drawable-hdpi/materialcolorpicker__alpha_thumb_pressed.png differ diff --git a/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_default.png b/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_default.png new file mode 100644 index 0000000..fd5bb62 Binary files /dev/null and b/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_default.png differ diff --git a/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_pressed.png b/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_pressed.png new file mode 100644 index 0000000..a3c52be Binary files /dev/null and b/library/src/main/res/drawable-mdpi/materialcolorpicker__alpha_thumb_pressed.png differ diff --git a/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_default.png b/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_default.png new file mode 100644 index 0000000..46142f3 Binary files /dev/null and b/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_default.png differ diff --git a/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_pressed.png b/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_pressed.png new file mode 100644 index 0000000..70e25da Binary files /dev/null and b/library/src/main/res/drawable-xhdpi/materialcolorpicker__alpha_thumb_pressed.png differ diff --git a/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_default.png b/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_default.png new file mode 100644 index 0000000..048c4f1 Binary files /dev/null and b/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_default.png differ diff --git a/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_pressed.png b/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_pressed.png new file mode 100644 index 0000000..eb1303e Binary files /dev/null and b/library/src/main/res/drawable-xxhdpi/materialcolorpicker__alpha_thumb_pressed.png differ diff --git a/library/src/main/res/drawable/materialcolorpicker__alpha_progress.xml b/library/src/main/res/drawable/materialcolorpicker__alpha_progress.xml new file mode 100644 index 0000000..807fd4e --- /dev/null +++ b/library/src/main/res/drawable/materialcolorpicker__alpha_progress.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/materialcolorpicker__alpha_thumb_drawable.xml b/library/src/main/res/drawable/materialcolorpicker__alpha_thumb_drawable.xml new file mode 100644 index 0000000..8d1e7e9 --- /dev/null +++ b/library/src/main/res/drawable/materialcolorpicker__alpha_thumb_drawable.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/library/src/main/res/layout-land-v21/materialcolorpicker__layout_color_picker.xml b/library/src/main/res/layout-land-v21/materialcolorpicker__layout_color_picker.xml index ffbb826..c7b9da0 100644 --- a/library/src/main/res/layout-land-v21/materialcolorpicker__layout_color_picker.xml +++ b/library/src/main/res/layout-land-v21/materialcolorpicker__layout_color_picker.xml @@ -1,18 +1,18 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + tools:context=".ColorPicker"> + android:elevation="2dp"/> - + android:max="255" + android:maxHeight="3dip" + android:minHeight="3dip" + android:progressDrawable="@drawable/materialcolorpicker__alpha_progress" + android:textColor="@android:color/black" + android:thumbTint="@android:color/black"/> - - - + android:textColor="@android:color/holo_red_light" + android:thumbTint="@color/materialcolorpicker__red"/> - - - + android:textColor="@android:color/holo_green_light" + android:thumbTint="@color/materialcolorpicker__green"/> - + android:textColor="@android:color/holo_blue_light" + android:thumbTint="@color/materialcolorpicker__blue"/> + android:labelFor="@id/hexCode" + android:text="@string/materialcolorpicker__hash"/> + tools:text="123456"/>