Add an 'Update voices' button to manually trigger an update.

This commit is contained in:
Reece H. Dunn
2012-12-13 11:56:29 +00:00
parent 99e63c4b2e
commit 9f2137a8ff
3 changed files with 27 additions and 2 deletions
+22 -2
View File
@@ -88,8 +88,30 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="-4dp"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/updateVoicesLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/updateVoices"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/update_voices" />
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:id="@+id/engineSettingsLayout"
android:layout_width="match_parent"
@@ -99,7 +121,6 @@
android:id="@+id/engineSettings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="-4dp"
android:layout_weight="0.5"
android:text="@string/engine_settings" />
@@ -120,7 +141,6 @@
android:id="@+id/ttsSettings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="-4dp"
android:layout_weight="0.5"
android:text="@string/tts_settings" />
+1
View File
@@ -127,5 +127,6 @@
<item>4x</item>
<item>5x</item>
</string-array>
<string name="update_voices">Update voices</string>
</resources>
@@ -192,6 +192,7 @@ public class eSpeakActivity extends Activity {
final TextView availableVoices = (TextView) findViewById(R.id.availableVoices);
availableVoices.setText(Integer.toString(mVoices.size()));
findViewById(R.id.updateVoices).setOnClickListener(mOnClickListener);
findViewById(R.id.ttsSettings).setOnClickListener(mOnClickListener);
findViewById(R.id.engineSettings).setOnClickListener(mOnClickListener);
@@ -301,6 +302,9 @@ public class eSpeakActivity extends Activity {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.updateVoices:
downloadVoiceData();
break;
case R.id.engineSettings:
startActivityForResult(
new Intent(eSpeakActivity.this, TtsSettingsActivity.class),