Hide time zone in reply header

This commit is contained in:
M66B 2022-09-14 08:24:46 +02:00
parent ed781f0206
commit d59383be0e
4 changed files with 10 additions and 5 deletions

View File

@ -657,7 +657,8 @@ public class ApplicationEx extends Application
else if (version < 1961) {
if (!prefs.contains("photo_picker"))
editor.putBoolean("photo_picker", true);
}
} else if (version < 1966)
editor.remove("hide_timezone");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
editor.remove("background_service");

View File

@ -50,6 +50,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.TimeZone;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -467,10 +468,13 @@ public class EntityMessage implements Serializable {
Element getReplyHeader(Context context, Document document, boolean separate, boolean extended) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean hide_timezone = prefs.getBoolean("hide_timezone", false);
boolean language_detection = prefs.getBoolean("language_detection", false);
String l = (language_detection ? language : null);
DateFormat DTF = Helper.getDateTimeInstance(context);
DTF.setTimeZone(hide_timezone ? TimeZone.getTimeZone("UTC") : TimeZone.getDefault());
String date = DTF.format(received);
Element p = document.createElement("p");
if (extended) {
@ -499,7 +503,7 @@ public class EntityMessage implements Serializable {
Element strong = document.createElement("strong");
strong.text(Helper.getString(context, l, R.string.title_date) + " ");
p.appendChild(strong);
p.appendText(DTF.format(received));
p.appendText(date);
p.appendElement("br");
}
if (!TextUtils.isEmpty(subject)) {
@ -510,7 +514,7 @@ public class EntityMessage implements Serializable {
p.appendElement("br");
}
} else
p.text(DTF.format(new Date(received)) + " " + MessageHelper.formatAddresses(from) + ":");
p.text(date + " " + MessageHelper.formatAddresses(from) + ":");
Element div = document.createElement("div")
.attr("fairemail", "reply");

View File

@ -587,7 +587,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
swAutoLockNav.setChecked(prefs.getBoolean("autolock_nav", false));
swClientId.setChecked(prefs.getBoolean("client_id", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", true));
swHideTimeZone.setChecked(prefs.getBoolean("hide_timezone", false));
swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false));
swIncognitoKeyboard.setChecked(prefs.getBoolean("incognito_keyboard", false));
swSecure.setChecked(prefs.getBoolean("secure", false));

View File

@ -285,7 +285,7 @@ public class MessageHelper {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int receipt_type = prefs.getInt("receipt_type", 2);
boolean receipt_legacy = prefs.getBoolean("receipt_legacy", false);
boolean hide_timezone = prefs.getBoolean("hide_timezone", true);
boolean hide_timezone = prefs.getBoolean("hide_timezone", false);
boolean autocrypt = prefs.getBoolean("autocrypt", true);
boolean mutual = prefs.getBoolean("autocrypt_mutual", true);
boolean encrypt_subject = prefs.getBoolean("encrypt_subject", false);