Упростил кнопки

This commit is contained in:
Struchkov Mark 2023-03-19 21:54:27 +03:00
parent 77f2c67540
commit 6f45154878
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
4 changed files with 32 additions and 29 deletions

View File

@ -3,12 +3,18 @@ package dev.struchkov.godfather.telegram.domain.keyboard;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoard; import dev.struchkov.godfather.main.domain.keyboard.KeyBoard;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardLine; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardLine;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
@Getter
@Setter
@NoArgsConstructor
public class InlineKeyBoard implements KeyBoard { public class InlineKeyBoard implements KeyBoard {
public static final String TYPE = "INLINE"; public static final String TYPE = "INLINE";
@ -39,15 +45,13 @@ public class InlineKeyBoard implements KeyBoard {
return builder().line(simpleLine(buttons)).build(); return builder().line(simpleLine(buttons)).build();
} }
public List<KeyBoardLine> getLines() { @Override
return lines;
}
public String getType() { public String getType() {
return TYPE; return TYPE;
} }
public static final class Builder { public static final class Builder {
private List<KeyBoardLine> lines = new ArrayList<>(); private List<KeyBoardLine> lines = new ArrayList<>();
private Builder() { private Builder() {
@ -66,6 +70,7 @@ public class InlineKeyBoard implements KeyBoard {
public InlineKeyBoard build() { public InlineKeyBoard build() {
return new InlineKeyBoard(this); return new InlineKeyBoard(this);
} }
} }
} }

View File

@ -1,6 +1,9 @@
package dev.struchkov.godfather.telegram.domain.keyboard.button; package dev.struchkov.godfather.telegram.domain.keyboard.button;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer; import static dev.struchkov.haiti.utils.Inspector.Utils.nullPointer;
import static dev.struchkov.haiti.utils.Inspector.isNotNull; import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@ -8,11 +11,14 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull;
/** /**
* Запрашивает у пользователя его контактный номер. * Запрашивает у пользователя его контактный номер.
*/ */
@Getter
@Setter
@NoArgsConstructor
public class ContactButton implements KeyBoardButton { public class ContactButton implements KeyBoardButton {
public static final String TYPE = "CONTACT"; public static final String TYPE = "CONTACT";
private final String label; private String label;
private ContactButton(String label) { private ContactButton(String label) {
this.label = label; this.label = label;
@ -23,10 +29,6 @@ public class ContactButton implements KeyBoardButton {
return new ContactButton(label); return new ContactButton(label);
} }
public String getLabel() {
return label;
}
@Override @Override
public String getType() { public String getType() {
return TYPE; return TYPE;

View File

@ -1,15 +1,21 @@
package dev.struchkov.godfather.telegram.domain.keyboard.button; package dev.struchkov.godfather.telegram.domain.keyboard.button;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import static dev.struchkov.haiti.utils.Inspector.isNotNull; import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@Getter
@Setter
@NoArgsConstructor
public class UrlButton implements KeyBoardButton { public class UrlButton implements KeyBoardButton {
public static final String TYPE = "URL"; public static final String TYPE = "URL";
private final String label; private String label;
private final String url; private String url;
public UrlButton(String label, String url) { public UrlButton(String label, String url) {
this.label = label; this.label = label;
@ -26,12 +32,4 @@ public class UrlButton implements KeyBoardButton {
return TYPE; return TYPE;
} }
public String getLabel() {
return label;
}
public String getUrl() {
return url;
}
} }

View File

@ -1,15 +1,21 @@
package dev.struchkov.godfather.telegram.domain.keyboard.button; package dev.struchkov.godfather.telegram.domain.keyboard.button;
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton; import dev.struchkov.godfather.main.domain.keyboard.KeyBoardButton;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import static dev.struchkov.haiti.utils.Inspector.isNotNull; import static dev.struchkov.haiti.utils.Inspector.isNotNull;
@Getter
@Setter
@NoArgsConstructor
public class WebAppButton implements KeyBoardButton { public class WebAppButton implements KeyBoardButton {
public static final String TYPE = "WEB_APP"; public static final String TYPE = "WEB_APP";
private final String label; private String label;
private final String url; private String url;
private WebAppButton(String label, String url) { private WebAppButton(String label, String url) {
this.label = label; this.label = label;
@ -21,14 +27,6 @@ public class WebAppButton implements KeyBoardButton {
return new WebAppButton(label, url); return new WebAppButton(label, url);
} }
public String getUrl() {
return url;
}
public String getLabel() {
return label;
}
@Override @Override
public String getType() { public String getType() {
return TYPE; return TYPE;