mirror of https://github.com/M66B/FairEmail.git
Small improvements
This commit is contained in:
parent
e93b23263f
commit
f5389600a9
|
@ -48,6 +48,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHolder> {
|
||||
private Fragment parentFragment;
|
||||
|
@ -322,9 +323,9 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
|
|||
items = all;
|
||||
else {
|
||||
items = new ArrayList<>();
|
||||
String query = search.toLowerCase().trim();
|
||||
String query = search.toLowerCase(Locale.ROOT).trim();
|
||||
for (TupleContactEx contact : contacts)
|
||||
if (contact.email.toLowerCase().contains(query) ||
|
||||
if (contact.email.toLowerCase(Locale.ROOT).contains(query) ||
|
||||
(contact.name != null && contact.name.toLowerCase().contains(query)))
|
||||
items.add(contact);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -1851,7 +1852,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private void onNotifyContact(final TupleMessageEx message) {
|
||||
final NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
final InternetAddress from = (InternetAddress) message.from[0];
|
||||
final String channelId = "notification." + from.getAddress().toLowerCase();
|
||||
final String channelId = "notification." + from.getAddress().toLowerCase(Locale.ROOT);
|
||||
|
||||
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, powner, ibAddContact);
|
||||
NotificationChannel channel = nm.getNotificationChannel(channelId);
|
||||
|
@ -3666,7 +3667,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
boolean changed = false;
|
||||
builder.clearQuery();
|
||||
for (String key : uri.getQueryParameterNames())
|
||||
if (PARANOID_QUERY.contains(key.toLowerCase()))
|
||||
if (PARANOID_QUERY.contains(key.toLowerCase(Locale.ROOT)))
|
||||
changed = true;
|
||||
else if (!TextUtils.isEmpty(key))
|
||||
for (String value : uri.getQueryParameters(key)) {
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.Arrays;
|
|||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -172,7 +173,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
String find = (TextUtils.isEmpty(query) ? null : query.toLowerCase());
|
||||
String find = (TextUtils.isEmpty(query) ? null : query.toLowerCase(Locale.ROOT));
|
||||
for (int i = state.index; i < state.messages.size() && found < pageSize && !state.destroyed; i++) {
|
||||
state.index = i + 1;
|
||||
|
||||
|
@ -204,17 +205,17 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
for (Address address : addresses) {
|
||||
String email = ((InternetAddress) address).getAddress();
|
||||
String name = ((InternetAddress) address).getPersonal();
|
||||
if (email != null && email.toLowerCase().contains(find) ||
|
||||
name != null && name.toLowerCase().contains(find))
|
||||
if (email != null && email.toLowerCase(Locale.ROOT).contains(find) ||
|
||||
name != null && name.toLowerCase(Locale.ROOT).contains(find))
|
||||
match = true;
|
||||
}
|
||||
|
||||
if (!match && message.subject != null)
|
||||
match = message.subject.toLowerCase().contains(find);
|
||||
match = message.subject.toLowerCase(Locale.ROOT).contains(find);
|
||||
|
||||
if (!match && message.keywords != null && message.keywords.length > 0)
|
||||
for (String keyword : message.keywords)
|
||||
if (keyword.toLowerCase().contains(find)) {
|
||||
if (keyword.toLowerCase(Locale.ROOT).contains(find)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
if (!match && message.content) {
|
||||
try {
|
||||
String body = Helper.readText(message.getFile(context));
|
||||
match = body.toLowerCase().contains(find);
|
||||
match = body.toLowerCase(Locale.ROOT).contains(find);
|
||||
} catch (IOException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ import java.util.Comparator;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
@ -1345,7 +1346,7 @@ class Core {
|
|||
boolean sync_kept = prefs.getBoolean("sync_kept", true);
|
||||
boolean delete_unseen = prefs.getBoolean("delete_unseen", false);
|
||||
|
||||
if (account.host.toLowerCase().contains("imap.zoho")) {
|
||||
if (account.host.toLowerCase(Locale.ROOT).contains("imap.zoho")) {
|
||||
sync_unseen = false;
|
||||
sync_flagged = false;
|
||||
}
|
||||
|
@ -2266,7 +2267,8 @@ class Core {
|
|||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O &&
|
||||
message.notifying == 0 && message.from != null && message.from.length > 0) {
|
||||
InternetAddress from = (InternetAddress) message.from[0];
|
||||
NotificationChannel channel = nm.getNotificationChannel("notification." + from.getAddress().toLowerCase());
|
||||
NotificationChannel channel = nm.getNotificationChannel(
|
||||
"notification." + from.getAddress().toLowerCase(Locale.ROOT));
|
||||
if (channel != null && channel.getImportance() == NotificationManager.IMPORTANCE_NONE)
|
||||
continue;
|
||||
}
|
||||
|
@ -2481,7 +2483,8 @@ class Core {
|
|||
|
||||
if (message.from != null && message.from.length > 0) {
|
||||
InternetAddress from = (InternetAddress) message.from[0];
|
||||
channel = nm.getNotificationChannel("notification." + from.getAddress().toLowerCase());
|
||||
channel = nm.getNotificationChannel(
|
||||
"notification." + from.getAddress().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
if (channel == null)
|
||||
|
|
|
@ -160,12 +160,12 @@ public class EmailProvider {
|
|||
static EmailProvider fromDomain(Context context, String domain, Discover discover) throws IOException {
|
||||
List<EmailProvider> providers = loadProfiles(context);
|
||||
for (EmailProvider provider : providers)
|
||||
if (provider.domain != null && provider.domain.contains(domain.toLowerCase())) {
|
||||
if (provider.domain != null && provider.domain.contains(domain.toLowerCase(Locale.ROOT))) {
|
||||
Log.i("Provider from domain=" + domain);
|
||||
return provider;
|
||||
}
|
||||
|
||||
EmailProvider autoconfig = _fromDomain(context, domain.toLowerCase(), discover);
|
||||
EmailProvider autoconfig = _fromDomain(context, domain.toLowerCase(Locale.ROOT), discover);
|
||||
|
||||
// Always prefer built-in profiles
|
||||
// - ISPDB is not always correct
|
||||
|
|
|
@ -303,7 +303,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
|||
|
||||
static String guessType(String fullName) {
|
||||
for (String guess : GUESS_FOLDER_TYPE.keySet())
|
||||
if (fullName.toLowerCase().contains(guess))
|
||||
if (fullName.toLowerCase(Locale.ROOT).contains(guess))
|
||||
return GUESS_FOLDER_TYPE.get(guess);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.mail.Address;
|
||||
|
@ -250,7 +251,8 @@ public class EntityRule {
|
|||
Pattern pattern = Pattern.compile(needle, Pattern.DOTALL);
|
||||
matched = pattern.matcher(haystack).matches();
|
||||
} else
|
||||
matched = haystack.toLowerCase().contains(needle.trim().toLowerCase());
|
||||
matched = haystack.toLowerCase(Locale.ROOT)
|
||||
.contains(needle.trim().toLowerCase(Locale.ROOT));
|
||||
|
||||
Log.i("Rule=" + name + " matched=" + matched +
|
||||
" needle=" + needle + " haystack=" + haystack + " regex=" + regex);
|
||||
|
|
|
@ -1142,7 +1142,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
String[] tos = new String[ato.length];
|
||||
for (int i = 0; i < ato.length; i++)
|
||||
tos[i] = ato[i].getAddress().toLowerCase();
|
||||
tos[i] = ato[i].getAddress().toLowerCase(Locale.ROOT);
|
||||
|
||||
Intent intent = new Intent(OpenPgpApi.ACTION_GET_KEY_IDS);
|
||||
intent.putExtra(OpenPgpApi.EXTRA_USER_IDS, tos);
|
||||
|
@ -1865,7 +1865,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
String extension = Helper.getExtension(attachment.name);
|
||||
if (extension != null)
|
||||
attachment.type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
|
||||
attachment.type = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT));
|
||||
if (attachment.type == null)
|
||||
attachment.type = "application/octet-stream";
|
||||
attachment.disposition = (image ? Part.INLINE : Part.ATTACHMENT);
|
||||
|
|
|
@ -92,7 +92,6 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
@ -393,7 +392,7 @@ public class Helper {
|
|||
|
||||
static String localizeFolderType(Context context, String type) {
|
||||
int resid = context.getResources().getIdentifier(
|
||||
"title_folder_" + type.toLowerCase(),
|
||||
"title_folder_" + type.toLowerCase(Locale.ROOT),
|
||||
"string",
|
||||
context.getPackageName());
|
||||
return (resid > 0 ? context.getString(resid) : type);
|
||||
|
|
|
@ -71,6 +71,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -154,10 +155,14 @@ public class HtmlHelper {
|
|||
for (String param : params) {
|
||||
String[] kv = param.split(":");
|
||||
if (kv.length == 2)
|
||||
switch (kv[0].trim().toLowerCase()) {
|
||||
switch (kv[0].trim().toLowerCase(Locale.ROOT)) {
|
||||
case "color":
|
||||
sb.append(param).append(";");
|
||||
break;
|
||||
|
||||
case "background":
|
||||
case "background-color":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -849,8 +854,8 @@ public class HtmlHelper {
|
|||
if (params.length > 0) {
|
||||
List<String> viewport = new ArrayList<>();
|
||||
for (String param : params)
|
||||
if (!param.toLowerCase().contains("maximum-scale") &&
|
||||
!param.toLowerCase().contains("user-scalable"))
|
||||
if (!param.toLowerCase(Locale.ROOT).contains("maximum-scale") &&
|
||||
!param.toLowerCase(Locale.ROOT).contains("user-scalable"))
|
||||
viewport.add(param.trim());
|
||||
|
||||
if (viewport.size() == 0)
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
@ -65,7 +66,7 @@ public class MailService implements AutoCloseable {
|
|||
properties.put("mail.event.scope", "folder");
|
||||
properties.put("mail.event.executor", executor);
|
||||
|
||||
String checkserveridentity = Boolean.toString(!insecure).toLowerCase();
|
||||
String checkserveridentity = Boolean.toString(!insecure).toLowerCase(Locale.ROOT);
|
||||
|
||||
if ("pop3".equals(protocol) || "pop3s".equals(protocol)) {
|
||||
this.debug = true;
|
||||
|
|
|
@ -50,6 +50,7 @@ import java.util.Date;
|
|||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
@ -1136,7 +1137,7 @@ public class MessageHelper {
|
|||
|
||||
try {
|
||||
ContentType ct = new ContentType(cpart.getContentType());
|
||||
if ("application/pgp-encrypted".equals(ct.getBaseType().toLowerCase())) {
|
||||
if ("application/pgp-encrypted".equals(ct.getBaseType().toLowerCase(Locale.ROOT))) {
|
||||
pgp = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -1157,7 +1158,7 @@ public class MessageHelper {
|
|||
try {
|
||||
disposition = part.getDisposition();
|
||||
if (disposition != null)
|
||||
disposition = disposition.toLowerCase();
|
||||
disposition = disposition.toLowerCase(Locale.ROOT);
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(ex);
|
||||
parts.warnings.add(Helper.formatThrowable(ex, false));
|
||||
|
@ -1213,7 +1214,7 @@ public class MessageHelper {
|
|||
|
||||
apart.attachment = new EntityAttachment();
|
||||
apart.attachment.name = apart.filename;
|
||||
apart.attachment.type = ct.getBaseType().toLowerCase();
|
||||
apart.attachment.type = ct.getBaseType().toLowerCase(Locale.ROOT);
|
||||
apart.attachment.disposition = apart.disposition;
|
||||
apart.attachment.size = (long) apart.part.getSize();
|
||||
apart.attachment.cid = (cid == null || cid.length == 0 ? null : MimeUtility.unfold(cid[0]));
|
||||
|
@ -1227,9 +1228,10 @@ public class MessageHelper {
|
|||
if (!apart.pgp) {
|
||||
String extension = Helper.getExtension(apart.attachment.name);
|
||||
if (extension != null &&
|
||||
("pdf".equals(extension.toLowerCase()) ||
|
||||
("pdf".equals(extension.toLowerCase(Locale.ROOT)) ||
|
||||
"application/octet-stream".equals(apart.attachment.type))) {
|
||||
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
|
||||
String type = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(extension.toLowerCase(Locale.ROOT));
|
||||
if (type != null) {
|
||||
if (!type.equals(apart.attachment.type))
|
||||
Log.w("Guessing file=" + apart.attachment.name + " type=" + type);
|
||||
|
|
Loading…
Reference in New Issue