eSpeakActivity: use the correct intent for launching the TTS settings on Android 3.x.

This commit is contained in:
Reece H. Dunn
2012-12-18 21:09:09 +00:00
parent 7dd1d66e4a
commit beb82cb6fd
@@ -26,6 +26,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceActivity;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
@@ -254,8 +255,7 @@ public class eSpeakActivity extends Activity {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
startActivityForResult(
new Intent(ACTION_TTS_SETTINGS), REQUEST_DEFAULT);
launchGeneralTtsSettings();
break;
}
}
@@ -322,9 +322,27 @@ public class eSpeakActivity extends Activity {
REQUEST_DEFAULT);
break;
case R.id.ttsSettings:
startActivityForResult(new Intent(ACTION_TTS_SETTINGS), REQUEST_DEFAULT);
launchGeneralTtsSettings();
break;
}
}
};
private void launchGeneralTtsSettings()
{
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
{
// The Text-to-Speech settings is a Fragment on 3.x:
intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, "com.android.settings.TextToSpeechSettings");
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, intent.getExtras());
}
else
{
// The Text-to-Speech settings is an Activity on 2.x and 4.x:
intent = new Intent(ACTION_TTS_SETTINGS);
}
startActivityForResult(intent, REQUEST_DEFAULT);
}
}