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;
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("eng")) {
45          if (country.equals("GBR")){
46            returnData.putExtra("sampleText", getString(R.string.eng_gbr_sample));
47          } else {
48            returnData.putExtra("sampleText", getString(R.string.eng_usa_sample));
49          }
50        } else if (language.equals("fra")) {
51          returnData.putExtra("sampleText", getString(R.string.fra_fra_sample));
52        } else if (language.equals("ita")) {
53          returnData.putExtra("sampleText", getString(R.string.ita_ita_sample));
54        } else if (language.equals("deu")) {
55          returnData.putExtra("sampleText", getString(R.string.deu_deu_sample));
56        } else if (language.equals("spa")) {
57          returnData.putExtra("sampleText", getString(R.string.spa_esp_sample));
58        } else {
59          result = TextToSpeech.LANG_NOT_SUPPORTED;
60          returnData.putExtra("sampleText", "");
61        }
62
63        setResult(result, returnData);
64        finish();
65    }
66}
67