Browse Source

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

master
Reece H. Dunn 12 years ago
parent
commit
beb82cb6fd
1 changed files with 21 additions and 3 deletions
  1. 21
    3
      android/src/com/reecedunn/espeak/eSpeakActivity.java

+ 21
- 3
android/src/com/reecedunn/espeak/eSpeakActivity.java View File

import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.preference.PreferenceActivity;
import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
startActivityForResult(
new Intent(ACTION_TTS_SETTINGS), REQUEST_DEFAULT);
launchGeneralTtsSettings();
break; break;
} }
} }
REQUEST_DEFAULT); REQUEST_DEFAULT);
break; break;
case R.id.ttsSettings: case R.id.ttsSettings:
startActivityForResult(new Intent(ACTION_TTS_SETTINGS), REQUEST_DEFAULT);
launchGeneralTtsSettings();
break; 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);
}
} }

Loading…
Cancel
Save