Exclude notification type from title
Hello. Thank you for this great library! I'm just thinking, is it possible to exclude notification type from title? Because, for example, in NotificationCenter you have this line: https://github.com/sshtools/two-slices/blob/master/src/main/java/com/sshtools/twoslices/impl/NotificationCenterToaster.java#L893 which basically adds unneeded text before title. Would be great to have it configurable in builder like so:
boolean includeTypeInTitleIfUnsupportedByToaster;
I would pass false here to disable this feature for all toaster's implementations. So, if toaster implementation supports differentiation by type, it should still be used. But if not, the type should be in title.
What do you think about it?
Hi, thanks for your report.
I've just pushed version 0.9.1 to Maven Central, that will support what you are trying to do. I have been meaning to improve how "hints" are provided to the various different implementations, and took the opportunity to do so here.
You will need the BasicToastHint.NO_TYPE_IN_TEXT hint. You can set this either globally via ToasterSettings, or use ToastBuilder.hints().
var builder = Toast.builder();
builder.hints().put(BasicToastHint.NO_TYPE_IN_TEXT, true);
builder.title("My Title");
builder.content("Some content");
builder.toast();
Hope this helps you.
@brett-smith wow, cool, thank you very much for such option!
Returned to the subject and tried to find the place where this setting is applied: https://github.com/search?q=repo%3Asshtools%2Ftwo-slices%20NO_TYPE_IN_TEXT&type=code
But it shows only declaration, no usage. Am I mistaken or is it really not used in the code?
You are not mistaken! I somehow managed to do everything except actually implement the original suggestion :-\
Anyway, this is fixed in 0.9.4-SNAPSHOT, full release to follow shortly.