本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker.setOldCenterColor方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.setOldCenterColor方法的具体用法?Java ColorPicker.setOldCenterColor怎么用?Java ColorPicker.setOldCenterColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.larswerkman.holocolorpicker.ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.setOldCenterColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例5: 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());
}
});
}
示例6: 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));
}
});
}
示例7: 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
示例8: 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;
}
示例9: onCreateDialog
import com.larswerkman.holocolorpicker.ColorPicker; //导入方法依赖的package包/类
@Override
@NonNull
public Dialog onCreateDialog(Bundle sis) {
final LayoutInflater inflater = LayoutInflater.from(getActivity());
final View view = inflater.inflate(R.layout.dialog_color_picker, null);
final int color = getArguments().getInt(ARG_COLOR, 0);
final ColorPicker picker = (ColorPicker) view.findViewById(R.id.dialog_color_picker);
final SVBar svBar = (SVBar) view.findViewById(R.id.dialog_color_sv_bar);
final OpacityBar alphaBar = (OpacityBar) view.findViewById(R.id.dialog_color_alpha_bar);
picker.addSVBar(svBar);
picker.addOpacityBar(alphaBar);
picker.setOldCenterColor(color);
return new AlertDialog.Builder(getActivity())
.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final int pickerColor = picker.getColor();
if (pickerColor != color) {
mOnColorPickedListener.onColorPicked(
getArguments().getString(ARG_TAG),
pickerColor
);
}
}
}).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: 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;
}
示例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;
}
}