public class

Selector

extends Object
java.lang.Object
   ↳ com.shinobicontrols.grids.core.Selector

Class Overview

A helper class which facilitates operations associated with the selection and deselection of items within the ShinobiGridView.

Summary

Public Methods
void deselect(int position)

Deselects the item which corresponds to the given position.

int getColumnIndexForPosition(int position)

Returns the index of the Column that corresponds to the given position.

int getPosition(int columnIndex, int rowIndex)

Returns the position that corresponds to the given column index and row index.

int getRowIndexForPosition(int position)

Returns the index of the row that corresponds to the given position.

int[] getSelectedItemPositions()

Returns the positions of the items in the grid that have been selected.

void select(int position)

Selects the item which corresponds to the given position.

[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void deselect (int position)

Deselects the item which corresponds to the given position.

Parameters
position the position in the adapter to deselect

public int getColumnIndexForPosition (int position)

Returns the index of the Column that corresponds to the given position. This method helps translate between adapter positions, which are a android.support.v7.widget.RecyclerView concept, and row and column indices which are specific to the ShinobiGridView.

If position does not map to a Column, for example if position is out of the range of all the valid positions in a grid, a value of -1 will be returned.

Parameters
position the position to query
Returns
  • the index of the Column that corresponds to the given position, or -1 if position does not map to a Column

public int getPosition (int columnIndex, int rowIndex)

Returns the position that corresponds to the given column index and row index. This method helps translate between row and column indices, which are specific to the ShinobiGridView, and adapter positions which are a android.support.v7.widget.RecyclerView concept.

If columnIndex and rowIndex do not map to a valid position within the grid, for example if the column index is greater than the number of columns present, a value of -1 will be returned.

Parameters
columnIndex the index of the column the item whose position is being queried is in
rowIndex the index of the row the item whose position is being queried is in
Returns
  • the position for the item that is in the given column and row

public int getRowIndexForPosition (int position)

Returns the index of the row that corresponds to the given position. This method helps translate between adapter positions, which are a android.support.v7.widget.RecyclerView concept, and row and column indices which are specific to the ShinobiGridView.

If position does not map to a row, for example if position is out of the range of all the valid positions in a grid, a value of -1 will be returned.

Parameters
position the position to query
Returns
  • the index of the row that corresponds to the given position, or -1 if position does not map to a row

public int[] getSelectedItemPositions ()

Returns the positions of the items in the grid that have been selected.

Returns
  • the positions of the selected items

public void select (int position)

Selects the item which corresponds to the given position.

Parameters
position the position in the adapter to select