2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Sort plugins by name in preferences

This commit is contained in:
Albert Vaca Cintora
2023-03-12 23:49:43 +01:00
committed by Albert Vaca Cintora
parent a638d66dd3
commit d2edd7a325
2 changed files with 9 additions and 0 deletions

View File

@@ -18,13 +18,20 @@ import org.atteo.classindex.IndexAnnotated;
import org.kde.kdeconnect.Device;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class PluginFactory {
public static void sortPluginList(List<String> plugins) {
plugins.sort(Comparator.comparing(o -> pluginInfo.get(o).displayName));
}
@IndexAnnotated
public @interface LoadablePlugin { } //Annotate plugins with this so PluginFactory finds them

View File

@@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import org.kde.kdeconnect.BackgroundService;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect_tp.R;
import java.util.List;
@@ -84,6 +85,7 @@ public class PluginSettingsListFragment extends PreferenceFragmentCompat {
return;
}
List<String> plugins = device.getSupportedPlugins();
PluginFactory.sortPluginList(plugins);
for (final String pluginKey : plugins) {
//TODO: Use PreferenceManagers context