App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mhr.appandroid.views.colorpicker.ColorPickerView Class Reference

Kompletní View pro výběr barev v režimu RGB, Alpha nastavena jako 0xFF. More...

Inheritance diagram for mhr.appandroid.views.colorpicker.ColorPickerView:

## Classes
interface | OnColorCanceledListener
interface | OnColorChangedListener
interface | OnColorSelectedListener

## Public Member Functions
void | setOnSelectedListener (OnColorSelectedListener selectedListener)
void | setOnChangedListener (OnColorChangedListener changedListener)
void | setOnCanceledListener (OnColorCanceledListener canceledListener)
int | getNewColor ()
int | getOldColor ()
int | getNativeNewColor ()
int | getNativeOldColor ()
void | setNewColor (int color)
void | setOldColor (int color)
void | setNativeOldColor (int nativeColor)
void | setNativeNewColor (int nativeColor)
void | setState (int color)
| Nastaví starou i novou barvu na hodnotu color.
void | setNativeState (int nativeColor)
| Nastaví starou i novou barvu na hodnotu odpovídající color.
void | setPickerEnabled (Boolean enabled)
| Nastaví, zda má být View povolen, pokud není, zešedne a nereaguje na vstup uživatele.
boolean | isPickerEnabled ()
| ColorPickerView (Context context)
| ColorPickerView (Context context, AttributeSet attrs)
| ColorPickerView (Context context, AttributeSet attrs, int defStyle)
void | onRestoreInstanceState (Parcelable state)
Parcelable | onSaveInstanceState ()
void | onProgressChanged (SeekBar seekBar, int progress, boolean fromUser)
| Zpracovává události SeekBarů
void | onStartTrackingTouch (SeekBar seekBar)
void | onStopTrackingTouch (SeekBar seekBar)
void | onClick (View v)
| Zpracovává události onClick pro pootmky.
void | onSVPickerChange (SVPickerView picker)
| Aktualizuje stav po změně SVPickeru.
void | onSVPickerStartTrackingTouch (SVPickerView picker)
| Voláno v okamžiku, kdy uživatel poprvé začne interagovat s Pickerem.
void | onSVPickerStopTrackingTouch (SVPickerView picker)
| Voláno v okamžiku, kdy uživatel zkončí svoji práci s Pickerem.

## Protected Member Functions
void | initSeekBar (SeekBar sb)
| Inicializje daný SeekBar ve smyslu tvaru pozadí, nikoliv barvy a stylu.
int | getNativeColor (int r, int g, int b)
| Ze zadaných složek vytvoří barvu v nativním formátu.
int | getNativeColor (int clr)
| Ze zadané barvy v Androidím formátu vytvoří barvu v nativním formátu.
int | getAndroidColor (int nativeClr)
| Ze zadané nativní barvy vytvoří barvu v Androidím formátu.
void | setSeekBarGradient (SeekBar sb, int[] colors)
| Nastaví gradient pozadí SeekBaru tak, že bude tvořen rovnoměrně rozloženými barvami z pole colors.
int | getFullySaturatedSelColor ()
| Vrátí plně saturovanou barvu pro barvu uloženou v newColorHSV.
int | getFullValueSelColor ()
| Vrátí barvu s maximální hodnotou value pro barvu uloženou v newColorHSV.
int | getFullyDesaturatedSelColor ()
| Vrátí plně desaturovanou barvu pro barvu uloženou v newColorHSV.
int[] | getHueSwatchForNewColor ()
| Vrátí barvy pro gradient obsahující všechny odstíny pro barvu uloženou v newColorHSV.
void | init ()
| Provede inicializace třídy - nalezení komponent, registrace posluchačů, nastavení defaultních barev.
void | setColor (int color)
| Nastaví barvu ze zadaných hodnot.
void | setColor (int r, int g, int b)
| Nastaví barvu ze zadaných hodnot.
void | setColor (float[] color)
| Nastaví barvu ze zadaných hodnot.
void | setColor (float h, float s, float v)
| Nastaví barvu ze zadaných hodnot.
void | updateNewColor ()
| Aktualizuje náhled nové barvy.
void | updateRGBSeekBars (boolean reposition)
| Aktualizuje RGB SeekBary.
void | updateHSVSeekBars (boolean reposition)
| Aktualizuje HSV SeekBary.
void | updateSVPicker ()
| Aktualizuje SVPicker.
void | updateStateFromRGBSeekBars ()
| Aktualizuje stav celého pickeru z RGB SeekBarů.
void | updateStateFromHSeekBar ()
| Aktualizuje stav celého pickeru z H SeekBaru.
void | updateStateFromSVSeekBars ()
| Aktualizuje stav celého pickeru z SV SeekBarů.

