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


Java OpacityBar类代码示例

本文整理汇总了Java中com.larswerkman.holocolorpicker.OpacityBar的典型用法代码示例。如果您正苦于以下问题:Java OpacityBar类的具体用法?Java OpacityBar怎么用?Java OpacityBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OpacityBar类属于com.larswerkman.holocolorpicker包,在下文中一共展示了OpacityBar类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PrepareColorPicker

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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: onCreateDialog

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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();
}
 
开发者ID:Tombarr,项目名称:Noyze,代码行数:25,代码来源:ColorPreference.java

示例3: onCreate

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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.OpacityBar; //导入依赖的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.OpacityBar; //导入依赖的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: init

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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);
}
 
开发者ID:DestinyVaultHelper,项目名称:dvh,代码行数:15,代码来源:LabelEditView.java

示例7: onCreateDialog

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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();
}
 
开发者ID:noties,项目名称:ColorCrossFade,代码行数:36,代码来源:ColorPickerDialog.java

示例8: openDialog

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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();
}
 
开发者ID:Phonbopit,项目名称:30-android-libraries-in-30-days,代码行数:34,代码来源:HoloColorPickerActivity.java

示例9: DialogPlotSettings

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的package包/类
public DialogPlotSettings(Activity context, PlotPropertiesChangeIf changeIf, PlotProperties parameters)
{
    super(context, R.layout.dialog_plot_settings, R.string.dialog_plot_settings_title);
    this.parameters = parameters;

    pickerWidth = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_width);
    pickerWidth.setValue(parameters.width);
    pickerWidth.minValue = 0;
    pickerHeight = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_height);
    pickerHeight.setValue(parameters.height);
    pickerHeight.minValue = 0;

    ((LinearLayout) findViewById(R.id.dialog_dimension_layout))
            .setVisibility((changeIf.getDimension() == PlotPropertiesChangeIf.Dimension.TWO_D) ? View.VISIBLE
                    : View.GONE);
    if (changeIf.getDimension() == PlotPropertiesChangeIf.Dimension.TWO_D)
    {
        rContour = (RadioButton) findViewById(R.id.dialog_button_contour);
        rContour.setOnClickListener(this);
        rSurface = (RadioButton) findViewById(R.id.dialog_button_surface);
        rSurface.setOnClickListener(this);
        switch (parameters.twoDPlotStyle)
        {
        case CONTOUR:
            rContour.setChecked(true);
            onClick(rContour);
            break;
        case SURFACE:
            rSurface.setChecked(true);
            onClick(rSurface);
            break;
        }

        cbMeshLines = (CheckBox) findViewById(R.id.dialog_checkbox_mesh_lines);
        cbMeshLines.setChecked(parameters.meshLines);
        cbMeshFill = (CheckBox) findViewById(R.id.dialog_checkbox_mesh_fill);
        cbMeshFill.setChecked(parameters.meshFill);
        pickerMeshOpacity = (OpacityBar) findViewById(R.id.dialog_colorpicker_mesh_opacity);
        pickerMeshOpacity.setColor(Color.BLACK);
        pickerMeshOpacity.setOpacity(parameters.meshOpacity);
        pickerRotation = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_rotation);
        pickerRotation.setValue(parameters.rotation);
        pickerRotation.minValue = 0;
        pickerRotation.maxValue = 360;
        pickerElevation = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_elevation);
        pickerElevation.setValue(parameters.elevation);
        pickerElevation.minValue = 0;
        pickerElevation.maxValue = 360;
    }

    switch (parameters.axesStyle)
    {
    case BOXED:
        ((RadioButton) findViewById(R.id.dialog_button_axes_boxed)).setChecked(true);
        break;
    case CROSSED:
        ((RadioButton) findViewById(R.id.dialog_button_axes_crossed)).setChecked(true);
        break;
    case NONE:
        ((RadioButton) findViewById(R.id.dialog_button_axes_none)).setChecked(true);
        break;
    }

    this.changeIf = changeIf;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:66,代码来源:DialogPlotSettings.java

示例10: onClick

import com.larswerkman.holocolorpicker.OpacityBar; //导入依赖的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;
    }
}
 
开发者ID:hoang8f,项目名称:android-flat-button,代码行数:44,代码来源:MainActivity.java


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