Add max allowed message option to Popup and increase window size for Monero to improve readability

This commit is contained in:
Christoph Atteneder 2019-11-14 15:21:30 +01:00
parent 1d813c347c
commit fa39258d71
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
2 changed files with 14 additions and 3 deletions

View File

@ -43,6 +43,7 @@ import bisq.core.util.validation.InputValidator;
import bisq.asset.AltCoinAccountDisclaimer;
import bisq.asset.Asset;
import bisq.asset.coins.Monero;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
@ -138,7 +139,10 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
if (asset.isPresent()) {
final AltCoinAccountDisclaimer disclaimerAnnotation = asset.get().getClass().getAnnotation(AltCoinAccountDisclaimer.class);
if (disclaimerAnnotation != null) {
new Popup<>().information(Res.get(disclaimerAnnotation.value()))
new Popup<>()
.width(asset.get() instanceof Monero ? 1000 : 669)
.maxMessageLength(2500)
.information(Res.get(disclaimerAnnotation.value()))
.useIUnderstandButton()
.show();
}

View File

@ -183,6 +183,8 @@ public abstract class Overlay<T extends Overlay> {
protected Timer centerTime;
protected Type type = Type.Undefined;
protected int maxChar = 1800;
///////////////////////////////////////////////////////////////////////////////////////////
// Public API
@ -460,6 +462,11 @@ public abstract class Overlay<T extends Overlay> {
return (T) this;
}
public T maxMessageLength(int maxChar) {
this.maxChar = maxChar;
return (T) this;
}
public T showBusyAnimation() {
this.showBusyAnimation = true;
//noinspection unchecked
@ -984,8 +991,8 @@ public abstract class Overlay<T extends Overlay> {
}
protected void setTruncatedMessage() {
if (message != null && message.length() > 1800)
truncatedMessage = StringUtils.abbreviate(message, 1800);
if (message != null && message.length() > maxChar)
truncatedMessage = StringUtils.abbreviate(message, maxChar);
else truncatedMessage = Objects.requireNonNullElse(message, "");
}