1package android.support.v4.speech.tts;
2
3import android.content.Context;
4import android.os.Build;
5import android.speech.tts.TextToSpeech;
6import android.speech.tts.TextToSpeech.OnInitListener;
7import android.util.Log;
8
9/** Helper class for TTS functionality introduced in ICS */
10class TextToSpeechICS {
11    private static final String TAG = "android.support.v4.speech.tts";
12
13    static TextToSpeech construct(Context context, OnInitListener onInitListener,
14            String engineName) {
15        if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
16            if (engineName == null) {
17                return new TextToSpeech(context, onInitListener);
18            } else {
19                Log.w(TAG, "Can't specify tts engine on this device");
20                return new TextToSpeech(context, onInitListener);
21            }
22        } else {
23            return new TextToSpeech(context, onInitListener, engineName);
24        }
25    }
26
27}
28