Localize folder names

pull/147/head
M66B 6 years ago
parent b1ebc3ffd2
commit 84f63ab473

@ -215,7 +215,7 @@ public class EntityFolder implements Serializable {
@Override
public String toString() {
return name;
return (display == null ? name : display);
}
public JSONObject toJSON() throws JSONException {

@ -637,6 +637,10 @@ public class FragmentAccount extends FragmentBase {
if (!junk && altJunk != null)
altJunk.type = EntityFolder.JUNK;
for (EntityFolder folder : result.folders)
folder.display = folder.getDisplayName(getContext());
EntityFolder.sort(getContext(), result.folders);
} finally {
if (istore != null)
istore.close();
@ -1109,7 +1113,17 @@ public class FragmentAccount extends FragmentBase {
@Override
protected List<EntityFolder> onExecute(Context context, Bundle args) {
long account = args.getLong("account");
return DB.getInstance(context).folder().getFolders(account);
DB db = DB.getInstance(context);
List<EntityFolder> folders = db.folder().getFolders(account);
if (folders != null) {
for (EntityFolder folder : folders)
folder.display = folder.getDisplayName(getContext());
EntityFolder.sort(getContext(), folders);
}
return folders;
}
@Override
@ -1302,8 +1316,6 @@ public class FragmentAccount extends FragmentBase {
}
private void setFolders(List<EntityFolder> folders) {
EntityFolder.sort(getContext(), folders);
EntityFolder none = new EntityFolder();
none.name = "-";
folders.add(0, none);

@ -957,7 +957,11 @@ public class FragmentIdentity extends FragmentBase {
result.identity = db.identity().getIdentity(iid);
result.folders = db.folder().getFolders(aid);
EntityFolder.sort(context, result.folders);
if (result.folders != null) {
for (EntityFolder folder : result.folders)
folder.display = folder.getDisplayName(context);
EntityFolder.sort(context, result.folders);
}
return result;
}

@ -178,7 +178,17 @@ public class FragmentRule extends FragmentBase {
@Override
protected List<EntityFolder> onExecute(Context context, Bundle args) {
long account = args.getLong("account");
return DB.getInstance(context).folder().getFolders(account);
DB db = DB.getInstance(context);
List<EntityFolder> folders = db.folder().getFolders(account);
if (folders != null) {
for (EntityFolder folder : folders)
folder.display = folder.getDisplayName(context);
EntityFolder.sort(context, folders);
}
return folders;
}
@Override

Loading…
Cancel
Save