Refactoring

pull/217/head
M66B 6 months ago
parent afe737a4f0
commit eb30b61259

@ -1340,12 +1340,12 @@ public class EntityRule {
sb.append(context.getString(R.string.title_rule_tts_content))
.append(' ').append(preview);
Intent intent = new Intent(context, ServiceTTS.class);
intent.setAction("tts:" + message.id);
intent.putExtra(ServiceTTS.EXTRA_FLUSH, false);
intent.putExtra(ServiceTTS.EXTRA_TEXT, sb.toString());
intent.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language);
intent.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "rule:" + message.id);
Intent intent = new Intent(context, ServiceTTS.class)
.setAction("tts:" + message.id)
.putExtra(ServiceTTS.EXTRA_FLUSH, false)
.putExtra(ServiceTTS.EXTRA_TEXT, sb.toString())
.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language)
.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "rule:" + message.id);
context.startService(intent);
}

@ -3734,12 +3734,12 @@ public class FragmentMessages extends FragmentBase
iProperties.setValue("tts", message.id, !tts);
if (tts) {
Intent intent = new Intent(getContext(), ServiceTTS.class);
intent.setAction("tts:" + message.id);
intent.putExtra(ServiceTTS.EXTRA_FLUSH, true);
intent.putExtra(ServiceTTS.EXTRA_TEXT, "");
intent.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language);
intent.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id);
Intent intent = new Intent(getContext(), ServiceTTS.class)
.setAction("tts:" + message.id)
.putExtra(ServiceTTS.EXTRA_FLUSH, true)
.putExtra(ServiceTTS.EXTRA_TEXT, "")
.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language)
.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id);
getContext().startService(intent);
return;
}
@ -3790,12 +3790,12 @@ public class FragmentMessages extends FragmentBase
if (text == null)
return;
Intent intent = new Intent(getContext(), ServiceTTS.class);
intent.setAction("tts:" + message.id);
intent.putExtra(ServiceTTS.EXTRA_FLUSH, true);
intent.putExtra(ServiceTTS.EXTRA_TEXT, text);
intent.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language);
intent.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id);
Intent intent = new Intent(getContext(), ServiceTTS.class)
.setAction("tts:" + message.id)
.putExtra(ServiceTTS.EXTRA_FLUSH, true)
.putExtra(ServiceTTS.EXTRA_TEXT, text)
.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language)
.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id);
getContext().startService(intent);
}

@ -1336,14 +1336,14 @@ class NotificationHelper {
}
if (message.content && notify_tts) {
Intent tts = new Intent(context, ServiceTTS.class);
tts.setAction("tts:" + message.id);
tts.putExtra(ServiceTTS.EXTRA_FLUSH, true);
tts.putExtra(ServiceTTS.EXTRA_TEXT, "");
tts.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language);
tts.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id);
tts.putExtra(ServiceTTS.EXTRA_GROUP, group);
tts.putExtra(ServiceTTS.EXTRA_MESSAGE, message.id);
Intent tts = new Intent(context, ServiceTTS.class)
.setAction("tts:" + message.id)
.putExtra(ServiceTTS.EXTRA_FLUSH, true)
.putExtra(ServiceTTS.EXTRA_TEXT, "")
.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language)
.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "tts:" + message.id)
.putExtra(ServiceTTS.EXTRA_GROUP, group)
.putExtra(ServiceTTS.EXTRA_MESSAGE, message.id);
PendingIntent piTts = PendingIntentCompat.getService(
context, ServiceTTS.PI_TTS, tts, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Action.Builder actionTts = new NotificationCompat.Action.Builder(

Loading…
Cancel
Save