use of com.rarepebble.colorpicker.ColorPickerView in project AnyMemo by helloworld1.
the class SettingsScreen method showColorPickerDialog.
private void showColorPickerDialog() {
final int spinnerPos = colorSpinner.getSelectedItemPosition();
Integer currentColor = colors.get(spinnerPos);
final int defaultTextColor = ContextCompat.getColor(this, android.R.color.primary_text_dark);
final int defaultBackgroundColor = ContextCompat.getColor(this, android.R.color.background_dark);
final ColorPickerView colorPickerView = new ColorPickerView(this);
colorPickerView.showAlpha(false);
if (currentColor != null) {
colorPickerView.setColor(currentColor);
} else if (spinnerPos == QUESTION_TEXT_SPINNER_POS || spinnerPos == ANSWER_TEXT_SPINNER_POS) {
colorPickerView.setColor(defaultTextColor);
} else if (spinnerPos == QUESTION_BACKGROUND_SPINNER_POS || spinnerPos == ANSWER_BACKGROUND_SPINNER_POS) {
colorPickerView.setColor(defaultBackgroundColor);
}
new AlertDialog.Builder(this).setTitle(R.string.color_button_text).setView(colorPickerView).setPositiveButton(R.string.ok_text, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
colorButton.setTextColor(colorPickerView.getColor());
colors.set(spinnerPos, colorPickerView.getColor());
}
}).create().show();
}
use of com.rarepebble.colorpicker.ColorPickerView in project collect by opendatakit.
the class DrawActivity method setColor.
private void setColor(View view) {
if (view.getVisibility() == View.VISIBLE) {
fabActions.performClick();
final ColorPickerView picker = new ColorPickerView(this);
picker.setColor(drawView.getColor());
picker.showAlpha(false);
picker.showHex(false);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setView(picker).setPositiveButton(R.string.ok, (dialog, which) -> drawView.setColor(picker.getColor())).show();
}
}
use of com.rarepebble.colorpicker.ColorPickerView in project WhatsappExtensions by suraj0208.
the class ColorChooserActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_color_chooser);
Bundle bundle = getIntent().getExtras();
if (bundle == null) {
Toast.makeText(getApplicationContext(), R.string.internal_error, Toast.LENGTH_SHORT).show();
finish();
}
final String which = bundle.getString("groupOrIndividual");
if (which == null) {
Toast.makeText(getApplicationContext(), R.string.internal_error, Toast.LENGTH_SHORT).show();
finish();
}
SharedPreferences sharedPreferences = Utils.getSharedPreferences(this);
final ColorPickerView picker = (ColorPickerView) findViewById(R.id.colorPicker);
picker.setColor(sharedPreferences.getInt(which, Color.GRAY));
findViewById(R.id.btnColorChooserCancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorChooserActivity.this.finish();
}
});
findViewById(R.id.btnColorChooserOk).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateHighlightColor(which, picker.getColor());
ColorChooserActivity.this.finish();
}
});
}
Aggregations