Loading src/com/owncloud/android/lib/resources/shares/OCShare.java +13 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class OCShare implements Parcelable, Serializable { private String shareLink; private boolean isPasswordProtected; private String note; private boolean hideFileDownload; public OCShare() { super(); Loading Loading @@ -134,6 +135,7 @@ public class OCShare implements Parcelable, Serializable { shareLink = ""; isPasswordProtected = false; note = ""; hideFileDownload = false; } /// Getters and Setters Loading Loading @@ -278,6 +280,14 @@ public class OCShare implements Parcelable, Serializable { return this.note; } public boolean isHideFileDownload() { return hideFileDownload; } public void setHideFileDownload(boolean hideFileDownload) { this.hideFileDownload = hideFileDownload; } /** * Parcelable Methods */ Loading Loading @@ -324,6 +334,7 @@ public class OCShare implements Parcelable, Serializable { remoteId = source.readLong(); shareLink = source.readString(); isPasswordProtected = source.readInt() == 1; hideFileDownload = source.readInt() == 1; } Loading Loading @@ -351,5 +362,6 @@ public class OCShare implements Parcelable, Serializable { dest.writeLong(remoteId); dest.writeString(shareLink); dest.writeInt(isPasswordProtected ? 1 : 0); dest.writeInt(hideFileDownload ? 1 : 0); } } src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java +13 −9 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class ShareXMLParser { private static final String NODE_PASSWORD = "password"; private static final String NODE_SHARE_WITH_DISPLAY_NAME = "share_with_displayname"; private static final String NODE_NOTE = "note"; private static final String NODE_HIDE_DOWNLOAD = "hide_download"; private static final String NODE_URL = "url"; Loading Loading @@ -137,14 +138,12 @@ public class ShareXMLParser { /** * Parse is as response of Share API * @param is * @param is InputStream to parse * @return List of ShareRemoteFiles * @throws XmlPullParserException * @throws IOException */ public ArrayList<OCShare> parseXMLResponse(InputStream is) throws XmlPullParserException, IOException { public ArrayList<OCShare> parseXMLResponse(InputStream is) throws XmlPullParserException, IOException { try { // XMLPullParser XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); Loading Loading @@ -361,6 +360,11 @@ public class ShareXMLParser { } else if (name.equalsIgnoreCase(NODE_NOTE)) { share.setNote(readNode(parser, NODE_NOTE)); } else if (name.equalsIgnoreCase(NODE_HIDE_DOWNLOAD)) { boolean b = "1".equalsIgnoreCase(readNode(parser, NODE_HIDE_DOWNLOAD)); share.setHideFileDownload(b); } else { skip(parser); } Loading src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java +17 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class UpdateRemoteShareOperation extends RemoteOperation { private static final String PARAM_PERMISSIONS = "permissions"; private static final String PARAM_PUBLIC_UPLOAD = "publicUpload"; private static final String PARAM_NOTE = "note"; private static final String PARAM_HIDE_DOWNLOAD = "hideDownload"; private static final String FORMAT_EXPIRATION_DATE = "yyyy-MM-dd"; private static final String ENTITY_CONTENT_TYPE = "application/x-www-form-urlencoded"; private static final String ENTITY_CHARSET = "UTF-8"; Loading Loading @@ -88,6 +89,11 @@ public class UpdateRemoteShareOperation extends RemoteOperation { */ private Boolean publicUpload; /** * Permission if file can be downloaded via share link (only for single file) */ private Boolean hideFileDownload; private String note; Loading Loading @@ -150,6 +156,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { this.publicUpload = publicUpload; } public void setHideFileDownload(Boolean hideFileDownload) { this.hideFileDownload = hideFileDownload; } public void setNote(String note) { this.note = note; } Loading @@ -164,10 +174,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { if (password != null) { parametersToUpdate.add(new Pair<>(PARAM_PASSWORD, password)); } if (expirationDateInMillis < 0) { // clear expiration date parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, "")); } else if (expirationDateInMillis > 0) { // set expiration date DateFormat dateFormat = new SimpleDateFormat(FORMAT_EXPIRATION_DATE); Loading @@ -175,8 +185,8 @@ public class UpdateRemoteShareOperation extends RemoteOperation { expirationDate.setTimeInMillis(expirationDateInMillis); String formattedExpirationDate = dateFormat.format(expirationDate.getTime()); parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, formattedExpirationDate)); } } // else, ignore - no update if (permissions > 0) { // set permissions parametersToUpdate.add(new Pair<>(PARAM_PERMISSIONS, Integer.toString(permissions))); Loading @@ -186,6 +196,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { parametersToUpdate.add(new Pair<>(PARAM_PUBLIC_UPLOAD, Boolean.toString(publicUpload))); } if (hideFileDownload != null) { parametersToUpdate.add(new Pair<>(PARAM_HIDE_DOWNLOAD, Boolean.toString(hideFileDownload))); } parametersToUpdate.add(new Pair<>(PARAM_NOTE, note)); /// perform required PUT requests Loading Loading
src/com/owncloud/android/lib/resources/shares/OCShare.java +13 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class OCShare implements Parcelable, Serializable { private String shareLink; private boolean isPasswordProtected; private String note; private boolean hideFileDownload; public OCShare() { super(); Loading Loading @@ -134,6 +135,7 @@ public class OCShare implements Parcelable, Serializable { shareLink = ""; isPasswordProtected = false; note = ""; hideFileDownload = false; } /// Getters and Setters Loading Loading @@ -278,6 +280,14 @@ public class OCShare implements Parcelable, Serializable { return this.note; } public boolean isHideFileDownload() { return hideFileDownload; } public void setHideFileDownload(boolean hideFileDownload) { this.hideFileDownload = hideFileDownload; } /** * Parcelable Methods */ Loading Loading @@ -324,6 +334,7 @@ public class OCShare implements Parcelable, Serializable { remoteId = source.readLong(); shareLink = source.readString(); isPasswordProtected = source.readInt() == 1; hideFileDownload = source.readInt() == 1; } Loading Loading @@ -351,5 +362,6 @@ public class OCShare implements Parcelable, Serializable { dest.writeLong(remoteId); dest.writeString(shareLink); dest.writeInt(isPasswordProtected ? 1 : 0); dest.writeInt(hideFileDownload ? 1 : 0); } }
src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java +13 −9 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class ShareXMLParser { private static final String NODE_PASSWORD = "password"; private static final String NODE_SHARE_WITH_DISPLAY_NAME = "share_with_displayname"; private static final String NODE_NOTE = "note"; private static final String NODE_HIDE_DOWNLOAD = "hide_download"; private static final String NODE_URL = "url"; Loading Loading @@ -137,14 +138,12 @@ public class ShareXMLParser { /** * Parse is as response of Share API * @param is * @param is InputStream to parse * @return List of ShareRemoteFiles * @throws XmlPullParserException * @throws IOException */ public ArrayList<OCShare> parseXMLResponse(InputStream is) throws XmlPullParserException, IOException { public ArrayList<OCShare> parseXMLResponse(InputStream is) throws XmlPullParserException, IOException { try { // XMLPullParser XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); Loading Loading @@ -361,6 +360,11 @@ public class ShareXMLParser { } else if (name.equalsIgnoreCase(NODE_NOTE)) { share.setNote(readNode(parser, NODE_NOTE)); } else if (name.equalsIgnoreCase(NODE_HIDE_DOWNLOAD)) { boolean b = "1".equalsIgnoreCase(readNode(parser, NODE_HIDE_DOWNLOAD)); share.setHideFileDownload(b); } else { skip(parser); } Loading
src/com/owncloud/android/lib/resources/shares/UpdateRemoteShareOperation.java +17 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ public class UpdateRemoteShareOperation extends RemoteOperation { private static final String PARAM_PERMISSIONS = "permissions"; private static final String PARAM_PUBLIC_UPLOAD = "publicUpload"; private static final String PARAM_NOTE = "note"; private static final String PARAM_HIDE_DOWNLOAD = "hideDownload"; private static final String FORMAT_EXPIRATION_DATE = "yyyy-MM-dd"; private static final String ENTITY_CONTENT_TYPE = "application/x-www-form-urlencoded"; private static final String ENTITY_CHARSET = "UTF-8"; Loading Loading @@ -88,6 +89,11 @@ public class UpdateRemoteShareOperation extends RemoteOperation { */ private Boolean publicUpload; /** * Permission if file can be downloaded via share link (only for single file) */ private Boolean hideFileDownload; private String note; Loading Loading @@ -150,6 +156,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { this.publicUpload = publicUpload; } public void setHideFileDownload(Boolean hideFileDownload) { this.hideFileDownload = hideFileDownload; } public void setNote(String note) { this.note = note; } Loading @@ -164,10 +174,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { if (password != null) { parametersToUpdate.add(new Pair<>(PARAM_PASSWORD, password)); } if (expirationDateInMillis < 0) { // clear expiration date parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, "")); } else if (expirationDateInMillis > 0) { // set expiration date DateFormat dateFormat = new SimpleDateFormat(FORMAT_EXPIRATION_DATE); Loading @@ -175,8 +185,8 @@ public class UpdateRemoteShareOperation extends RemoteOperation { expirationDate.setTimeInMillis(expirationDateInMillis); String formattedExpirationDate = dateFormat.format(expirationDate.getTime()); parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, formattedExpirationDate)); } } // else, ignore - no update if (permissions > 0) { // set permissions parametersToUpdate.add(new Pair<>(PARAM_PERMISSIONS, Integer.toString(permissions))); Loading @@ -186,6 +196,10 @@ public class UpdateRemoteShareOperation extends RemoteOperation { parametersToUpdate.add(new Pair<>(PARAM_PUBLIC_UPLOAD, Boolean.toString(publicUpload))); } if (hideFileDownload != null) { parametersToUpdate.add(new Pair<>(PARAM_HIDE_DOWNLOAD, Boolean.toString(hideFileDownload))); } parametersToUpdate.add(new Pair<>(PARAM_NOTE, note)); /// perform required PUT requests Loading