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


Java ColorPicker类代码示例

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


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

示例1: pickColor

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
private int pickColor(Context context) {
    List<Account> accounts = Preferences.getPreferences(context).getAccounts();

    List<Integer> availableColors = new ArrayList<>(PREDEFINED_COLORS.length);
    Collections.addAll(availableColors, PREDEFINED_COLORS);

    for (Account account : accounts) {
        Integer color = account.getChipColor();
        if (availableColors.contains(color)) {
            availableColors.remove(color);
            if (availableColors.isEmpty()) {
                break;
            }
        }
    }

    return (availableColors.isEmpty()) ? ColorPicker.getRandomColor() : availableColors.get(0);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:19,代码来源:Account.java

示例2: ColorPickerDialog

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
public ColorPickerDialog(Context context, OnColorChangedListener listener, int color) {
    super(context);
    mColorChangedListener = listener;

    @SuppressLint("InflateParams")
    View view = LayoutInflater.from(context).inflate(R.layout.color_picker_dialog, null);

    mColorPicker = (ColorPicker) view.findViewById(R.id.color_picker);
    mColorPicker.setColor(color);

    setView(view);

    setButton(BUTTON_POSITIVE, context.getString(R.string.okay_action),
            new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mColorChangedListener != null) {
                mColorChangedListener.colorChanged(mColorPicker.getColor());
            }
        }
    });

    setButton(BUTTON_NEGATIVE, context.getString(R.string.cancel_action),
            (OnClickListener) null);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:26,代码来源:ColorPickerDialog.java

示例3: pickColor

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
private int pickColor(Context context) {
    Account[] accounts = Preferences.getPreferences(context).getAccounts();

    List<Integer> availableColors = new ArrayList<Integer>(PREDEFINED_COLORS.length);
    Collections.addAll(availableColors, PREDEFINED_COLORS);

    for (Account account : accounts) {
        Integer color = account.getChipColor();
        if (availableColors.contains(color)) {
            availableColors.remove(color);
            if (availableColors.isEmpty()) {
                break;
            }
        }
    }

    return (availableColors.isEmpty()) ? ColorPicker.getRandomColor() : availableColors.get(0);
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:19,代码来源:Account.java

示例4: ColorPickerDialog

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
public ColorPickerDialog(Context context, OnColorChangedListener listener, int color) {
    super(context);
    mColorChangedListener = listener;

    View view = LayoutInflater.from(context).inflate(R.layout.color_picker_dialog, null);

    mColorPicker = (ColorPicker) view.findViewById(R.id.color_picker);
    mColorPicker.setColor(color);

    setView(view);

    setButton(BUTTON_POSITIVE, context.getString(R.string.okay_action),
            new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mColorChangedListener != null) {
                mColorChangedListener.colorChanged(mColorPicker.getColor());
            }
        }
    });

    setButton(BUTTON_NEGATIVE, context.getString(R.string.cancel_action),
            (OnClickListener) null);
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:25,代码来源:ColorPickerDialog.java

示例5: onCreateView

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.simple_color_picker_fragment, null);

    mColorPicker = (ColorPicker) view.findViewById(R.id.color_picker);
    mButton = (Button) view.findViewById(R.id.change_color_button);
    mTextView = (TextView) view.findViewById(R.id.text_view);

    mButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mTextView.setTextColor(mColorPicker.getColor());
            mColorPicker.setOldCenterColor(mColorPicker.getColor());
        }
    });

    return view;
}
 
开发者ID:cketti,项目名称:HoloColorPicker_demo,代码行数:21,代码来源:SimpleColorPickerFragment.java

