|
|
|
@ -1,19 +1,3 @@
|
|
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
@ -71,9 +55,21 @@ import java.util.Map;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Package: net.micode.notes.ui
|
|
|
|
|
* @ClassName: NoteEditActivity
|
|
|
|
|
* @Description:
|
|
|
|
|
* 该类主要是针对标签的编辑
|
|
|
|
|
* 继承了系统内部许多和监听有关的类
|
|
|
|
|
* @Author: YangYizhe
|
|
|
|
|
* @CreateDate: 12/21/2023 12:47 AM
|
|
|
|
|
* @Version: 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
NoteSettingChangedListener, OnTextViewChangeListener {
|
|
|
|
|
/**
|
|
|
|
|
* 类属性的定义
|
|
|
|
|
*/
|
|
|
|
|
private class HeadViewHolder {
|
|
|
|
|
public TextView tvModified;
|
|
|
|
|
|
|
|
|
@ -83,7 +79,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
|
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
|
static {
|
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
|
|
|
|
@ -119,21 +114,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
public WorkingNote mWorkingNote;
|
|
|
|
|
private SharedPreferences mSharedPrefs;
|
|
|
|
|
private int mFontSizeId;
|
|
|
|
|
|
|
|
|
@ -148,12 +135,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
|
|
|
|
|
private String mUserQuery;
|
|
|
|
|
private Pattern mPattern;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*在 Activity 创建时进行一些初始化工作,包括设置布局、初始化状态和资源等操作
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
this.setContentView(R.layout.note_edit);
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState == null && !initActivityState(getIntent())) {
|
|
|
|
|
finish();
|
|
|
|
|
return;
|
|
|
|
@ -179,6 +167,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean initActivityState(Intent intent) {
|
|
|
|
|
/**
|
|
|
|
|
* If the user specified the {@link Intent#ACTION_VIEW} but not provided with id,
|
|
|
|
@ -188,25 +177,29 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) {
|
|
|
|
|
long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0);
|
|
|
|
|
mUserQuery = "";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Starting from the searched result
|
|
|
|
|
*/
|
|
|
|
|
//根据键值查找ID
|
|
|
|
|
if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) {
|
|
|
|
|
noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
|
|
|
|
|
mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果ID在数据库中未找到
|
|
|
|
|
if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) {
|
|
|
|
|
Intent jump = new Intent(this, NotesListActivity.class);
|
|
|
|
|
startActivity(jump);
|
|
|
|
|
//程序将跳转到上面声明的intent——jump
|
|
|
|
|
showToast(R.string.error_note_not_exist);
|
|
|
|
|
finish();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
//ID在数据库中找到
|
|
|
|
|
else {
|
|
|
|
|
mWorkingNote = WorkingNote.load(this, noteId);
|
|
|
|
|
if (mWorkingNote == null) {
|
|
|
|
|
Log.e(TAG, "load note failed with note id" + noteId);
|
|
|
|
|
//打印出红色的错误信息
|
|
|
|
|
finish();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -215,7 +208,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
|
|
|
|
|
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
|
|
|
} else if(TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) {
|
|
|
|
|
// New note
|
|
|
|
|
long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0);
|
|
|
|
|
int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID,
|
|
|
|
|
AppWidgetManager.INVALID_APPWIDGET_ID);
|
|
|
|
@ -223,8 +215,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
Notes.TYPE_WIDGET_INVALIDE);
|
|
|
|
|
int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID,
|
|
|
|
|
ResourceParser.getDefaultBgId(this));
|
|
|
|
|
|
|
|
|
|
// Parse call-record note
|
|
|
|
|
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
|
|
|
|
|
long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0);
|
|
|
|
|
if (callDate != 0 && phoneNumber != null) {
|
|
|
|
@ -262,12 +252,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onResume() {
|
|
|
|
|
super.onResume();
|
|
|
|
|
initNoteScreen();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initNoteScreen() {
|
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
@ -300,7 +292,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
long time = System.currentTimeMillis();
|
|
|
|
|
if (time > mWorkingNote.getAlertDate()) {
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString(
|
|
|
|
|
mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS));
|
|
|
|
|
}
|
|
|
|
@ -312,12 +305,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onNewIntent(Intent intent) {
|
|
|
|
|
super.onNewIntent(intent);
|
|
|
|
|
initActivityState(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
@ -332,7 +325,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
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
|
|
|
|
@ -357,7 +349,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
if (ev.getX() < x
|
|
|
|
|
|| ev.getX() > (x + view.getWidth())
|
|
|
|
|
|| ev.getY() < y
|
|
|
|
|
|| ev.getY() > (y + view.getHeight())) {
|
|
|
|
|
|| ev.getY() > (y + view.getHeight()))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
@ -405,7 +398,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
clearSettingState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateWidget() {
|
|
|
|
|
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
|
|
|
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
|
|
|
|
@ -425,6 +417,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
setResult(RESULT_OK, intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
int id = v.getId();
|
|
|
|
|
if (id == R.id.btn_set_bg_color) {
|
|
|
|
@ -472,14 +465,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onBackgroundColorChanged() {
|
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
|
View.VISIBLE);
|
|
|
|
|
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
|
|
|
|
|
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
|
|
if (isFinishing()) {
|
|
|
|
@ -504,13 +495,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
|
if (itemId == R.id.menu_new_note) {
|
|
|
|
|
createNewNote();
|
|
|
|
|
} else if (itemId == R.id.menu_delete) {
|
|
|
|
|
}
|
|
|
|
|
else if (itemId == R.id.menu_delete) {
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
|
builder.setTitle(getString(R.string.alert_title_delete));
|
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
|
|
|
@ -548,11 +539,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
d.setOnDateTimeSetListener(new OnDateTimeSetListener() {
|
|
|
|
|
public void OnDateTimeSet(AlertDialog dialog, long date) {
|
|
|
|
|
mWorkingNote.setAlertDate(date , true);
|
|
|
|
|
//选择提醒的日期
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
d.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Share note to apps that support {@link Intent#ACTION_SEND} action
|
|
|
|
|
* and {@text/plain} type
|
|
|
|
@ -563,7 +556,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
intent.setType("text/plain");
|
|
|
|
|
context.startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createNewNote() {
|
|
|
|
|
// Firstly, save current editing notes
|
|
|
|
|
saveNote();
|
|
|
|
@ -575,7 +567,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mWorkingNote.getFolderId());
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void deleteCurrentNote() {
|
|
|
|
|
if (mWorkingNote.existInDatabase()) {
|
|
|
|
|
HashSet<Long> ids = new HashSet<Long>();
|
|
|
|
@ -597,11 +588,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
mWorkingNote.markDeleted(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isSyncMode() {
|
|
|
|
|
return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onClockAlertChanged(long date, boolean set) {
|
|
|
|
|
/**
|
|
|
|
|
* User could set clock to an unsaved note, so before setting the
|
|
|
|
@ -631,11 +620,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
showToast(R.string.error_note_empty_for_clock);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onWidgetChanged() {
|
|
|
|
|
updateWidget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onEditTextDelete(int index, String text) {
|
|
|
|
|
int childCount = mEditTextList.getChildCount();
|
|
|
|
|
if (childCount == 1) {
|
|
|
|
@ -661,7 +648,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
edit.requestFocus();
|
|
|
|
|
edit.setSelection(length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onEditTextEnter(int index, String text) {
|
|
|
|
|
/**
|
|
|
|
|
* Should not happen, check for debug
|
|
|
|
@ -680,7 +666,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
.setIndex(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void switchToListMode(String text) {
|
|
|
|
|
mEditTextList.removeAllViews();
|
|
|
|
|
String[] items = text.split("\n");
|
|
|
|
@ -697,7 +682,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
mNoteEditor.setVisibility(View.GONE);
|
|
|
|
|
mEditTextList.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Spannable getHighlightQueryResult(String fullText, String userQuery) {
|
|
|
|
|
SpannableString spannable = new SpannableString(fullText == null ? "" : fullText);
|
|
|
|
|
if (!TextUtils.isEmpty(userQuery)) {
|
|
|
|
@ -714,7 +698,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
}
|
|
|
|
|
return spannable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@ -745,7 +728,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
edit.setText(getHighlightQueryResult(item, mUserQuery));
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onTextChange(int index, boolean hasText) {
|
|
|
|
|
if (index >= mEditTextList.getChildCount()) {
|
|
|
|
|
Log.e(TAG, "Wrong index, should not happen");
|
|
|
|
@ -761,43 +743,59 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
public void onCheckListModeChanged(int oldMode, int newMode) {
|
|
|
|
|
if (newMode == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
switchToListMode(mNoteEditor.getText().toString());
|
|
|
|
|
//检查模式切换到列表模式
|
|
|
|
|
} else {
|
|
|
|
|
if (!getWorkingText()) {
|
|
|
|
|
mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ",
|
|
|
|
|
""));
|
|
|
|
|
}
|
|
|
|
|
//若是获取到文本就改变其检查标记
|
|
|
|
|
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
|
|
|
|
|
mEditTextList.setVisibility(View.GONE);
|
|
|
|
|
mNoteEditor.setVisibility(View.VISIBLE);
|
|
|
|
|
//修改文本编辑器的内容和可见性
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean getWorkingText() {
|
|
|
|
|
boolean hasChecked = false;
|
|
|
|
|
//初始化check标记
|
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
|
// 若模式为CHECK_LIST
|
|
|
|
|
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())) {
|
|
|
|
|
//若文本不为空
|
|
|
|
|
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");
|
|
|
|
|
//扩展字符串添加未打钩
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mWorkingNote.setWorkingText(sb.toString());
|
|
|
|
|
//利用编辑好的字符串设置运行便签的内容
|
|
|
|
|
} else {
|
|
|
|
|
mWorkingNote.setWorkingText(mNoteEditor.getText().toString());
|
|
|
|
|
// 若不是该模式直接用编辑器中的内容设置运行中标签的内容
|
|
|
|
|
}
|
|
|
|
|
return hasChecked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 函数功能:保存便签
|
|
|
|
|
* 函数实现:如下注释
|
|
|
|
|
*/
|
|
|
|
|
private boolean saveNote() {
|
|
|
|
|
getWorkingText();
|
|
|
|
|
boolean saved = mWorkingNote.saveNote();
|
|
|
|
|
//运行 getWorkingText()之后保存
|
|
|
|
|
if (saved) {
|
|
|
|
|
/**
|
|
|
|
|
* There are two modes from List view to edit view, open one note,
|
|
|
|
@ -806,6 +804,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
* new node requires to the top of the list. This code
|
|
|
|
|
* {@link #RESULT_OK} is used to identify the create/edit state
|
|
|
|
|
*/
|
|
|
|
|
//如英文注释所说链接RESULT_OK是为了识别保存的2种情况,一是创建后保存,二是修改后保存
|
|
|
|
|
setResult(RESULT_OK);
|
|
|
|
|
}
|
|
|
|
|
return saved;
|
|
|
|
@ -845,18 +844,16 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
showToast(R.string.error_note_empty_for_send_to_desktop);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String makeShortcutIconTitle(String content) {
|
|
|
|
|
content = content.replace(TAG_CHECKED, "");
|
|
|
|
|
content = content.replace(TAG_UNCHECKED, "");
|
|
|
|
|
return content.length() > SHORTCUT_ICON_TITLE_MAX_LEN ? content.substring(0,
|
|
|
|
|
SHORTCUT_ICON_TITLE_MAX_LEN) : content;
|
|
|
|
|
//直接设置为content中的内容并返回,有勾选和未勾选2种
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showToast(int resId) {
|
|
|
|
|
showToast(resId, Toast.LENGTH_SHORT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showToast(int resId, int duration) {
|
|
|
|
|
Toast.makeText(this, resId, duration).show();
|
|
|
|
|
}
|
|
|
|
|