|
|
@@ -14,14 +14,20 @@ import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
import android.widget.AdapterView;
|
|
|
+import android.widget.ImageView;
|
|
|
import android.widget.ListView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.handmark.pulltorefresh.library.PullToRefreshBase;
|
|
|
import com.handmark.pulltorefresh.library.PullToRefreshListView;
|
|
|
+import com.iflytek.cloud.speech.RecognizerResult;
|
|
|
+import com.iflytek.cloud.speech.SpeechError;
|
|
|
+import com.iflytek.cloud.ui.RecognizerDialogListener;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
import com.xzjmyk.pm.activity.adapter.WorkDailyAdapter;
|
|
|
+import com.xzjmyk.pm.activity.audio.voicerecognition.JsonParser;
|
|
|
+import com.xzjmyk.pm.activity.audio.voicerecognition.VoiceToWord;
|
|
|
import com.xzjmyk.pm.activity.bean.oa.WorkDailyBean;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
|
|
|
@@ -48,7 +54,7 @@ import java.util.regex.Pattern;
|
|
|
/**
|
|
|
* Created by FANGlh on 2016/11/1.
|
|
|
*/
|
|
|
-public class WorkDailyShowActivity extends BaseActivity {
|
|
|
+public class WorkDailyShowActivity extends BaseActivity implements RecognizerDialogListener {
|
|
|
private static final int DELETE_DOC_REQUEST_SUCCESSFULLY = 1219;
|
|
|
private ClearEditText mSearchEt;
|
|
|
private PullToRefreshListView mPullToRefreshListView;
|
|
|
@@ -62,6 +68,7 @@ public class WorkDailyShowActivity extends BaseActivity {
|
|
|
private List<WorkDailyBean> click_list;
|
|
|
private List<WorkDailyBean> last_list;
|
|
|
private String delete_succeed;
|
|
|
+ private ImageView voice_search;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -76,6 +83,7 @@ public class WorkDailyShowActivity extends BaseActivity {
|
|
|
getSupportActionBar().setTitle("日报记录");
|
|
|
mSearchEt = (ClearEditText) findViewById(R.id.work_daily_search_edit);
|
|
|
mPullToRefreshListView = (PullToRefreshListView) findViewById(R.id.work_daily_context_ptlv);
|
|
|
+ voice_search = (ImageView) findViewById(R.id.voice_search_iv);
|
|
|
|
|
|
mEmptyLayout = new EmptyLayout(this, mPullToRefreshListView.getRefreshableView());
|
|
|
mEmptyLayout.setShowEmptyButton(false);
|
|
|
@@ -88,6 +96,15 @@ public class WorkDailyShowActivity extends BaseActivity {
|
|
|
mWorkDailyAdapter.setmWorkDailyBeanList(real_list);
|
|
|
mPullToRefreshListView.getRefreshableView().setAdapter(mWorkDailyAdapter);
|
|
|
real_list = mWorkDailyAdapter.getmWorkDailyBeanList();
|
|
|
+ final VoiceToWord voice = new VoiceToWord(mContext,"534e3fe2");
|
|
|
+ voice.setRecognizerDialogListener(this); //自己调用自己
|
|
|
+ voice_search.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ voice_search.setImageResource(R.drawable.btn_yuyin_pressed);
|
|
|
+ voice.GetWordFromVoice();
|
|
|
+ }
|
|
|
+ });
|
|
|
mSearchEt.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
@@ -363,4 +380,19 @@ public class WorkDailyShowActivity extends BaseActivity {
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
imm.hideSoftInputFromWindow(mSearchEt.getWindowToken(), 0);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResult(RecognizerResult recognizerResult, boolean b) {
|
|
|
+ String text = JsonParser.parseIatResult(recognizerResult.getResultString());
|
|
|
+ System.out.println(text);
|
|
|
+ Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
|
|
|
+
|
|
|
+ voice_search.setImageResource(R.drawable.btn_yuyin_nor);
|
|
|
+ mSearchEt.setText(mSearchEt.getText().toString() + text);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SpeechError speechError) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|