public class

ColorPickerGridViewAdapter

extends ArrayAdapter<T>
java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ android.widget.ArrayAdapter<T>
       ↳ com.pdftron.pdf.utils.ColorPickerGridViewAdapter

Class Overview

An array adapter for showing colors.

Summary

Constants
String TYPE_ADD_COLOR Color type add new color.
String TYPE_REMOVE_COLOR Color type remove color
String TYPE_RESTORE_COLOR Color type restore color
String TYPE_TRANSPARENT Color type transparent color
[Expand]
Inherited Constants
From interface android.widget.Adapter
Public Constructors
ColorPickerGridViewAdapter(Context context, List<String> list)
Public Methods
void add(String object)
Adds a color item.
void addAll(Collection<? extends String> collection)
Adds all items to color source list
void addFront(String object)
Adds a color item to the front of the color source list.
void addItem(int position, String value)
Add source value to specified position
void addSelected(int position)
Add given position color source item to selected list
boolean contains(String item)
Whether the color source contains the given color item
void deleteAllSelected()
Deletes selected list items from color source
int getCount()
Gets color source count.
String getFirstSelectedInList()
Gets first selected list item
String getItem(int position)
Get color item in list at specific position.
Pair<Boolean, Integer> getItemIndex(int colorInt)
Gets the index of the color item.
Pair<Boolean, Integer> getItemIndex(String item)
Gets the index of the color item.
List<String> getItems()
Gets all color source items
String getSelected()
Gets selected color source
ArrayList<String> getSelectedList()
Gets selected list
int getSelectedListCount()
Gets selected list count
View getView(int position, View convertView, ViewGroup parent)
boolean isEditing()
Gets whether the color source is editing
boolean isInSelectedList(int position)
Whether the specified position in color source is in selected list
boolean isItemDisabled(String item)
Whether the specified color item is disabled
void removeAllSelected()
Clears selected list
int removeItem(String value)
Remove Item from color source
void removeItem(int position)
Removes item at specific position
void removeSelected(int position)
Remove the specific position color source item from selected list
void setCellBackground(int resId)
Sets color cell background
void setCellSize(int width, int height)
Sets cell size for color item
void setDisabledColorList(ArrayList<String> disabledColorList)
Sets disabled list of color items.
void setEditing(boolean editing)
Sets whether the color source is editing.
void setFavoriteList(ArrayList<String> favoriteList)
Sets favorite list of color items.
void setItem(int index, String item)
Sets color item in specific index
void setMaxSize(int size)
Sets the maximum size of holdable color sources.
void setSelected(String selected)
Sets the given color source to be selected
void setSelected(int position)
Sets whether the specific position color is selected
void setSelectedList(ArrayList<String> selectedList)
Sets selected list of color items.
void setSource(List<String> list)
Sets color list source
[Expand]
Inherited Methods
From class android.widget.ArrayAdapter
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Adapter
From interface android.widget.Filterable
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter
From interface android.widget.ThemedSpinnerAdapter

Constants

public static final String TYPE_ADD_COLOR

Color type add new color.

Constant Value: "add_custom_color"

public static final String TYPE_REMOVE_COLOR

Color type remove color

Constant Value: "remove_custom_color"

public static final String TYPE_RESTORE_COLOR

Color type restore color

Constant Value: "restore_color"

public static final String TYPE_TRANSPARENT

Color type transparent color

Constant Value: "no_fill_color"

Public Constructors

public ColorPickerGridViewAdapter (Context context, List<String> list)

Parameters
context The context
list the color list

Public Methods

public void add (String object)

Adds a color item. If color source exceeds maximum size, then it removes the first color item.

Parameters
object The color item

public void addAll (Collection<? extends String> collection)

Adds all items to color source list

Parameters
collection The collection of color items

public void addFront (String object)

Adds a color item to the front of the color source list. If the color source exceeds maximum size, then it removes the color item at the end of the list.

Parameters
object The color item

public void addItem (int position, String value)

Add source value to specified position

Parameters
position position
value source value

public void addSelected (int position)

Add given position color source item to selected list

Parameters
position The position in color source

public boolean contains (String item)

Whether the color source contains the given color item

Parameters
item The color item
Returns
  • true the color source list contains the given color item, false otherwise.

public void deleteAllSelected ()

Deletes selected list items from color source

public int getCount ()

Gets color source count.

Returns
  • The color source count

public String getFirstSelectedInList ()

Gets first selected list item

Returns
  • first selected list item

public String getItem (int position)

Get color item in list at specific position.

Parameters
position The specific position.
Returns
  • color item in color source list.

public Pair<Boolean, Integer> getItemIndex (int colorInt)

Gets the index of the color item.

Parameters
colorInt The color item
Returns
  • A pair of whether it founds the color, and the found color index. If the returned color index is -1, it means the color is not found.

public Pair<Boolean, Integer> getItemIndex (String item)

Gets the index of the color item.

Parameters
item The color item in string format
Returns
  • A pair of whether it founds the color, and the found color index. If the returned color index is -1, it means the color is not found.

public List<String> getItems ()

Gets all color source items

Returns
  • all color source items

public String getSelected ()

Gets selected color source

Returns
  • The selected color source

public ArrayList<String> getSelectedList ()

Gets selected list

Returns
  • selected list

public int getSelectedListCount ()

Gets selected list count

Returns
  • Selected list count

public View getView (int position, View convertView, ViewGroup parent)

public boolean isEditing ()

Gets whether the color source is editing

Returns
  • true then it is editing, false otherwise

public boolean isInSelectedList (int position)

Whether the specified position in color source is in selected list

Parameters
position The position in color source
Returns
  • true then it is in selected list, false otherwise

public boolean isItemDisabled (String item)

Whether the specified color item is disabled

Parameters
item The color item
Returns
  • true then this item is disabled, false other wise

public void removeAllSelected ()

Clears selected list

public int removeItem (String value)

Remove Item from color source

Parameters
value color value that is going to be removed
Returns
  • position of color value, return -1 if color value not found

public void removeItem (int position)

Removes item at specific position

Parameters
position The specific position

public void removeSelected (int position)

Remove the specific position color source item from selected list

Parameters
position The position of selected list

public void setCellBackground (int resId)

Sets color cell background

Parameters
resId The background resource id

public void setCellSize (int width, int height)

Sets cell size for color item

Parameters
width Cell width
height Cell height

public void setDisabledColorList (ArrayList<String> disabledColorList)

Sets disabled list of color items. If a color source item is in disabled list, it will show a half transparent star icon in middle

Parameters
disabledColorList a list of disabled color items

public void setEditing (boolean editing)

Sets whether the color source is editing. If the color source is editing, show item TYPE_REMOVE_COLOR, else hide it.

Parameters
editing whether the color source is editing

public void setFavoriteList (ArrayList<String> favoriteList)

Sets favorite list of color items. If a color source item is in favorite list, it will show a star icon in middle

Parameters
favoriteList a list of favorite color items

public void setItem (int index, String item)

Sets color item in specific index

Parameters
index The specific index
item The color item in string format

public void setMaxSize (int size)

Sets the maximum size of holdable color sources.

Parameters
size Maximum size

public void setSelected (String selected)

Sets the given color source to be selected

Parameters
selected The selected color source

public void setSelected (int position)

Sets whether the specific position color is selected

Parameters
position The specific position

public void setSelectedList (ArrayList<String> selectedList)

Sets selected list of color items. If a color source item is in selected list, it will show a white check mark icon in middle

Parameters
selectedList a list of selected color items

public void setSource (List<String> list)

Sets color list source

Parameters
list color list source