Allow full list loading in selection activity

This commit is contained in:
Tanguy Herbron 2018-05-27 00:29:28 +02:00
parent c09fa8ca6f
commit fcb288e0ed
2 changed files with 2 additions and 4 deletions

View File

@ -72,7 +72,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
ArrayList<Currency> currencyArrayList = new ArrayList<>(); ArrayList<Currency> currencyArrayList = new ArrayList<>();
for(int i = 0; i < currencyNames.size(); i++) for(int i = currencyNames.size() - 1; i > 0; i--)
{ {
currencyArrayList.add(new Currency(currencyNames.get(i), currencySymbols.get(i))); currencyArrayList.add(new Currency(currencyNames.get(i), currencySymbols.get(i)));
} }

View File

@ -79,16 +79,14 @@ public class CurrencyListAdapter extends ArrayAdapter<Currency> {
suggestions.clear(); suggestions.clear();
int i = 0; int i = 0;
int found = 0;
String temp = constraint.toString().toLowerCase(); String temp = constraint.toString().toLowerCase();
while(i < tempCurrency.size() && found < 50) while(i < tempCurrency.size())
{ {
Currency currency = tempCurrency.get(i); Currency currency = tempCurrency.get(i);
if (currency.getName().toLowerCase().startsWith(temp) if (currency.getName().toLowerCase().startsWith(temp)
|| currency.getSymbol().toLowerCase().startsWith(temp)) { || currency.getSymbol().toLowerCase().startsWith(temp)) {
suggestions.add(currency); suggestions.add(currency);
found++;
} }
i++; i++;
} }