HexGridView
The View version of the library's hex grid.
HexGridView is a ViewGroup that can hold one child View for each cell. The group recognizes special layout attributes on its children to allow cell assignment and initialization in the layout XML. For example:
<com.gonodono.hexgrid.view.HexGridView …>
<Button
…
app:layout_cellRowAndColumn="1,1"
app:layout_cellIsSelected="true" />
</com.gonodono.hexgrid.view.HexGridView>If the library's CellStateView is used instead of a regular View, no actual View object is added to the HexGridView, and the element is used only for the attribute settings.
The class also offers the ViewProvider interface as a way to assign Views in code instead. This method always overrides anything set in the layout XML for a given cell.
HexGridView offers its own OnClickListener interface and corresponding property for click callbacks, and the drawn grid's cosmetic values are all available as direct properties; e.g., strokeColor and showRowIndices.
A HexGridView's Grid is handled similarly to ListView's and RecyclerView's data sets: if the user modifies the Grid, the HexGridView needs to be notified to update itself. The only thing needed is a call to invalidate, so that's left to the user, rather than having a pointless alias function that does nothing else. That is, if you change a State in the Grid, you need to call invalidate() on the HexGridView afterward.
Types
Properties
A read-only Map of the current child Views.
The HexGridView's current HexOrientation.
The HexGridView's current OnClickListener.
Color of the cells' interior when its selected state is true.
Whether to show each cell's column index.
Whether to show each cell's row index.
Color of the cells' outlines.
The HexGridView's current stroke width.
The HexGridView's current ViewProvider.
Functions
Modifies the passed View's LayoutParams to cause a HexDrawable background to be added or updated during layout.
Causes the HexGridView to re-layout and redraw.
Modifies the passed View's LayoutParams to remove any HexDrawable background that may be present.