[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] App sorting for TorifiedApps is case insensitive



commit 0675600505843058fd2aa6a4425b0f0ebb660808
Author: lexi <bird.s.lex@xxxxxxxxx>
Date:   Fri Apr 13 14:10:02 2018 -0400

    App sorting for TorifiedApps is case insensitive
---
 .../main/java/org/torproject/android/ui/AppManagerActivity.java    | 7 ++++++-
 .../main/java/org/torproject/android/service/vpn/TorifiedApp.java  | 3 +--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
index c3cdc5eb..17e39ccd 100644
--- a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
@@ -130,7 +130,12 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
 
         Collections.sort(mApps,new Comparator<TorifiedApp>() {
             public int compare(TorifiedApp o1, TorifiedApp o2) {
-                if (o1.isTorified() == o2.isTorified()) return o1.getName().compareTo(o2.getName());
+                /* Some apps start with lowercase letters and without the sorting being case
+                   insensitive they'd appear at the end of the grid of apps, a position where users
+                   would likely not expect to find them.
+                 */
+                if (o1.isTorified() == o2.isTorified())
+                    return o1.getName().toUpperCase().compareTo(o2.getName().toUpperCase());
                 if (o1.isTorified()) return -1;
                 return 1;
             }
diff --git a/orbotservice/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java b/orbotservice/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java
index c72ebe3b..1276f2f6 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/vpn/TorifiedApp.java
@@ -133,8 +133,7 @@ public class TorifiedApp implements Comparable {
 	
 	@Override
 	public int compareTo(Object another) {
-		
-		return this.toString().compareTo(another.toString());
+		return this.toString().toUpperCase().compareTo(another.toString().toUpperCase());
 	}
 	
 	@Override



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits