1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Explicitly use the default locale

This commit is contained in:
cketti 2014-04-07 20:35:16 +02:00
parent efc5565b91
commit 510195bce7
2 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -1161,12 +1162,13 @@ public class FolderList extends K9ListActivity {
mSearchTerm = searchTerm; mSearchTerm = searchTerm;
FilterResults results = new FilterResults(); FilterResults results = new FilterResults();
Locale locale = Locale.getDefault();
if ((searchTerm == null) || (searchTerm.length() == 0)) { if ((searchTerm == null) || (searchTerm.length() == 0)) {
ArrayList<FolderInfoHolder> list = new ArrayList<FolderInfoHolder>(mFolders); ArrayList<FolderInfoHolder> list = new ArrayList<FolderInfoHolder>(mFolders);
results.values = list; results.values = list;
results.count = list.size(); results.count = list.size();
} else { } else {
final String searchTermString = searchTerm.toString().toLowerCase(); final String searchTermString = searchTerm.toString().toLowerCase(locale);
final String[] words = searchTermString.split(" "); final String[] words = searchTermString.split(" ");
final int wordCount = words.length; final int wordCount = words.length;
@ -1176,7 +1178,7 @@ public class FolderList extends K9ListActivity {
if (value.displayName == null) { if (value.displayName == null) {
continue; continue;
} }
final String valueText = value.displayName.toLowerCase(); final String valueText = value.displayName.toLowerCase(locale);
for (int k = 0; k < wordCount; k++) { for (int k = 0; k < wordCount; k++) {
if (valueText.contains(words[k])) { if (valueText.contains(words[k])) {

View File

@ -2,6 +2,7 @@ package com.fsck.k9.activity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import android.util.Log; import android.util.Log;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -59,12 +60,13 @@ public class FolderListFilter<T> extends Filter {
} }
} }
Locale locale = Locale.getDefault();
if ((searchTerm == null) || (searchTerm.length() == 0)) { if ((searchTerm == null) || (searchTerm.length() == 0)) {
ArrayList<T> list = new ArrayList<T>(mOriginalValues); ArrayList<T> list = new ArrayList<T>(mOriginalValues);
results.values = list; results.values = list;
results.count = list.size(); results.count = list.size();
} else { } else {
final String searchTermString = searchTerm.toString().toLowerCase(); final String searchTermString = searchTerm.toString().toLowerCase(locale);
final String[] words = searchTermString.split(" "); final String[] words = searchTermString.split(" ");
final int wordCount = words.length; final int wordCount = words.length;
@ -73,7 +75,7 @@ public class FolderListFilter<T> extends Filter {
final ArrayList<T> newValues = new ArrayList<T>(); final ArrayList<T> newValues = new ArrayList<T>();
for (final T value : values) { for (final T value : values) {
final String valueText = value.toString().toLowerCase(); final String valueText = value.toString().toLowerCase(locale);
for (int k = 0; k < wordCount; k++) { for (int k = 0; k < wordCount; k++) {
if (valueText.contains(words[k])) { if (valueText.contains(words[k])) {