## Protected Attributes
SeekBar | redValueSB
SeekBar | greenValueSB
SeekBar | blueValueSB
SeekBar | hueValueSB
SeekBar | saturationValueSB
SeekBar | valueValueSB
SVPickerView | svPicker
View | newColorV
View | oldColorV
TextView | redValueTV
TextView | greenValueTV
TextView | blueValueTV
TextView | hueValueTV
TextView | saturationValueTV
TextView | valueValueTV
Button | selectBtn
Button | cancelBtn
int | newColor = 0xFF000000
| Hodnota nové (aktuálně vybrané) barvy ve formátu Android.
int | oldColor = 0xFF000000
| Hodnota staré barvy ve formátu Android.
float[] | newColorHSV = new float[3]
| Hodnota nové (aktuálně vybrané) barvy jako HSV ve formátu Android (0..360, 0..1, 0..1)
int[] | newColorRGB = new int[3]
| Hodnota nové (aktuálně vybrané) barvy po složkách 0..255.
float[] | tmp = new float[3]
| Dočasné pole pro převody mezi barvami, aby se nemuselo neustále vytvářet běhěm dynamických změn UI.
OnColorSelectedListener | selectedListener = null
OnColorChangedListener | changedListener = null
OnColorCanceledListener | canceledListener = null
View | overlay
boolean | enabled = true

## Detailed Description

Kompletní View pro výběr barev v režimu RGB, Alpha nastavena jako 0xFF.

View pro výběr barvy pomocí RGB a HSV hodnot, nabízí kompletní funkcionalitu jako pokročilé nástoroje typu Photoshop a GIMP s okamžitým náhledem vybrané barvy a náhledem změny jednotlivých parametrů.

Neumožňuje výběr alphy, ta je nastavena na max, protože náhled barev s průhledností nemůže být optimální bez nastavení bozadí, navíc alpha není přímo vlastností barvy, ale spíš souvisí s její aplikací.

Vlastní Scrubber pro SeekBary je vytvořen v GIMPu, pro hdpi je prolnutí řešeno odstraněním eliptického vyběru 30x30 s feather edges 10.

SVPickerView musi běřet jako softwarová vrstva, protože android neumožňuje tvorbu požadovaných HW shaderů, to ale vyžaduje manuální volání invalidate() na všech SeekBarech, pravděpodobně nastavení SVPickerView na SW vykreslování vede k nastavení tohoto módu i dále.

Definition at line 49 of file ColorPickerView.java.

## Constructor & Destructor Documentation

mhr.appandroid.views.colorpicker.ColorPickerView.ColorPickerView | ( | Context | context | ) |
| inline

Definition at line 329 of file ColorPickerView.java.

{
super(context);
init();
}

mhr.appandroid.views.colorpicker.ColorPickerView.ColorPickerView | ( | Context | context,
|  | AttributeSet | attrs
| ) |  |
| inline

Definition at line 334 of file ColorPickerView.java.

{
super(context, attrs);
init();
}

mhr.appandroid.views.colorpicker.ColorPickerView.ColorPickerView | ( | Context | context,
|  | AttributeSet | attrs,
|  | int | defStyle
| ) |  |
| inline

Definition at line 339 of file ColorPickerView.java.

{
super(context, attrs, defStyle);
init();
}

## Member Function Documentation

int mhr.appandroid.views.colorpicker.ColorPickerView.getAndroidColor | ( | int | nativeClr | ) |
| inlineprotected

Ze zadané nativní barvy vytvoří barvu v Androidím formátu.

Parameters

  nativeClr |

Returns

Definition at line 247 of file ColorPickerView.java.

