diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-03-16 01:37:29 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2021-03-16 01:37:29 +0300 |
commit | 669d457f5c2eaf062dec08a133f3516ee4038c4d (patch) | |
tree | be54883e6c0b29f154fee21243939ec8907a18d6 /app/src/main/java/it/niedermann/owncloud/notes/shared | |
parent | a447542fc16f602fa0e7db7533b2ca78b72d18fc (diff) |
#916 Change remote account settings - Server connection
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/shared')
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/shared/model/ServerSettings.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/shared/model/ServerSettings.java b/app/src/main/java/it/niedermann/owncloud/notes/shared/model/ServerSettings.java new file mode 100644 index 00000000..e977b697 --- /dev/null +++ b/app/src/main/java/it/niedermann/owncloud/notes/shared/model/ServerSettings.java @@ -0,0 +1,47 @@ +package it.niedermann.owncloud.notes.shared.model; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.Serializable; + +import static it.niedermann.owncloud.notes.persistence.NotesClient.JSON_SETTINGS_FILE_SUFFIX; +import static it.niedermann.owncloud.notes.persistence.NotesClient.JSON_SETTINGS_NOTES_PATH; + +public class ServerSettings implements Serializable { + private String notesPath = ""; + private String fileSuffix = ""; + + public ServerSettings(String notesPath, String fileSuffix) { + setNotesPath(notesPath); + setFileSuffix(fileSuffix); + } + + public static ServerSettings from(JSONObject settings) throws JSONException { + String notesPath = ""; + if (settings.has(JSON_SETTINGS_NOTES_PATH)) { + notesPath = settings.getString(JSON_SETTINGS_NOTES_PATH); + } + String fileSuffix = ""; + if (settings.has(JSON_SETTINGS_FILE_SUFFIX)) { + fileSuffix = settings.getString(JSON_SETTINGS_FILE_SUFFIX); + } + return new ServerSettings(notesPath, fileSuffix); + } + + public String getNotesPath() { + return notesPath; + } + + public void setNotesPath(String notesPath) { + this.notesPath = notesPath; + } + + public String getFileSuffix() { + return fileSuffix; + } + + public void setFileSuffix(String fileSuffix) { + this.fileSuffix = fileSuffix; + } +}
\ No newline at end of file |