diff options
Diffstat (limited to 'android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java index 388f48cece56..337c05cf2ae4 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java @@ -9,6 +9,8 @@ package org.libreoffice.impressremote.communication; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; import java.util.List; @@ -19,7 +21,7 @@ import android.content.Context; import org.libreoffice.impressremote.util.Preferences; -class ServersManager { +class ServersManager implements Comparator<Server> { private final Context mContext; private final ServersFinder mBluetoothServersFinder; @@ -53,7 +55,11 @@ class ServersManager { aServers.addAll(mTcpServersFinder.getServers()); aServers.addAll(getManualAddedTcpServers()); - return filterBlacklistedServers(aServers); + aServers = filterBlacklistedServers(aServers); + + Collections.sort(aServers, this); + + return aServers; } private List<Server> getManualAddedTcpServers() { @@ -89,6 +95,14 @@ class ServersManager { return aFilteredServers; } + @Override + public int compare(Server aFirstServer, Server aSecondServer) { + String aFirstServerName = aFirstServer.getName(); + String aSecondServerName = aSecondServer.getName(); + + return aFirstServerName.compareToIgnoreCase(aSecondServerName); + } + public void addTcpServer(String aAddress, String aName) { Preferences.set(mContext, Preferences.Locations.STORED_SERVERS, aAddress, aName); |