示例6: displayColorPicker

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
private void displayColorPicker(final int position) {
    final BambooInfo bamboo = mGardenAdapter.getItem(position);

    AlertDialog.Builder ab = new AlertDialog.Builder(Garden.this);
    View dialogView = getLayoutInflater().inflate(R.layout.color_picker, null);
    ab.setView(dialogView);

    final ColorPicker picker = (ColorPicker)dialogView.findViewById(R.id.picker);
    picker.addSVBar((SVBar)dialogView.findViewById(R.id.svbar));
    picker.addOpacityBar((OpacityBar) dialogView.findViewById(R.id.opacitybar));
    picker.setOldCenterColor(bamboo.getColor());
    picker.setColor(bamboo.getColor());

    ab.setTitle("Color")
            .setMessage("Pick a new color for this notebook.")
            .setNegativeButton("Cancel", null)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    updateBambooColor(bamboo, picker.getColor());
                }
            });
    ab.create().show();

}
 
开发者ID:Fusion,项目名称:BambooGarden,代码行数:26,代码来源:Garden.java

示例7: onCreateView

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.customized_color_picker_fragment, null);

    mColorPicker = (ColorPicker) view.findViewById(R.id.color_picker);
    mSvBar = (SVBar) view.findViewById(R.id.svbar);
    mOpacityBar = (OpacityBar) view.findViewById(R.id.opacitybar);

    mColorPicker.addSVBar(mSvBar);
    mColorPicker.addOpacityBar(mOpacityBar);

    return view;
}
 
开发者ID:cketti,项目名称:HoloColorPicker_demo,代码行数:16,代码来源:CustomizedColorPickerFragment.java

示例8: onCreate

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	// init CardView
	mCardView = (CardUI) findViewById(R.id.cardsview);
	mCardView.setSwipeable(true);

	titleColorPicker = (ColorPicker) findViewById(R.id.titlePicker);

	stripeColorPicker = (ColorPicker) findViewById(R.id.stripePicker);
	clickable = (CheckBox) findViewById(R.id.checkClickable);
	addToStack = (CheckBox) findViewById(R.id.checkToStack);
	overflow = (CheckBox) findViewById(R.id.checkOverflow);
	createCard = (Button) findViewById(R.id.createCard);
	cardTitle = (EditText) findViewById(R.id.editTitle);
	cardDesc = (EditText) findViewById(R.id.editDesc);
	cardType = (Spinner) findViewById(R.id.cardType);
	divider = (View) findViewById(R.id.divider);
	expandCollapse = (ImageView) findViewById(R.id.expandCollapse);
	addCardLayout = (LinearLayout) findViewById(R.id.newCardLayout);
	clickableLayout = (LinearLayout) findViewById(R.id.clickableLayout);
	colorPickersLayout = (LinearLayout) findViewById(R.id.colorPickersLayout);
	checkBoxesLayout = (LinearLayout) findViewById(R.id.checkboxesLayout);
	colorTitle = (TextView) findViewById(R.id.colorTitle);
	colorStripe = (TextView) findViewById(R.id.colorStripe);

	addCardLayout.setVisibility(View.GONE);

	cardType.setVisibility(View.GONE);
	cardTitle.setVisibility(View.GONE);
	cardDesc.setVisibility(View.GONE);
	colorPickersLayout.setVisibility(View.GONE);
	divider.setVisibility(View.GONE);
	checkBoxesLayout.setVisibility(View.GONE);
	createCard.setVisibility(View.GONE);

	handleButton();
	handleSpinner();
	handleColorPickers();
	handleExpandCollapseClick();
	generateInitialCards();
	mCardView.refresh();
}
 
开发者ID:smo-key,项目名称:sohacks,代码行数:46,代码来源:MainActivity.java

示例9: CreatePicker

import com.larswerkman.colorpicker.ColorPicker; //导入依赖的package包/类
private void CreatePicker() {

		picker = (ColorPicker) findViewById(R.id.picker);
		
		picker.setOnColorChangedListener(new OnColorChangedListener(){

			@Override
			public void onColorChanged(int color) {
				isColorChange=true;
			}
		});
		

	}
 
开发者ID:DFRobot,项目名称:BlunoAccessoryShieldDemo,代码行数:15,代码来源:BLUNOActivity.java


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