本文整理汇总了Java中com.flask.colorpicker.builder.ColorPickerDialogBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ColorPickerDialogBuilder类的具体用法?Java ColorPickerDialogBuilder怎么用?Java ColorPickerDialogBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorPickerDialogBuilder类属于com.flask.colorpicker.builder包,在下文中一共展示了ColorPickerDialogBuilder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setColorForViews
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
public void setColorForViews(final String key) {
ColorPickerDialogBuilder
.with(getContext())
.setTitle("Выберите цвет")
.initialColor(R.color.colorPrimary)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(12)
.setOnColorSelectedListener(selectedColor -> {
})
.setPositiveButton("Ок", (dialog, selectedColor, allColors) -> {
setColorValue(selectedColor);
putIntValueInSharedPreference(getPref(), getContext(), key, getColorValue());
})
.setNegativeButton("Отмена", (dialog, which) -> {
})
.build()
.show();
}
示例2: onClick
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
@Override
protected void onClick() {
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
.with(getContext())
.setTitle(pickerTitle)
.initialColor(selectedColor)
.wheelType(wheelType)
.density(density)
.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
setValue(selectedColorFromPicker);
}
})
.setNegativeButton(pickerButtonCancel, null);
if (!alphaSlider && !lightSlider) builder.noSliders();
else if (!alphaSlider) builder.lightnessSliderOnly();
else if (!lightSlider) builder.alphaSliderOnly();
builder
.build()
.show();
}
示例3: setColorForView
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
private void setColorForView(@IdRes final int id) {
final View view = findViewById(id);
int color = Color.WHITE;
Drawable background = view.getBackground();
if (background instanceof ColorDrawable)
color = ((ColorDrawable) background).getColor();
ColorPickerDialogBuilder.with(this)
.showAlphaSlider(false)
.initialColor(color)
.setPositiveButton(android.R.string.ok,
new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface d, int lastSelectedColor, Integer[] allColors) {
view.setBackgroundColor(lastSelectedColor);
setColor(id, lastSelectedColor);
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
}).build().show();
}
示例4: onPickColorClick
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
@OnClick(R.id.color_picker)
void onPickColorClick(View view) {
ColorPickerDialogBuilder.with(this)
.setTitle(getString(R.string.pick_color_title))
.initialColor(getIntColor())
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(12)
.lightnessSliderOnly()
.setPositiveButton(getString(android.R.string.ok), new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface d, int lastSelectedColor, Integer[] allColors) {
mQuery = String.format("%06X", 0xFFFFFF & lastSelectedColor);
updateColor();
}
})
.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.build().show();
}
示例5: onClick
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
@Override
protected void onClick() {
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
.with(getContext())
.setTitle(pickerTitle)
.initialColor(selectedColor)
.wheelType(wheelType)
.density(density)
.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
setValue(selectedColorFromPicker);
}
})
.setNegativeButton(pickerButtonCancel, null);
if (!alphaSlider && !lightSlider) builder.noSliders();
else if (!alphaSlider) builder.lightnessSliderOnly();
else if (!lightSlider) builder.alphaSliderOnly();
builder
.build()
.show();
}
示例6: createColorPickerDialog
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
public void createColorPickerDialog(int initialColor, ColorPickerClickListener onResult) {
ColorPickerDialogBuilder
.with(getContext())
.initialColor(initialColor)
.showAlphaSlider(false)
.wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE)
.density(5)
.setPositiveButton(getString(R.string.done), onResult)
.build()
.show();
}
示例7: showColorPickerDialog
import com.flask.colorpicker.builder.ColorPickerDialogBuilder; //导入依赖的package包/类
/**
* Show a cool color picker to customize a user's flag color.
*/
private void showColorPickerDialog() {
int currentBackgroundColor = mFlagColor;
ColorPickerDialogBuilder
.with(this)
.setTitle(getString(R.string.choose_flag_color))
.initialColor(currentBackgroundColor)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(12)
.setOnColorSelectedListener(this::setFlagColor)
.setPositiveButton("ok", (dialog, selectedColor, allColors) -> setFlagColor(selectedColor))
.noSliders()
.build()
.show();
}