From 080fd5e249086713219351f80331f351150717a9 Mon Sep 17 00:00:00 2001 From: n8fr8 Date: Fri, 29 Jun 2012 11:41:36 -0400 Subject: [PATCH] made transproxy app list alphabetical --- .../torproject/android/settings/AppManager.java | 2 ++ .../torproject/android/settings/TorifiedApp.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/org/torproject/android/settings/AppManager.java b/src/org/torproject/android/settings/AppManager.java index db641ae1..07330306 100644 --- a/src/org/torproject/android/settings/AppManager.java +++ b/src/org/torproject/android/settings/AppManager.java @@ -5,6 +5,7 @@ package org.torproject.android.settings; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -266,6 +267,7 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC appIdx++; } + Collections.sort(apps); return apps; } diff --git a/src/org/torproject/android/settings/TorifiedApp.java b/src/org/torproject/android/settings/TorifiedApp.java index 8e533212..a7868004 100644 --- a/src/org/torproject/android/settings/TorifiedApp.java +++ b/src/org/torproject/android/settings/TorifiedApp.java @@ -2,7 +2,7 @@ package org.torproject.android.settings; import android.graphics.drawable.Drawable; -public class TorifiedApp { +public class TorifiedApp implements Comparable { private boolean enabled; private int uid; @@ -115,4 +115,16 @@ public class TorifiedApp { public void setIcon(Drawable icon) { this.icon = icon; } + + @Override + public int compareTo(Object another) { + + return this.toString().compareTo(another.toString()); + } + + @Override + public String toString () + { + return getName(); + } }