protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_tts_offline_mode); this.FindViewById(Resource.Id.btn_speak).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_stop_speak).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_download_model).SetOnClickListener(this); this.FindViewById(Resource.Id.close).SetOnClickListener(this); mEditText = (EditText)this.FindViewById(Resource.Id.edit_input); mTextView = (TextView)this.FindViewById(Resource.Id.textView); tv_download_progress = (TextView)this.FindViewById(Resource.Id.tv_download_progress); // Use customized parameter settings to create a offline TTS engine. mlTtsConfigs = new MLTtsConfig() // Setting the language for synthesis. .SetLanguage(MLTtsConstants.TtsEnUs) // Set the timbre. .SetPerson(MLTtsConstants.TtsSpeakerOfflineEnUsMaleEagle) // Set the speech speed. Range: 0.2–2.0 1.0 indicates 1x speed. .SetSpeed(1.0f) // Set the volume. Range: 0.2–2.0 1.0 indicates 1x volume. .SetVolume(1.0f) // set the synthesis mode. .SetSynthesizeMode(MLTtsConstants.TtsOfflineMode); mlTtsEngine = new MLTtsEngine(mlTtsConfigs); // Pass the TTS callback to the TTS engine. mlTtsEngine.SetTtsCallback(this); manager = MLLocalModelManager.Instance; this.SetOnResultCallback(this); handler = new Handler(new TtsOfflineHandlerCallBack(this)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_language_detection_translation); this.mTextView = (Android.Widget.TextView) this.FindViewById(Resource.Id.tv_output); this.mEditText = (Android.Widget.EditText) this.FindViewById(Resource.Id.et_input); this.FindViewById(Resource.Id.btn_local_translator).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_local_detector).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_remote_translator).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_remote_detector).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_delete_model).SetOnClickListener(this); this.FindViewById(Resource.Id.btn_download_model).SetOnClickListener(this); TranslatorActivity.nationAndCode = this.ReadNationAndCode(); manager = MLLocalModelManager.Instance; }