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