@Override
public void bindView(View view, Context context, final Cursor cursor) {
super.bindView(view, context, cursor);
CircleView color = view.findViewById(R.id.rgb_panel_color);
TextView rgbValue = view.findViewById(R.id.rgb_value);
TextView hsbValue = view.findViewById(R.id.hsb_value);
ImageButton popupMenu = view.findViewById(R.id.btn_popup_menu);
final int colorId = cursor.getInt(cursor.getColumnIndex(ColorDataContract.ColorEntry._ID));
int rgbRValue = cursor.getInt(cursor.getColumnIndex(ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_R));
int rgbGValue = cursor.getInt(cursor.getColumnIndex(ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_G));
int rgbBValue = cursor.getInt(cursor.getColumnIndex(ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_B));
int rgbAValue = cursor.getInt(cursor.getColumnIndex(ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_A));
float[] hsb;
rgbValue.setText("(" + rgbAValue + ", " + rgbRValue + ", " + rgbGValue + ", " + rgbBValue + ")");
hsb = ColorUtils.RGBToHSB(rgbRValue, rgbGValue, rgbBValue);
hsbValue.setText("");
hsbValue.append("(" + String.format("%.0f", hsb[0]));
hsbValue.append(", " + String.format("%.0f%%", (hsb[1] * 100.0f)));
hsbValue.append(", " + String.format("%.0f%%", (hsb[2] * 100.0f)) + ")");
color.setFillColor(Color.argb(rgbAValue, rgbRValue, rgbGValue, rgbBValue));
color.setStrokeColor(Color.argb(rgbAValue, rgbRValue, rgbGValue, rgbBValue));
popupMenu.setOnClickListener(v -> {
v.post(() -> showPopupMenu(v));
});
popupMenu.setTag(colorId);
}