本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker类的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker类的具体用法?Java ColorPicker怎么用?Java ColorPicker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorPicker类属于com.larswerkman.holocolorpicker包,在下文中一共展示了ColorPicker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_main);
ColorPicker picker = (ColorPicker) findViewById(R.id.picker);
SVBar svBar = (SVBar) findViewById(R.id.svbar);
picker.addSVBar(svBar);
picker.setOldCenterColor(picker.getColor());
picker.setOnColorChangedListener(this);
ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggle);
toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
StatusBarCompat.setTranslucent(getWindow(), isChecked);
StatusBarCompat.resetActionBarContainerTopMargin(getWindow());
}
});
}
示例3: init
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
private void init(int color){
View view=View.inflate(getContext(),R.layout.color_panel,null);
picker = (ColorPicker) view.findViewById(R.id.picker);
svBar = (SVBar) view.findViewById(R.id.svbar);
saturationBar = (SaturationBar) view.findViewById(R.id.saturationbar);
valueBar = (ValueBar) view.findViewById(R.id.valuebar);
picker.addSVBar(svBar);
picker.addSaturationBar(saturationBar);
picker.addValueBar(valueBar);
setView(view);
picker.setOldCenterColor(color);
setPositiveButton(getContext().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(colorChoseCallback!=null){
colorChoseCallback.onColorChose(ColorPanel.this.picker.getColor());
}
}
});
show();
}
示例4: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final LoadingImageView loadingImageView = (LoadingImageView) findViewById(R.id.loadingiv);
ColorPicker colorPicker = (ColorPicker) findViewById(R.id.picker);
colorPicker.setOnColorSelectedListener(new ColorPicker.OnColorSelectedListener() {
@Override
public void onColorSelected(int i) {
loadingImageView.setMaskColor(i);
}
});
RadioGroup rg = (RadioGroup) findViewById(R.id.rg);
rg.check(rg.findViewWithTag(loadingImageView.getMaskOrientation() + "").getId());
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
String tag = (String) group.findViewById(checkedId).getTag();
loadingImageView.setMaskOrientation(Integer.parseInt(tag));
}
});
}
示例5: onCreateDialog
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
mRootView = (ViewGroup) layoutInflater.inflate(R.layout.advanced_color_picker, null);
mColorPicker = (ColorPicker) mRootView.findViewById(R.id.color_picker);
mSvBar = (SVBar) mRootView.findViewById(R.id.svbar);
mOpacityBar = (OpacityBar) mRootView.findViewById(R.id.opacitybar);
mColorPicker.addSVBar(mSvBar);
hexEdit = (EditText) mRootView.findViewById(R.id.hex);
hexApply = (Button) mRootView.findViewById(R.id.apply);
hexEdit.setFilters(new InputFilter[] { ALPHANUMERIC });
hexApply.setOnClickListener(hexApplyListener);
String hexColor = String.format("%06X", (0xFFFFFF &
ColorDialogFragment.getColor(startColor, 255)));
hexEdit.setHint(hexColor);
mColorPicker.addOpacityBar(mOpacityBar);
mColorPicker.setOldCenterColor(startColor);
mColorPicker.setShowOldCenterColor(true);
return new AlertDialog.Builder(getActivity())
.setView(mRootView)
.setNegativeButton(android.R.string.cancel, clickListener)
.setPositiveButton(android.R.string.ok, clickListener)
.create();
}
示例6: ColorPreference
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@SuppressLint("InflateParams")
public ColorPreference(Context context, AttributeSet attrs) {
super(context, attrs);
attributes = new HashMap<String, String>();
for (int i=0;i<attrs.getAttributeCount();i++) {
String attr = attrs.getAttributeName(i);
String val = attrs.getAttributeValue(i);
attributes.put(attr, val);
}
this.key = attributes.get("key");
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
pickerView = inflater.inflate(R.layout.dialog_color_picker, null);
picker = (ColorPicker) pickerView.findViewById(R.id.picker);
svBar = (SVBar) pickerView.findViewById(R.id.svbar);
picker.addSVBar(svBar);
}
示例7: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_icon_palette);
ColorPicker picker = ((ColorPicker) findViewById(R.id.picker));
picker.setOnColorChangedListener(this);
mImage = (ImageView) findViewById(R.id.palette);
mIconPainter = new IconPainter(picker.getColor());
mIconPainter.paint(mImage);
background = findViewById(R.id.background);
mBackgroundPainter = new BackgroundPainter(picker.getColor());
mBackgroundPainter.paint(background);
}
示例8: 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());
}
});
}
示例9: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
colorPicker = (ColorPicker) findViewById(R.id.colorPicker);
colorPicker.addSVBar((SVBar) findViewById(R.id.svbar));
colorPicker.setOldCenterColor(invertColorKeepOpacity(colorPicker.getColor()));
colorPicker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int color) {
// container.setBackgroundColor(color);
colorPicker.setOldCenterColor(invertColorKeepOpacity(color));
}
});
}
示例10: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_holo_color_picker_sample);
ColorPicker picker = (ColorPicker) findViewById(R.id.picker);
SVBar svBar = (SVBar) findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar);
SaturationBar saturationBar = (SaturationBar) findViewById(R.id.saturationbar);
ValueBar valueBar = (ValueBar) findViewById(R.id.valuebar);
picker.addSVBar(svBar);
picker.addOpacityBar(opacityBar);
picker.addSaturationBar(saturationBar);
picker.addValueBar(valueBar);
picker.setOldCenterColor(picker.getColor());
picker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int color) {
findViewById(R.id.layout).setBackgroundColor(color);
}
});
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:22,代码来源:HoloColorPickerSampleActivity.java
示例11: onCreateDialog
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.color_picker, null);
mPicker = (ColorPicker) v.findViewById(R.id.color_picker);
mColorText = (TextView) v.findViewById(R.id.color_text);
OpacityBar opacityBar = (OpacityBar) v.findViewById(R.id.opacity_bar);
mPicker.addOpacityBar(opacityBar);
// SVBar svBar = (SVBar) v.findViewById(R.id.svbar);
// mPicker.addSVBar(svBar);
SaturationBar saturationBar = (SaturationBar) v.findViewById(R.id.saturationbar);
mPicker.addSaturationBar(saturationBar);
ValueBar valueBar = (ValueBar) v.findViewById(R.id.valuebar);
mPicker.addValueBar(valueBar);
mPicker.setOnColorChangedListener(this);
return new AlertDialog.Builder(getActivity())
.setView(v)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setNewColor(mPicker.getColor());
}
})
.create();
}
示例12: onCreateView
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_color_picker, container, false);
ColorPicker picker = (ColorPicker) rootView.findViewById(R.id.picker);
SVBar svBar = (SVBar) rootView.findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) rootView.findViewById(R.id.opacitybar);
SaturationBar saturationBar = (SaturationBar) rootView.findViewById(R.id.saturationbar);
ValueBar valueBar = (ValueBar) rootView.findViewById(R.id.valuebar);
// picker.addSVBar(svBar);
// picker.addOpacityBar(opacityBar);
svBar.setVisibility(View.GONE); // hide it, not used
opacityBar.setVisibility(View.GONE); // hide it, not used
picker.addSaturationBar(saturationBar);
picker.addValueBar(valueBar);
int color = picker.getColor();
picker.setOldCenterColor(color);
picker.setOnColorChangedListener(this);
return rootView;
}
示例13: initViews
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
private void initViews() {
title = (EditText) findViewById(R.id.category_title);
description = (EditText) findViewById(R.id.category_description);
picker = (ColorPicker) findViewById(R.id.colorpicker_category);
picker.setOnColorChangedListener(color -> {
picker.setOldCenterColor(picker.getColor());
colorChanged = true;
});
// Long click on color picker to remove color
picker.setOnLongClickListener(v -> {
picker.setColor(Color.WHITE);
return true;
});
picker.setOnClickListener(v -> picker.setColor(Color.WHITE));
// Added invisible saturation and value bars to get achieve pastel colors
SaturationBar saturationbar = (SaturationBar) findViewById(R.id.saturationbar_category);
saturationbar.setSaturation(SATURATION);
picker.addSaturationBar(saturationbar);
ValueBar valuebar = (ValueBar) findViewById(R.id.valuebar_category);
valuebar.setValue(VALUE);
picker.addValueBar(valuebar);
deleteBtn = (Button) findViewById(R.id.delete);
saveBtn = (Button) findViewById(R.id.save);
// Buttons events
deleteBtn.setOnClickListener(v -> deleteCategory());
saveBtn.setOnClickListener(v -> {
// In case category name is not compiled a message will be shown
if (title.getText().toString().length() > 0) {
saveCategory();
} else {
title.setError(getString(R.string.category_missing_title));
}
});
}
示例14: init
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.label_edit_view, this, true);
textview = (TextView) findViewById(R.id.label_name_edit);
textview.addTextChangedListener(this);
picker = (ColorPicker) findViewById(R.id.picker);
SVBar svBar = (SVBar) findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar);
picker.addSVBar(svBar);
picker.addOpacityBar(opacityBar);
picker.setShowOldCenterColor(false);
picker.setOnColorChangedListener(this);
}
示例15: onCreate
import com.larswerkman.holocolorpicker.ColorPicker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notti_device);
Intent intent = getIntent();
address = intent.getStringExtra("deviceAddr");
String deviceName = intent.getStringExtra("deviceName");
setTitle(deviceName.trim() + " [ " + address + " ] ");
//init toggle button
ToggleButton onOff = (ToggleButton) findViewById(R.id.ledButton);
onOff.setOnClickListener(this);
//init color picker
ColorPicker picker = (ColorPicker) findViewById(R.id.picker);
picker.setOnColorChangedListener(this);
picker.setShowOldCenterColor(false);
//init seekbar
SeekBar luminosityBar = (SeekBar) findViewById(R.id.intensity_bar);
luminosityBar.setOnSeekBarChangeListener(this);
Intent intentMain = new Intent(this, NottiBtService.class);
// bind the service to current activity and create it if it didnt exist before
startService(intentMain);
bindService(intentMain, mServiceConnection, BIND_AUTO_CREATE);
}