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)) sb.append(context.getString(R.string.title_rule_tts_content))
.append(' ').append(preview); .append(' ').append(preview);
Intent intent = new Intent(context, ServiceTTS.class); Intent intent = new Intent(context, ServiceTTS.class)
intent.setAction("tts:" + message.id); .setAction("tts:" + message.id)
intent.putExtra(ServiceTTS.EXTRA_FLUSH, false); .putExtra(ServiceTTS.EXTRA_FLUSH, false)
intent.putExtra(ServiceTTS.EXTRA_TEXT, sb.toString()); .putExtra(ServiceTTS.EXTRA_TEXT, sb.toString())
intent.putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language); .putExtra(ServiceTTS.EXTRA_LANGUAGE, message.language)
intent.putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "rule:" + message.id); .putExtra(ServiceTTS.EXTRA_UTTERANCE_ID, "rule:" + message.id);
context.startService(intent); context.startService(intent);
} }

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

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

Loading…
Cancel
Save