public class ColorPaletteAdapter
extends <any>
| Modifier and Type | Class and Description |
|---|---|
static class |
ColorPaletteAdapter.ViewHolder
The view holder, which is used by the adapter.
|
| Constructor and Description |
|---|
ColorPaletteAdapter(android.content.Context context,
int[] colorPalette,
int previewSize,
AbstractColorPickerPreference.PreviewShape previewShape,
int previewBorderWidth,
int previewBorderColor,
android.graphics.drawable.Drawable previewBackground)
Creates a new adapter, which provides colors for visualization using a RecyclerView.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getItem(int position)
Returns the color that corresponds to a specific position.
|
int |
getItemCount() |
long |
getItemId(int position) |
int |
indexOf(int color)
Returns the index of a specific color.
|
void |
onBindViewHolder(ColorPaletteAdapter.ViewHolder holder,
int position) |
ColorPaletteAdapter.ViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType) |
public ColorPaletteAdapter(android.content.Context context,
int[] colorPalette,
int previewSize,
AbstractColorPickerPreference.PreviewShape previewShape,
int previewBorderWidth,
int previewBorderColor,
android.graphics.drawable.Drawable previewBackground)
colorPalette - The color palette, which should be provided by the adapter, as an Integer
array. The color palette may not be nullpreviewSize - The size, which should be used to preview colors, as an Integer value in
pixels. The size must be at least 1previewShape - The shape, which should be used to preview colors, as a value of the enum AbstractColorPickerPreference.PreviewShape. The shape may not be nullpreviewBorderWidth - The border width, which should be used to preview colors, as an Integer
value. The border width must be at least 0previewBorderColor - The border color, which should be used to preview colors, as an Integer
valuepreviewBackground - The background, which should be used to preview colors, as an instance of the class
Drawable or null, if no background should be shownpublic final int indexOf(int color)
color - The color, whose index should be returned, as an Integer valuepublic final int getItem(int position)
position - The position of the color, which should be returned, as an Integer valueInteger valuepublic final ColorPaletteAdapter.ViewHolder onCreateViewHolder(android.view.ViewGroup parent, int viewType)
public final void onBindViewHolder(ColorPaletteAdapter.ViewHolder holder, int position)
public final int getItemCount()
public final long getItemId(int position)