PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/tts/src/com/google/tts/GetSampleText.java

http://eyes-free.googlecode.com/
Java | 120 lines | 93 code | 9 blank | 18 comment | 68 complexity | 2a547fec5b901d61887d41c00890beca 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.tts;
 18
 19import java.io.File;
 20
 21import android.app.Activity;
 22import android.content.Intent;
 23import android.os.Bundle;
 24import android.speech.tts.TextToSpeech;
 25
 26import android.util.Log;
 27
 28/*
 29 * Returns the sample text string for the language requested
 30 */
 31public class GetSampleText extends Activity {
 32    @Override
 33    protected void onCreate(Bundle savedInstanceState) {
 34        super.onCreate(savedInstanceState);
 35
 36        int result = TextToSpeech.LANG_AVAILABLE;
 37        Intent returnData = new Intent();
 38
 39        Intent i = getIntent();
 40        String language = i.getExtras().getString("language");
 41        String country = i.getExtras().getString("country");
 42        String variant = i.getExtras().getString("variant");
 43
 44        if (language.equals("afr")) {
 45            returnData.putExtra("sampleText", getString(R.string.afr));
 46        } else if (language.equals("bos")) {
 47            returnData.putExtra("sampleText", getString(R.string.bos));
 48        } else if (language.equals("zho")) {
 49            returnData.putExtra("sampleText", getString(R.string.zho));
 50        } else if (language.equals("hrv")) {
 51            returnData.putExtra("sampleText", getString(R.string.hrv));
 52        } else if (language.equals("ces")) {
 53            returnData.putExtra("sampleText", getString(R.string.ces));
 54        } else if (language.equals("nld")) {
 55            returnData.putExtra("sampleText", getString(R.string.nld));
 56        } else if (language.equals("eng")) {
 57            returnData.putExtra("sampleText", getString(R.string.eng));
 58        } else if (language.equals("epo")) {
 59            returnData.putExtra("sampleText", getString(R.string.epo));
 60        } else if (language.equals("fin")) {
 61            returnData.putExtra("sampleText", getString(R.string.fin));
 62        } else if (language.equals("fra")) {
 63            returnData.putExtra("sampleText", getString(R.string.fra));
 64        } else if (language.equals("deu")) {
 65            returnData.putExtra("sampleText", getString(R.string.deu));
 66        } else if (language.equals("ell")) {
 67            returnData.putExtra("sampleText", getString(R.string.ell));
 68        } else if (language.equals("hin")) {
 69            returnData.putExtra("sampleText", getString(R.string.hin));
 70        } else if (language.equals("hun")) {
 71            returnData.putExtra("sampleText", getString(R.string.hun));
 72        } else if (language.equals("isl")) {
 73            returnData.putExtra("sampleText", getString(R.string.isl));
 74        } else if (language.equals("ind")) {
 75            returnData.putExtra("sampleText", getString(R.string.ind));
 76        } else if (language.equals("ita")) {
 77            returnData.putExtra("sampleText", getString(R.string.ita));
 78        } else if (language.equals("kur")) {
 79            returnData.putExtra("sampleText", getString(R.string.kur));
 80        } else if (language.equals("lat")) {
 81            returnData.putExtra("sampleText", getString(R.string.lat));
 82        } else if (language.equals("mkd")) {
 83            returnData.putExtra("sampleText", getString(R.string.mkd));
 84        } else if (language.equals("nor")) {
 85            returnData.putExtra("sampleText", getString(R.string.nor));
 86        } else if (language.equals("pol")) {
 87            returnData.putExtra("sampleText", getString(R.string.pol));
 88        } else if (language.equals("por")) {
 89            returnData.putExtra("sampleText", getString(R.string.por));
 90        } else if (language.equals("ron")) {
 91            returnData.putExtra("sampleText", getString(R.string.ron));
 92        } else if (language.equals("rus")) {
 93            returnData.putExtra("sampleText", getString(R.string.rus));
 94        } else if (language.equals("srp")) {
 95            returnData.putExtra("sampleText", getString(R.string.srp));
 96        } else if (language.equals("slk")) {
 97            returnData.putExtra("sampleText", getString(R.string.slk));
 98        } else if (language.equals("spa")) {
 99            returnData.putExtra("sampleText", getString(R.string.spa));
100        } else if (language.equals("swa")) {
101            returnData.putExtra("sampleText", getString(R.string.swa));
102        } else if (language.equals("swe")) {
103            returnData.putExtra("sampleText", getString(R.string.swe));
104        } else if (language.equals("tam")) {
105            returnData.putExtra("sampleText", getString(R.string.tam));
106        } else if (language.equals("tur")) {
107            returnData.putExtra("sampleText", getString(R.string.tur));
108        } else if (language.equals("vie")) {
109            returnData.putExtra("sampleText", getString(R.string.vie));
110        } else if (language.equals("cym")) {
111            returnData.putExtra("sampleText", getString(R.string.cym));
112        } else {
113            result = TextToSpeech.LANG_NOT_SUPPORTED;
114            returnData.putExtra("sampleText", "");
115        }
116
117        setResult(result, returnData);
118        finish();
119    }
120}