Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
copy to clipboard is working again with latest pocketsphinx results
  • Loading branch information
cesine committed Aug 26, 2018
commit 019d550e100afedf98bf218ef4e4ea8e975e8620
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,15 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
if (mHasRecognized == false) {
return;
}
// if (mHasRecognized == false) {
// return;
// }
String currentText = hypothesis1EditText.getText().toString();
mItem.setOrthography(currentText);
showOrthographyOnly(rootView);
ContentValues values = new ContentValues();
values.put(DatumTable.COLUMN_ORTHOGRAPHY, currentText);
values.put(DatumTable.COLUMN_TAGS, "Gismet");
getActivity().getContentResolver().update(mUri, values, null, null);
recordUserEvent("editDatum", "hypothesis1");
}
Expand Down Expand Up @@ -509,6 +510,7 @@ public boolean toggleAudioRecording(MenuItem item) {
if (mPromptFromCaller == null) {
mPromptFromCaller = getString(R.string.im_listening);
}

hypothesis5EditText.setText(mPromptFromCaller);

Intent intent = new Intent(getActivity(), PocketSphinxRecognitionService.class);
Expand Down Expand Up @@ -624,7 +626,8 @@ public void processRecognitionPartialHypothesis(Intent data) {
if (partialResults.size() > 0 && partialResults.get(0) != null && !"".equals(partialResults.get(0))
&& !hypothesis1EditText.getText().equals(partialResults.get(0))) {
hypothesis1EditText.setText(partialResults.get(0));
// this.mHasRecognized = true;
this.mHasRecognized = true;
mHypotheses = partialResults;
} else {
// hypothesis1EditText.setVisibility(View.GONE);
}
Expand Down Expand Up @@ -742,6 +745,7 @@ public void onPause() {

@Override
public void onDestroy() {
setIntentResult();
if (this.mRecognitionReceiver != null && getActivity() != null) {
getActivity().unregisterReceiver(this.mRecognitionReceiver);
}
Expand Down Expand Up @@ -815,7 +819,8 @@ public void setIntentResult() {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("recognized", firstGuessOrEditedGuess);
clipboard.setPrimaryClip(clip);
Toast.makeText(getActivity(), "Copied " + firstGuessOrEditedGuess + " to your clibboard.", Toast.LENGTH_LONG)
String copied = getString(R.string.copied_result_to_your_clipboard);
Toast.makeText(getActivity(), String.format(copied, firstGuessOrEditedGuess), Toast.LENGTH_LONG)
.show();

Intent returnToCaller = new Intent();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ka/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
<string name="or_maybe">ან შეიძლება </string>
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
<string name="train">წვრთნა</string>
<string name="saving">შენახვა</string>
<string name="recognize">ამოცნობა</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<string name="i_might_have_heard">Cred ca am auzit: </string>
<string name="or_maybe">Sau poate: </string>
<string name="there_were_others">. Te fac sa razi, nu? Ar fi fost si alte optiuni, dar cred ca o sa ma opresc aici. </string>
<string name="copied_result_to_your_clipboard">Copied %s to your clipboard</string>
<string name="train">Antrenament in curs</string>
<string name="saving">Saving</string>
<string name="recognize">Recunoastere</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
<string name="or_maybe">ან შეიძლება </string>
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
<string name="train">წვრთნა</string>
<string name="saving">შენახვა</string>
<string name="recognize">ამოცნობა</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
<string name="or_maybe">ან შეიძლება </string>
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
<string name="train">წვრთნა</string>
<string name="saving">შენახვა</string>
<string name="recognize">ამოცნობა</string>
Expand Down