From 5e54bc0c6a38c9e0c76022fb8df369a1d067d003 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 13 Jun 2019 22:08:43 +0200 Subject: [PATCH] Export/import account/folder order --- app/src/main/java/eu/faircode/email/EntityAccount.java | 5 +++++ app/src/main/java/eu/faircode/email/EntityFolder.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/EntityAccount.java b/app/src/main/java/eu/faircode/email/EntityAccount.java index 8116e29cc9..04266c31c6 100644 --- a/app/src/main/java/eu/faircode/email/EntityAccount.java +++ b/app/src/main/java/eu/faircode/email/EntityAccount.java @@ -141,6 +141,7 @@ public class EntityAccount extends EntityOrder implements Serializable { public JSONObject toJSON() throws JSONException { JSONObject json = new JSONObject(); json.put("id", id); + json.put("order", order); json.put("auth_type", auth_type); json.put("host", host); json.put("starttls", starttls); @@ -173,6 +174,10 @@ public class EntityAccount extends EntityOrder implements Serializable { public static EntityAccount fromJSON(JSONObject json) throws JSONException { EntityAccount account = new EntityAccount(); // id + + if (json.has("order")) + account.order = json.getInt("order"); + account.auth_type = json.getInt("auth_type"); account.host = json.getString("host"); account.starttls = (json.has("starttls") && json.getBoolean("starttls")); diff --git a/app/src/main/java/eu/faircode/email/EntityFolder.java b/app/src/main/java/eu/faircode/email/EntityFolder.java index f41c881797..4d1c54f8da 100644 --- a/app/src/main/java/eu/faircode/email/EntityFolder.java +++ b/app/src/main/java/eu/faircode/email/EntityFolder.java @@ -312,6 +312,7 @@ public class EntityFolder extends EntityOrder implements Serializable { public JSONObject toJSON() throws JSONException { JSONObject json = new JSONObject(); json.put("id", id); + json.put("order", order); json.put("name", name); json.put("type", type); json.put("synchronize", synchronize); @@ -333,6 +334,9 @@ public class EntityFolder extends EntityOrder implements Serializable { if (json.has("id")) folder.id = json.getLong("id"); + if (json.has("order")) + folder.order = json.getInt("order"); + folder.name = json.getString("name"); folder.type = json.getString("type");