|
|
|
@ -71,19 +71,18 @@ import java.util.Map;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义 NoteEditActivity 类,用于编辑笔记的活动
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
|
|
|
|
// 内部类,用于保存笔记头部视图的持有者
|
|
|
|
private class HeadViewHolder {
|
|
|
|
private class HeadViewHolder {
|
|
|
|
public TextView tvModified;
|
|
|
|
public TextView tvModified;
|
|
|
|
|
|
|
|
|
|
|
|
public ImageView ivAlertIcon;
|
|
|
|
public ImageView ivAlertIcon;
|
|
|
|
|
|
|
|
|
|
|
|
public TextView tvAlertDate;
|
|
|
|
public TextView tvAlertDate;
|
|
|
|
|
|
|
|
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 背景颜色选择按钮和对应的资源 ID 的映射
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
|
|
|
|
@ -93,6 +92,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_white, ResourceParser.WHITE);
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_white, ResourceParser.WHITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 背景颜色选择后的显示 ID 的映射
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorSelectionMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorSelectionMap = new HashMap<Integer, Integer>();
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
sBgSelectorSelectionMap.put(ResourceParser.YELLOW, R.id.iv_bg_yellow_select);
|
|
|
|
sBgSelectorSelectionMap.put(ResourceParser.YELLOW, R.id.iv_bg_yellow_select);
|
|
|
|
@ -102,6 +102,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
sBgSelectorSelectionMap.put(ResourceParser.WHITE, R.id.iv_bg_white_select);
|
|
|
|
sBgSelectorSelectionMap.put(ResourceParser.WHITE, R.id.iv_bg_white_select);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 字体大小选择按钮和对应的资源 ID 的映射
|
|
|
|
private static final Map<Integer, Integer> sFontSizeBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sFontSizeBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
sFontSizeBtnsMap.put(R.id.ll_font_large, ResourceParser.TEXT_LARGE);
|
|
|
|
sFontSizeBtnsMap.put(R.id.ll_font_large, ResourceParser.TEXT_LARGE);
|
|
|
|
@ -110,6 +111,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
sFontSizeBtnsMap.put(R.id.ll_font_super, ResourceParser.TEXT_SUPER);
|
|
|
|
sFontSizeBtnsMap.put(R.id.ll_font_super, ResourceParser.TEXT_SUPER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 字体大小选择后的显示 ID 的映射
|
|
|
|
private static final Map<Integer, Integer> sFontSelectorSelectionMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sFontSelectorSelectionMap = new HashMap<Integer, Integer>();
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
sFontSelectorSelectionMap.put(ResourceParser.TEXT_LARGE, R.id.iv_large_select);
|
|
|
|
sFontSelectorSelectionMap.put(ResourceParser.TEXT_LARGE, R.id.iv_large_select);
|
|
|
|
@ -120,54 +122,75 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "NoteEditActivity";
|
|
|
|
private static final String TAG = "NoteEditActivity";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记头部视图的持有者实例
|
|
|
|
private HeadViewHolder mNoteHeaderHolder;
|
|
|
|
private HeadViewHolder mNoteHeaderHolder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记头部视图面板
|
|
|
|
private View mHeadViewPanel;
|
|
|
|
private View mHeadViewPanel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记背景颜色选择器视图
|
|
|
|
private View mNoteBgColorSelector;
|
|
|
|
private View mNoteBgColorSelector;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 字体大小选择器视图
|
|
|
|
private View mFontSizeSelector;
|
|
|
|
private View mFontSizeSelector;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记编辑框
|
|
|
|
private EditText mNoteEditor;
|
|
|
|
private EditText mNoteEditor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记编辑面板视图
|
|
|
|
private View mNoteEditorPanel;
|
|
|
|
private View mNoteEditorPanel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 正在编辑的笔记对象
|
|
|
|
private WorkingNote mWorkingNote;
|
|
|
|
private WorkingNote mWorkingNote;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 共享偏好设置对象
|
|
|
|
private SharedPreferences mSharedPrefs;
|
|
|
|
private SharedPreferences mSharedPrefs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前字体大小 ID
|
|
|
|
private int mFontSizeId;
|
|
|
|
private int mFontSizeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 共享偏好设置中的字体大小键名
|
|
|
|
private static final String PREFERENCE_FONT_SIZE = "pref_font_size";
|
|
|
|
private static final String PREFERENCE_FONT_SIZE = "pref_font_size";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 快捷方式图标标题的最大长度
|
|
|
|
private static final int SHORTCUT_ICON_TITLE_MAX_LEN = 10;
|
|
|
|
private static final int SHORTCUT_ICON_TITLE_MAX_LEN = 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记中已勾选项的标记
|
|
|
|
public static final String TAG_CHECKED = String.valueOf('\u221A');
|
|
|
|
public static final String TAG_CHECKED = String.valueOf('\u221A');
|
|
|
|
|
|
|
|
// 笔记中未勾选项的标记
|
|
|
|
public static final String TAG_UNCHECKED = String.valueOf('\u25A1');
|
|
|
|
public static final String TAG_UNCHECKED = String.valueOf('\u25A1');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 线性布局,用于容纳多个编辑框(列表模式下)
|
|
|
|
private LinearLayout mEditTextList;
|
|
|
|
private LinearLayout mEditTextList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户查询字符串
|
|
|
|
private String mUserQuery;
|
|
|
|
private String mUserQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 正则表达式模式对象,用于搜索用户查询字符串
|
|
|
|
private Pattern mPattern;
|
|
|
|
private Pattern mPattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 活动创建时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
// 设置布局文件
|
|
|
|
this.setContentView(R.layout.note_edit);
|
|
|
|
this.setContentView(R.layout.note_edit);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果保存的状态为空且初始化活动状态失败,则结束活动
|
|
|
|
if (savedInstanceState == null &&!initActivityState(getIntent())) {
|
|
|
|
if (savedInstanceState == null &&!initActivityState(getIntent())) {
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化资源
|
|
|
|
initResources();
|
|
|
|
initResources();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
// 当活动从被杀死的状态恢复时调用的方法
|
|
|
|
* Current activity may be killed when the memory is low. Once it is killed, for another time
|
|
|
|
|
|
|
|
* user load this activity, we should restore the former state
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
|
|
|
|
|
|
// 如果保存的状态不为空且包含笔记 ID,则尝试恢复活动状态
|
|
|
|
if (savedInstanceState!= null && savedInstanceState.containsKey(Intent.EXTRA_UID)) {
|
|
|
|
if (savedInstanceState!= null && savedInstanceState.containsKey(Intent.EXTRA_UID)) {
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
|
intent.putExtra(Intent.EXTRA_UID, savedInstanceState.getLong(Intent.EXTRA_UID));
|
|
|
|
intent.putExtra(Intent.EXTRA_UID, savedInstanceState.getLong(Intent.EXTRA_UID));
|
|
|
|
@ -179,24 +202,21 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化活动状态的方法,根据意图确定要编辑的笔记
|
|
|
|
private boolean initActivityState(Intent intent) {
|
|
|
|
private boolean initActivityState(Intent intent) {
|
|
|
|
/**
|
|
|
|
|
|
|
|
* If the user specified the {@link Intent#ACTION_VIEW} but not provided with id,
|
|
|
|
|
|
|
|
* then jump to the NotesListActivity
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
mWorkingNote = null;
|
|
|
|
mWorkingNote = null;
|
|
|
|
|
|
|
|
// 如果意图的动作是查看笔记
|
|
|
|
if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) {
|
|
|
|
if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) {
|
|
|
|
long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0);
|
|
|
|
long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0);
|
|
|
|
mUserQuery = "";
|
|
|
|
mUserQuery = "";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
// 如果是从搜索结果启动的
|
|
|
|
* Starting from the searched result
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) {
|
|
|
|
if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) {
|
|
|
|
noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
|
|
|
|
noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
|
|
|
|
mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY);
|
|
|
|
mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果笔记在数据库中不可见,则跳转到 NotesListActivity 并显示错误信息
|
|
|
|
if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) {
|
|
|
|
if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) {
|
|
|
|
Intent jump = new Intent(this, NotesListActivity.class);
|
|
|
|
Intent jump = new Intent(this, NotesListActivity.class);
|
|
|
|
startActivity(jump);
|
|
|
|
startActivity(jump);
|
|
|
|
@ -204,6 +224,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 加载要编辑的笔记
|
|
|
|
mWorkingNote = WorkingNote.load(this, noteId);
|
|
|
|
mWorkingNote = WorkingNote.load(this, noteId);
|
|
|
|
if (mWorkingNote == null) {
|
|
|
|
if (mWorkingNote == null) {
|
|
|
|
Log.e(TAG, "load note failed with note id" + noteId);
|
|
|
|
Log.e(TAG, "load note failed with note id" + noteId);
|
|
|
|
@ -211,11 +232,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置软键盘状态为隐藏且调整布局
|
|
|
|
getWindow().setSoftInputMode(
|
|
|
|
getWindow().setSoftInputMode(
|
|
|
|
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
|
|
|
|
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
|
|
|
|
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
|
|
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
|
|
} else if (TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) {
|
|
|
|
} else if (TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) {
|
|
|
|
// New note
|
|
|
|
// 创建新笔记的情况
|
|
|
|
long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0);
|
|
|
|
long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0);
|
|
|
|
int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID,
|
|
|
|
int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID,
|
|
|
|
AppWidgetManager.INVALID_APPWIDGET_ID);
|
|
|
|
AppWidgetManager.INVALID_APPWIDGET_ID);
|
|
|
|
@ -224,7 +246,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID,
|
|
|
|
int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID,
|
|
|
|
ResourceParser.getDefaultBgId(this));
|
|
|
|
ResourceParser.getDefaultBgId(this));
|
|
|
|
|
|
|
|
|
|
|
|
// Parse call-record note
|
|
|
|
// 处理通话记录笔记
|
|
|
|
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
|
|
|
|
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
|
|
|
|
long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0);
|
|
|
|
long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0);
|
|
|
|
if (callDate!= 0 && phoneNumber!= null) {
|
|
|
|
if (callDate!= 0 && phoneNumber!= null) {
|
|
|
|
@ -250,6 +272,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
bgResId);
|
|
|
|
bgResId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置软键盘状态为可见且调整布局
|
|
|
|
getWindow().setSoftInputMode(
|
|
|
|
getWindow().setSoftInputMode(
|
|
|
|
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
|
|
|
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
|
|
|
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
|
|
|
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
|
|
|
@ -258,133 +281,67 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置笔记设置状态改变监听器
|
|
|
|
mWorkingNote.setOnSettingStatusChangedListener(this);
|
|
|
|
mWorkingNote.setOnSettingStatusChangedListener(this);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 活动恢复时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
// 初始化笔记屏幕显示
|
|
|
|
initNoteScreen();
|
|
|
|
initNoteScreen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化笔记屏幕显示的方法
|
|
|
|
private void initNoteScreen() {
|
|
|
|
private void initNoteScreen() {
|
|
|
|
|
|
|
|
// 设置笔记编辑框的文本外观
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
|
|
|
|
// 如果笔记处于清单模式
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
|
|
|
// 将笔记内容转换为列表模式显示
|
|
|
|
switchToListMode(mWorkingNote.getContent());
|
|
|
|
switchToListMode(mWorkingNote.getContent());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 突出显示查询结果并设置编辑框文本和光标位置
|
|
|
|
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
|
|
|
|
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
|
|
|
|
mNoteEditor.setSelection(mNoteEditor.getText().length());
|
|
|
|
mNoteEditor.setSelection(mNoteEditor.getText().length());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 隐藏所有背景颜色选择后的显示
|
|
|
|
for (Integer id : sBgSelectorSelectionMap.keySet()) {
|
|
|
|
for (Integer id : sBgSelectorSelectionMap.keySet()) {
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(id)).setVisibility(View.GONE);
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(id)).setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置头部面板和编辑面板的背景资源
|
|
|
|
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
|
|
|
|
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
|
|
|
|
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
|
|
|
|
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
|
|
|
|
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this,
|
|
|
|
// 设置修改日期显示文本 mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
|
|
|
|
mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE
|
|
|
|
|
|
|
|
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
|
|
|
|
|
|
|
|
| DateUtils.FORMAT_SHOW_YEAR));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
|
|
|
|
|
|
|
|
* is not ready
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
showAlertHeader();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void showAlertHeader() {
|
|
|
|
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
|
|
|
|
|
if (time > mWorkingNote.getAlertDate()) {
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString(
|
|
|
|
|
|
|
|
mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onNewIntent(Intent intent) {
|
|
|
|
|
|
|
|
super.onNewIntent(intent);
|
|
|
|
|
|
|
|
initActivityState(intent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
|
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* For new note without note id, we should firstly save it to
|
|
|
|
|
|
|
|
* generate a id. If the editing note is not worth saving, there
|
|
|
|
|
|
|
|
* is no id which is equivalent to create new note
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!mWorkingNote.existInDatabase()) {
|
|
|
|
|
|
|
|
saveNote();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId());
|
|
|
|
|
|
|
|
Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
|
|
|
|
|
|
|
if (mNoteBgColorSelector.getVisibility() == View.VISIBLE
|
|
|
|
|
|
|
|
&& !inRangeOfView(mNoteBgColorSelector, ev)) {
|
|
|
|
|
|
|
|
mNoteBgColorSelector.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mFontSizeSelector.getVisibility() == View.VISIBLE
|
|
|
|
|
|
|
|
&& !inRangeOfView(mFontSizeSelector, ev)) {
|
|
|
|
|
|
|
|
mFontSizeSelector.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.dispatchTouchEvent(ev);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean inRangeOfView(View view, MotionEvent ev) {
|
|
|
|
|
|
|
|
int []location = new int[2];
|
|
|
|
|
|
|
|
view.getLocationOnScreen(location);
|
|
|
|
|
|
|
|
int x = location[0];
|
|
|
|
|
|
|
|
int y = location[1];
|
|
|
|
|
|
|
|
if (ev.getX() < x
|
|
|
|
|
|
|
|
|| ev.getX() > (x + view.getWidth())
|
|
|
|
|
|
|
|
|| ev.getY() < y
|
|
|
|
|
|
|
|
|| ev.getY() > (y + view.getHeight())) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initResources() {
|
|
|
|
|
|
|
|
mHeadViewPanel = findViewById(R.id.note_title);
|
|
|
|
|
|
|
|
mNoteHeaderHolder = new HeadViewHolder();
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
|
|
|
|
|
|
|
|
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
|
|
|
|
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
|
|
|
|
|
|
|
|
// 设置背景颜色设置按钮的点击监听器
|
|
|
|
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
|
|
|
|
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
|
|
|
|
|
|
|
|
// 获取笔记编辑框实例
|
|
|
|
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
|
|
|
|
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
|
|
|
|
|
|
|
|
// 获取笔记编辑面板视图实例
|
|
|
|
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
|
|
|
|
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
|
|
|
|
|
|
|
|
// 获取笔记背景颜色选择器视图实例
|
|
|
|
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
|
|
|
|
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
|
|
|
|
|
|
|
|
// 为所有背景颜色选择按钮设置点击监听器
|
|
|
|
for (int id : sBgSelectorBtnsMap.keySet()) {
|
|
|
|
for (int id : sBgSelectorBtnsMap.keySet()) {
|
|
|
|
ImageView iv = (ImageView) findViewById(id);
|
|
|
|
ImageView iv = (ImageView) findViewById(id);
|
|
|
|
iv.setOnClickListener(this);
|
|
|
|
iv.setOnClickListener(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取字体大小选择器视图实例
|
|
|
|
mFontSizeSelector = findViewById(R.id.font_size_selector);
|
|
|
|
mFontSizeSelector = findViewById(R.id.font_size_selector);
|
|
|
|
|
|
|
|
// 为所有字体大小选择按钮设置点击监听器
|
|
|
|
for (int id : sFontSizeBtnsMap.keySet()) {
|
|
|
|
for (int id : sFontSizeBtnsMap.keySet()) {
|
|
|
|
View view = findViewById(id);
|
|
|
|
View view = findViewById(id);
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// 获取共享偏好设置实例
|
|
|
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
|
|
|
|
// 获取当前字体大小 ID 从共享偏好设置中
|
|
|
|
mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE);
|
|
|
|
mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* HACKME: Fix bug of store the resource id in shared preference.
|
|
|
|
* HACKME: Fix bug of store the resource id in shared preference.
|
|
|
|
@ -394,20 +351,26 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) {
|
|
|
|
if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) {
|
|
|
|
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
|
|
|
|
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取线性布局实例,用于容纳多个编辑框(列表模式下)
|
|
|
|
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
|
|
|
|
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 暂停活动时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onPause() {
|
|
|
|
protected void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
super.onPause();
|
|
|
|
|
|
|
|
// 保存笔记,如果保存成功则记录日志
|
|
|
|
if(saveNote()) {
|
|
|
|
if(saveNote()) {
|
|
|
|
Log.d(TAG, "Note data was saved with length:" + mWorkingNote.getContent().length());
|
|
|
|
Log.d(TAG, "Note data was saved with length:" + mWorkingNote.getContent().length());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 清除设置状态
|
|
|
|
clearSettingState();
|
|
|
|
clearSettingState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新小部件的方法
|
|
|
|
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) {
|
|
|
|
intent.setClass(this, NoteWidgetProvider_2x.class);
|
|
|
|
intent.setClass(this, NoteWidgetProvider_2x.class);
|
|
|
|
} else if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_4X) {
|
|
|
|
} else if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_4X) {
|
|
|
|
@ -421,82 +384,115 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mWorkingNote.getWidgetId()
|
|
|
|
mWorkingNote.getWidgetId()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 发送广播更新小部件
|
|
|
|
sendBroadcast(intent);
|
|
|
|
sendBroadcast(intent);
|
|
|
|
|
|
|
|
// 设置结果码为 RESULT_OK,并将意图作为结果返回
|
|
|
|
setResult(RESULT_OK, intent);
|
|
|
|
setResult(RESULT_OK, intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 点击事件处理方法
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
int id = v.getId();
|
|
|
|
int id = v.getId();
|
|
|
|
|
|
|
|
// 如果点击了背景颜色设置按钮
|
|
|
|
if (id == R.id.btn_set_bg_color) {
|
|
|
|
if (id == R.id.btn_set_bg_color) {
|
|
|
|
|
|
|
|
// 显示背景颜色选择器
|
|
|
|
mNoteBgColorSelector.setVisibility(View.VISIBLE);
|
|
|
|
mNoteBgColorSelector.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
// 显示当前选择的背景颜色的选中状态
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
- View.VISIBLE);
|
|
|
|
View.VISIBLE);
|
|
|
|
} else if (sBgSelectorBtnsMap.containsKey(id)) {
|
|
|
|
} else if (sBgSelectorBtnsMap.containsKey(id)) {
|
|
|
|
|
|
|
|
// 隐藏之前选择的背景颜色的选中状态
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
View.GONE);
|
|
|
|
View.GONE);
|
|
|
|
|
|
|
|
// 设置新的背景颜色 ID
|
|
|
|
mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id));
|
|
|
|
mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id));
|
|
|
|
|
|
|
|
// 隐藏背景颜色选择器
|
|
|
|
mNoteBgColorSelector.setVisibility(View.GONE);
|
|
|
|
mNoteBgColorSelector.setVisibility(View.GONE);
|
|
|
|
} else if (sFontSizeBtnsMap.containsKey(id)) {
|
|
|
|
} else if (sFontSizeBtnsMap.containsKey(id)) {
|
|
|
|
|
|
|
|
// 隐藏之前选择的字体大小的选中状态
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.GONE);
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.GONE);
|
|
|
|
|
|
|
|
// 设置新的字体大小 ID
|
|
|
|
mFontSizeId = sFontSizeBtnsMap.get(id);
|
|
|
|
mFontSizeId = sFontSizeBtnsMap.get(id);
|
|
|
|
|
|
|
|
// 将新的字体大小 ID 保存到共享偏好设置中
|
|
|
|
mSharedPrefs.edit().putInt(PREFERENCE_FONT_SIZE, mFontSizeId).commit();
|
|
|
|
mSharedPrefs.edit().putInt(PREFERENCE_FONT_SIZE, mFontSizeId).commit();
|
|
|
|
|
|
|
|
// 显示新选择的字体大小的选中状态
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
|
|
|
// 获取工作文本(在列表模式下)
|
|
|
|
getWorkingText();
|
|
|
|
getWorkingText();
|
|
|
|
|
|
|
|
// 将笔记内容转换为列表模式显示
|
|
|
|
switchToListMode(mWorkingNote.getContent());
|
|
|
|
switchToListMode(mWorkingNote.getContent());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 设置笔记编辑框的文本外观为新的字体大小
|
|
|
|
mNoteEditor.setTextAppearance(this,
|
|
|
|
mNoteEditor.setTextAppearance(this,
|
|
|
|
TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
|
|
|
|
TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 隐藏字体大小选择器
|
|
|
|
mFontSizeSelector.setVisibility(View.GONE);
|
|
|
|
mFontSizeSelector.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 按下返回键时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
|
|
|
// 如果清除设置状态成功,则直接返回,不执行默认的返回操作
|
|
|
|
if(clearSettingState()) {
|
|
|
|
if(clearSettingState()) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存笔记
|
|
|
|
saveNote();
|
|
|
|
saveNote();
|
|
|
|
|
|
|
|
// 执行默认的返回操作
|
|
|
|
super.onBackPressed();
|
|
|
|
super.onBackPressed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清除设置状态的方法
|
|
|
|
private boolean clearSettingState() {
|
|
|
|
private boolean clearSettingState() {
|
|
|
|
|
|
|
|
// 如果背景颜色选择器可见,则隐藏它并返回 true
|
|
|
|
if (mNoteBgColorSelector.getVisibility() == View.VISIBLE) {
|
|
|
|
if (mNoteBgColorSelector.getVisibility() == View.VISIBLE) {
|
|
|
|
mNoteBgColorSelector.setVisibility(View.GONE);
|
|
|
|
mNoteBgColorSelector.setVisibility(View.GONE);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else if (mFontSizeSelector.getVisibility() == View.VISIBLE) {
|
|
|
|
} else if (mFontSizeSelector.getVisibility() == View.VISIBLE) {
|
|
|
|
|
|
|
|
// 如果字体大小选择器可见,则隐藏它并返回 true
|
|
|
|
mFontSizeSelector.setVisibility(View.GONE);
|
|
|
|
mFontSizeSelector.setVisibility(View.GONE);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当背景颜色改变时调用的方法
|
|
|
|
public void onBackgroundColorChanged() {
|
|
|
|
public void onBackgroundColorChanged() {
|
|
|
|
|
|
|
|
// 显示当前选择的背景颜色的选中状态
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
View.VISIBLE);
|
|
|
|
View.VISIBLE);
|
|
|
|
|
|
|
|
// 设置编辑面板和头部面板的背景资源为新的背景颜色
|
|
|
|
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
|
|
|
|
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
|
|
|
|
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
|
|
|
|
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 准备选项菜单时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
|
if (isFinishing()) {
|
|
|
|
if (isFinishing()) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 清除设置状态
|
|
|
|
clearSettingState();
|
|
|
|
clearSettingState();
|
|
|
|
menu.clear();
|
|
|
|
menu.clear();
|
|
|
|
|
|
|
|
// 根据笔记类型设置不同的菜单资源
|
|
|
|
if (mWorkingNote.getFolderId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
if (mWorkingNote.getFolderId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
getMenuInflater().inflate(R.menu.call_note_edit, menu);
|
|
|
|
getMenuInflater().inflate(R.menu.call_note_edit, menu);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
getMenuInflater().inflate(R.menu.note_edit, menu);
|
|
|
|
getMenuInflater().inflate(R.menu.note_edit, menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果笔记处于清单模式,则设置菜单项标题为切换到普通模式
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_normal_mode);
|
|
|
|
menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_normal_mode);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果笔记处于普通模式,则设置菜单项标题为切换到清单模式
|
|
|
|
menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_list_mode);
|
|
|
|
menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_list_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 根据是否有提醒设置不同的菜单项可见性
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
if (mWorkingNote.hasClockAlert()) {
|
|
|
|
menu.findItem(R.id.menu_alert).setVisible(false);
|
|
|
|
menu.findItem(R.id.menu_alert).setVisible(false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -505,13 +501,16 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选项菜单项被选择时调用的方法
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.menu_new_note:
|
|
|
|
case R.id.menu_new_note:
|
|
|
|
|
|
|
|
// 创建新笔记
|
|
|
|
createNewNote();
|
|
|
|
createNewNote();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_delete:
|
|
|
|
case R.id.menu_delete:
|
|
|
|
|
|
|
|
// 显示删除确认对话框
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
builder.setTitle(getString(R.string.alert_title_delete));
|
|
|
|
builder.setTitle(getString(R.string.alert_title_delete));
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
|
|
|
@ -519,6 +518,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
builder.setPositiveButton(android.R.string.ok,
|
|
|
|
builder.setPositiveButton(android.R.string.ok,
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
// 删除当前笔记并结束活动
|
|
|
|
deleteCurrentNote();
|
|
|
|
deleteCurrentNote();
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -527,24 +527,30 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
builder.show();
|
|
|
|
builder.show();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_font_size:
|
|
|
|
case R.id.menu_font_size:
|
|
|
|
|
|
|
|
// 显示字体大小选择器
|
|
|
|
mFontSizeSelector.setVisibility(View.VISIBLE);
|
|
|
|
mFontSizeSelector.setVisibility(View.VISIBLE);
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);
|
|
|
|
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_list_mode:
|
|
|
|
case R.id.menu_list_mode:
|
|
|
|
|
|
|
|
// 切换笔记的清单模式状态
|
|
|
|
mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0?
|
|
|
|
mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0?
|
|
|
|
TextNote.MODE_CHECK_LIST : 0);
|
|
|
|
TextNote.MODE_CHECK_LIST : 0);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_share:
|
|
|
|
case R.id.menu_share:
|
|
|
|
|
|
|
|
// 获取工作文本并分享笔记内容
|
|
|
|
getWorkingText();
|
|
|
|
getWorkingText();
|
|
|
|
sendTo(this, mWorkingNote.getContent());
|
|
|
|
sendTo(this, mWorkingNote.getContent());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_send_to_desktop:
|
|
|
|
case R.id.menu_send_to_desktop:
|
|
|
|
|
|
|
|
// 将笔记发送到桌面
|
|
|
|
sendToDesktop();
|
|
|
|
sendToDesktop();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_alert:
|
|
|
|
case R.id.menu_alert:
|
|
|
|
|
|
|
|
// 设置提醒
|
|
|
|
setReminder();
|
|
|
|
setReminder();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case R.id.menu_delete_remind:
|
|
|
|
case R.id.menu_delete_remind:
|
|
|
|
|
|
|
|
// 删除提醒
|
|
|
|
mWorkingNote.setAlertDate(0, false);
|
|
|
|
mWorkingNote.setAlertDate(0, false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
@ -553,10 +559,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置提醒的方法
|
|
|
|
private void setReminder() {
|
|
|
|
private void setReminder() {
|
|
|
|
DateTimePickerDialog d = new DateTimePickerDialog(this, System.currentTimeMillis());
|
|
|
|
DateTimePickerDialog d = new DateTimePickerDialog(this, System.currentTimeMillis());
|
|
|
|
d.setOnDateTimeSetListener(new OnDateTimeSetListener() {
|
|
|
|
d.setOnDateTimeSetListener(new OnDateTimeSetListener() {
|
|
|
|
public void OnDateTimeSet(AlertDialog dialog, long date) {
|
|
|
|
public void OnDateTimeSet(AlertDialog dialog, long date) {
|
|
|
|
|
|
|
|
// 设置笔记的提醒日期
|
|
|
|
mWorkingNote.setAlertDate(date, true);
|
|
|
|
mWorkingNote.setAlertDate(date, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -574,11 +582,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
context.startActivity(intent);
|
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建新笔记的方法
|
|
|
|
private void createNewNote() {
|
|
|
|
private void createNewNote() {
|
|
|
|
// Firstly, save current editing notes
|
|
|
|
// 首先保存当前正在编辑的笔记
|
|
|
|
saveNote();
|
|
|
|
saveNote();
|
|
|
|
|
|
|
|
|
|
|
|
// For safety, start a new NoteEditActivity
|
|
|
|
// 为了安全起见,启动一个新的 NoteEditActivity
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
Intent intent = new Intent(this, NoteEditActivity.class);
|
|
|
|
Intent intent = new Intent(this, NoteEditActivity.class);
|
|
|
|
intent.setAction(Intent.ACTION_INSERT_OR_EDIT);
|
|
|
|
intent.setAction(Intent.ACTION_INSERT_OR_EDIT);
|
|
|
|
@ -586,6 +595,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
startActivity(intent);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 删除当前笔记的方法
|
|
|
|
private void deleteCurrentNote() {
|
|
|
|
private void deleteCurrentNote() {
|
|
|
|
if (mWorkingNote.existInDatabase()) {
|
|
|
|
if (mWorkingNote.existInDatabase()) {
|
|
|
|
HashSet<Long> ids = new HashSet<Long>();
|
|
|
|
HashSet<Long> ids = new HashSet<Long>();
|
|
|
|
@ -596,22 +606,27 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
Log.d(TAG, "Wrong note id, should not happen");
|
|
|
|
Log.d(TAG, "Wrong note id, should not happen");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isSyncMode()) {
|
|
|
|
if (!isSyncMode()) {
|
|
|
|
|
|
|
|
// 如果不是同步模式,则直接删除笔记
|
|
|
|
if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) {
|
|
|
|
if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) {
|
|
|
|
Log.e(TAG, "Delete Note error");
|
|
|
|
Log.e(TAG, "Delete Note error");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果是同步模式,则将笔记移动到回收站文件夹
|
|
|
|
if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLER)) {
|
|
|
|
if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLER)) {
|
|
|
|
Log.e(TAG, "Move notes to trash folder error, should not happens");
|
|
|
|
Log.e(TAG, "Move notes to trash folder error, should not happens");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 标记笔记为已删除
|
|
|
|
mWorkingNote.markDeleted(true);
|
|
|
|
mWorkingNote.markDeleted(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否为同步模式的方法
|
|
|
|
private boolean isSyncMode() {
|
|
|
|
private boolean isSyncMode() {
|
|
|
|
return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
|
|
|
|
return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当时钟提醒改变时调用的方法
|
|
|
|
public void onClockAlertChanged(long date, boolean set) {
|
|
|
|
public void onClockAlertChanged(long date, boolean set) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User could set clock to an unsaved note, so before setting the
|
|
|
|
* User could set clock to an unsaved note, so before setting the
|
|
|
|
@ -625,10 +640,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId()));
|
|
|
|
intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId()));
|
|
|
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
|
|
|
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
|
|
|
|
AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE));
|
|
|
|
AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE));
|
|
|
|
|
|
|
|
// 显示提醒头部信息
|
|
|
|
showAlertHeader();
|
|
|
|
showAlertHeader();
|
|
|
|
if(!set) {
|
|
|
|
if(!set) {
|
|
|
|
|
|
|
|
// 如果取消提醒,则取消闹钟
|
|
|
|
alarmManager.cancel(pendingIntent);
|
|
|
|
alarmManager.cancel(pendingIntent);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 如果设置提醒,则设置闹钟
|
|
|
|
alarmManager.set(AlarmManager.RTC_WAKEUP, date, pendingIntent);
|
|
|
|
alarmManager.set(AlarmManager.RTC_WAKEUP, date, pendingIntent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -638,14 +656,17 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* should input something
|
|
|
|
* should input something
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
Log.e(TAG, "Clock alert setting error");
|
|
|
|
Log.e(TAG, "Clock alert setting error");
|
|
|
|
|
|
|
|
// 显示提示信息,表示笔记为空无法设置闹钟
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当小部件改变时调用的方法
|
|
|
|
public void onWidgetChanged() {
|
|
|
|
public void onWidgetChanged() {
|
|
|
|
updateWidget();
|
|
|
|
updateWidget();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当编辑框中的文本被删除时调用的方法
|
|
|
|
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) {
|
|
|
|
@ -672,6 +693,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
edit.setSelection(length);
|
|
|
|
edit.setSelection(length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当编辑框中按下回车键时调用的方法
|
|
|
|
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
|
|
|
|
@ -691,6 +713,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将笔记内容转换为列表模式显示的方法
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
String[] items = text.split("\n");
|
|
|
|
String[] items = text.split("\n");
|
|
|
|
@ -708,16 +731,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取突出显示查询结果的 Spannable 对象的方法
|
|
|
|
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)) {
|
|
|
|
mPattern = Pattern.compile(userQuery);
|
|
|
|
mPattern = Pattern.compile(userQuery);
|
|
|
|
Matcher m = mPattern.matcher(fullText);
|
|
|
|
Matcher m = mPattern.matcher(fullText);
|
|
|
|
int start = 0;
|
|
|
|
int start = 0;
|
|
|
|
while (m.find(start)) {
|
|
|
|
while (m.find(start m.start(), m.end(),
|
|
|
|
spannable.setSpan(
|
|
|
|
|
|
|
|
new BackgroundColorSpan(this.getResources().getColor(
|
|
|
|
|
|
|
|
R.color.user_query_highlight)), m.start(), m.end(),
|
|
|
|
|
|
|
|
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
|
|
start = m.end();
|
|
|
|
start = m.end();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -725,6 +746,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return spannable;
|
|
|
|
return spannable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取列表项视图的方法
|
|
|
|
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);
|
|
|
|
@ -756,6 +778,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当编辑框中的文本改变时调用的方法
|
|
|
|
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");
|
|
|
|
@ -768,6 +791,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当清单模式改变时调用的方法
|
|
|
|
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());
|
|
|
|
@ -782,6 +806,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取工作文本的方法
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
boolean hasChecked = false;
|
|
|
|
boolean hasChecked = false;
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
@ -805,6 +830,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return hasChecked;
|
|
|
|
return hasChecked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存笔记的方法
|
|
|
|
private boolean saveNote() {
|
|
|
|
private boolean saveNote() {
|
|
|
|
getWorkingText();
|
|
|
|
getWorkingText();
|
|
|
|
boolean saved = mWorkingNote.saveNote();
|
|
|
|
boolean saved = mWorkingNote.saveNote();
|
|
|
|
@ -821,6 +847,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return saved;
|
|
|
|
return saved;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将笔记发送到桌面的方法
|
|
|
|
private void sendToDesktop() {
|
|
|
|
private void sendToDesktop() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Before send message to home, we should make sure that current
|
|
|
|
* Before send message to home, we should make sure that current
|
|
|
|
@ -856,6 +883,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生成快捷方式图标标题的方法
|
|
|
|
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, "");
|
|
|
|
@ -863,10 +891,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
SHORTCUT_ICON_TITLE_MAX_LEN) : content;
|
|
|
|
SHORTCUT_ICON_TITLE_MAX_LEN) : content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示吐司消息的方法
|
|
|
|
private void showToast(int resId) {
|
|
|
|
private void showToast(int resId) {
|
|
|
|
showToast(resId, Toast.LENGTH_SHORT);
|
|
|
|
showToast(resId, Toast.LENGTH_SHORT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示吐司消息的重载方法,可指定时长
|
|
|
|
private void showToast(int resId, int duration) {
|
|
|
|
private void showToast(int resId, int duration) {
|
|
|
|
Toast.makeText(this, resId, duration).show();
|
|
|
|
Toast.makeText(this, resId, duration).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|