Android holo blue hex value

Android-holo-blue-hex-value-featured.png

//package com.hyperzsoft.utils
import android.application.Dialog
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Fresh paint
import android.os.Bundle
import android.view.MotionEvent
import android.view.View

public class ColorSelectDialog stretches Dialog

private OnColorChangedListener mListener
private int mInitialColor
private String mKey

public static class ColorPickerView stretches View Fresh paint mPaint
private float mCurrentHue =
private final int[] mHueBarColors = new int[258]
private OnColorChangedListener mListener

public void setColor(int color)

public int getColor()

ColorPickerView(Context c, OnColorChangedListener l, int color) Obtain the current hue in the current color increase the primary color area
float[] hsv = new float[3]
Color.colorToHSV(color, hsv)
mCurrentHue = hsv[]

// Initialize the colours from the hue slider bar
int index =
for (float i= i<256 i += 256/42) // Red (#f00) to pink (#f0f) for (float i= i<256 i += 256/42) // Pink (#f0f) to blue (#00f) for (float i= i<256 i += 256/42) // Blue (#00f) to light blue (#0ff) for (float i= i<256 i += 256/42) // Light blue (#0ff) to eco-friendly (#0f0) for (float i= i<256 i += 256/42) // Green (#0f0) to yellow (#ff0) for (float i= i<256 i += 256/42) // Yellow (#ff0) to red (#f00)
// Initializes the Fresh paint which will draw the vista
mPaint = new Fresh paint(Fresh paint.ANTI_ALIAS_FLAG)
mPaint.setTextAlign(Fresh paint.Align.CENTER)
mPaint.setTextSize(12)

// Obtain the current selected color in the hue bar
private int getCurrentMainColor()

for (float i= i<256 i += 256/42) for (float i= i<256 i += 256/42) for (float i= i<256 i += 256/42) for (float i= i<256 i += 256/42) for (float i= i<256 i += 256/42) return Color.Red-colored
@Override
protected void onDraw(Canvas canvas) all of the colors from the hue bar with lines
for (int x= x<256 x++)
If this isn’t the present selected hue, display the particular color
if (translatedHue != x)

else // else display a rather bigger black line

canvas.drawLine((x*2)+10, , (x*2)+10, 40, mPaint)

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

@Override
public boolean onTouchEvent(MotionEvent event) Lower) return true
float x = event.getX()
float y = event.getY()

//the touch event is situated within the hue bar
if (x > 10 && x < 522 && y> && y < 40)
primary area colors
mCurrentHue = (255-(x/2))*360/255
mListener.colorChanged(“”, getCurrentMainColor())

// Pressure the redraw from the dialog
invalidate()

return true

public ColorSelectDialog(Context context, OnColorChangedListener listener, String key, int initialColor)

@Override
protected void onCreate(Bundle savedInstanceState)

setContentView(new ColorPickerView(getContext(), l, mInitialColor))
setTitle(“Choose Color”)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>