PageRenderTime 27ms CodeModel.GetById 9ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/documentation/TextToSpeech_Plugin_Engine_Examples/eSpeakEngine/src/com/google/marvin/espeak/GetSampleText.java

http://eyes-free.googlecode.com/
Java | 116 lines | 91 code | 7 blank | 18 comment | 68 complexity | 88b53d943e51ea1b4a405d4f9cf52005 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.google.marvin.espeak;
 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("afr")) {
 41            returnData.putExtra("sampleText", getString(R.string.afr));
 42        } else if (language.equals("bos")) {
 43            returnData.putExtra("sampleText", getString(R.string.bos));
 44        } else if (language.equals("zho")) {
 45            returnData.putExtra("sampleText", getString(R.string.zho));
 46        } else if (language.equals("hrv")) {
 47            returnData.putExtra("sampleText", getString(R.string.hrv));
 48        } else if (language.equals("ces")) {
 49            returnData.putExtra("sampleText", getString(R.string.ces));
 50        } else if (language.equals("nld")) {
 51            returnData.putExtra("sampleText", getString(R.string.nld));
 52        } else if (language.equals("eng")) {
 53            returnData.putExtra("sampleText", getString(R.string.eng));
 54        } else if (language.equals("epo")) {
 55            returnData.putExtra("sampleText", getString(R.string.epo));
 56        } else if (language.equals("fin")) {
 57            returnData.putExtra("sampleText", getString(R.string.fin));
 58        } else if (language.equals("fra")) {
 59            returnData.putExtra("sampleText", getString(R.string.fra));
 60        } else if (language.equals("deu")) {
 61            returnData.putExtra("sampleText", getString(R.string.deu));
 62        } else if (language.equals("ell")) {
 63            returnData.putExtra("sampleText", getString(R.string.ell));
 64        } else if (language.equals("hin")) {
 65            returnData.putExtra("sampleText", getString(R.string.hin));
 66        } else if (language.equals("hun")) {
 67            returnData.putExtra("sampleText", getString(R.string.hun));
 68        } else if (language.equals("isl")) {
 69            returnData.putExtra("sampleText", getString(R.string.isl));
 70        } else if (language.equals("ind")) {
 71            returnData.putExtra("sampleText", getString(R.string.ind));
 72        } else if (language.equals("ita")) {
 73            returnData.putExtra("sampleText", getString(R.string.ita));
 74        } else if (language.equals("kur")) {
 75            returnData.putExtra("sampleText", getString(R.string.kur));
 76        } else if (language.equals("lat")) {
 77            returnData.putExtra("sampleText", getString(R.string.lat));
 78        } else if (language.equals("mkd")) {
 79            returnData.putExtra("sampleText", getString(R.string.mkd));
 80        } else if (language.equals("nor")) {
 81            returnData.putExtra("sampleText", getString(R.string.nor));
 82        } else if (language.equals("pol")) {
 83            returnData.putExtra("sampleText", getString(R.string.pol));
 84        } else if (language.equals("por")) {
 85            returnData.putExtra("sampleText", getString(R.string.por));
 86        } else if (language.equals("ron")) {
 87            returnData.putExtra("sampleText", getString(R.string.ron));
 88        } else if (language.equals("rus")) {
 89            returnData.putExtra("sampleText", getString(R.string.rus));
 90        } else if (language.equals("srp")) {
 91            returnData.putExtra("sampleText", getString(R.string.srp));
 92        } else if (language.equals("slk")) {
 93            returnData.putExtra("sampleText", getString(R.string.slk));
 94        } else if (language.equals("spa")) {
 95            returnData.putExtra("sampleText", getString(R.string.spa));
 96        } else if (language.equals("swa")) {
 97            returnData.putExtra("sampleText", getString(R.string.swa));
 98        } else if (language.equals("swe")) {
 99            returnData.putExtra("sampleText", getString(R.string.swe));
100        } else if (language.equals("tam")) {
101            returnData.putExtra("sampleText", getString(R.string.tam));
102        } else if (language.equals("tur")) {
103            returnData.putExtra("sampleText", getString(R.string.tur));
104        } else if (language.equals("vie")) {
105            returnData.putExtra("sampleText", getString(R.string.vie));
106        } else if (language.equals("cym")) {
107            returnData.putExtra("sampleText", getString(R.string.cym));
108        } else {
109            result = TextToSpeech.LANG_NOT_SUPPORTED;
110            returnData.putExtra("sampleText", "");
111        }
112
113        setResult(result, returnData);
114        finish();
115    }
116}