diff --git a/Hyperrail/build.gradle b/Hyperrail/build.gradle index 8fcdc49..1e310a8 100644 --- a/Hyperrail/build.gradle +++ b/Hyperrail/build.gradle @@ -8,8 +8,8 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' -def VERSION_CODE = 58 -def VERSION_NAME = '1.3.4' +def VERSION_CODE = 60 +def VERSION_NAME = '1.4.1' android { compileSdk 34 diff --git a/Hyperrail/src/main/java/be/hyperrail/android/adapter/MultilangAutocompleteAdapter.java b/Hyperrail/src/main/java/be/hyperrail/android/adapter/MultilangAutocompleteAdapter.java index a1ae300..b1eee41 100644 --- a/Hyperrail/src/main/java/be/hyperrail/android/adapter/MultilangAutocompleteAdapter.java +++ b/Hyperrail/src/main/java/be/hyperrail/android/adapter/MultilangAutocompleteAdapter.java @@ -12,7 +12,10 @@ import androidx.collection.ArraySet; import androidx.fragment.app.FragmentActivity; +import com.google.firebase.crashlytics.FirebaseCrashlytics; + import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -48,11 +51,16 @@ public MultilangFilterResults(List results) { @Override protected FilterResults performFiltering(CharSequence constraint) { - constraint = constraint.toString().toLowerCase(); List list = new ArrayList<>(); - for (StopLocation s : stations) { - if (stationNameContains(constraint, s)) { - list.add(s); + if (constraint == null){ // no filtering + constraint = ""; // allows using the same sorter a little later + list.addAll(Arrays.asList(stations)); + } else { + constraint = constraint.toString().toLowerCase(); + for (StopLocation s : stations) { + if (stationNameContains(constraint, s)) { + list.add(s); + } } } Collections.sort(list, new AutocompleteSortComparator(constraint)); @@ -80,6 +88,10 @@ protected void publishResults(CharSequence constraint, FilterResults results) { } private void updateVisibleStops(List stops) { + if (stops == null){ + FirebaseCrashlytics.getInstance().recordException(new IllegalArgumentException("Tried to set null in MultilangAutocompleteAdapter!")); + stops = new ArrayList<>(); // Never allow setting null, even when there are issues with the autocomplete + } this.visibleStops = stops; for (DataSetObserver observer : observers) { observer.onChanged();