|
|
@ -67,6 +67,12 @@ import java.util.regex.Pattern;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 类属性的定义
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private class HeadViewHolder {
|
|
|
|
private class HeadViewHolder {
|
|
|
|
public TextView tvModified;
|
|
|
|
public TextView tvModified;
|
|
|
|
|
|
|
|
|
|
|
@ -288,6 +294,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
showAlertHeader();
|
|
|
|
showAlertHeader();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method showAlertHeader
|
|
|
|
* @method showAlertHeader
|
|
|
|
* @description
|
|
|
|
* @description
|
|
|
@ -299,6 +306,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @date: 12/24/2023 6:24 PM
|
|
|
|
* @date: 12/24/2023 6:24 PM
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private void showAlertHeader() {
|
|
|
|
private void showAlertHeader() {
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
@ -410,12 +420,15 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clearSettingState();
|
|
|
|
clearSettingState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method updateWidget
|
|
|
|
* @method updateWidget
|
|
|
|
* @description 更新小部件的操作
|
|
|
|
* @description 更新小部件的操作
|
|
|
|
* @date: 12/24/2023 6:21 PM
|
|
|
|
* @date: 12/24/2023 6:21 PM
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private void updateWidget() {
|
|
|
|
private void updateWidget() {
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
@ -664,6 +677,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 当小部件发生改变时调用updateWidget
|
|
|
|
* 当小部件发生改变时调用updateWidget
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -678,6 +692,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param index 文本框索引
|
|
|
|
* @param index 文本框索引
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
public void onWidgetChanged() {
|
|
|
|
|
|
|
|
updateWidget();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
public void onEditTextDelete(int index, String text) {
|
|
|
|
public void onEditTextDelete(int index, String text) {
|
|
|
|
int childCount = mEditTextList.getChildCount();
|
|
|
|
int childCount = mEditTextList.getChildCount();
|
|
|
|
if (childCount == 1) {
|
|
|
|
if (childCount == 1) {
|
|
|
@ -703,6 +722,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
edit.requestFocus();
|
|
|
|
edit.requestFocus();
|
|
|
|
edit.setSelection(length);
|
|
|
|
edit.setSelection(length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method onEditTextEnter
|
|
|
|
* @method onEditTextEnter
|
|
|
|
* @description 编辑文本框中按下回车键的操作
|
|
|
|
* @description 编辑文本框中按下回车键的操作
|
|
|
@ -711,6 +731,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param index 文本框索引
|
|
|
|
* @param index 文本框索引
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
public void onEditTextEnter(int index, String text) {
|
|
|
|
public void onEditTextEnter(int index, String text) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Should not happen, check for debug
|
|
|
|
* Should not happen, check for debug
|
|
|
@ -729,6 +751,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
.setIndex(i);
|
|
|
|
.setIndex(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method switchToListMode
|
|
|
|
* @method switchToListMode
|
|
|
|
* @description 切换到列表模式
|
|
|
|
* @description 切换到列表模式
|
|
|
@ -736,6 +759,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @param text 列表文本
|
|
|
|
* @param text 列表文本
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
String[] items = text.split("\n");
|
|
|
|
String[] items = text.split("\n");
|
|
|
@ -752,6 +777,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mNoteEditor.setVisibility(View.GONE);
|
|
|
|
mNoteEditor.setVisibility(View.GONE);
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method getHighlightQueryResult
|
|
|
|
* @method getHighlightQueryResult
|
|
|
|
* @description 获取高亮查询结果
|
|
|
|
* @description 获取高亮查询结果
|
|
|
@ -761,6 +787,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param userQuery 用户查询关键词
|
|
|
|
* @param userQuery 用户查询关键词
|
|
|
|
* @return 带有高亮效果的 Spannable 对象
|
|
|
|
* @return 带有高亮效果的 Spannable 对象
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private Spannable getHighlightQueryResult(String fullText, String userQuery) {
|
|
|
|
private Spannable getHighlightQueryResult(String fullText, String userQuery) {
|
|
|
|
SpannableString spannable = new SpannableString(fullText == null ? "" : fullText);
|
|
|
|
SpannableString spannable = new SpannableString(fullText == null ? "" : fullText);
|
|
|
|
if (!TextUtils.isEmpty(userQuery)) {
|
|
|
|
if (!TextUtils.isEmpty(userQuery)) {
|
|
|
@ -777,6 +805,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return spannable;
|
|
|
|
return spannable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method getListItem
|
|
|
|
* @method getListItem
|
|
|
|
* @description 获取列表项视图
|
|
|
|
* @description 获取列表项视图
|
|
|
@ -786,6 +815,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param index 列表项索引
|
|
|
|
* @param index 列表项索引
|
|
|
|
* @return 列表项视图
|
|
|
|
* @return 列表项视图
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private View getListItem(String item, int index) {
|
|
|
|
private View getListItem(String item, int index) {
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null);
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null);
|
|
|
|
final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
|
|
|
|
final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
|
|
|
@ -816,6 +847,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
edit.setText(getHighlightQueryResult(item, mUserQuery));
|
|
|
|
edit.setText(getHighlightQueryResult(item, mUserQuery));
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method onTextChange
|
|
|
|
* @method onTextChange
|
|
|
|
* @description 当文本内容发生变化时的处理方法
|
|
|
|
* @description 当文本内容发生变化时的处理方法
|
|
|
@ -824,6 +856,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param index 文本索引
|
|
|
|
* @param index 文本索引
|
|
|
|
* @param hasText 是否有文本内容
|
|
|
|
* @param hasText 是否有文本内容
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
public void onTextChange(int index, boolean hasText) {
|
|
|
|
public void onTextChange(int index, boolean hasText) {
|
|
|
|
if (index >= mEditTextList.getChildCount()) {
|
|
|
|
if (index >= mEditTextList.getChildCount()) {
|
|
|
|
Log.e(TAG, "Wrong index, should not happen");
|
|
|
|
Log.e(TAG, "Wrong index, should not happen");
|
|
|
@ -835,6 +869,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE);
|
|
|
|
mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method onCheckListModeChanged
|
|
|
|
* @method onCheckListModeChanged
|
|
|
|
* @description 当检查列表模式发生变化时的处理方法
|
|
|
|
* @description 当检查列表模式发生变化时的处理方法
|
|
|
@ -843,6 +878,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param oldMode 旧的模式
|
|
|
|
* @param oldMode 旧的模式
|
|
|
|
* @param newMode 新的模式
|
|
|
|
* @param newMode 新的模式
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
public void onCheckListModeChanged(int oldMode, int newMode) {
|
|
|
|
public void onCheckListModeChanged(int oldMode, int newMode) {
|
|
|
|
if (newMode == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (newMode == TextNote.MODE_CHECK_LIST) {
|
|
|
|
switchToListMode(mNoteEditor.getText().toString());
|
|
|
|
switchToListMode(mNoteEditor.getText().toString());
|
|
|
@ -856,6 +894,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mNoteEditor.setVisibility(View.VISIBLE);
|
|
|
|
mNoteEditor.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method getWorkingText
|
|
|
|
* @method getWorkingText
|
|
|
|
* @description 获取正在编辑的文本内容
|
|
|
|
* @description 获取正在编辑的文本内容
|
|
|
@ -863,6 +902,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @return 是否存在已打钩的选项
|
|
|
|
* @return 是否存在已打钩的选项
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
boolean hasChecked = false;//初始化check标记
|
|
|
|
boolean hasChecked = false;//初始化check标记
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
@ -902,6 +943,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* 保存便签,退出时候会自动调本函数
|
|
|
|
* 保存便签,退出时候会自动调本函数
|
|
|
|
* @date: 12/21/2023 8:14 AM
|
|
|
|
* @date: 12/21/2023 8:14 AM
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
* @param
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private boolean saveNote() {
|
|
|
|
private boolean saveNote() {
|
|
|
|
getWorkingText();
|
|
|
|
getWorkingText();
|
|
|
@ -926,6 +972,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* send to home功能,发到桌面上
|
|
|
|
* send to home功能,发到桌面上
|
|
|
|
* @date: 12/21/2023 8:15 AM
|
|
|
|
* @date: 12/21/2023 8:15 AM
|
|
|
|
* @author: YangYizhe
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
* @param
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void sendToDesktop() {
|
|
|
|
private void sendToDesktop() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -961,6 +1012,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
showToast(R.string.error_note_empty_for_send_to_desktop);
|
|
|
|
showToast(R.string.error_note_empty_for_send_to_desktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method makeShortcutIconTitle
|
|
|
|
* @method makeShortcutIconTitle
|
|
|
|
* @description 生成快捷方式图标标题
|
|
|
|
* @description 生成快捷方式图标标题
|
|
|
@ -969,6 +1021,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* @param content 内容
|
|
|
|
* @param content 内容
|
|
|
|
* @return 生成的快捷方式图标标题
|
|
|
|
* @return 生成的快捷方式图标标题
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
========
|
|
|
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
private String makeShortcutIconTitle(String content) {
|
|
|
|
private String makeShortcutIconTitle(String content) {
|
|
|
|
content = content.replace(TAG_CHECKED, "");
|
|
|
|
content = content.replace(TAG_CHECKED, "");
|
|
|
|
content = content.replace(TAG_UNCHECKED, "");
|
|
|
|
content = content.replace(TAG_UNCHECKED, "");
|
|
|
|