|
|
|
@ -190,10 +190,34 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ReadNow(){
|
|
|
|
|
;
|
|
|
|
|
String noteContent = getCurrentNoteContent();
|
|
|
|
|
if (noteContent.isEmpty()){
|
|
|
|
|
MediaPlayer player=MediaPlayer.create(this,R.raw.pleaseinput);
|
|
|
|
|
player.start();
|
|
|
|
|
Toast.makeText(NoteEditActivity.this, "请输入内容", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Toast.makeText(NoteEditActivity.this, "开始阅读", Toast.LENGTH_SHORT).show();
|
|
|
|
|
// 开始朗读(使用本地语音)
|
|
|
|
|
tts.speak(noteContent, TextToSpeech.QUEUE_ADD, null, "test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getCurrentNoteContent() {//获取文本
|
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
|
|
for (int i = 0; i < mEditTextList.getChildCount(); i++) {
|
|
|
|
|
View itemView = mEditTextList.getChildAt(i);
|
|
|
|
|
CheckBox checkBox = itemView.findViewById(R.id.cb_edit_item);
|
|
|
|
|
NoteEditText editText = itemView.findViewById(R.id.et_edit_text);
|
|
|
|
|
|
|
|
|
|
String prefix = checkBox.isChecked() ? "已完成: " : "未完成: ";
|
|
|
|
|
content.append(prefix).append(editText.getText()).append("\n");
|
|
|
|
|
}
|
|
|
|
|
return content.toString();
|
|
|
|
|
} else {
|
|
|
|
|
return mNoteEditor.getText().toString();
|
|
|
|
|
}
|
|
|
|
|
}//
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Current activity may be killed when the memory is low. Once it is killed, for another time
|
|
|
|
|