mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-12 12:03:17 +02:00
Small improvements
This commit is contained in:
@@ -54,7 +54,6 @@ 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;
|
||||
@@ -357,9 +356,9 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
|
||||
items = all;
|
||||
else {
|
||||
items = new ArrayList<>();
|
||||
String query = search.toLowerCase(Locale.ROOT).trim();
|
||||
String query = search.toLowerCase().trim();
|
||||
for (TupleContactEx contact : contacts)
|
||||
if (contact.email.toLowerCase(Locale.ROOT).contains(query) ||
|
||||
if (contact.email.toLowerCase().contains(query) ||
|
||||
(contact.name != null && contact.name.toLowerCase().contains(query)))
|
||||
items.add(contact);
|
||||
}
|
||||
|
||||
@@ -272,17 +272,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
// https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
|
||||
private static final List<String> IMAP_KEYWORDS_BLACKLIST = Collections.unmodifiableList(Arrays.asList(
|
||||
"$MDNSent".toLowerCase(),
|
||||
"$Forwarded".toLowerCase(),
|
||||
"$SubmitPending".toLowerCase(),
|
||||
"$Submitted".toLowerCase(),
|
||||
"$Junk".toLowerCase(),
|
||||
"$NotJunk".toLowerCase(),
|
||||
"$recent".toLowerCase(),
|
||||
"DTAG_document".toLowerCase(),
|
||||
"DTAG_image".toLowerCase(),
|
||||
"$X-Me-Annot-1".toLowerCase(),
|
||||
"$X-Me-Annot-2".toLowerCase()
|
||||
"$MDNSent".toLowerCase(Locale.ROOT),
|
||||
"$Forwarded".toLowerCase(Locale.ROOT),
|
||||
"$SubmitPending".toLowerCase(Locale.ROOT),
|
||||
"$Submitted".toLowerCase(Locale.ROOT),
|
||||
"$Junk".toLowerCase(Locale.ROOT),
|
||||
"$NotJunk".toLowerCase(Locale.ROOT),
|
||||
"$recent".toLowerCase(Locale.ROOT),
|
||||
"DTAG_document".toLowerCase(Locale.ROOT),
|
||||
"DTAG_image".toLowerCase(Locale.ROOT),
|
||||
"$X-Me-Annot-1".toLowerCase(Locale.ROOT),
|
||||
"$X-Me-Annot-2".toLowerCase(Locale.ROOT)
|
||||
));
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements
|
||||
@@ -918,7 +918,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (keywords_header) {
|
||||
SpannableStringBuilder keywords = new SpannableStringBuilder();
|
||||
for (int i = 0; i < message.keywords.length; i++) {
|
||||
String k = message.keywords[i].toLowerCase();
|
||||
String k = message.keywords[i].toLowerCase(Locale.ROOT);
|
||||
if (!IMAP_KEYWORDS_BLACKLIST.contains(k)) {
|
||||
if (keywords.length() > 0)
|
||||
keywords.append(" ");
|
||||
|
||||
@@ -43,7 +43,6 @@ import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.mail.FetchProfile;
|
||||
@@ -172,7 +171,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
Boolean flagged = null;
|
||||
Boolean snoozed = null;
|
||||
Boolean encrypted = null;
|
||||
String find = (TextUtils.isEmpty(query) ? null : query.toLowerCase(Locale.ROOT));
|
||||
String find = (TextUtils.isEmpty(query) ? null : query.toLowerCase());
|
||||
if (find != null && find.startsWith(context.getString(R.string.title_search_special_prefix) + ":")) {
|
||||
String special = find.split(":")[1];
|
||||
if (context.getString(R.string.title_search_special_unseen).equals(special))
|
||||
@@ -251,9 +250,9 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||
File file = EntityMessage.getFile(context, match.id);
|
||||
if (file.exists()) {
|
||||
String html = Helper.readText(file);
|
||||
if (html.toLowerCase(Locale.ROOT).contains(find)) {
|
||||
if (html.toLowerCase().contains(find)) {
|
||||
String text = HtmlHelper.getFullText(html);
|
||||
if (text.toLowerCase(Locale.ROOT).contains(find))
|
||||
if (text.toLowerCase().contains(find))
|
||||
match.matched = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -200,7 +201,7 @@ public class ContactInfo {
|
||||
if (lookup) {
|
||||
HttpURLConnection urlConnection = null;
|
||||
try {
|
||||
String hash = Helper.md5(address.getAddress().toLowerCase().getBytes());
|
||||
String hash = Helper.md5(address.getAddress().toLowerCase(Locale.ROOT).getBytes());
|
||||
URL url = new URL("https://www.gravatar.com/avatar/" + hash + "?d=404");
|
||||
Log.i("Gravatar url=" + url);
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
||||
|
||||
static String getType(String[] attrs, String fullName, boolean selectable) {
|
||||
// https://tools.ietf.org/html/rfc3501#section-5.1
|
||||
if ("INBOX".equals(fullName.toUpperCase()))
|
||||
if ("INBOX".equals(fullName.toUpperCase(Locale.ROOT)))
|
||||
return INBOX;
|
||||
|
||||
// https://www.iana.org/assignments/imap-mailbox-name-attributes/imap-mailbox-name-attributes.xhtml
|
||||
|
||||
@@ -42,7 +42,6 @@ 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;
|
||||
@@ -256,8 +255,7 @@ public class EntityRule {
|
||||
Pattern pattern = Pattern.compile(needle, Pattern.DOTALL);
|
||||
matched = pattern.matcher(haystack).matches();
|
||||
} else
|
||||
matched = haystack.toLowerCase(Locale.ROOT)
|
||||
.contains(needle.trim().toLowerCase(Locale.ROOT));
|
||||
matched = haystack.toLowerCase().contains(needle.trim().toLowerCase());
|
||||
|
||||
Log.i("Rule=" + name + " matched=" + matched +
|
||||
" needle=" + needle + " haystack=" + haystack + " regex=" + regex);
|
||||
|
||||
@@ -153,7 +153,6 @@ import java.util.Arrays;
|
||||
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;
|
||||
@@ -1464,7 +1463,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
pgpUserIds = new String[recipients.size()];
|
||||
for (int i = 0; i < recipients.size(); i++) {
|
||||
InternetAddress recipient = (InternetAddress) recipients.get(i);
|
||||
pgpUserIds[i] = recipient.getAddress().toLowerCase(Locale.ROOT);
|
||||
pgpUserIds[i] = recipient.getAddress().toLowerCase();
|
||||
}
|
||||
|
||||
Intent intent;
|
||||
@@ -3994,8 +3993,8 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
private static String unprefix(String subject, String prefix) {
|
||||
subject = subject.trim();
|
||||
prefix = prefix.trim().toLowerCase(Locale.ROOT);
|
||||
while (subject.toLowerCase(Locale.ROOT).startsWith(prefix))
|
||||
prefix = prefix.trim().toLowerCase();
|
||||
while (subject.toLowerCase().startsWith(prefix))
|
||||
subject = subject.substring(prefix.length()).trim();
|
||||
return subject;
|
||||
}
|
||||
|
||||
@@ -4695,7 +4695,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
for (int i = 0; i < param.length; i++) {
|
||||
int e = param[i].indexOf("=");
|
||||
if (e > 0) {
|
||||
String key = param[i].substring(0, e).trim().toLowerCase();
|
||||
String key = param[i].substring(0, e).trim().toLowerCase(Locale.ROOT);
|
||||
String value = param[i].substring(e + 1);
|
||||
Log.i("Autocrypt " + key + "=" + value);
|
||||
switch (key) {
|
||||
@@ -4703,7 +4703,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||
addr = value;
|
||||
break;
|
||||
case "prefer-encrypt":
|
||||
mutual = value.trim().toLowerCase().equals("mutual");
|
||||
mutual = value.trim().toLowerCase(Locale.ROOT).equals("mutual");
|
||||
break;
|
||||
case "keydata":
|
||||
keydata = Base64.decode(value, Base64.DEFAULT);
|
||||
|
||||
@@ -669,7 +669,7 @@ public class Helper {
|
||||
}
|
||||
|
||||
static String localizeFolderName(Context context, String name) {
|
||||
if (name != null && "INBOX".equals(name.toUpperCase()))
|
||||
if (name != null && "INBOX".equals(name.toUpperCase(Locale.ROOT)))
|
||||
return context.getString(R.string.title_folder_inbox);
|
||||
else if ("OUTBOX".equals(name))
|
||||
return context.getString(R.string.title_folder_outbox);
|
||||
@@ -892,7 +892,7 @@ public class Helper {
|
||||
byte[] bytes = digest.digest(cert);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : bytes)
|
||||
sb.append(Integer.toString(b & 0xff, 16).toUpperCase());
|
||||
sb.append(Integer.toString(b & 0xff, 16).toUpperCase(Locale.ROOT));
|
||||
return sb.toString();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
|
||||
Reference in New Issue
Block a user