Added support for Descriptions in API Client

Added hint for Replay Name in GuiUploadFile
This commit is contained in:
CrushedPixel
2015-06-04 19:26:16 +02:00
parent 146aa40bd4
commit ea968ca418
5 changed files with 24 additions and 6 deletions

View File

@@ -31,7 +31,8 @@ public class FileUploader {
private String boundary = "*****";
private GuiUploadFile parent;
public void uploadFile(GuiUploadFile gui, String auth, String filename, List<String> tags, File file, Category category) throws IOException, ApiException, RuntimeException {
public void uploadFile(GuiUploadFile gui, String auth, String filename, List<String> tags, File file, Category category, String description)
throws IOException, ApiException, RuntimeException {
boolean success = false;
String info = null;

View File

@@ -24,6 +24,7 @@ public class GuiConstants {
public static final int UPLOAD_TAG_INPUT = 3007;
public static final int UPLOAD_TAG_PLACEHOLDER = 3008;
public static final int UPLOAD_HIDE_SERVER_IP = 3009;
public static final int UPLOAD_NAME_PLACEHOLDER = 3010;
public static final int EXIT_REPLAY_BUTTON = 4001;

View File

@@ -47,7 +47,7 @@ public class GuiRegister extends GuiScreen {
if(!initialized) {
usernameInput = new GuiTextField(GuiConstants.REGISTER_USERNAME_FIELD, fontRendererObj, this.width / 2 - 45, 30, 145, 20);
usernameInput.setMaxStringLength(16);
mailInput = new GuiTextField(GuiConstants.REGISTER_MAIL_FIELD, fontRendererObj, this.width / 2 - 45, 60, 145, 20);
passwordInput = new PasswordTextField(GuiConstants.REGISTER_PASSWORD_FIELD, fontRendererObj, this.width / 2 - 45, 90, 145, 20);
passwordConfirmation = new PasswordTextField(GuiConstants.REGISTER_PASSWORD_CONFIRM_FIELD, fontRendererObj, this.width / 2 - 45, 120, 145, 20);

View File

@@ -48,7 +48,7 @@ public class GuiUploadFile extends GuiScreen {
private final ResourceLocation textureResource;
private DynamicTexture dynTex = null;
private GuiTextField fileTitleInput, tagInput, messageTextField, tagPlaceholder;
private GuiTextField fileTitleInput, fileTitlePlaceholder, tagInput, messageTextField, tagPlaceholder;
private GuiCheckBox hideServerIP;
private GuiButton categoryButton, startUploadButton, cancelUploadButton, backButton;
private GuiProgressBar progressBar;
@@ -141,6 +141,15 @@ public class GuiUploadFile extends GuiScreen {
fileTitleInput.width = Math.min(200, this.width - 20 - 260);
}
if(fileTitlePlaceholder == null) {
fileTitlePlaceholder = new GuiTextField(GuiConstants.UPLOAD_NAME_PLACEHOLDER, fontRendererObj, fileTitleInput.xPosition, fileTitleInput.yPosition, fileTitleInput.width, 20);
fileTitlePlaceholder.setTextColor(Color.DARK_GRAY.getRGB());
fileTitlePlaceholder.setText(I18n.format("replaymod.gui.upload.namehint"));
} else {
fileTitlePlaceholder.xPosition = fileTitleInput.xPosition;
fileTitlePlaceholder.width = fileTitleInput.width;
}
if(hideServerIP == null) {
hideServerIP = new GuiCheckBox(GuiConstants.UPLOAD_HIDE_SERVER_IP, 0, 80, I18n.format("replaymod.gui.upload.hideip"), false);
hideServerIP.enabled = !metaData.isSingleplayer();
@@ -282,12 +291,12 @@ public class GuiUploadFile extends GuiScreen {
FileUtils.copyFile(replayFile, tmp);
ReplayFileIO.addFilesToZip(tmp, toAdd);
uploader.uploadFile(GuiUploadFile.this, AuthenticationHandler.getKey(), name, tags, tmp, category);
uploader.uploadFile(GuiUploadFile.this, AuthenticationHandler.getKey(), name, tags, tmp, category, null);
tmpMeta.delete();
tmp.delete();
} else {
uploader.uploadFile(GuiUploadFile.this, AuthenticationHandler.getKey(), name, tags, replayFile, category);
uploader.uploadFile(GuiUploadFile.this, AuthenticationHandler.getKey(), name, tags, replayFile, category, null);
}
ReplayMod.uploadedFileHandler.markAsUploaded(replayFile);
@@ -334,7 +343,12 @@ public class GuiUploadFile extends GuiScreen {
Gui.drawScaledCustomSizeModalRect(19, 20, 0, 0, 1280, 720, wid, hei, 1280, 720);
}
fileTitleInput.drawTextBox();
if(fileTitleInput.getText().length() > 0 || fileTitleInput.isFocused()) {
fileTitleInput.drawTextBox();
} else {
fileTitlePlaceholder.drawTextBox();
}
messageTextField.drawTextBox();
if(tagInput.getText().length() > 0 || tagInput.isFocused()) {

View File

@@ -27,6 +27,7 @@ replaymod.api.authfailed=Authentication to the Minecraft Session Servers failed
replaymod.api.mcuserexists=A ReplayMod account is already associated with this Minecraft account
replaymod.api.filetoobig=The uploaded file is too big
replaymod.api.usernametoolong=The username is too long
replaymod.api.descriptiontoolong=The description is too long
#All of the chat messages
replaymod.chat.recordingstarted=Recording started
@@ -154,6 +155,7 @@ replaymod.gui.upload.title=Upload File
replaymod.gui.upload.start=Start Upload
replaymod.gui.upload.cancel=Cancel Upload
replaymod.gui.upload.tagshint=Tags separated by comma
replaymod.gui.upload.namehint=Replay Title
replaymod.gui.upload.uploading=Uploading...
replaymod.gui.upload.success=File has been successfully uploaded
replaymod.gui.upload.canceled=Upload has been canceled