Merge pull request #2444 from ndew623/Hide-Timezone-in-Reply-Quote

Use UTC time in quote header

Fixes #2403
This commit is contained in:
cketti 2017-03-26 22:33:13 +02:00 committed by GitHub
commit e601cb2fa2
2 changed files with 13 additions and 4 deletions

View file

@ -4,9 +4,11 @@ package com.fsck.k9.message.quote;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone;
import android.content.res.Resources; import android.content.res.Resources;
import com.fsck.k9.K9;
import com.fsck.k9.mail.Message; import com.fsck.k9.mail.Message;
@ -26,9 +28,16 @@ class QuoteHelper {
final int dateStyle = DateFormat.LONG; final int dateStyle = DateFormat.LONG;
final int timeStyle = DateFormat.LONG; final int timeStyle = DateFormat.LONG;
Date date = message.getSentDate(); Date date = message.getSentDate();
DateFormat dateFormat;
if (K9.hideTimeZone()) {
dateFormat = DateFormat.getDateTimeInstance(dateStyle, timeStyle, Locale.ROOT);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
} else {
Locale locale = resources.getConfiguration().locale; Locale locale = resources.getConfiguration().locale;
return DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale) dateFormat = DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale);
.format(date); }
return dateFormat.format(date);
} catch (Exception e) { } catch (Exception e) {
return ""; return "";
} }

View file

@ -342,7 +342,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="global_settings_privacy_hide_useragent">Hide mail client</string> <string name="global_settings_privacy_hide_useragent">Hide mail client</string>
<string name="global_settings_privacy_hide_useragent_detail">Remove K-9 User-Agent from mail headers</string> <string name="global_settings_privacy_hide_useragent_detail">Remove K-9 User-Agent from mail headers</string>
<string name="global_settings_privacy_hide_timezone">Hide timezone</string> <string name="global_settings_privacy_hide_timezone">Hide timezone</string>
<string name="global_settings_privacy_hide_timezone_detail">Use UTC instead of local timezone in mail headers</string> <string name="global_settings_privacy_hide_timezone_detail">Use UTC instead of local timezone in mail headers and reply header</string>
<string name="global_settings_notification_hide_subject_title">Hide subject in notifications</string> <string name="global_settings_notification_hide_subject_title">Hide subject in notifications</string>
<string name="global_settings_notification_hide_subject_never">Never</string> <string name="global_settings_notification_hide_subject_never">Never</string>
<string name="global_settings_notification_hide_subject_when_locked">When device is locked</string> <string name="global_settings_notification_hide_subject_when_locked">When device is locked</string>