Search in sources :

Example 1 with ColorPanelView

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;
}
Also used : ColorPanelView(cn.qqtheme.framework.widget.ColorPanelView) Drawable(android.graphics.drawable.Drawable) LinearLayout(android.widget.LinearLayout) NonNull(android.support.annotation.NonNull)

Aggregations

Drawable (android.graphics.drawable.Drawable)1 NonNull (android.support.annotation.NonNull)1 LinearLayout (android.widget.LinearLayout)1 ColorPanelView (cn.qqtheme.framework.widget.ColorPanelView)1