|
|
@ -37,13 +37,15 @@ public class FragmentDialogColor extends FragmentDialogBase {
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
|
|
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
|
|
|
int color = getArguments().getInt("color");
|
|
|
|
Bundle args = getArguments();
|
|
|
|
String title = getArguments().getString("title");
|
|
|
|
int color = args.getInt("color");
|
|
|
|
|
|
|
|
String title = args.getString("title");
|
|
|
|
|
|
|
|
boolean reset = args.getBoolean("reset", false);
|
|
|
|
|
|
|
|
|
|
|
|
if (color == Color.TRANSPARENT)
|
|
|
|
if (color == Color.TRANSPARENT)
|
|
|
|
color = Color.BLUE;
|
|
|
|
color = Color.BLUE;
|
|
|
|
|
|
|
|
|
|
|
|
return ColorPickerDialogBuilder
|
|
|
|
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
|
|
|
|
.with(getContext())
|
|
|
|
.with(getContext())
|
|
|
|
.setTitle(title)
|
|
|
|
.setTitle(title)
|
|
|
|
.initialColor(color)
|
|
|
|
.initialColor(color)
|
|
|
@ -56,14 +58,17 @@ public class FragmentDialogColor extends FragmentDialogBase {
|
|
|
|
getArguments().putInt("color", selectedColor);
|
|
|
|
getArguments().putInt("color", selectedColor);
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
if (reset)
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
builder.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
getArguments().putInt("color", Color.TRANSPARENT);
|
|
|
|
@Override
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
}
|
|
|
|
getArguments().putInt("color", Color.TRANSPARENT);
|
|
|
|
})
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return builder.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|