本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker.setOnColorChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.setOnColorChangedListener方法的具体用法?Java ColorPicker.setOnColorChangedListener怎么用?Java ColorPicker.setOnColorChangedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.larswerkman.holocolorpicker.ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.setOnColorChangedListener方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
});
}
示例2: 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);
}
示例3: 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));
}
});
}
示例4: 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
示例5: 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();
}
示例6: 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;
}
示例7: 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));
}
});
}
示例8: 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);
}
示例9: 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);
}
示例10: onClick
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (v == mClearButton) {
mDrawingView.resetDrawing();
if (mDrawingImageView.getVisibility() == View.VISIBLE) {
mSubmitButton.setVisibility(View.VISIBLE);
mDrawingImageView.setVisibility(View.GONE);
mDrawingImageView.setImageBitmap(null);
mThicknessText.setVisibility(View.VISIBLE);
mThicknessBar.setVisibility(View.VISIBLE);
mColorButton.setVisibility(View.VISIBLE);
}
}
else if (v == mSubmitButton) {
mSubmitButton.setVisibility(View.GONE);
mDrawingImageView.setVisibility(View.VISIBLE);
mDrawingImageView.setImageBitmap(mDrawingView.getDrawing());
mThicknessText.setVisibility(View.GONE);
mThicknessBar.setVisibility(View.GONE);
mColorButton.setVisibility(View.GONE);
}
else if (v == mColorButton) {
ColorPicker colorPicker = new ColorPicker(this);
colorPicker.setOldCenterColor(mDrawingView.getDrawingColor());
colorPicker.setOnColorChangedListener(this);
new AlertDialog.Builder(this).setView(colorPicker).show();
}
}
示例11: openDialog
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
private void openDialog() {
AlertDialog.Builder builder =
new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
final View view = inflater.inflate(R.layout.day6_dialog, null);
builder.setView(view);
final ColorPicker picker = (ColorPicker) view.findViewById(R.id.picker);
SVBar svBar = (SVBar) view.findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) view.findViewById(R.id.opacitybar);
picker.addOpacityBar(opacityBar);
picker.addSVBar(svBar);
picker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
@Override
public void onColorChanged(int i) {
mLinearLayout.setBackgroundColor(picker.getColor());
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Change color go here.
mLinearLayout.setBackgroundColor(picker.getColor());
}
});
builder.setNegativeButton("Cancel", null);
builder.show();
}
示例12: 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();
}
示例13: 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);
}
示例14: onClick
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.change_color_button:
//Create color picker view
View view = this.getLayoutInflater().inflate(R.layout.color_picker_dialog, null);
if (view == null) return;
//Config picker
final ColorPicker picker = (ColorPicker) view.findViewById(R.id.picker);
SVBar svBar = (SVBar) view.findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) view.findViewById(R.id.opacitybar);
final TextView hexCode = (TextView) view.findViewById(R.id.hex_code);
picker.addSVBar(svBar);
picker.addOpacityBar(opacityBar);
picker.setOldCenterColor(twitterBtn.getButtonColor());
picker.setOnColorChangedListener(new ColorPicker.OnColorChangedListener() {
@Override
public void onColorChanged(int intColor) {
String hexColor = Integer.toHexString(intColor).toUpperCase();
hexCode.setText("#" + hexColor);
}
});
//Config dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(view);
builder.setTitle("Choose your color");
builder.setCancelable(true);
builder.setNegativeButton("Cancel", null);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Update color
twitterBtn.setButtonColor(picker.getColor());
}
});
builder.create().show();
break;
}
}