PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/documentation/TextToSpeech_Plugin_Engine_Examples/PicoUnbundled/src/com/svox/pico/unbundled/GetSampleText.java

http://eyes-free.googlecode.com/
Java | 62 lines | 37 code | 7 blank | 18 comment | 12 complexity | f1f4f711a16e24bfff696a4bd48bd73e MD5 | raw file
 1/*
 2 * Copyright (C) 2009 The Android Open Source Project
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 *      http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.svox.pico.unbundled;
18
19import android.app.Activity;
20import android.content.Intent;
21import android.os.Bundle;
22import android.speech.tts.TextToSpeech;
23
24/*
25 * Returns the sample text string for the language requested
26 */
27public class GetSampleText extends Activity {
28    @Override
29    protected void onCreate(Bundle savedInstanceState) {
30        super.onCreate(savedInstanceState);
31
32        int result = TextToSpeech.LANG_AVAILABLE;
33        Intent returnData = new Intent();
34
35        Intent i = getIntent();
36        String language = i.getExtras().getString("language");
37        String country = i.getExtras().getString("country");
38        String variant = i.getExtras().getString("variant");
39
40        if (language.equals("eng")) {
41          if (country.equals("GBR")){
42            returnData.putExtra("sampleText", getString(R.string.eng_gbr_sample));
43          } else {
44            returnData.putExtra("sampleText", getString(R.string.eng_usa_sample));
45          }
46        } else if (language.equals("fra")) {
47          returnData.putExtra("sampleText", getString(R.string.fra_fra_sample));
48        } else if (language.equals("ita")) {
49          returnData.putExtra("sampleText", getString(R.string.ita_ita_sample));
50        } else if (language.equals("deu")) {
51          returnData.putExtra("sampleText", getString(R.string.deu_deu_sample));
52        } else if (language.equals("spa")) {
53          returnData.putExtra("sampleText", getString(R.string.spa_esp_sample));
54        } else {
55          result = TextToSpeech.LANG_NOT_SUPPORTED;
56          returnData.putExtra("sampleText", "");
57        }
58
59        setResult(result, null); //returnData);
60        finish();
61    }
62}