Sort albums by title in gallery mode.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 21 Nov 2011 17:53:05 +0000 (18:53 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 21 Nov 2011 17:53:05 +0000 (18:53 +0100)
src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java

index 406a762..5bb75d1 100644 (file)
@@ -18,8 +18,9 @@
 package net.pterodactylus.sone.web;
 
 import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import net.pterodactylus.sone.data.Album;
 import net.pterodactylus.sone.data.Image;
@@ -81,10 +82,11 @@ public class ImageBrowserPage extends SoneTemplatePage {
                String mode = request.getHttpRequest().getParam("mode", null);
                if ("gallery".equals(mode)) {
                        templateContext.set("galleryRequested", true);
-                       Set<Album> albums = new HashSet<Album>();
+                       List<Album> albums = new ArrayList<Album>();
                        for (Sone sone : webInterface.getCore().getSones()) {
                                albums.addAll(sone.getAllAlbums());
                        }
+                       Collections.sort(albums, Album.TITLE_COMPARATOR);
                        templateContext.set("albums", albums);
                        return;
                }