最终代码合并

master
SheYu 10 months ago
parent 61abc87349
commit bdec42262d

@ -1,20 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--- 定义应用程序的名称和版本号 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.micode.notes"

@ -23,6 +23,14 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
/**
* @Package: net.micode.notes.gtask.remote
* @ClassName: GTaskSyncService
* @Description:
* @Author: WuShuxian
* @CreateDate: 2024/1/15 21:36
* @Version: 1.0
*/
public class GTaskSyncService extends Service {
public final static String ACTION_STRING_NAME = "sync_action_type";
@ -118,10 +126,17 @@ public class GTaskSyncService extends Service {
context.startService(intent);
}
/**
* @method isSyncing
* @description:
* @date: 2024/1/15 21:38
* @author: WuShuxian
*/
public static boolean isSyncing() {
return mSyncTask != null;
}
public static String getProgressString() {
return mSyncProgress;
}

@ -14,6 +14,8 @@ import android.content.SharedPreferences;
import android.graphics.Paint;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@ -127,21 +129,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
"android.permission.WRITE_EXTERNAL_STORAGE" };//权限名称
private static final String TAG = "NoteEditActivity";
private HeadViewHolder mNoteHeaderHolder;
private View mHeadViewPanel;
private View mNoteBgColorSelector;
private View mFontSizeSelector;
private EditText mNoteEditor;
private View mNoteEditorPanel;
private WorkingNote mWorkingNote;
private SharedPreferences mSharedPrefs;
private int mFontSizeId;
@ -234,6 +228,24 @@ public class NoteEditActivity extends Activity implements OnClickListener,
return;
}
initResources();
final ImageButton add_img_btn = (ImageButton) findViewById(R.id.add_img_btn);//根据id获取添加图片按钮
//为点击图片按钮设置监听器
add_img_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "onClick: click add image button");
//ACTION_GET_CONTENT: 允许用户选择特殊种类的数据,并返回(特殊种类的数据:照一张相片或录一段音)
Intent loadImage = new Intent(Intent.ACTION_GET_CONTENT);
//Category属性用于指定当前动作Action被执行的环境.
//CATEGORY_OPENABLE; 用来指示一个ACTION_GET_CONTENT的intent
loadImage.addCategory(Intent.CATEGORY_OPENABLE);
loadImage.setType("image/*");
startActivityForResult(loadImage, PHOTO_REQUEST);
}
});
convertToImage();//将路径显示为图片
count();
}
/**
@ -493,6 +505,24 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
}
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
//朗读
mTTS = new TextToSpeech(this,new TextToSpeech.OnInitListener(){
@Override
public void onInit(int status){
// 判断是否转化成功
if (status == TextToSpeech.SUCCESS){
//默认设定语言为中文
int result = mTTS.setLanguage(Locale.CHINESE);
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED){
Toast.makeText(NoteEditActivity.this, "Language not available.", Toast.LENGTH_SHORT).show();
}else{
//不支持中文就将语言设置为英文
mTTS.setLanguage(Locale.US);
}
}
}
});
}
@Override
@ -661,6 +691,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
setReminder();
} else if (itemId == R.id.menu_delete_remind) {
mWorkingNote.setAlertDate(0, false);
} else if (itemId == R.id.menu_voice){
Log.d("voiceOut","in");
textToSpeach();
}
return true;
}
@ -1005,6 +1038,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private boolean saveNote() {
getWorkingText();
boolean saved = mWorkingNote.saveNote();
//如果便签内容为空,则删除
if (TextUtils.isEmpty(mWorkingNote.getContent())) {
deleteCurrentNote();//删除当前便签
saved = false; // 标记为未保存
}
//运行 getWorkingText()之后保存
if (saved) {
/**
@ -1300,4 +1338,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
e.printStackTrace();
}
}
/**
* @method textToSpeach
* @description:
* @date: 2024/1/16 20:21
* @author: WuShuxian
*/
private void textToSpeach(){
mTTS.speak(mNoteEditor.getText().toString(),TextToSpeech.QUEUE_FLUSH,null);
}
}

Loading…
Cancel
Save