Skip to content

Commit 019d550

Browse files
committed
copy to clipboard is working again with latest pocketsphinx results
1 parent be76d51 commit 019d550

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

app/src/main/java/com/github/fielddb/lessons/ui/DatumSpeechRecognitionHypothesesFragment.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,15 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
225225

226226
@Override
227227
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
228-
if (mHasRecognized == false) {
229-
return;
230-
}
228+
// if (mHasRecognized == false) {
229+
// return;
230+
// }
231231
String currentText = hypothesis1EditText.getText().toString();
232232
mItem.setOrthography(currentText);
233233
showOrthographyOnly(rootView);
234234
ContentValues values = new ContentValues();
235235
values.put(DatumTable.COLUMN_ORTHOGRAPHY, currentText);
236+
values.put(DatumTable.COLUMN_TAGS, "Gismet");
236237
getActivity().getContentResolver().update(mUri, values, null, null);
237238
recordUserEvent("editDatum", "hypothesis1");
238239
}
@@ -509,6 +510,7 @@ public boolean toggleAudioRecording(MenuItem item) {
509510
if (mPromptFromCaller == null) {
510511
mPromptFromCaller = getString(R.string.im_listening);
511512
}
513+
512514
hypothesis5EditText.setText(mPromptFromCaller);
513515

514516
Intent intent = new Intent(getActivity(), PocketSphinxRecognitionService.class);
@@ -624,7 +626,8 @@ public void processRecognitionPartialHypothesis(Intent data) {
624626
if (partialResults.size() > 0 && partialResults.get(0) != null && !"".equals(partialResults.get(0))
625627
&& !hypothesis1EditText.getText().equals(partialResults.get(0))) {
626628
hypothesis1EditText.setText(partialResults.get(0));
627-
// this.mHasRecognized = true;
629+
this.mHasRecognized = true;
630+
mHypotheses = partialResults;
628631
} else {
629632
// hypothesis1EditText.setVisibility(View.GONE);
630633
}
@@ -742,6 +745,7 @@ public void onPause() {
742745

743746
@Override
744747
public void onDestroy() {
748+
setIntentResult();
745749
if (this.mRecognitionReceiver != null && getActivity() != null) {
746750
getActivity().unregisterReceiver(this.mRecognitionReceiver);
747751
}
@@ -815,7 +819,8 @@ public void setIntentResult() {
815819
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
816820
ClipData clip = ClipData.newPlainText("recognized", firstGuessOrEditedGuess);
817821
clipboard.setPrimaryClip(clip);
818-
Toast.makeText(getActivity(), "Copied " + firstGuessOrEditedGuess + " to your clibboard.", Toast.LENGTH_LONG)
822+
String copied = getString(R.string.copied_result_to_your_clipboard);
823+
Toast.makeText(getActivity(), String.format(copied, firstGuessOrEditedGuess), Toast.LENGTH_LONG)
819824
.show();
820825

821826
Intent returnToCaller = new Intent();

app/src/main/res/values-ka/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
3333
<string name="or_maybe">ან შეიძლება </string>
3434
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
35+
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
3536
<string name="train">წვრთნა</string>
3637
<string name="saving">შენახვა</string>
3738
<string name="recognize">ამოცნობა</string>

app/src/main/res/values-ro/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<string name="i_might_have_heard">Cred ca am auzit: </string>
3333
<string name="or_maybe">Sau poate: </string>
3434
<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>
35+
<string name="copied_result_to_your_clipboard">Copied %s to your clipboard</string>
3536
<string name="train">Antrenament in curs</string>
3637
<string name="saving">Saving</string>
3738
<string name="recognize">Recunoastere</string>

app/src/main/res/values-ru/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
3232
<string name="or_maybe">ან შეიძლება </string>
3333
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
34+
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
3435
<string name="train">წვრთნა</string>
3536
<string name="saving">შენახვა</string>
3637
<string name="recognize">ამოცნობა</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<string name="i_might_have_heard">შესაძლებელია გამიგია: </string>
2929
<string name="or_maybe">ან შეიძლება </string>
3030
<string name="there_were_others">. I\'m pretty funny, ey? There were some other options, but I think I\'ll stop there. </string>
31+
<string name="copied_result_to_your_clipboard">დააკოპირეს %s თქვენს ბუფერში</string>
3132
<string name="train">წვრთნა</string>
3233
<string name="saving">შენახვა</string>
3334
<string name="recognize">ამოცნობა</string>

0 commit comments

Comments
 (0)