本文整理汇总了Java中com.thebluealliance.spectrum.SpectrumDialog类的典型用法代码示例。如果您正苦于以下问题:Java SpectrumDialog类的具体用法?Java SpectrumDialog怎么用?Java SpectrumDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpectrumDialog类属于com.thebluealliance.spectrum包,在下文中一共展示了SpectrumDialog类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
@Override
public void onClick(View view) {
int viewId = view.getId();
switch (viewId)
{
// Allow the user to select another color for the global color
case R.id.brush_color_button:
spectrumBuilder
.setSelectedColorRes(colorMap.get(currentGlobalColor))
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(boolean positiveResult, @ColorInt int color) {
currentGlobalColor = color;
}
}).build().show(getSupportFragmentManager(), "color_chooser_fragment");
break;
// Fill the grid with one color
case R.id.fill_button:
currentGrid.init(currentGlobalColor);
mAdapter.notifyDataSetChanged();
break;
}
}
示例2: onClick
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
@Override
public void onClick(View v) {
new SpectrumDialog.Builder(getBaseContext())
.setColors(colorArray)
.setSelectedColor(kanboardColors.get(colorId != null ? colorId : defaultColor).getBackground())
.setDismissOnColorSelected(true)
.setTitle(R.string.taskedit_seclect_color)
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(boolean positiveResult, @ColorInt int color) {
if (positiveResult) {
Enumeration<String> iter = kanboardColors.keys();
while (iter.hasMoreElements()) {
String key = iter.nextElement();
if (kanboardColors.get(key).getBackground() == color) {
colorId = key;
break;
}
}
setButtonColor();
}
}
}).build().show(getSupportFragmentManager(), "color_dialog");
}
示例3: handlePaletteAction
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
/**
* When the user touch palette menu icon in order to change background color of the
* future CardView.
*/
private void handlePaletteAction() {
new SpectrumDialog.Builder(this)
.setColors(R.array.card_colors)
.setSelectedColor(this.selectedColor)
.setDismissOnColorSelected(true)
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(boolean positiveResult, @ColorInt int color) {
if (positiveResult) {
selectedColor = color;
mainLayout.setBackgroundColor(selectedColor);
}
}
}).build().show(getSupportFragmentManager(), "SpectrumDialog");
}
示例4: showColorSelectionDialog
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
private void showColorSelectionDialog() {
new SpectrumDialog.Builder(getActivity())
.setColors(R.array.demo_colors)
.setDismissOnColorSelected(true)
.setOutlineWidth(2)
.setSelectedColor(sharedPrefStorage.getQodColor())
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(boolean positiveResult, @ColorInt int color) {
if (positiveResult) {
binding.circleImageViewTextColor.setFillColor(color);
sharedPrefStorage.setQodColor(color);
}
}
})
.build()
.show(getActivity().getSupportFragmentManager(), "dialog_demo_1");
}
示例5: launchColourPickerDialog
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
/**
* Launch the colour picker dialog using the Spectrum Colour picker
* https://github.com/the-blue-alliance/spectrum
*/
private void launchColourPickerDialog(Integer currentColour){
new SpectrumDialog.Builder(getApplicationContext())
.setColors(R.array.avatar_colours)
.setSelectedColor(currentColour)
.setDismissOnColorSelected(true)
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override public void onColorSelected(boolean positiveResult, @ColorInt int color) {
if (positiveResult) {
// Change the button colour to the selected colour.
GradientDrawable buttonBackgroundShape = (GradientDrawable) mPickAvatarColourButton.getBackground();
buttonBackgroundShape.setColor(color);
// Update the sCurrentAvatarColour
sCurrentAvatarColour = color;
}
}
}).build().show(getSupportFragmentManager(), COLOUR_PICKER_TAG);
}
示例6: showColorDialog
import com.thebluealliance.spectrum.SpectrumDialog; //导入依赖的package包/类
private void showColorDialog() {
new SpectrumDialog.Builder(MainActivity.this)
.setColors(R.array.demo_colors)
.setOnColorSelectedListener(new SpectrumDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(boolean positiveResult, @ColorInt int color) {
if (positiveResult) {
tintMediaRouterButtons(color);
}
}
}).build().show(getSupportFragmentManager(), "color_dialog");
}