wll
dev
pjmhoeuy7 3 months ago
commit be3505db6d

@ -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

@ -69,6 +69,17 @@
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:id="@+id/readnote"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dip"
android:layout_marginLeft="30dip"
android:layout_marginRight="30dip"
style="?android:attr/textAppearanceMedium"
android:text="阅读便签"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="7dip"
@ -83,6 +94,8 @@
android:layout_gravity="left|top"
android:fadingEdgeLength="0dip">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -396,5 +409,7 @@
android:layout_marginBottom="-7dip"
android:src="@drawable/selected" />
</FrameLayout>
</LinearLayout>
</FrameLayout>

Loading…
Cancel
Save