mirror of https://github.com/M66B/FairEmail.git
TTS install voices
This commit is contained in:
parent
cd4b187bd8
commit
a2108c8dd8
|
@ -134,7 +134,8 @@ public class FragmentRule extends FragmentBase {
|
|||
private Spinner spAnswer;
|
||||
private CheckBox cbCc;
|
||||
|
||||
private Button btnTts;
|
||||
private Button btnTtsSetup;
|
||||
private Button btnTtsData;
|
||||
|
||||
private TextView tvAutomation;
|
||||
|
||||
|
@ -172,7 +173,8 @@ public class FragmentRule extends FragmentBase {
|
|||
private final static int REQUEST_DELETE = 4;
|
||||
private final static int REQUEST_SCHEDULE_START = 5;
|
||||
private final static int REQUEST_SCHEDULE_END = 6;
|
||||
private final static int REQUEST_TTS = 7;
|
||||
private final static int REQUEST_TTS_CHECK = 7;
|
||||
private final static int REQUEST_TTS_DATA = 8;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -252,7 +254,8 @@ public class FragmentRule extends FragmentBase {
|
|||
spAnswer = view.findViewById(R.id.spAnswer);
|
||||
cbCc = view.findViewById(R.id.cbCc);
|
||||
|
||||
btnTts = view.findViewById(R.id.btnTts);
|
||||
btnTtsSetup = view.findViewById(R.id.btnTtsSetup);
|
||||
btnTtsData = view.findViewById(R.id.btnTtsData);
|
||||
tvAutomation = view.findViewById(R.id.tvAutomation);
|
||||
|
||||
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
||||
|
@ -462,12 +465,21 @@ public class FragmentRule extends FragmentBase {
|
|||
spIdent.setOnItemSelectedListener(onItemSelectedListener);
|
||||
spAnswer.setOnItemSelectedListener(onItemSelectedListener);
|
||||
|
||||
btnTts.setOnClickListener(new View.OnClickListener() {
|
||||
btnTtsSetup.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent tts = new Intent();
|
||||
tts.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
||||
startActivityForResult(tts, REQUEST_TTS);
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
||||
startActivityForResult(intent, REQUEST_TTS_CHECK);
|
||||
}
|
||||
});
|
||||
|
||||
btnTtsData.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
|
||||
startActivityForResult(intent, REQUEST_TTS_DATA);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -652,15 +664,17 @@ public class FragmentRule extends FragmentBase {
|
|||
if (resultCode == RESULT_OK)
|
||||
onScheduleEnd(data.getBundleExtra("args"));
|
||||
break;
|
||||
case REQUEST_TTS:
|
||||
case REQUEST_TTS_CHECK:
|
||||
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
|
||||
ToastEx.makeText(getContext(), android.R.string.ok, Toast.LENGTH_LONG).show();
|
||||
ToastEx.makeText(getContext(), R.string.title_rule_tts_ok, Toast.LENGTH_LONG).show();
|
||||
else {
|
||||
Intent tts = new Intent();
|
||||
tts.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
|
||||
startActivity(tts);
|
||||
}
|
||||
break;
|
||||
case REQUEST_TTS_DATA:
|
||||
break;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
|
|
|
@ -690,7 +690,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/cbCc" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTts"
|
||||
android:id="@+id/btnTtsSetup"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -699,6 +699,16 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAnswerRemark" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTtsData"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_rule_tts_data"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnTtsSetup" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvAutomation"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -707,7 +717,7 @@
|
|||
android:text="@string/title_rule_automation_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnTts" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnTtsData" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpReady"
|
||||
|
@ -769,7 +779,7 @@
|
|||
android:id="@+id/grpTts"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="btnTts" />
|
||||
app:constraint_referenced_ids="btnTtsSetup,btnTtsData" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpAutomation"
|
||||
|
|
|
@ -1096,7 +1096,9 @@
|
|||
<string name="title_rule_matched">Matching messages</string>
|
||||
<string name="title_rule_no_matches">No matching messages</string>
|
||||
|
||||
<string name="title_rule_tts_ok">Setup okay</string>
|
||||
<string name="title_rule_tts_setup">Check setup</string>
|
||||
<string name="title_rule_tts_data">Install voice data</string>
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue