|
|
@@ -22,6 +22,12 @@ import com.common.data.StringUtil;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.widget.ClearEditText;
|
|
|
import com.core.widget.EmptyLayout;
|
|
|
+import com.core.xmpp.utils.audio.voicerecognition.JsonParser;
|
|
|
+import com.iflytek.cloud.RecognizerResult;
|
|
|
+import com.iflytek.cloud.SpeechConstant;
|
|
|
+import com.iflytek.cloud.SpeechError;
|
|
|
+import com.iflytek.cloud.ui.RecognizerDialog;
|
|
|
+import com.iflytek.cloud.ui.RecognizerDialogListener;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.activity.datainquiry.bean.DataInquiryGirdItemBean;
|
|
|
@@ -128,6 +134,30 @@ public class DataInquirySearchActivity extends BaseActivity {
|
|
|
startActivity(intent);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ mVoiceImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ RecognizerDialog dialog = new RecognizerDialog(DataInquirySearchActivity.this, null);
|
|
|
+ dialog.setParameter(SpeechConstant.LANGUAGE, "zh_cn");
|
|
|
+ dialog.setParameter(SpeechConstant.ACCENT, "mandarin");
|
|
|
+ dialog.setListener(new RecognizerDialogListener() {
|
|
|
+ @Override
|
|
|
+ public void onResult(RecognizerResult recognizerResult, boolean b) {
|
|
|
+ String text = JsonParser.parseIatResult(recognizerResult.getResultString());
|
|
|
+ String s = mSearchEditText.getText().toString() + CommonUtil.getPlaintext(text);
|
|
|
+ mSearchEditText.setText(s);
|
|
|
+ mSearchEditText.setSelection(s.length());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SpeechError speechError) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dialog.show();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void initDatas() {
|
|
|
@@ -293,10 +323,10 @@ public class DataInquirySearchActivity extends BaseActivity {
|
|
|
filterResults.count = mDataInquirySearchBeanList.size();
|
|
|
} else {
|
|
|
filterObjects = new ArrayList<>();
|
|
|
- for (int i = 0; i < objects.size(); i++) {
|
|
|
- String title = objects.get(i).getQueryScheme().getScheme();
|
|
|
+ for (int i = 0; i < mDataInquirySearchBeanList.size(); i++) {
|
|
|
+ String title = mDataInquirySearchBeanList.get(i).getQueryScheme().getScheme();
|
|
|
if (title.contains(constraint.toString())) {
|
|
|
- filterObjects.add(objects.get(i));
|
|
|
+ filterObjects.add(mDataInquirySearchBeanList.get(i));
|
|
|
}
|
|
|
}
|
|
|
|