BasicFieldColorView

public class BasicFieldColorView extends FrameLayout
implements FieldView
Known Direct Subclasses

Renders a color field and picker as part of a BlockView.

Nested Class Summary

class BasicFieldColorView.AutoPositionPopupWindow Popup window that adjusts positioning to the size of the wrapped view. 
class BasicFieldColorView.ColorPaletteView View for a color palette that matches Web Blockly's. 

Constant Summary

int DEFAULT_MIN_HEIGHT_DP
int DEFAULT_MIN_WIDTH_DP

Inherited Constant Summary

Field Summary

protected FieldColor mColorField
protected BasicFieldColorView.ColorPaletteView mColorPaletteView
protected BasicFieldColorView.AutoPositionPopupWindow mColorPopupWindow

Inherited Field Summary

Public Constructor Summary

BasicFieldColorView(Context context)
BasicFieldColorView(Context context, AttributeSet attrs)
BasicFieldColorView(Context context, AttributeSet attrs, int defStyleAttr)

Public Method Summary

Field
void
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void
setColor(int color)
Set the selected color represented by this view.
void
setField(Field field)
Sets the Field model for this view.
void
unlinkField()
Disconnect the model from this view.

Protected Method Summary

int
onMeasureDimension(int min, int measureSpec)
Calculates the measured dimension in a single direction (width or height).
void
openColorPickerPopupWindow()
Open a PopupWindow showing a color selection palette.

Inherited Method Summary

Constants

protected static final int DEFAULT_MIN_HEIGHT_DP

Constant Value: 28

protected static final int DEFAULT_MIN_WIDTH_DP

Constant Value: 40

Fields

protected FieldColor mColorField

protected BasicFieldColorView.ColorPaletteView mColorPaletteView

protected BasicFieldColorView.AutoPositionPopupWindow mColorPopupWindow

Public Constructors

public BasicFieldColorView (Context context)

Parameters
context

public BasicFieldColorView (Context context, AttributeSet attrs)

Parameters
context
attrs

public BasicFieldColorView (Context context, AttributeSet attrs, int defStyleAttr)

Parameters
context
attrs
defStyleAttr

Public Methods

public Field getField ()

public void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

Parameters
widthMeasureSpec
heightMeasureSpec

public void setColor (int color)

Set the selected color represented by this view. The alpha values will be ignored for rendering.

Parameters
color The color in int format.

public void setField (Field field)

Sets the Field model for this view. If null the current field will be disconnected from the view if one is set. The field must be of the appropriate type for the specific view implementation or a ClassCastException may be thrown.

Parameters
field The field backing this view.

public void unlinkField ()

Disconnect the model from this view.

Protected Methods

protected int onMeasureDimension (int min, int measureSpec)

Calculates the measured dimension in a single direction (width or height).

Parameters
min The minimum size.
measureSpec The View.MeasureSpec provided by the parent.
Returns
  • The calculated size.

protected void openColorPickerPopupWindow ()

Open a PopupWindow showing a color selection palette.