use of cn.qqtheme.framework.widget.ColorPanelView in project AndroidPicker by gzu-liyujiang.
the class ColorPicker method makeCenterView.
@Override
@NonNull
protected LinearLayout makeCenterView() {
LinearLayout rootLayout = new LinearLayout(activity);
rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
rootLayout.setOrientation(LinearLayout.VERTICAL);
multiColorView = new ColorPanelView(activity);
multiColorView.setId(MULTI_ID);
multiColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
Drawable cursorTopDrawable = ConvertUtils.toDrawable(ColorPickerIcon.getCursorTop());
multiColorView.setPointerDrawable(cursorTopDrawable);
multiColorView.setOnColorChangedListener(new ColorPanelView.OnColorChangedListener() {
@Override
public void onColorChanged(ColorPanelView view, int color) {
updateCurrentColor(color);
}
});
rootLayout.addView(multiColorView);
blackColorView = new ColorPanelView(activity);
blackColorView.setId(BLACK_ID);
blackColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
Drawable cursorBottomDrawable = ConvertUtils.toDrawable(ColorPickerIcon.getCursorBottom());
blackColorView.setPointerDrawable(cursorBottomDrawable);
blackColorView.setOnColorChangedListener(new ColorPanelView.OnColorChangedListener() {
@Override
public void onColorChanged(ColorPanelView view, int color) {
updateCurrentColor(color);
}
});
rootLayout.addView(blackColorView);
return rootLayout;
}
Aggregations