当前位置: 首页>>代码示例>>Java>>正文


Java ColorPicker.addSaturationBar方法代码示例

本文整理汇总了Java中com.larswerkman.holocolorpicker.ColorPicker.addSaturationBar方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.addSaturationBar方法的具体用法?Java ColorPicker.addSaturationBar怎么用?Java ColorPicker.addSaturationBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.larswerkman.holocolorpicker.ColorPicker的用法示例。


在下文中一共展示了ColorPicker.addSaturationBar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:26,代码来源:DialogBase.java

示例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();
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:22,代码来源:ColorPanel.java

示例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();
    }
 
开发者ID:OpenSilk,项目名称:FuzzyClock,代码行数:27,代码来源:FuzzyColorPickerDialog.java

示例5: 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;
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:27,代码来源:ColorPickerFragment.java

示例6: 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));
	}
});
  }
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:38,代码来源:CategoryActivity.java

示例7: 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;
}
 
开发者ID:AChep,项目名称:AcDisplay,代码行数:34,代码来源:ColorPickerPreference.java

示例8: 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();
}
 
开发者ID:adafruit,项目名称:Bluefruit_LE_Connect_Android,代码行数:35,代码来源:ColorPickerActivity.java

示例9: 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);

    }
 
开发者ID:adafruit,项目名称:Bluefruit_LE_Connect_Android,代码行数:31,代码来源:NeopixelColorPickerActivity.java


注:本文中的com.larswerkman.holocolorpicker.ColorPicker.addSaturationBar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。