commit f702a0e462a79774405ac8bee55cdcf82d32772d Author: n8fr8 nathan@freitas.net 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@lists.torproject.org