mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
TTS preview
This commit is contained in:
parent
c9cf140fe4
commit
b4fd46b50c
2 changed files with 14 additions and 1 deletions
|
@ -520,7 +520,13 @@ public class EntityRule {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean onActionTts(Context context, EntityMessage message, JSONObject jargs) {
|
||||
private boolean onActionTts(Context context, EntityMessage message, JSONObject jargs) throws IOException {
|
||||
if (!message.content) {
|
||||
EntityOperation.queue(context, message, EntityOperation.BODY);
|
||||
EntityOperation.queue(context, message, EntityOperation.RULE, this.id);
|
||||
return true;
|
||||
}
|
||||
|
||||
Locale locale = (message.language == null ? Locale.getDefault() : new Locale(message.language));
|
||||
|
||||
Configuration configuration = new Configuration(context.getResources().getConfiguration());
|
||||
|
@ -538,6 +544,12 @@ public class EntityRule {
|
|||
sb.append(res.getString(R.string.title_rule_tts_subject))
|
||||
.append(' ').append(message.subject).append(". ");
|
||||
|
||||
String body = Helper.readText(message.getFile(context));
|
||||
String preview = HtmlHelper.getPreview(body);
|
||||
if (!TextUtils.isEmpty(preview))
|
||||
sb.append(res.getString(R.string.title_rule_tts_content))
|
||||
.append(' ').append(preview);
|
||||
|
||||
TTSHelper.speak(context, "rule:" + message.id, sb.toString(), locale);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1117,6 +1117,7 @@
|
|||
<string name="title_rule_tts_prefix">New message</string>
|
||||
<string name="title_rule_tts_from">From</string>
|
||||
<string name="title_rule_tts_subject">Subject</string>
|
||||
<string name="title_rule_tts_content">Text</string>
|
||||
|
||||
<string name="title_legend_section_synchronize">Synchronize</string>
|
||||
<string name="title_legend_section_folders">Folders</string>
|
||||
|
|
Loading…
Reference in a new issue