Упростил кнопки
This commit is contained in:
parent
77f2c67540
commit
6f45154878
@ -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.KeyBoardButton;
|
||||
import dev.struchkov.godfather.main.domain.keyboard.KeyBoardLine;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class InlineKeyBoard implements KeyBoard {
|
||||
|
||||
public static final String TYPE = "INLINE";
|
||||
@ -39,15 +45,13 @@ public class InlineKeyBoard implements KeyBoard {
|
||||
return builder().line(simpleLine(buttons)).build();
|
||||
}
|
||||
|
||||
public List<KeyBoardLine> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private List<KeyBoardLine> lines = new ArrayList<>();
|
||||
|
||||
private Builder() {
|
||||
@ -66,6 +70,7 @@ public class InlineKeyBoard implements KeyBoard {
|
||||
public InlineKeyBoard build() {
|
||||
return new InlineKeyBoard(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package dev.struchkov.godfather.telegram.domain.keyboard.button;
|
||||
|
||||
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.isNotNull;
|
||||
@ -8,11 +11,14 @@ import static dev.struchkov.haiti.utils.Inspector.isNotNull;
|
||||
/**
|
||||
* Запрашивает у пользователя его контактный номер.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ContactButton implements KeyBoardButton {
|
||||
|
||||
public static final String TYPE = "CONTACT";
|
||||
|
||||
private final String label;
|
||||
private String label;
|
||||
|
||||
private ContactButton(String label) {
|
||||
this.label = label;
|
||||
@ -23,10 +29,6 @@ public class ContactButton implements KeyBoardButton {
|
||||
return new ContactButton(label);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return TYPE;
|
||||
|
@ -1,15 +1,21 @@
|
||||
package dev.struchkov.godfather.telegram.domain.keyboard.button;
|
||||
|
||||
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;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class UrlButton implements KeyBoardButton {
|
||||
|
||||
public static final String TYPE = "URL";
|
||||
|
||||
private final String label;
|
||||
private final String url;
|
||||
private String label;
|
||||
private String url;
|
||||
|
||||
public UrlButton(String label, String url) {
|
||||
this.label = label;
|
||||
@ -26,12 +32,4 @@ public class UrlButton implements KeyBoardButton {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,21 @@
|
||||
package dev.struchkov.godfather.telegram.domain.keyboard.button;
|
||||
|
||||
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;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class WebAppButton implements KeyBoardButton {
|
||||
|
||||
public static final String TYPE = "WEB_APP";
|
||||
|
||||
private final String label;
|
||||
private final String url;
|
||||
private String label;
|
||||
private String url;
|
||||
|
||||
private WebAppButton(String label, String url) {
|
||||
this.label = label;
|
||||
@ -21,14 +27,6 @@ public class WebAppButton implements KeyBoardButton {
|
||||
return new WebAppButton(label, url);
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return TYPE;
|
||||
|
Loading…
Reference in New Issue
Block a user