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

[tor-commits] [orbot/master] fix country selector spinner bug with phantom selections



commit f702a0e462a79774405ac8bee55cdcf82d32772d
Author: n8fr8 <nathan@xxxxxxxxxxx>
Date:   Sat May 12 00:39:16 2018 -0400

    fix country selector spinner bug with phantom selections
---
 .../main/java/org/torproject/android/OrbotMainActivity.java   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index e3fd1a40..4e50dd53 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -367,8 +367,6 @@ public class OrbotMainActivity extends AppCompatActivity
 
     }
 
-    boolean firstTimeCountrySelect = true;
-
     private void setCountrySpinner ()
     {
         String currentExit = Prefs.getExitNodes();
@@ -403,14 +401,17 @@ public class OrbotMainActivity extends AppCompatActivity
                 spnCountries.setSelection(selIdx,true);
 
             spnCountries.setOnItemSelectedListener(new OnItemSelectedListener() {
+
+                int mOldPosition = spnCountries.getSelectedItemPosition();
+
                 @Override
                 public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
                     // your code here
 
-                    if (firstTimeCountrySelect) {
-                        firstTimeCountrySelect = false;
+                    if (mOldPosition == position)
                         return;
-                    }
+
+                    mOldPosition = position; //new position!
 
                     String country = null;
 



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