本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.setColor方法的具体用法?Java ColorPicker.setColor怎么用?Java ColorPicker.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.larswerkman.holocolorpicker.ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.setColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PrepareColorPicker
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
protected ColorPicker PrepareColorPicker(int color)
{
ColorPicker cp = (ColorPicker) findViewById(R.id.dialog_colorpicker);
if (cp != null)
{
View v = findViewById(R.id.dialog_colorpicker_saturation_bar);
if (v != null && v instanceof SaturationBar)
{
cp.addSaturationBar((SaturationBar) v);
}
v = findViewById(R.id.dialog_colorpicker_value_bar);
if (v != null && v instanceof ValueBar)
{
cp.addValueBar((ValueBar) v);
}
v = findViewById(R.id.dialog_colorpicker_opacity_bar);
if (v != null && v instanceof OpacityBar)
{
cp.addOpacityBar((OpacityBar) v);
}
cp.setColor(color);
cp.setOldCenterColor(color);
}
return cp;
}
示例2: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_color_chooser);
// initialize the color picker
picker = (ColorPicker) findViewById(R.id.picker);
picker.setOldCenterColor(getOldColor());
picker.setColor(getOldColor());
connection = new WearConnection(getBaseContext());
findViewById(R.id.chooseColorButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setOldColor(picker.getColor());
connection.sendColor(CommonConstants.DATA_PATH_DOT_COLOR, picker.getColor());
}
});
}
示例3: onBuildDialog
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@NonNull
@Override
public MaterialDialog onBuildDialog(@NonNull MaterialDialog.Builder builder) {
MaterialDialog md = builder
.customView(R.layout.dialog_preference_colorpicker, true)
.build();
int color = (int) mOption.read(mConfig);
boolean randomColor = Color.alpha(color) == RANDOM_COLOR_ALPHA_MASK;
if (randomColor) color |= Color.argb(255, 0, 0, 0);
RadioGroup rg = (RadioGroup) md.getCustomView().findViewById(R.id.radios);
mColorPanel = (ViewGroup) rg.findViewById(R.id.custom_color_panel);
mColorPicker = (ColorPicker) mColorPanel.findViewById(R.id.picker);
mColorPicker.addSaturationBar((SaturationBar) mColorPanel.findViewById(R.id.saturationbar));
mColorPicker.addValueBar((ValueBar) mColorPanel.findViewById(R.id.valuebar));
mColorPicker.setColor(color);
mColorPicker.setOldCenterColor(color);
// Setup radio things
mRadioCustomColor = (RadioButton) rg.findViewById(R.id.custom_color);
mRadioRandomColor = (RadioButton) rg.findViewById(R.id.random_color);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
ViewUtils.setVisible(mColorPanel, mRadioCustomColor.isChecked());
}
});
rg.check(randomColor
? mRadioRandomColor.getId()
: mRadioCustomColor.getId());
return md;
}
示例4: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_color_picker);
mBleManager = BleManager.getInstance(this);
// UI
mRgbColorView = findViewById(R.id.rgbColorView);
mRgbTextView = (TextView) findViewById(R.id.rgbTextView);
SaturationBar mSaturationBar = (SaturationBar) findViewById(R.id.saturationbar);
ValueBar mValueBar = (ValueBar) findViewById(R.id.valuebar);
mColorPicker = (ColorPicker) findViewById(R.id.colorPicker);
if (mColorPicker != null) {
mColorPicker.addSaturationBar(mSaturationBar);
mColorPicker.addValueBar(mValueBar);
mColorPicker.setOnColorChangedListener(this);
}
if (kPersistValues) {
SharedPreferences preferences = getSharedPreferences(kPreferences, Context.MODE_PRIVATE);
mSelectedColor = preferences.getInt(kPreferences_color, kFirstTimeColor);
} else {
mSelectedColor = kFirstTimeColor;
}
mColorPicker.setOldCenterColor(mSelectedColor);
mColorPicker.setColor(mSelectedColor);
onColorChanged(mSelectedColor);
// Start services
onServicesDiscovered();
}
示例5: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_neopixel_colorpicker);
setContentView(R.layout.activity_color_picker);
Intent intent = getIntent();
mSelectedColor = intent.getIntExtra(kActivityParameter_SelectedColorKey, Color.WHITE);
// UI
mRgbColorView = findViewById(R.id.rgbColorView);
mRgbTextView = (TextView) findViewById(R.id.rgbTextView);
SaturationBar mSaturationBar = (SaturationBar) findViewById(R.id.saturationbar);
ValueBar mValueBar = (ValueBar) findViewById(R.id.valuebar);
mColorPicker = (ColorPicker) findViewById(R.id.colorPicker);
if (mColorPicker != null) {
mColorPicker.addSaturationBar(mSaturationBar);
mColorPicker.addValueBar(mValueBar);
mColorPicker.setOnColorChangedListener(this);
mColorPicker.setOldCenterColor(mSelectedColor);
mColorPicker.setColor(mSelectedColor);
}
onColorChanged(mSelectedColor);
Button sendButton = (Button) findViewById(R.id.sendButton);
sendButton.setText(R.string.neopixel_colorpicker_setcolor);
}