aboutsummaryrefslogtreecommitdiffstats
path: root/libs/colorpicker
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2015-04-15 21:29:31 +0200
committerlookshe <github@lookshe.org>2015-04-15 21:43:53 +0200
commitb3b4a2902e37fb072e800f5dff0392755f5d4501 (patch)
tree0b0666dfbf20ef04e1d92531ce59d8697bb5c4eb /libs/colorpicker
parent549810783ce651f27bdd386488b6690195522372 (diff)
moved color picker to libs
Diffstat (limited to 'libs/colorpicker')
-rw-r--r--libs/colorpicker/.gitignore1
-rw-r--r--libs/colorpicker/build.gradle18
-rw-r--r--libs/colorpicker/proguard-rules.pro17
-rw-r--r--libs/colorpicker/src/main/AndroidManifest.xml2
-rw-r--r--libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java298
-rw-r--r--libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java46
-rw-r--r--libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java34
-rw-r--r--libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java134
-rw-r--r--libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.pngbin0 -> 1032 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.pngbin0 -> 1041 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.pngbin0 -> 666 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.pngbin0 -> 983 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.pngbin0 -> 748 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.pngbin0 -> 751 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.pngbin0 -> 480 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.pngbin0 -> 607 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.pngbin0 -> 135 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.pngbin0 -> 889 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.pngbin0 -> 814 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.pngbin0 -> 579 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.pngbin0 -> 455 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.pngbin0 -> 816 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.pngbin0 -> 1097 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.pngbin0 -> 1151 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.pngbin0 -> 782 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.pngbin0 -> 1526 bytes
-rw-r--r--libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml6
-rw-r--r--libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml127
-rw-r--r--libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml122
-rw-r--r--libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml23
-rw-r--r--libs/colorpicker/src/main/res/values-land/dimen.xml5
-rw-r--r--libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml5
-rw-r--r--libs/colorpicker/src/main/res/values/attrs.xml7
-rw-r--r--libs/colorpicker/src/main/res/values/dimen.xml7
34 files changed, 852 insertions, 0 deletions
diff --git a/libs/colorpicker/.gitignore b/libs/colorpicker/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/libs/colorpicker/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/libs/colorpicker/build.gradle b/libs/colorpicker/build.gradle
new file mode 100644
index 00000000..1920d0f6
--- /dev/null
+++ b/libs/colorpicker/build.gradle
@@ -0,0 +1,18 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ minSdkVersion 7
+ targetSdkVersion 21
+ versionCode 2
+ versionName "2.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ }
+ }
+}
diff --git a/libs/colorpicker/proguard-rules.pro b/libs/colorpicker/proguard-rules.pro
new file mode 100644
index 00000000..f665b348
--- /dev/null
+++ b/libs/colorpicker/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Developer/android-sdk-macosx/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/libs/colorpicker/src/main/AndroidManifest.xml b/libs/colorpicker/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..e59bd5b5
--- /dev/null
+++ b/libs/colorpicker/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="yuku.ambilwarna" />
diff --git a/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java
new file mode 100644
index 00000000..5c05e4ec
--- /dev/null
+++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java
@@ -0,0 +1,298 @@
+package yuku.ambilwarna;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.graphics.Color;
+import android.graphics.drawable.GradientDrawable;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+
+public class AmbilWarnaDialog {
+ public interface OnAmbilWarnaListener {
+ void onCancel(AmbilWarnaDialog dialog);
+
+ void onOk(AmbilWarnaDialog dialog, int color);
+ }
+
+ final AlertDialog dialog;
+ private final boolean supportsAlpha;
+ final OnAmbilWarnaListener listener;
+ final View viewHue;
+ final AmbilWarnaSquare viewSatVal;
+ final ImageView viewCursor;
+ final ImageView viewAlphaCursor;
+ final View viewOldColor;
+ final View viewNewColor;
+ final View viewAlphaOverlay;
+ final ImageView viewTarget;
+ final ImageView viewAlphaCheckered;
+ final ViewGroup viewContainer;
+ final float[] currentColorHsv = new float[3];
+ int alpha;
+
+ /**
+ * Create an AmbilWarnaDialog.
+ *
+ * @param context activity context
+ * @param color current color
+ * @param listener an OnAmbilWarnaListener, allowing you to get back error or OK
+ */
+ public AmbilWarnaDialog(final Context context, int color, OnAmbilWarnaListener listener) {
+ this(context, color, false, listener);
+ }
+
+ /**
+ * Create an AmbilWarnaDialog.
+ *
+ * @param context activity context
+ * @param color current color
+ * @param supportsAlpha whether alpha/transparency controls are enabled
+ * @param listener an OnAmbilWarnaListener, allowing you to get back error or OK
+ */
+ public AmbilWarnaDialog(final Context context, int color, boolean supportsAlpha, OnAmbilWarnaListener listener) {
+ this.supportsAlpha = supportsAlpha;
+ this.listener = listener;
+
+ if (!supportsAlpha) { // remove alpha if not supported
+ color = color | 0xff000000;
+ }
+
+ Color.colorToHSV(color, currentColorHsv);
+ alpha = Color.alpha(color);
+
+ final View view = LayoutInflater.from(context).inflate(R.layout.ambilwarna_dialog, null);
+ viewHue = view.findViewById(R.id.ambilwarna_viewHue);
+ viewSatVal = (AmbilWarnaSquare) view.findViewById(R.id.ambilwarna_viewSatBri);
+ viewCursor = (ImageView) view.findViewById(R.id.ambilwarna_cursor);
+ viewOldColor = view.findViewById(R.id.ambilwarna_oldColor);
+ viewNewColor = view.findViewById(R.id.ambilwarna_newColor);
+ viewTarget = (ImageView) view.findViewById(R.id.ambilwarna_target);
+ viewContainer = (ViewGroup) view.findViewById(R.id.ambilwarna_viewContainer);
+ viewAlphaOverlay = view.findViewById(R.id.ambilwarna_overlay);
+ viewAlphaCursor = (ImageView) view.findViewById(R.id.ambilwarna_alphaCursor);
+ viewAlphaCheckered = (ImageView) view.findViewById(R.id.ambilwarna_alphaCheckered);
+
+ { // hide/show alpha
+ viewAlphaOverlay.setVisibility(supportsAlpha? View.VISIBLE: View.GONE);
+ viewAlphaCursor.setVisibility(supportsAlpha? View.VISIBLE: View.GONE);
+ viewAlphaCheckered.setVisibility(supportsAlpha? View.VISIBLE: View.GONE);
+ }
+
+ viewSatVal.setHue(getHue());
+ viewOldColor.setBackgroundColor(color);
+ viewNewColor.setBackgroundColor(color);
+
+ viewHue.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_MOVE
+ || event.getAction() == MotionEvent.ACTION_DOWN
+ || event.getAction() == MotionEvent.ACTION_UP) {
+
+ float y = event.getY();
+ if (y < 0.f) y = 0.f;
+ if (y > viewHue.getMeasuredHeight()) {
+ y = viewHue.getMeasuredHeight() - 0.001f; // to avoid jumping the cursor from bottom to top.
+ }
+ float hue = 360.f - 360.f / viewHue.getMeasuredHeight() * y;
+ if (hue == 360.f) hue = 0.f;
+ setHue(hue);
+
+ // update view
+ viewSatVal.setHue(getHue());
+ moveCursor();
+ viewNewColor.setBackgroundColor(getColor());
+ updateAlphaView();
+ return true;
+ }
+ return false;
+ }
+ });
+
+ if (supportsAlpha) viewAlphaCheckered.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if ((event.getAction() == MotionEvent.ACTION_MOVE)
+ || (event.getAction() == MotionEvent.ACTION_DOWN)
+ || (event.getAction() == MotionEvent.ACTION_UP)) {
+
+ float y = event.getY();
+ if (y < 0.f) {
+ y = 0.f;
+ }
+ if (y > viewAlphaCheckered.getMeasuredHeight()) {
+ y = viewAlphaCheckered.getMeasuredHeight() - 0.001f; // to avoid jumping the cursor from bottom to top.
+ }
+ final int a = Math.round(255.f - ((255.f / viewAlphaCheckered.getMeasuredHeight()) * y));
+ AmbilWarnaDialog.this.setAlpha(a);
+
+ // update view
+ moveAlphaCursor();
+ int col = AmbilWarnaDialog.this.getColor();
+ int c = a << 24 | col & 0x00ffffff;
+ viewNewColor.setBackgroundColor(c);
+ return true;
+ }
+ return false;
+ }
+ });
+ viewSatVal.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_MOVE
+ || event.getAction() == MotionEvent.ACTION_DOWN
+ || event.getAction() == MotionEvent.ACTION_UP) {
+
+ float x = event.getX(); // touch event are in dp units.
+ float y = event.getY();
+
+ if (x < 0.f) x = 0.f;
+ if (x > viewSatVal.getMeasuredWidth()) x = viewSatVal.getMeasuredWidth();
+ if (y < 0.f) y = 0.f;
+ if (y > viewSatVal.getMeasuredHeight()) y = viewSatVal.getMeasuredHeight();
+
+ setSat(1.f / viewSatVal.getMeasuredWidth() * x);
+ setVal(1.f - (1.f / viewSatVal.getMeasuredHeight() * y));
+
+ // update view
+ moveTarget();
+ viewNewColor.setBackgroundColor(getColor());
+
+ return true;
+ }
+ return false;
+ }
+ });
+
+ dialog = new AlertDialog.Builder(context)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (AmbilWarnaDialog.this.listener != null) {
+ AmbilWarnaDialog.this.listener.onOk(AmbilWarnaDialog.this, getColor());
+ }
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (AmbilWarnaDialog.this.listener != null) {
+ AmbilWarnaDialog.this.listener.onCancel(AmbilWarnaDialog.this);
+ }
+ }
+ })
+ .setOnCancelListener(new OnCancelListener() {
+ // if back button is used, call back our listener.
+ @Override
+ public void onCancel(DialogInterface paramDialogInterface) {
+ if (AmbilWarnaDialog.this.listener != null) {
+ AmbilWarnaDialog.this.listener.onCancel(AmbilWarnaDialog.this);
+ }
+
+ }
+ })
+ .create();
+ // kill all padding from the dialog window
+ dialog.setView(view, 0, 0, 0, 0);
+
+ // move cursor & target on first draw
+ ViewTreeObserver vto = view.getViewTreeObserver();
+ vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ moveCursor();
+ if (AmbilWarnaDialog.this.supportsAlpha) moveAlphaCursor();
+ moveTarget();
+ if (AmbilWarnaDialog.this.supportsAlpha) updateAlphaView();
+ view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+ }
+ });
+ }
+
+ protected void moveCursor() {
+ float y = viewHue.getMeasuredHeight() - (getHue() * viewHue.getMeasuredHeight() / 360.f);
+ if (y == viewHue.getMeasuredHeight()) y = 0.f;
+ RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewCursor.getLayoutParams();
+ layoutParams.leftMargin = (int) (viewHue.getLeft() - Math.floor(viewCursor.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
+ layoutParams.topMargin = (int) (viewHue.getTop() + y - Math.floor(viewCursor.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
+ viewCursor.setLayoutParams(layoutParams);
+ }
+
+ protected void moveTarget() {
+ float x = getSat() * viewSatVal.getMeasuredWidth();
+ float y = (1.f - getVal()) * viewSatVal.getMeasuredHeight();
+ RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewTarget.getLayoutParams();
+ layoutParams.leftMargin = (int) (viewSatVal.getLeft() + x - Math.floor(viewTarget.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
+ layoutParams.topMargin = (int) (viewSatVal.getTop() + y - Math.floor(viewTarget.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
+ viewTarget.setLayoutParams(layoutParams);
+ }
+
+ protected void moveAlphaCursor() {
+ final int measuredHeight = this.viewAlphaCheckered.getMeasuredHeight();
+ float y = measuredHeight - ((this.getAlpha() * measuredHeight) / 255.f);
+ final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.viewAlphaCursor.getLayoutParams();
+ layoutParams.leftMargin = (int) (this.viewAlphaCheckered.getLeft() - Math.floor(this.viewAlphaCursor.getMeasuredWidth() / 2) - this.viewContainer.getPaddingLeft());
+ layoutParams.topMargin = (int) ((this.viewAlphaCheckered.getTop() + y) - Math.floor(this.viewAlphaCursor.getMeasuredHeight() / 2) - this.viewContainer.getPaddingTop());
+
+ this.viewAlphaCursor.setLayoutParams(layoutParams);
+ }
+
+ private int getColor() {
+ final int argb = Color.HSVToColor(currentColorHsv);
+ return alpha << 24 | (argb & 0x00ffffff);
+ }
+
+ private float getHue() {
+ return currentColorHsv[0];
+ }
+
+ private float getAlpha() {
+ return this.alpha;
+ }
+
+ private float getSat() {
+ return currentColorHsv[1];
+ }
+
+ private float getVal() {
+ return currentColorHsv[2];
+ }
+
+ private void setHue(float hue) {
+ currentColorHsv[0] = hue;
+ }
+
+ private void setSat(float sat) {
+ currentColorHsv[1] = sat;
+ }
+
+ private void setAlpha(int alpha) {
+ this.alpha = alpha;
+ }
+
+ private void setVal(float val) {
+ currentColorHsv[2] = val;
+ }
+
+ public void show() {
+ dialog.show();
+ }
+
+ public AlertDialog getDialog() {
+ return dialog;
+ }
+
+ private void updateAlphaView() {
+ final GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] {
+ Color.HSVToColor(currentColorHsv), 0x0
+ });
+ viewAlphaOverlay.setBackgroundDrawable(gd);
+ }
+}
diff --git a/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java
new file mode 100644
index 00000000..1f0c86e4
--- /dev/null
+++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java
@@ -0,0 +1,46 @@
+package yuku.ambilwarna;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ComposeShader;
+import android.graphics.LinearGradient;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.Shader;
+import android.graphics.Shader.TileMode;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class AmbilWarnaSquare extends View {
+ Paint paint;
+ Shader luar;
+ final float[] color = { 1.f, 1.f, 1.f };
+
+ public AmbilWarnaSquare(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public AmbilWarnaSquare(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @SuppressLint("DrawAllocation") @Override protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (paint == null) {
+ paint = new Paint();
+ luar = new LinearGradient(0.f, 0.f, 0.f, this.getMeasuredHeight(), 0xffffffff, 0xff000000, TileMode.CLAMP);
+ }
+ int rgb = Color.HSVToColor(color);
+ Shader dalam = new LinearGradient(0.f, 0.f, this.getMeasuredWidth(), 0.f, 0xffffffff, rgb, TileMode.CLAMP);
+ ComposeShader shader = new ComposeShader(luar, dalam, PorterDuff.Mode.MULTIPLY);
+ paint.setShader(shader);
+ canvas.drawRect(0.f, 0.f, this.getMeasuredWidth(), this.getMeasuredHeight(), paint);
+ }
+
+ void setHue(float hue) {
+ color[0] = hue;
+ invalidate();
+ }
+}
diff --git a/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java
new file mode 100644
index 00000000..7ed4c4e3
--- /dev/null
+++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java
@@ -0,0 +1,34 @@
+package yuku.ambilwarna.widget;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.util.AttributeSet;
+import android.util.FloatMath;
+import android.view.View;
+
+public class AmbilWarnaPrefWidgetView extends View {
+ Paint paint;
+ float rectSize;
+ float strokeWidth;
+
+ public AmbilWarnaPrefWidgetView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ float density = context.getResources().getDisplayMetrics().density;
+ rectSize = FloatMath.floor(24.f * density + 0.5f);
+ strokeWidth = FloatMath.floor(1.f * density + 0.5f);
+
+ paint = new Paint();
+ paint.setColor(0xffffffff);
+ paint.setStyle(Style.STROKE);
+ paint.setStrokeWidth(strokeWidth);
+ }
+
+ @Override protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ canvas.drawRect(strokeWidth, strokeWidth, rectSize - strokeWidth, rectSize - strokeWidth, paint);
+ }
+}
diff --git a/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java
new file mode 100644
index 00000000..2c634eb9
--- /dev/null
+++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java
@@ -0,0 +1,134 @@
+package yuku.ambilwarna.widget;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.preference.Preference;
+import android.util.AttributeSet;
+import android.view.View;
+
+import yuku.ambilwarna.AmbilWarnaDialog;
+import yuku.ambilwarna.R;
+
+public class AmbilWarnaPreference extends Preference {
+ private final boolean supportsAlpha;
+ int value;
+
+ public AmbilWarnaPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.AmbilWarnaPreference);
+ supportsAlpha = ta.getBoolean(R.styleable.AmbilWarnaPreference_supportsAlpha, false);
+
+ setWidgetLayoutResource(R.layout.ambilwarna_pref_widget);
+ }
+
+ @Override protected void onBindView(View view) {
+ super.onBindView(view);
+
+ // Set our custom views inside the layout
+ final View box = view.findViewById(R.id.ambilwarna_pref_widget_box);
+ if (box != null) {
+ box.setBackgroundColor(value);
+ }
+ }
+
+ @Override protected void onClick() {
+ new AmbilWarnaDialog(getContext(), value, supportsAlpha, new AmbilWarnaDialog.OnAmbilWarnaListener() {
+ @Override public void onOk(AmbilWarnaDialog dialog, int color) {
+ if (!callChangeListener(color)) return; // They don't want the value to be set
+ value = color;
+ persistInt(value);
+ notifyChanged();
+ }
+
+ @Override public void onCancel(AmbilWarnaDialog dialog) {
+ // nothing to do
+ }
+ }).show();
+ }
+
+ public void forceSetValue(int value) {
+ this.value = value;
+ persistInt(value);
+ notifyChanged();
+ }
+
+ @Override protected Object onGetDefaultValue(TypedArray a, int index) {
+ // This preference type's value type is Integer, so we read the default value from the attributes as an Integer.
+ return a.getInteger(index, 0);
+ }
+
+ @Override protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+ if (restoreValue) { // Restore state
+ value = getPersistedInt(value);
+ } else { // Set state
+ int value = (Integer) defaultValue;
+ this.value = value;
+ persistInt(value);
+ }
+ }
+
+ /*
+ * Suppose a client uses this preference type without persisting. We
+ * must save the instance state so it is able to, for example, survive
+ * orientation changes.
+ */
+ @Override protected Parcelable onSaveInstanceState() {
+ final Parcelable superState = super.onSaveInstanceState();
+ if (isPersistent()) return superState; // No need to save instance state since it's persistent
+
+ final SavedState myState = new SavedState(superState);
+ myState.value = value;
+ return myState;
+ }
+
+ @Override protected void onRestoreInstanceState(Parcelable state) {
+ if (!state.getClass().equals(SavedState.class)) {
+ // Didn't save state for us in onSaveInstanceState
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
+ // Restore the instance state
+ SavedState myState = (SavedState) state;
+ super.onRestoreInstanceState(myState.getSuperState());
+ this.value = myState.value;
+ notifyChanged();
+ }
+
+ /**
+ * SavedState, a subclass of {@link android.preference.Preference.BaseSavedState}, will store the state
+ * of MyPreference, a subclass of Preference.
+ * <p>
+ * It is important to always call through to super methods.
+ */
+ private static class SavedState extends BaseSavedState {
+ int value;
+
+ public SavedState(Parcel source) {
+ super(source);
+ value = source.readInt();
+ }
+
+ @Override public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ dest.writeInt(value);
+ }
+
+ public SavedState(Parcelable superState) {
+ super(superState);
+ }
+
+ @SuppressWarnings("unused") public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
+ public SavedState createFromParcel(Parcel in) {
+ return new SavedState(in);
+ }
+
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ };
+ }
+}
diff --git a/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png
new file mode 100644
index 00000000..d2aa1b09
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png
new file mode 100644
index 00000000..faf1bd75
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.png
new file mode 100644
index 00000000..28cebc32
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.png
new file mode 100644
index 00000000..6f7bf906
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png
new file mode 100644
index 00000000..19d6d4ef
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png
new file mode 100644
index 00000000..ace7986b
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png
new file mode 100644
index 00000000..539eeeb9
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png
new file mode 100644
index 00000000..4fdf5977
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png
new file mode 100644
index 00000000..5ceec214
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png
new file mode 100644
index 00000000..5f434552
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png
new file mode 100644
index 00000000..23d54619
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.png
new file mode 100644
index 00000000..c336e883
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.png
new file mode 100644
index 00000000..09d28397
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.png
new file mode 100644
index 00000000..56fa0de9
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png
new file mode 100644
index 00000000..592dd7ca
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png
new file mode 100644
index 00000000..04f655ad
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.png
new file mode 100644
index 00000000..ddea3167
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.png
new file mode 100644
index 00000000..bb4b1eb7
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.png
Binary files differ
diff --git a/libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml b/libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml
new file mode 100644
index 00000000..049f1332
--- /dev/null
+++ b/libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ambilwarna_alphacheckered"
+ android:tileMode="repeat" >
+
+</bitmap> \ No newline at end of file
diff --git a/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml b/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml
new file mode 100644
index 00000000..bd4b9089
--- /dev/null
+++ b/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/ambilwarna_viewContainer"
+ android:paddingTop="@dimen/ambilwarna_spacer"
+ android:paddingRight="@dimen/ambilwarna_spacer"
+ android:paddingBottom="0dp"
+ android:paddingLeft="@dimen/ambilwarna_spacer"
+ android:clipToPadding="false"
+ android:layout_gravity="center"
+>
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/ambilwarna_state"
+ android:orientation="vertical"
+ android:paddingRight="@dimen/ambilwarna_spacer"
+ android:gravity="center"
+ android:layout_centerVertical="true"
+ >
+ <FrameLayout
+ android:layout_width="60dp"
+ android:layout_height="30dp">
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_oldColor"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#faa" />
+ </FrameLayout>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ambilwarna_arrow_down"
+ android:paddingTop="@dimen/ambilwarna_spacer"
+ android:paddingBottom="@dimen/ambilwarna_spacer"
+ />
+ <FrameLayout
+ android:layout_width="60dp"
+ android:layout_height="30dp">
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_newColor"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#aaf" />
+ </FrameLayout>
+ </LinearLayout>
+ <yuku.ambilwarna.AmbilWarnaSquare
+ android:id="@+id/ambilwarna_viewSatBri"
+ android:layout_width="@dimen/ambilwarna_hsvWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_toRightOf="@id/ambilwarna_state"
+ android:layerType="software"
+ />
+ <!-- needed because i can't get parent keeping its bottom layout
+ and its wrap_content height. This view will serve as a bottom spacer. -->
+ <View
+ android:layout_width="@dimen/ambilwarna_spacer"
+ android:layout_height="@dimen/ambilwarna_spacer"
+ android:layout_below="@id/ambilwarna_viewSatBri"
+ />
+ <ImageView
+ android:id="@+id/ambilwarna_viewHue"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_toRightOf="@id/ambilwarna_viewSatBri"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:src="@drawable/ambilwarna_hue"
+ android:scaleType="fitXY"
+ />
+
+ <ImageView
+ android:id="@+id/ambilwarna_alphaCheckered"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:layout_toRightOf="@id/ambilwarna_viewHue"
+ android:scaleType="fitXY"
+ android:src="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_overlay"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:layout_toRightOf="@id/ambilwarna_viewHue" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_cursor"
+ android:layout_width="9dp"
+ android:layout_height="9dp"
+ android:src="@drawable/ambilwarna_cursor"
+ android:scaleType="matrix"
+ />
+
+ <ImageView
+ android:id="@+id/ambilwarna_alphaCursor"
+ android:layout_width="9dp"
+ android:layout_height="9dp"
+ android:scaleType="matrix"
+ android:src="@drawable/ambilwarna_cursor" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_target"
+ android:layout_width="15dp"
+ android:layout_height="15dp"
+ android:src="@drawable/ambilwarna_target"
+ android:scaleType="matrix"
+ />
+
+
+</RelativeLayout>
diff --git a/libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml b/libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml
new file mode 100644
index 00000000..8a1a403e
--- /dev/null
+++ b/libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/ambilwarna_dialogView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center" >
+
+ <RelativeLayout
+ android:id="@+id/ambilwarna_viewContainer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:clipToPadding="false"
+ android:paddingBottom="@dimen/ambilwarna_spacer"
+ android:paddingLeft="@dimen/ambilwarna_spacer"
+ android:paddingRight="@dimen/ambilwarna_spacer"
+ android:paddingTop="@dimen/ambilwarna_spacer" >
+
+ <yuku.ambilwarna.AmbilWarnaSquare
+ android:id="@+id/ambilwarna_viewSatBri"
+ android:layout_width="@dimen/ambilwarna_hsvWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layerType="software" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_viewHue"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:layout_toRightOf="@id/ambilwarna_viewSatBri"
+ android:scaleType="fitXY"
+ android:src="@drawable/ambilwarna_hue" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_alphaCheckered"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:layout_toRightOf="@id/ambilwarna_viewHue"
+ android:scaleType="fitXY"
+ android:src="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_overlay"
+ android:layout_width="@dimen/ambilwarna_hueWidth"
+ android:layout_height="@dimen/ambilwarna_hsvHeight"
+ android:layout_marginLeft="@dimen/ambilwarna_spacer"
+ android:layout_toRightOf="@id/ambilwarna_viewHue" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_cursor"
+ android:layout_width="9dp"
+ android:layout_height="9dp"
+ android:scaleType="matrix"
+ android:src="@drawable/ambilwarna_cursor" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_alphaCursor"
+ android:layout_width="9dp"
+ android:layout_height="9dp"
+ android:scaleType="matrix"
+ android:src="@drawable/ambilwarna_cursor" />
+
+ <ImageView
+ android:id="@+id/ambilwarna_target"
+ android:layout_width="15dp"
+ android:layout_height="15dp"
+ android:scaleType="matrix"
+ android:src="@drawable/ambilwarna_target" />
+
+ <LinearLayout
+ android:id="@+id/ambilwarna_state"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/ambilwarna_viewSatBri"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="@dimen/ambilwarna_spacer"
+ android:gravity="center"
+ android:orientation="horizontal" >
+
+ <FrameLayout
+ android:layout_width="60dp"
+ android:layout_height="30dp" >
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_oldColor"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#faa" />
+ </FrameLayout>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/ambilwarna_spacer"
+ android:paddingRight="@dimen/ambilwarna_spacer"
+ android:src="@drawable/ambilwarna_arrow_right" />
+
+ <FrameLayout
+ android:layout_width="60dp"
+ android:layout_height="30dp" >
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@drawable/ambilwarna_alphacheckered_tiled" />
+
+ <View
+ android:id="@+id/ambilwarna_newColor"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#aaf" />
+ </FrameLayout>
+ </LinearLayout>
+ </RelativeLayout>
+
+</FrameLayout> \ No newline at end of file
diff --git a/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml b/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml
new file mode 100644
index 00000000..bbab8d95
--- /dev/null
+++ b/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="6dp"
+ android:focusable="false"
+ android:clickable="false">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="fitXY"
+ android:src="@drawable/ambilwarna_alphacheckered_tiled"/>
+
+
+ <yuku.ambilwarna.widget.AmbilWarnaPrefWidgetView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/ambilwarna_pref_widget_box"
+ />
+</FrameLayout>
diff --git a/libs/colorpicker/src/main/res/values-land/dimen.xml b/libs/colorpicker/src/main/res/values-land/dimen.xml
new file mode 100644
index 00000000..f1c48326
--- /dev/null
+++ b/libs/colorpicker/src/main/res/values-land/dimen.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="ambilwarna_hsvWidth">240dp</dimen>
+ <dimen name="ambilwarna_hsvHeight">120dp</dimen>
+</resources> \ No newline at end of file
diff --git a/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml b/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml
new file mode 100644
index 00000000..1e72cca5
--- /dev/null
+++ b/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="ambilwarna_hsvWidth">240dp</dimen>
+ <dimen name="ambilwarna_hsvHeight">240dp</dimen>
+</resources> \ No newline at end of file
diff --git a/libs/colorpicker/src/main/res/values/attrs.xml b/libs/colorpicker/src/main/res/values/attrs.xml
new file mode 100644
index 00000000..ee65a5b9
--- /dev/null
+++ b/libs/colorpicker/src/main/res/values/attrs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <declare-styleable name="AmbilWarnaPreference">
+ <attr name="supportsAlpha"
+ format="boolean"/>
+ </declare-styleable>
+</resources>
diff --git a/libs/colorpicker/src/main/res/values/dimen.xml b/libs/colorpicker/src/main/res/values/dimen.xml
new file mode 100644
index 00000000..92f53a2e
--- /dev/null
+++ b/libs/colorpicker/src/main/res/values/dimen.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="ambilwarna_hsvHeight">240dp</dimen>
+ <dimen name="ambilwarna_hsvWidth">240dp</dimen>
+ <dimen name="ambilwarna_hueWidth">30dp</dimen>
+ <dimen name="ambilwarna_spacer">8dp</dimen>
+</resources>