use of yuku.ambilwarna.AmbilWarnaDialog in project FBReaderJ by geometer.
the class ColorPreference method onClick.
@Override
protected void onClick() {
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
new AmbilWarnaDialog(getContext(), ZLAndroidColorUtil.rgb(getSavedColor()), new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
if (!callChangeListener(color)) {
return;
}
saveColor(new ZLColor(color));
notifyChanged();
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
}, buttonResource.getResource("ok").getValue(), buttonResource.getResource("cancel").getValue()).show();
}
use of yuku.ambilwarna.AmbilWarnaDialog in project KeepScore by nolanlawson.
the class DialogHelper method showCustomColorDialog.
private static void showCustomColorDialog(Context context, int initialColor, final Callback<PlayerColor> onColorChanged, final Runnable onColorSelected) {
AmbilWarnaDialog dialog = new AmbilWarnaDialog(context, initialColor, new OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
onColorChanged.onCallback(new CustomPlayerColor(color));
onColorSelected.run();
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
// do nothing
}
});
dialog.show();
}
use of yuku.ambilwarna.AmbilWarnaDialog in project J2ME-Loader by nikita36078.
the class ConfigActivity method onClick.
@SuppressLint("SetTextI18n")
@Override
public void onClick(View v) {
String[] presets = null;
DialogInterface.OnClickListener presetListener = null;
int color = 0;
AmbilWarnaDialog.OnAmbilWarnaListener colorListener = null;
switch(v.getId()) {
case R.id.cmdScreenSizePresets:
presets = screenAdapter.toArray(new String[0]);
presetListener = (dialog, which) -> {
tfScreenWidth.setText(Integer.toString(screenWidths.get(which)));
tfScreenHeight.setText(Integer.toString(screenHeights.get(which)));
};
break;
case R.id.cmdSwapSizes:
String tmp = tfScreenWidth.getText().toString();
tfScreenWidth.setText(tfScreenHeight.getText().toString());
tfScreenHeight.setText(tmp);
break;
case R.id.cmdFontSizePresets:
presets = fontAdapter.toArray(new String[0]);
presetListener = (dialog, which) -> {
tfFontSizeSmall.setText(Integer.toString(fontSmall.get(which)));
tfFontSizeMedium.setText(Integer.toString(fontMedium.get(which)));
tfFontSizeLarge.setText(Integer.toString(fontLarge.get(which)));
};
break;
case R.id.cmdScreenBack:
color = Integer.parseInt(tfScreenBack.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfScreenBack.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
case R.id.cmdVKBack:
color = Integer.parseInt(tfVKBack.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfVKBack.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
case R.id.cmdVKFore:
color = Integer.parseInt(tfVKFore.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfVKFore.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
case R.id.cmdVKSelFore:
color = Integer.parseInt(tfVKSelFore.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfVKSelFore.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
case R.id.cmdVKSelBack:
color = Integer.parseInt(tfVKSelBack.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfVKSelBack.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
case R.id.cmdVKOutline:
color = Integer.parseInt(tfVKOutline.getText().toString(), 16);
colorListener = new AmbilWarnaDialog.OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
tfVKOutline.setText(Integer.toHexString(color & 0xFFFFFF).toUpperCase());
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
}
};
break;
default:
return;
}
if (presetListener != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.SIZE_PRESETS));
builder.setItems(presets, presetListener);
AlertDialog alert = builder.create();
alert.show();
} else if (colorListener != null) {
AmbilWarnaDialog dialog = new AmbilWarnaDialog(this, color | 0xFF000000, colorListener);
dialog.show();
}
}
use of yuku.ambilwarna.AmbilWarnaDialog in project android-jigsaw-puzzle by julesbond007.
the class DrawActivity method openColorPickerDialog.
/**
* Create new dialog for color picker and show it
*/
private void openColorPickerDialog() {
Log.d(TAG, "show color picker dialog...");
AmbilWarnaDialog dialog = new AmbilWarnaDialog(this, drawView.getPaintColor(), false, getColorPickerCallback());
dialog.show();
}
Aggregations