{
// Nativni: 0xAABBGGRR Android:0xAARRGGBB
return 0xFF000000 | ((nativeClr & 0x000000FF) << 16) | (nativeClr & 0x0000FF00) | ((nativeClr & 0x00FF0000) >> 16);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getFullValueSelColor | ( |  | ) |
| inlineprotected

Vrátí barvu s maximální hodnotou value pro barvu uloženou v newColorHSV.

Returns

Definition at line 276 of file ColorPickerView.java.

{
tmp[0] = newColorHSV[0];
tmp[1] = newColorHSV[1];
tmp[2] = 1.000f;
return Color.HSVToColor(tmp);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getFullyDesaturatedSelColor | ( |  | ) |
| inlineprotected

Vrátí plně desaturovanou barvu pro barvu uloženou v newColorHSV.

Returns

Definition at line 287 of file ColorPickerView.java.

{
tmp[0] = newColorHSV[0];
tmp[1] = 0.000f;
tmp[2] = newColorHSV[2];
return Color.HSVToColor(tmp);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getFullySaturatedSelColor | ( |  | ) |
| inlineprotected

Vrátí plně saturovanou barvu pro barvu uloženou v newColorHSV.

Returns

Definition at line 265 of file ColorPickerView.java.

{
tmp[0] = newColorHSV[0];
tmp[1] = 1.000f;
tmp[2] = newColorHSV[2];
return Color.HSVToColor(tmp);
}

int [] mhr.appandroid.views.colorpicker.ColorPickerView.getHueSwatchForNewColor | ( |  | ) |
| inlineprotected

Vrátí barvy pro gradient obsahující všechny odstíny pro barvu uloženou v newColorHSV.

Returns

Definition at line 298 of file ColorPickerView.java.

{
int[] retVal = new int[7];
tmp[1] = newColorHSV[1];
tmp[2] = newColorHSV[2];
tmp[0] = 0;
retVal[0] = Color.HSVToColor(tmp);
tmp[0] = 60;
retVal[1] = Color.HSVToColor(tmp);
tmp[0] = 120;
retVal[2] = Color.HSVToColor(tmp);
tmp[0] = 180;
retVal[3] = Color.HSVToColor(tmp);
tmp[0] = 240;
retVal[4] = Color.HSVToColor(tmp);
tmp[0] = 300;
retVal[5] = Color.HSVToColor(tmp);
tmp[0] = 360;
retVal[6] = Color.HSVToColor(tmp);
return retVal;
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getNativeColor | ( | int | r,
|  | int | g,
|  | int | b
| ) |  |
| inlineprotected

Ze zadaných složek vytvoří barvu v nativním formátu.

Parameters

  r |
  g |
  b |

Returns

Definition at line 227 of file ColorPickerView.java.

{
// Nativni: 0xAABBGGRR Android:0xAARRGGBB
return 0xFF000000 | (b << 16) | (g << 8) | r;
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getNativeColor | ( | int | clr | ) |
| inlineprotected

Ze zadané barvy v Androidím formátu vytvoří barvu v nativním formátu.

Parameters

  clr |

Returns

Definition at line 237 of file ColorPickerView.java.

{
// Nativni: 0xAABBGGRR Android:0xAARRGGBB
return 0xFF000000 | ((clr & 0x000000FF) << 16) | (clr & 0x0000FF00) | ((clr & 0x00FF0000) >> 16);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getNativeNewColor | ( |  | ) |
| inline

Definition at line 137 of file ColorPickerView.java.

{
return getNativeColor(newColor);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getNativeOldColor | ( |  | ) |
| inline

Definition at line 141 of file ColorPickerView.java.

{
return getNativeColor(oldColor);
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getNewColor | ( |  | ) |
| inline

Definition at line 129 of file ColorPickerView.java.

{
return newColor;
}

int mhr.appandroid.views.colorpicker.ColorPickerView.getOldColor | ( |  | ) |
| inline

Definition at line 133 of file ColorPickerView.java.

{
return oldColor;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.init | ( |  | ) |
| inlineprotected

Provede inicializace třídy - nalezení komponent, registrace posluchačů, nastavení defaultních barev.

Definition at line 347 of file ColorPickerView.java.

{
if (isInEditMode()) {
TextView tv = new TextView(getContext());
tv.setText("ColorPickerView, preview not availiable.");
addView(tv);
return;
}
try {
((Activity) getContext()).getLayoutInflater().inflate(R.layout.view_color_picker, this, true);
} catch (ClassCastException exc) {
// Tento kod probehne, pokud je poroblem s pretypovanim, napriklad pro nahled v Eclipse, behem behu programu by nemel nastat
TextView tv = new TextView(getContext());
tv.setText("Prewiew not available, requires Activity to be Context.");
addView(tv);
return;
}
// Inicializace promennych, pro rychly pristup k prvkum formulare
redValueSB = (SeekBar) findViewById(R.id.RedValueSB);
greenValueSB = (SeekBar) findViewById(R.id.GreenValueSB);
blueValueSB = (SeekBar) findViewById(R.id.BlueValueSB);
hueValueSB = (SeekBar) findViewById(R.id.HueValueSB);
saturationValueSB = (SeekBar) findViewById(R.id.SaturationValueSB);
valueValueSB = (SeekBar) findViewById(R.id.ValueValueSB);
svPicker = (SVPickerView) findViewById(R.id.SVPicker);
redValueTV = (TextView) findViewById(R.id.RedValueTV);
greenValueTV = (TextView) findViewById(R.id.GreenValueTV);
blueValueTV = (TextView) findViewById(R.id.BlueValueTV);
hueValueTV = (TextView) findViewById(R.id.HueValueTV);
saturationValueTV = (TextView) findViewById(R.id.SaturationValueTV);
valueValueTV = (TextView) findViewById(R.id.ValueValueTV);
newColorV = findViewById(R.id.NewColorView);
oldColorV = findViewById(R.id.OldColorView);
selectBtn = (Button) findViewById(R.id.SelectColorBtn);
cancelBtn = (Button) findViewById(R.id.CancelColorBtn);
overlay = findViewById(R.id.ColorPickerDisabledOverlay);
// Nastaveni sebe jako posluchace udalosti potomku.
redValueSB.setOnSeekBarChangeListener(this);
greenValueSB.setOnSeekBarChangeListener(this);
blueValueSB.setOnSeekBarChangeListener(this);
hueValueSB.setOnSeekBarChangeListener(this);
saturationValueSB.setOnSeekBarChangeListener(this);
valueValueSB.setOnSeekBarChangeListener(this);
svPicker.setOnSVChangedListener(this);
selectBtn.setOnClickListener(this);
cancelBtn.setOnClickListener(this);
oldColorV.setOnClickListener(this);
// Nastaveni spravneho typu pozadi pro seekbary
initSeekBar(redValueSB);
initSeekBar(greenValueSB);
initSeekBar(blueValueSB);
initSeekBar(hueValueSB);
initSeekBar(saturationValueSB);
initSeekBar(valueValueSB);
// Nastaveni barev
setNewColor(0xFFFFFFFF);
setOldColor(0xFF000000);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.initSeekBar | ( | SeekBar | sb | ) |
| inlineprotected

Inicializje daný SeekBar ve smyslu tvaru pozadí, nikoliv barvy a stylu.

Parameters

  sb | SeekBar

Definition at line 209 of file ColorPickerView.java.

{
Path pth = new Path(); // Cara presne uprostred
pth.moveTo(0, 50);
pth.lineTo(100, 50);
ShapeDrawable sdr = new ShapeDrawable(new PathShape(pth, 100, 100));
Paint paint = sdr.getPaint();
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(20); // tloustka je 20%
sb.setProgressDrawable(sdr);
}

boolean mhr.appandroid.views.colorpicker.ColorPickerView.isPickerEnabled | ( |  | ) |
| inline

Definition at line 198 of file ColorPickerView.java.

{
return enabled;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onClick | ( | View | v | ) |
| inline

Zpracovává události onClick pro pootmky.

Definition at line 613 of file ColorPickerView.java.

{
if (v == selectBtn) {
oldColor = newColor;
oldColorV.setBackgroundColor(oldColor);
if (selectedListener != null) {
selectedListener.onColorSelected(this);
}
} else if (v == cancelBtn) {
setNewColor(oldColor);
if (changedListener != null) {
changedListener.onColorChanged(this);
}
if (canceledListener != null) {
canceledListener.onColorCanceled(this);
}
} else if (v == oldColorV) {
setNewColor(oldColor);
if (changedListener != null) {
changedListener.onColorChanged(this);
}
}
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onProgressChanged | ( | SeekBar | seekBar,
|  | int | progress,
|  | boolean | fromUser
| ) |  |
| inline

Zpracovává události SeekBarů

Definition at line 585 of file ColorPickerView.java.

{
if (!fromUser) {
return;
}
if (seekBar == redValueSB || seekBar == greenValueSB || seekBar == blueValueSB) {
updateStateFromRGBSeekBars();
} else if (seekBar == hueValueSB) {
updateStateFromHSeekBar();
} else if (seekBar == saturationValueSB || seekBar == valueValueSB) {
updateStateFromSVSeekBars();
}
if (changedListener != null) {
changedListener.onColorChanged(this);
}
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onRestoreInstanceState | ( | Parcelable | state | ) |
| inline

Definition at line 410 of file ColorPickerView.java.

{
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
setOldColor(bundle.getInt("oldColor"));
setNewColor(bundle.getInt("newColor"));
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}

Parcelable mhr.appandroid.views.colorpicker.ColorPickerView.onSaveInstanceState | ( |  | ) |
| inline

Definition at line 424 of file ColorPickerView.java.

{
Bundle bundle = new Bundle();
bundle.putParcelable("instanceState", super.onSaveInstanceState());
bundle.putInt("newColor", newColor);
bundle.putInt("oldColor", oldColor);
return bundle;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onStartTrackingTouch | ( | SeekBar | seekBar | ) |
| inline

Definition at line 602 of file ColorPickerView.java.

{
// Nevyužitá událost SeekBaru
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onStopTrackingTouch | ( | SeekBar | seekBar | ) |
| inline

Definition at line 607 of file ColorPickerView.java.

{
// Nevyužitá událost SeekBaru
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onSVPickerChange | ( | SVPickerView | picker | ) |
| inline

Aktualizuje stav po změně SVPickeru.

Implements mhr.appandroid.views.colorpicker.SVPickerView.OnSVPickerChangeListener.

Definition at line 638 of file ColorPickerView.java.

{
picker.getColor(tmp);
setColor(tmp);
updateRGBSeekBars(true);
updateHSVSeekBars(true);
updateNewColor();
if (changedListener != null) {
changedListener.onColorChanged(this);
}
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onSVPickerStartTrackingTouch | ( | SVPickerView | picker | ) |
| inline

Voláno v okamžiku, kdy uživatel poprvé začne interagovat s Pickerem.

Parameters

  picker |

Implements mhr.appandroid.views.colorpicker.SVPickerView.OnSVPickerChangeListener.

Definition at line 650 of file ColorPickerView.java.

{
// Nevyužitá událost SVPickeru
}

void mhr.appandroid.views.colorpicker.ColorPickerView.onSVPickerStopTrackingTouch | ( | SVPickerView | picker | ) |
| inline

Voláno v okamžiku, kdy uživatel zkončí svoji práci s Pickerem.

Parameters

  picker |

Implements mhr.appandroid.views.colorpicker.SVPickerView.OnSVPickerChangeListener.

Definition at line 655 of file ColorPickerView.java.

{
// Nevyužitá událost SeekBaru
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setColor | ( | int | color | ) |
| inlineprotected

Nastaví barvu ze zadaných hodnot.

Parameters

  color |

Definition at line 437 of file ColorPickerView.java.

{
newColor = color;
newColorRGB[0] = (newColor & 0x00FF0000) >> 16;
newColorRGB[1] = (newColor & 0x0000FF00) >> 8;
newColorRGB[2] = (newColor & 0x000000FF);
Color.colorToHSV(newColor, newColorHSV);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setColor | ( | int | r,
|  | int | g,
|  | int | b
| ) |  |
| inlineprotected

Nastaví barvu ze zadaných hodnot.

Parameters

  color |

Definition at line 449 of file ColorPickerView.java.

{
newColor = 0xFF000000 | (r << 16) | (g << 8) | b;
newColorRGB[0] = r;
newColorRGB[1] = g;
newColorRGB[2] = b;
Color.colorToHSV(newColor, newColorHSV);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setColor | ( | float[] | color | ) |
| inlineprotected

Nastaví barvu ze zadaných hodnot.

Parameters

  color |

Definition at line 461 of file ColorPickerView.java.

{
newColor = Color.HSVToColor(color);
newColorRGB[0] = (newColor & 0x00FF0000) >> 16;
newColorRGB[1] = (newColor & 0x0000FF00) >> 8;
newColorRGB[2] = (newColor & 0x000000FF);
newColorHSV[0] = color[0];
newColorHSV[1] = color[1];
newColorHSV[2] = color[2];
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setColor | ( | float | h,
|  | float | s,
|  | float | v
| ) |  |
| inlineprotected

Nastaví barvu ze zadaných hodnot.

Parameters

  color |

Definition at line 475 of file ColorPickerView.java.

{
newColorHSV[0] = h;
newColorHSV[1] = s;
newColorHSV[2] = v;
newColor = Color.HSVToColor(newColorHSV);
newColorRGB[0] = (newColor & 0x00FF0000) >> 16;
newColorRGB[1] = (newColor & 0x0000FF00) >> 8;
newColorRGB[2] = (newColor & 0x000000FF);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setNativeNewColor | ( | int | nativeColor | ) |
| inline

Definition at line 163 of file ColorPickerView.java.

{
setNewColor(getAndroidColor(nativeColor));
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setNativeOldColor | ( | int | nativeColor | ) |
| inline

Definition at line 158 of file ColorPickerView.java.

{
oldColor = getAndroidColor(nativeColor);
oldColorV.setBackgroundColor(oldColor);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setNativeState | ( | int | nativeColor | ) |
| inline

Nastaví starou i novou barvu na hodnotu odpovídající color.

Parameters

  color |

Definition at line 180 of file ColorPickerView.java.

{
setNativeNewColor(nativeColor);
setNativeOldColor(nativeColor);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setNewColor | ( | int | color | ) |
| inline

Definition at line 145 of file ColorPickerView.java.

{
setColor(color);
updateRGBSeekBars(true);
updateHSVSeekBars(true);
updateSVPicker();
updateNewColor();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setOldColor | ( | int | color | ) |
| inline

Definition at line 153 of file ColorPickerView.java.

{
oldColor = color;
oldColorV.setBackgroundColor(oldColor);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setOnCanceledListener | ( | OnColorCanceledListener | canceledListener | ) |
| inline

Definition at line 125 of file ColorPickerView.java.

{
this.canceledListener = canceledListener;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setOnChangedListener | ( | OnColorChangedListener | changedListener | ) |
| inline

Definition at line 121 of file ColorPickerView.java.

{
this.changedListener = changedListener;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setOnSelectedListener | ( | OnColorSelectedListener | selectedListener | ) |
| inline

Definition at line 117 of file ColorPickerView.java.

{
this.selectedListener = selectedListener;
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setPickerEnabled | ( | Boolean | enabled | ) |
| inline

Nastaví, zda má být View povolen, pokud není, zešedne a nereaguje na vstup uživatele.

Parameters

  enabled |

Definition at line 189 of file ColorPickerView.java.

{
this.enabled = enabled;
if (enabled) {
overlay.setVisibility(VISIBLE);
} else {
overlay.setVisibility(GONE);
}
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setSeekBarGradient | ( | SeekBar | sb,
|  | int[] | colors
| ) |  |
| inlineprotected

Nastaví gradient pozadí SeekBaru tak, že bude tvořen rovnoměrně rozloženými barvami z pole colors.

Parameters

  sb |
  colors |

Definition at line 257 of file ColorPickerView.java.

{
((ShapeDrawable) sb.getProgressDrawable()).getPaint().setShader(new LinearGradient(0, 0, 100, 0, colors, null, TileMode.CLAMP));
}

void mhr.appandroid.views.colorpicker.ColorPickerView.setState | ( | int | color | ) |
| inline

Nastaví starou i novou barvu na hodnotu color.

Parameters

  color |

Definition at line 171 of file ColorPickerView.java.

{
setNewColor(color);
setOldColor(color);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateHSVSeekBars | ( | boolean | reposition | ) |
| inlineprotected

Aktualizuje HSV SeekBary.

Parameters

  reposition | Udává, jestli je třeba nastavit i pozici SeekBarů

Definition at line 522 of file ColorPickerView.java.

{
int h = Math.round(newColorHSV[0]);
int s = Math.round(newColorHSV[1] * 255);
int v = Math.round(newColorHSV[2] * 255);
if (reposition) {
hueValueSB.setProgress(h);
saturationValueSB.setProgress(s);
valueValueSB.setProgress(v);
}
hueValueTV.setText(Integer.toString(h));
saturationValueTV.setText(Integer.toString(s));
valueValueTV.setText(Integer.toString(v));
setSeekBarGradient(hueValueSB, getHueSwatchForNewColor());
hueValueSB.invalidate();
setSeekBarGradient(saturationValueSB, new int[] { getFullyDesaturatedSelColor(), getFullySaturatedSelColor() });
saturationValueSB.invalidate();
setSeekBarGradient(valueValueSB, new int[] { 0xFF000000, getFullValueSelColor() });
valueValueSB.invalidate();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateNewColor | ( |  | ) |
| inlineprotected

Aktualizuje náhled nové barvy.

Definition at line 488 of file ColorPickerView.java.

{
newColorV.setBackgroundColor(newColor);
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateRGBSeekBars | ( | boolean | reposition | ) |
| inlineprotected

Aktualizuje RGB SeekBary.

Parameters

  reposition | Udává, jestli je třeba nastavit i pozici SeekBarů

Definition at line 497 of file ColorPickerView.java.

{
if (reposition) {
redValueSB.setProgress(newColorRGB[0]);
greenValueSB.setProgress(newColorRGB[1]);
blueValueSB.setProgress(newColorRGB[2]);
}
redValueTV.setText(Integer.toString(newColorRGB[0]));
greenValueTV.setText(Integer.toString(newColorRGB[1]));
blueValueTV.setText(Integer.toString(newColorRGB[2]));
setSeekBarGradient(redValueSB, new int[] { (newColor & 0xFF00FFFF), (newColor & 0xFF00FFFF) | 0x00FF0000 });
redValueSB.invalidate();
setSeekBarGradient(greenValueSB, new int[] { (newColor & 0xFFFF00FF), (newColor & 0xFFFF00FF) | 0x0000FF00 });
greenValueSB.invalidate();
setSeekBarGradient(blueValueSB, new int[] { (newColor & 0xFFFFFF00), (newColor & 0xFFFFFF00) | 0x000000FF });
blueValueSB.invalidate();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateStateFromHSeekBar | ( |  | ) |
| inlineprotected

Aktualizuje stav celého pickeru z H SeekBaru.

Definition at line 564 of file ColorPickerView.java.

{
setColor(hueValueSB.getProgress(), newColorHSV[1], newColorHSV[2]);
updateRGBSeekBars(true);
updateHSVSeekBars(false);
updateSVPicker();
updateNewColor();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateStateFromRGBSeekBars | ( |  | ) |
| inlineprotected

Aktualizuje stav celého pickeru z RGB SeekBarů.

Definition at line 553 of file ColorPickerView.java.

{
setColor(redValueSB.getProgress(), greenValueSB.getProgress(), blueValueSB.getProgress());
updateRGBSeekBars(false);
updateHSVSeekBars(true);
updateSVPicker();
updateNewColor();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateStateFromSVSeekBars | ( |  | ) |
| inlineprotected

Aktualizuje stav celého pickeru z SV SeekBarů.

Definition at line 575 of file ColorPickerView.java.

{
setColor(hueValueSB.getProgress(), saturationValueSB.getProgress() / 255.f, valueValueSB.getProgress() / 255.f);
updateRGBSeekBars(true);
updateHSVSeekBars(false);
updateSVPicker();
updateNewColor();
}

void mhr.appandroid.views.colorpicker.ColorPickerView.updateSVPicker | ( |  | ) |
| inlineprotected

Aktualizuje SVPicker.

Definition at line 546 of file ColorPickerView.java.

{
svPicker.setColor(newColorHSV);
}

## Member Data Documentation

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.blueValueSB
| protected

Definition at line 83 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.blueValueTV
| protected

Definition at line 94 of file ColorPickerView.java.

Button mhr.appandroid.views.colorpicker.ColorPickerView.cancelBtn
| protected

Definition at line 100 of file ColorPickerView.java.

OnColorCanceledListener mhr.appandroid.views.colorpicker.ColorPickerView.canceledListener = null
| protected

Definition at line 110 of file ColorPickerView.java.

OnColorChangedListener mhr.appandroid.views.colorpicker.ColorPickerView.changedListener = null
| protected

Definition at line 109 of file ColorPickerView.java.

boolean mhr.appandroid.views.colorpicker.ColorPickerView.enabled = true
| protected

Definition at line 113 of file ColorPickerView.java.

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.greenValueSB
| protected

Definition at line 82 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.greenValueTV
| protected

Definition at line 93 of file ColorPickerView.java.

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.hueValueSB
| protected

Definition at line 84 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.hueValueTV
| protected

Definition at line 95 of file ColorPickerView.java.

int mhr.appandroid.views.colorpicker.ColorPickerView.newColor = 0xFF000000
| protected

Hodnota nové (aktuálně vybrané) barvy ve formátu Android.

Definition at line 102 of file ColorPickerView.java.

float [] mhr.appandroid.views.colorpicker.ColorPickerView.newColorHSV = new float[3]
| protected

Hodnota nové (aktuálně vybrané) barvy jako HSV ve formátu Android (0..360, 0..1, 0..1)

Definition at line 104 of file ColorPickerView.java.

int [] mhr.appandroid.views.colorpicker.ColorPickerView.newColorRGB = new int[3]
| protected

Hodnota nové (aktuálně vybrané) barvy po složkách 0..255.

Definition at line 105 of file ColorPickerView.java.

View mhr.appandroid.views.colorpicker.ColorPickerView.newColorV
| protected

Definition at line 89 of file ColorPickerView.java.

int mhr.appandroid.views.colorpicker.ColorPickerView.oldColor = 0xFF000000
| protected

Hodnota staré barvy ve formátu Android.

Definition at line 103 of file ColorPickerView.java.

View mhr.appandroid.views.colorpicker.ColorPickerView.oldColorV
| protected

Definition at line 90 of file ColorPickerView.java.

View mhr.appandroid.views.colorpicker.ColorPickerView.overlay
| protected

Definition at line 112 of file ColorPickerView.java.

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.redValueSB
| protected

Definition at line 81 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.redValueTV
| protected

Definition at line 92 of file ColorPickerView.java.

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.saturationValueSB
| protected

Definition at line 85 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.saturationValueTV
| protected

Definition at line 96 of file ColorPickerView.java.

Button mhr.appandroid.views.colorpicker.ColorPickerView.selectBtn
| protected

Definition at line 99 of file ColorPickerView.java.

OnColorSelectedListener mhr.appandroid.views.colorpicker.ColorPickerView.selectedListener = null
| protected

Definition at line 108 of file ColorPickerView.java.

SVPickerView mhr.appandroid.views.colorpicker.ColorPickerView.svPicker
| protected

Definition at line 87 of file ColorPickerView.java.

float [] mhr.appandroid.views.colorpicker.ColorPickerView.tmp = new float[3]
| protected

Dočasné pole pro převody mezi barvami, aby se nemuselo neustále vytvářet běhěm dynamických změn UI.

Definition at line 106 of file ColorPickerView.java.

SeekBar mhr.appandroid.views.colorpicker.ColorPickerView.valueValueSB
| protected

Definition at line 86 of file ColorPickerView.java.

TextView mhr.appandroid.views.colorpicker.ColorPickerView.valueValueTV
| protected

Definition at line 97 of file ColorPickerView.java.

The documentation for this class was generated from the following file:

- /home/xxx/eclipse_workspaces/app/appandroid/src/mhr/appandroid/views/colorpicker/ColorPickerView.java