|
|
|
@ -71,18 +71,9 @@ import java.util.regex.Pattern;
|
|
|
|
|
*/
|
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
/**
|
|
|
|
|
* 类属性的定义
|
|
|
|
|
*/
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/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 {
|
|
|
|
|
public TextView tvModified;
|
|
|
|
|
|
|
|
|
@ -397,7 +388,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
showAlertHeader();
|
|
|
|
|
convertToImage();//将路径转化未图片
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method showAlertHeader
|
|
|
|
|
* @description
|
|
|
|
@ -409,12 +399,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @date: 12/24/2023 6:24 PM
|
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
private void showAlertHeader() {
|
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
|
@ -527,18 +511,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
clearSettingState();
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method updateWidget
|
|
|
|
|
* @description 更新小部件的操作
|
|
|
|
|
* @date: 12/24/2023 6:21 PM
|
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
private void updateWidget() {
|
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
|
@ -661,12 +639,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
|
if (itemId == R.id.menu_new_note) {
|
|
|
|
|
createNewNote();
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
} else if (itemId == R.id.menu_delete) {
|
|
|
|
|
========
|
|
|
|
|
}
|
|
|
|
|
else if (itemId == R.id.menu_delete) {
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
|
builder.setTitle(getString(R.string.alert_title_delete));
|
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
|
|
|
@ -791,9 +765,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* 当小部件发生改变时调用updateWidget
|
|
|
|
|
*/
|
|
|
|
@ -808,16 +779,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @param index 文本框索引
|
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
public void onWidgetChanged() {
|
|
|
|
|
updateWidget();
|
|
|
|
|
}
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
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) {
|
|
|
|
|
int childCount = mEditTextList.getChildCount();
|
|
|
|
|
if (childCount == 1) {
|
|
|
|
@ -843,8 +804,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
edit.requestFocus();
|
|
|
|
|
edit.setSelection(length);
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method onEditTextEnter
|
|
|
|
|
* @description 编辑文本框中按下回车键的操作
|
|
|
|
@ -853,10 +812,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @param index 文本框索引
|
|
|
|
|
* @param text 文本框中的文本内容
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
public void onEditTextEnter(int index, String text) {
|
|
|
|
|
/**
|
|
|
|
|
* Should not happen, check for debug
|
|
|
|
@ -875,8 +830,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
.setIndex(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method switchToListMode
|
|
|
|
|
* @description 切换到列表模式
|
|
|
|
@ -884,10 +837,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
* @param text 列表文本
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
|
String[] items = text.split("\n");
|
|
|
|
@ -904,8 +853,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
mNoteEditor.setVisibility(View.GONE);
|
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method getHighlightQueryResult
|
|
|
|
|
* @description 获取高亮查询结果
|
|
|
|
@ -915,10 +862,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @param userQuery 用户查询关键词
|
|
|
|
|
* @return 带有高亮效果的 Spannable 对象
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
private Spannable getHighlightQueryResult(String fullText, String userQuery) {
|
|
|
|
|
SpannableString spannable = new SpannableString(fullText == null ? "" : fullText);
|
|
|
|
|
if (!TextUtils.isEmpty(userQuery)) {
|
|
|
|
@ -935,8 +878,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
return spannable;
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method getListItem
|
|
|
|
|
* @description 获取列表项视图
|
|
|
|
@ -946,10 +887,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @param index 列表项索引
|
|
|
|
|
* @return 列表项视图
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
private View getListItem(String item, int index) {
|
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null);
|
|
|
|
|
final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
|
|
|
|
@ -980,8 +917,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
edit.setText(getHighlightQueryResult(item, mUserQuery));
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
<<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
/**
|
|
|
|
|
* @method onTextChange
|
|
|
|
|
* @description 当文本内容发生变化时的处理方法
|
|
|
|
@ -990,10 +925,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @param index 文本索引
|
|
|
|
|
* @param hasText 是否有文本内容
|
|
|
|
|
*/
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
========
|
|
|
|
|
>>>>>>>> b654a61 (code):src/Notes/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
public void onTextChange(int index, boolean hasText) {
|
|
|
|
|
if (index >= mEditTextList.getChildCount()) {
|
|
|
|
|
Log.e(TAG, "Wrong index, should not happen");
|
|
|
|
@ -1005,7 +936,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @method onCheckListModeChanged
|
|
|
|
|
* @description 当检查列表模式发生变化时的处理方法
|
|
|
|
@ -1039,7 +969,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* @return 是否存在已打钩的选项
|
|
|
|
|
*/
|
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
|
boolean hasChecked = false;//初始化check标记
|
|
|
|
|
boolean hasChecked = false;
|
|
|
|
|
//初始化check标记
|
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
/**
|
|
|
|
|
* 若模式为CHECK_LIST
|
|
|
|
@ -1047,8 +978,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* 遍历所有子编辑框的视图
|
|
|
|
|
*/
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
//创建可变字符串
|
|
|
|
|
for (int i = 0; i < mEditTextList.getChildCount(); i++) {
|
|
|
|
|
View view = mEditTextList.getChildAt(i);
|
|
|
|
|
//遍历所有子编辑框的视图
|
|
|
|
|
NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
|
|
|
|
|
if (!TextUtils.isEmpty(edit.getText())) {
|
|
|
|
|
/**
|
|
|
|
@ -1057,8 +990,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* 扩展字符串为已打钩并把标记置true
|
|
|
|
|
*/
|
|
|
|
|
if (((CheckBox) view.findViewById(R.id.cb_edit_item)).isChecked()) {
|
|
|
|
|
//该选项框已打钩
|
|
|
|
|
sb.append(TAG_CHECKED).append(" ").append(edit.getText()).append("\n");
|
|
|
|
|
hasChecked = true;
|
|
|
|
|
//扩展字符串为已打钩并把标记置true
|
|
|
|
|
} else {
|
|
|
|
|
//扩展字符串添加未打钩
|
|
|
|
|
sb.append(TAG_UNCHECKED).append(" ").append(edit.getText()).append("\n");
|
|
|
|
@ -1082,8 +1017,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* 保存便签,退出时候会自动调本函数
|
|
|
|
|
* @date: 12/21/2023 8:14 AM
|
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean saveNote() {
|
|
|
|
|
getWorkingText();
|
|
|
|
@ -1108,8 +1041,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* send to home功能,发到桌面上
|
|
|
|
|
* @date: 12/21/2023 8:15 AM
|
|
|
|
|
* @author: YangYizhe
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private void sendToDesktop() {
|
|
|
|
|
/**
|
|
|
|
|