本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker.addSVBar方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.addSVBar方法的具体用法?Java ColorPicker.addSVBar怎么用?Java ColorPicker.addSVBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.larswerkman.holocolorpicker.ColorPicker
的用法示例。
在下文中一共展示了ColorPicker.addSVBar方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例3: 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();
}
示例4: 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);
}
示例5: 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));
}
});
}
示例6: 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
示例7: 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);
}
示例8: 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();
}
示例9: 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();
}
示例10: 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;
}
}