mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 14:46:31 +02:00
TTS preview
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user