From e65dc7516289a149b4582a836a189974a7c34cfc Mon Sep 17 00:00:00 2001 From: afiq3821 <39751738+afiq3821@users.noreply.github.com> Date: Tue, 9 Oct 2018 09:13:18 +0700 Subject: [PATCH 1/2] gaktau add activty record --- gaktau | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 gaktau diff --git a/gaktau b/gaktau new file mode 100644 index 0000000..7243df7 --- /dev/null +++ b/gaktau @@ -0,0 +1,48 @@ +package com.blogspot.blogsetyaaji.androidlanjutan; + +import android.content.Intent; +import android.os.Bundle; +import android.speech.RecognizerIntent; +import android.support.v7.app.AppCompatActivity; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import java.util.Locale; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + +public class SttActivity extends AppCompatActivity { + + @BindView(R.id.edTs) + EditText edTs; + @BindView(R.id.btnStt) + Button btnStt; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_stt); + ButterKnife.bind(this); + } + + @OnClick(R.id.btnStt) + public void onViewClicked() { + prosesSuara(); + } + + private void prosesSuara() { + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,new Locale("in","INA")); + intent.putExtra(RecognizerIntent.EXTRA_PROMPT,"Start Speak"); + + try { + startActivity(intent, ); + }catch (Exception e){ + Toast.makeText(this, getString(R.string.tts_error), Toast.LENGTH_LONG); + } + } +} From 4be088fb746bf38558a40a8154a0200995aaf0d7 Mon Sep 17 00:00:00 2001 From: afiq3821 <39751738+afiq3821@users.noreply.github.com> Date: Tue, 9 Oct 2018 09:26:00 +0700 Subject: [PATCH 2/2] furqon add activty record --- furqon | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 furqon diff --git a/furqon b/furqon new file mode 100644 index 0000000..7243df7 --- /dev/null +++ b/furqon @@ -0,0 +1,48 @@ +package com.blogspot.blogsetyaaji.androidlanjutan; + +import android.content.Intent; +import android.os.Bundle; +import android.speech.RecognizerIntent; +import android.support.v7.app.AppCompatActivity; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import java.util.Locale; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + +public class SttActivity extends AppCompatActivity { + + @BindView(R.id.edTs) + EditText edTs; + @BindView(R.id.btnStt) + Button btnStt; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_stt); + ButterKnife.bind(this); + } + + @OnClick(R.id.btnStt) + public void onViewClicked() { + prosesSuara(); + } + + private void prosesSuara() { + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,new Locale("in","INA")); + intent.putExtra(RecognizerIntent.EXTRA_PROMPT,"Start Speak"); + + try { + startActivity(intent, ); + }catch (Exception e){ + Toast.makeText(this, getString(R.string.tts_error), Toast.LENGTH_LONG); + } + } +}