Skip to content

Commit

Permalink
fix voice text
Browse files Browse the repository at this point in the history
  • Loading branch information
etman55 committed Apr 11, 2017
1 parent 35191c4 commit d1d225e
Showing 1 changed file with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void onClick(View arg0) {
});
}


@Override
public void doOnResume() {
super.doOnResume();
Expand All @@ -104,29 +103,24 @@ public void onActivityCreated(Bundle savedInstanceState) {
}

private RecognitionEventHandler speechRecognitionEventHandler = new RecognitionEventHandler() {

@Override
public void onResult(final List<String> result) {
uiHandler.post(new Runnable() {

@Override
public void run() {
if (canChangeUI()) {
if (canChangeUI())
uiHandler.post(new Runnable() {
@Override
public void run() {
setOff();
if (result.size() > 0)
lastResult = result.get(0);
lastResult = result.get(0);
recognizedResult.setText(lastResult
.toLowerCase());
}
}
});
});
}

@Override
public void onReadyForSpeach(Bundle params) {
if (canChangeUI()) {
if (canChangeUI())
uiHandler.post(new Runnable() {

@Override
public void run() {
if (canChangeUI()) {
Expand All @@ -136,39 +130,38 @@ public void run() {
}
}
});
}
}

@Override
public void onError(final String error, int errorCode) {
uiHandler.post(new Runnable() {

@Override
public void run() {
if (canChangeUI()) {
setOff();
Toast.makeText(activity, error, Toast.LENGTH_SHORT)
.show();
lastResult = "";
}
}
});
}

@Override
public void onEndOfSpeech() {
if (canChangeUI()) {
if (canChangeUI())
uiHandler.post(new Runnable() {
@Override
public void run() {
setOff();
}
});
}
}


@Override
public void onBeginningOfSpeech() {
if (canChangeUI()) {
if (canChangeUI())
uiHandler.post(new Runnable() {

@Override
Expand All @@ -178,15 +171,12 @@ public void run() {
setON();
}
});
}
}

@Override
public void onRmsChanged(final float rmsdB) {
uiHandler.removeCallbacksAndMessages(null);
if (canChangeUI())
uiHandler.post(new Runnable() {

@Override
public void run() {
Log.d("RMS", rmsdB + "");
Expand Down

0 comments on commit d1d225e

Please sign in to comment.