涂鸦功能上线啦O(∩_∩)O

lrx_branch
LiuRuiXuan 2 years ago
parent 8bd0e44d87
commit 8384c5a9c3

@ -1,25 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="net.micode.notes" package="net.micode.notes"
android:versionCode="1" android:versionCode="1"
android:versionName="0.1" > android:versionName="0.1">
<uses-sdk android:minSdkVersion="14" /> <uses-sdk android:minSdkVersion="14" />
@ -35,46 +19,49 @@
<application <application
android:icon="@drawable/icon_app" android:icon="@drawable/icon_app"
android:label="@string/app_name" > android:label="@string/app_name">
<activity <activity
android:name=".ui.NotesListActivity" android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:uiOptions="splitActionBarWhenNarrow" android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan" > android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".ui.NoteEditActivity" android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" > android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<intent-filter android:scheme="http"> <intent-filter android:scheme="http">
<action android:name="android.intent.action.VIEW" <action
android:name="android.intent.action.VIEW"
tools:ignore="AppLinkUrlError" /> tools:ignore="AppLinkUrlError" />
<category android:name="android.intent.category.DEFAULT"
<category
android:name="android.intent.category.DEFAULT"
tools:ignore="AppLinkUrlError" /> tools:ignore="AppLinkUrlError" />
<data android:mimeType="vnd.android.cursor.item/text_note" /> <data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" /> <data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" /> <action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" /> <data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" /> <data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
@ -82,15 +69,17 @@
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable" /> android:resource="@xml/searchable" />
</activity> </activity>
<activity android:name=".ui.MyPaintToolsActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
</activity>
<provider <provider
android:name="net.micode.notes.data.NotesProvider" android:name=".data.NotesProvider"
android:authorities="micode_notes" android:authorities="micode_notes"
android:multiprocess="true" /> android:multiprocess="true" />
<receiver <receiver
android:name=".widget.NoteWidgetProvider_2x" android:name=".widget.NoteWidgetProvider_2x"
android:label="@string/app_widget2x2" > android:label="@string/app_widget2x2">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" /> <action android:name="android.appwidget.action.APPWIDGET_DELETED" />
@ -103,8 +92,7 @@
</receiver> </receiver>
<receiver <receiver
android:name=".widget.NoteWidgetProvider_4x" android:name=".widget.NoteWidgetProvider_4x"
android:label="@string/app_widget4x4" > android:label="@string/app_widget4x4">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" /> <action android:name="android.appwidget.action.APPWIDGET_DELETED" />
@ -115,39 +103,33 @@
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_4x_info" /> android:resource="@xml/widget_4x_info" />
</receiver> </receiver>
<receiver android:name=".ui.AlarmInitReceiver">
<receiver android:name=".ui.AlarmInitReceiver" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name="net.micode.notes.ui.AlarmReceiver" android:name=".ui.AlarmReceiver"
android:process=":remote" > android:process=":remote"></receiver>
</receiver>
<activity <activity
android:name=".ui.AlarmAlertActivity" android:name=".ui.AlarmAlertActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" > android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar"></activity>
</activity>
<activity <activity
android:name="net.micode.notes.ui.NotesPreferenceActivity" android:name=".ui.NotesPreferenceActivity"
android:label="@string/preferences_title" android:label="@string/preferences_title"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" > android:theme="@android:style/Theme.Holo.Light"></activity>
</activity>
<service <service
android:name="net.micode.notes.gtask.remote.GTaskSyncService" android:name=".gtask.remote.GTaskSyncService"
android:exported="true" > android:exported="true"></service>
</service>
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".ui.NoteEditActivity" /> android:value=".ui.NoteEditActivity" />
</application> </application>
</manifest> </manifest>

@ -165,6 +165,7 @@ public class Notes {
* <P> Type : INTEGER (long) </P> * <P> Type : INTEGER (long) </P>
*/ */
public static final String VERSION = "version"; public static final String VERSION = "version";
public static final String IMAGE="image";
} }
public interface DataColumns { public interface DataColumns {

@ -60,8 +60,9 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," + NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," + NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" + NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +","+
")"; NoteColumns.IMAGE + " BLOB DEFAULT NULL"+
")";
private static final String CREATE_DATA_TABLE_SQL = private static final String CREATE_DATA_TABLE_SQL =
"CREATE TABLE " + TABLE.DATA + "(" + "CREATE TABLE " + TABLE.DATA + "(" +

@ -61,6 +61,7 @@ public class WorkingNote {
private boolean mIsDeleted; private boolean mIsDeleted;
private NoteSettingChangedListener mNoteSettingStatusListener; private NoteSettingChangedListener mNoteSettingStatusListener;
private byte[] image;
public static final String[] DATA_PROJECTION = new String[] { public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID, DataColumns.ID,
@ -82,7 +83,6 @@ public class WorkingNote {
}; };
private static final int DATA_ID_COLUMN = 0; private static final int DATA_ID_COLUMN = 0;
private static final int DATA_CONTENT_COLUMN = 1; private static final int DATA_CONTENT_COLUMN = 1;
private static final int DATA_MIME_TYPE_COLUMN = 2; private static final int DATA_MIME_TYPE_COLUMN = 2;
@ -150,10 +150,11 @@ public class WorkingNote {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] { DataColumns.NOTE_ID + "=?", new String[] {
String.valueOf(mNoteId) String.valueOf(mNoteId)
}, null); }, null);//调用Content Providers Api接口来获取ContentResolver对象,读取对应文件的数据,就相当于一个数据库
//这里是根据这个便签的id来查找其中string中存储了当前的这个便签的id
if (cursor != null) { if (cursor != null) {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {//是否存在
do { do {
String type = cursor.getString(DATA_MIME_TYPE_COLUMN); String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
if (DataConstants.NOTE.equals(type)) { if (DataConstants.NOTE.equals(type)) {
@ -165,11 +166,11 @@ public class WorkingNote {
} else { } else {
Log.d(TAG, "Wrong note type with type:" + type); Log.d(TAG, "Wrong note type with type:" + type);
} }
} while (cursor.moveToNext()); } while (cursor.moveToNext());//只要没有找到
} }
cursor.close(); cursor.close();
} else { } else {
Log.e(TAG, "No data with id:" + mNoteId); Log.e(TAG, "No data with id:" + mNoteId);//打印日志信息
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId); throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
} }
} }
@ -183,20 +184,20 @@ public class WorkingNote {
return note; return note;
} }
public static WorkingNote load(Context context, long id) { public static WorkingNote load(Context context, long id) {//根据id找到对应的便签
return new WorkingNote(context, id, 0); return new WorkingNote(context, id, 0);
} }
public synchronized boolean saveNote() { public synchronized boolean saveNote() {
if (isWorthSaving()) { if (isWorthSaving()) {//如果值得保存的话就保存
if (!existInDatabase()) { if (!existInDatabase()) {//是否在database中存在
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) { if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {//创建新的笔记如果创建新的笔记过程中发生异常那么此语句就执行直接返回false
Log.e(TAG, "Create new note fail with id:" + mNoteId); Log.e(TAG, "Create new note fail with id:" + mNoteId);
return false; return false;
} }
} }
mNote.syncNote(mContext, mNoteId); mNote.syncNote(mContext, mNoteId);//将新添加的内容和当前id对应的小米便签进行同步
/** /**
* Update widget content if there exist any widget of this note * Update widget content if there exist any widget of this note
@ -206,17 +207,17 @@ public class WorkingNote {
&& mNoteSettingStatusListener != null) { && mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged(); mNoteSettingStatusListener.onWidgetChanged();
} }
return true; return true;//当前widgetId合法并且类型和法才进行改变
} else { } else {
return false; return false;
} }
} }
public boolean existInDatabase() { public boolean existInDatabase() {//如果数据库中的id小于等于0就代表该id不合法也就是说这个便签不存在于数据库中
return mNoteId > 0; return mNoteId > 0;
} }
private boolean isWorthSaving() { private boolean isWorthSaving() {//如果当前文件是要进行删除的文件则没有必要保存,不在数据库中也不需要保存,如果内容为空也不用保存,已经在数据库中存在也不需要保存,如果没有改变内容也不需要保存
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent)) if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|| (existInDatabase() && !mNote.isLocalModified())) { || (existInDatabase() && !mNote.isLocalModified())) {
return false; return false;
@ -229,8 +230,8 @@ public class WorkingNote {
mNoteSettingStatusListener = l; mNoteSettingStatusListener = l;
} }
public void setAlertDate(long date, boolean set) { public void setAlertDate(long date, boolean set) {//设置更改日期
if (date != mAlertDate) { if (date != mAlertDate) {//如果时间不相同
mAlertDate = date; mAlertDate = date;
mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate)); mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate));
} }
@ -239,30 +240,30 @@ public class WorkingNote {
} }
} }
public void markDeleted(boolean mark) { public void markDeleted(boolean mark) {//mark为1代表要删除为0代表不删除
mIsDeleted = mark; mIsDeleted = mark;//将对应属性标记为删除
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) { && mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged(); mNoteSettingStatusListener.onWidgetChanged();
} }//如果当前便签的mwidgetid合法类型合法就改变对应的数据
} }
public void setBgColorId(int id) { public void setBgColorId(int id) {//设置颜色id
if (id != mBgColorId) { if (id != mBgColorId) {//只有当要改的颜色不同的时候才执行该语句
mBgColorId = id; mBgColorId = id;
if (mNoteSettingStatusListener != null) { if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onBackgroundColorChanged(); mNoteSettingStatusListener.onBackgroundColorChanged();//改变颜色
} }
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id)); mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));//更新当前便签的颜色属性值
} }
} }
public void setCheckListMode(int mode) { public void setCheckListMode(int mode) {//设置对应的模式
if (mMode != mode) { if (mMode != mode) {
if (mNoteSettingStatusListener != null) { if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode); mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
} }
mMode = mode; mMode = mode;//更改模式
mNote.setTextData(TextNote.MODE, String.valueOf(mMode)); mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
} }
} }
@ -287,6 +288,10 @@ public class WorkingNote {
mNote.setTextData(DataColumns.CONTENT, mContent); mNote.setTextData(DataColumns.CONTENT, mContent);
} }
} }
public void setImage(byte[]image)
{
this.image=image;
}
public void convertToCallNote(String phoneNumber, long callDate) { public void convertToCallNote(String phoneNumber, long callDate) {
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate)); mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
@ -341,6 +346,7 @@ public class WorkingNote {
public int getWidgetType() { public int getWidgetType() {
return mWidgetType; return mWidgetType;
} }
public byte[] getImage(){return image;}
public interface NoteSettingChangedListener { public interface NoteSettingChangedListener {
/** /**

@ -142,7 +142,7 @@ public class ResourceParser {
} }
private final static int [] BG_4X_RESOURCES = new int [] { private final static int [] BG_4X_RESOURCES = new int [] {
R.drawable.widget_4x_yellow, R.drawable.widget_4x_yellow,//widget用来设置图标或者背景可以用来绘制图形
R.drawable.widget_4x_blue, R.drawable.widget_4x_blue,
R.drawable.widget_4x_white, R.drawable.widget_4x_white,
R.drawable.widget_4x_green, R.drawable.widget_4x_green,
@ -151,7 +151,7 @@ public class ResourceParser {
public static int getWidget4xBgResource(int id) { public static int getWidget4xBgResource(int id) {
return BG_4X_RESOURCES[id]; return BG_4X_RESOURCES[id];
} }//获取对应的颜色
} }
public static class TextAppearanceResources { public static class TextAppearanceResources {

@ -27,9 +27,11 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Paint; import android.graphics.Paint;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
@ -65,6 +67,7 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x; import net.micode.notes.widget.NoteWidgetProvider_4x;
import java.io.ByteArrayOutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -72,8 +75,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class NoteEditActivity extends Activity implements OnClickListener, public class NoteEditActivity extends AppCompatActivity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener { NoteSettingChangedListener, OnTextViewChangeListener {
private static final int REQUEST_CODE = 8848;
private class HeadViewHolder { private class HeadViewHolder {
public TextView tvModified; public TextView tvModified;
@ -132,7 +137,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private View mNoteEditorPanel; private View mNoteEditorPanel;
private WorkingNote mWorkingNote; public WorkingNote mWorkingNote;
private SharedPreferences mSharedPrefs; private SharedPreferences mSharedPrefs;
private int mFontSizeId; private int mFontSizeId;
@ -273,40 +278,40 @@ public class NoteEditActivity extends Activity implements OnClickListener,
.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);//找到当前键的值也就是id并隐藏背景选择器选中的背景图
} }
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());//在头部显示标题
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId()); mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());//在背景显示对应的背景颜色
mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this, mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this,
mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_YEAR)); | DateUtils.FORMAT_SHOW_YEAR));//将修改时间文本视图中的数据写入标题
/** /**
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker * TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
* is not ready * is not ready
*/ */
showAlertHeader(); showAlertHeader();//决定是否显示提醒的表头
} }
private void showAlertHeader() { private void showAlertHeader() {
if (mWorkingNote.hasClockAlert()) { if (mWorkingNote.hasClockAlert()) {//如果有时间提醒
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();//获得当前的时间
if (time > mWorkingNote.getAlertDate()) { if (time > mWorkingNote.getAlertDate()) {//如果超过时间提醒
mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired); mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired);//设置提醒日期文本视图为过期显示内容
} else { } else {
mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString( mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString(//显示距离提示还有多长时间
mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS)); mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS));
} }
mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE); mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE);//显示提醒日期
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE); mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE);//显示提醒图标
} else { } else {//没有时间提醒就隐藏对应的提醒标志
mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE); mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE);
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE); mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE);
}; };
@ -326,75 +331,75 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* generate a id. If the editing note is not worth saving, there * generate a id. If the editing note is not worth saving, there
* is no id which is equivalent to create new note * is no id which is equivalent to create new note
*/ */
if (!mWorkingNote.existInDatabase()) { if (!mWorkingNote.existInDatabase()) {//如果数据库没有就进行保存
saveNote(); saveNote();
} }
outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId()); outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId());//初始化
Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState"); Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState");//显示对应id信息和保存成功
} }
@Override @Override
public boolean dispatchTouchEvent(MotionEvent ev) { public boolean dispatchTouchEvent(MotionEvent ev) {//笔记编辑器的触摸事件
if (mNoteBgColorSelector.getVisibility() == View.VISIBLE if (mNoteBgColorSelector.getVisibility() == View.VISIBLE
&& !inRangeOfView(mNoteBgColorSelector, ev)) { && !inRangeOfView(mNoteBgColorSelector, ev)) {//如果不在背景颜色选择器的触摸范围之内,并且背景选择器是可视化的
mNoteBgColorSelector.setVisibility(View.GONE); mNoteBgColorSelector.setVisibility(View.GONE);//将背景选择器隐藏起来
return true; return true;
} }
if (mFontSizeSelector.getVisibility() == View.VISIBLE if (mFontSizeSelector.getVisibility() == View.VISIBLE//判断字体大小选择器是否显示,并且是否在改变字体大小的控制范围内
&& !inRangeOfView(mFontSizeSelector, ev)) { && !inRangeOfView(mFontSizeSelector, ev)) {
mFontSizeSelector.setVisibility(View.GONE); mFontSizeSelector.setVisibility(View.GONE);//将其隐藏起来
return true; return true;
} }
return super.dispatchTouchEvent(ev); return super.dispatchTouchEvent(ev);
} }
private boolean inRangeOfView(View view, MotionEvent ev) { private boolean inRangeOfView(View view, MotionEvent ev) {
int []location = new int[2]; int []location = new int[2];//获取位置
view.getLocationOnScreen(location); view.getLocationOnScreen(location);//获取鼠标所在屏幕的左上角对应位置
int x = location[0]; int x = location[0];//横坐标
int y = location[1]; int y = location[1];//纵坐标
if (ev.getX() < x if (ev.getX() < x
|| ev.getX() > (x + view.getWidth()) || ev.getX() > (x + view.getWidth())
|| ev.getY() < y || ev.getY() < y
|| ev.getY() > (y + view.getHeight())) { || ev.getY() > (y + view.getHeight())) {
return false; return false;
} }//ev.getX获取了触摸事件的横坐标getY则是获取纵坐标该判断语句就是判断触摸事件的横纵坐标在该视图的外部
return true; return true;//在管辖范畴内
} }
private void initResources() { private void initResources() {
mHeadViewPanel = findViewById(R.id.note_title); mHeadViewPanel = findViewById(R.id.note_title);//获取对应id的视图
mNoteHeaderHolder = new HeadViewHolder(); mNoteHeaderHolder = new HeadViewHolder();//实例化头部信息
mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date); mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date);//把修改日期视图封装在mNoteHeaderHolder中
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon); mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);//把提醒图标视图封装在对象中
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); 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);//将背景颜色选择器捆绑给mNoteBgColorSelector中
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);//获取默认的共享偏好
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.
* The id may larger than the length of resources, in this case, * The id may larger than the length of resources, in this case,
* return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE} * return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE}
*/ */
if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) { if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) {//如果设置的字体大小的id超过了限制那么就重新调回默认的字体大小
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
@ -402,72 +407,72 @@ public class NoteEditActivity extends Activity implements OnClickListener,
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() {//更新widget
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) {//更新到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) {//更新到4x大小
intent.setClass(this, NoteWidgetProvider_4x.class); intent.setClass(this, NoteWidgetProvider_4x.class);
} else { } else {
Log.e(TAG, "Unspported widget type"); Log.e(TAG, "Unspported widget type");
return; return;
} }
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {//把对应id附加上去
mWorkingNote.getWidgetId() mWorkingNote.getWidgetId()
}); });
sendBroadcast(intent); sendBroadcast(intent);//让widget进行刷新操作从而实现数据同步
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();//获取id号
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)) {//如果是背景选择按钮包含此id
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.GONE); View.GONE);//将选择视图关闭
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);//将选择字体大小的视图关闭
mFontSizeId = sFontSizeBtnsMap.get(id); mFontSizeId = sFontSizeBtnsMap.get(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() {
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) {//判断字体大小是否可见
mFontSizeSelector.setVisibility(View.GONE); mFontSizeSelector.setVisibility(View.GONE);//关闭
return true; return true;
} }
return false; return false;
@ -475,89 +480,103 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public void onBackgroundColorChanged() { public void onBackgroundColorChanged() {
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.VISIBLE); View.VISIBLE);//找到对应颜色的id并进行视图显示
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 {
menu.findItem(R.id.menu_delete_remind).setVisible(false); menu.findItem(R.id.menu_delete_remind).setVisible(false);//菜单删除提醒关闭
} }
return true; return true;
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {//根据选项的id号进行对应的选择
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);//设置删除的图标
builder.setMessage(getString(R.string.alert_message_delete_note)); builder.setMessage(getString(R.string.alert_message_delete_note));//提示要不要删除
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();
} }
}); });
builder.setNegativeButton(android.R.string.cancel, null); builder.setNegativeButton(android.R.string.cancel, null);//不确定
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;
case R.id.menu_Graffiti:
Intent intent = new Intent(this, MyPaintToolsActivity.class);
if (mWorkingNote.getImage() != null) {
intent.putExtra("Bitmap", mWorkingNote.getImage());
}
startActivityForResult(intent, REQUEST_CODE);
break; break;
default: default:
break; break;
} }
return true; return true;
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
mWorkingNote.setImage(data.getByteArrayExtra("result"));
}
}
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);//设置信息
} }
}); });
d.show(); d.show();
@ -568,10 +587,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* and {@text/plain} type * and {@text/plain} type
*/ */
private void sendTo(Context context, String info) { private void sendTo(Context context, String info) {
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);//代表发送一个文本信息
intent.putExtra(Intent.EXTRA_TEXT, info); intent.putExtra(Intent.EXTRA_TEXT, info);//向intend中加入文本信息
intent.setType("text/plain"); intent.setType("text/plain");//文本类型
context.startActivity(intent); context.startActivity(intent);//启动这个intent也就是发送信息
} }
private void createNewNote() { private void createNewNote() {
@ -580,36 +599,36 @@ public class NoteEditActivity extends Activity implements OnClickListener,
// For safety, start a new NoteEditActivity // For safety, start a new NoteEditActivity
finish(); finish();
Intent intent = new Intent(this, NoteEditActivity.class); Intent intent = new Intent(this, NoteEditActivity.class);//新建一个intent
intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.setAction(Intent.ACTION_INSERT_OR_EDIT);//设置为编辑或者插入
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mWorkingNote.getFolderId()); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mWorkingNote.getFolderId());//给id
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>();
long id = mWorkingNote.getNoteId(); long id = mWorkingNote.getNoteId();
if (id != Notes.ID_ROOT_FOLDER) { if (id != Notes.ID_ROOT_FOLDER) {//如果不是无效值
ids.add(id); ids.add(id);//加入
} else { } else {
Log.d(TAG, "Wrong note id, should not happen"); Log.d(TAG, "Wrong note id, should not happen");//不存在这样的便签id
} }
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) {
@ -617,19 +636,19 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* User could set clock to an unsaved note, so before setting the * User could set clock to an unsaved note, so before setting the
* alert clock, we should save the note first * alert clock, we should save the note first
*/ */
if (!mWorkingNote.existInDatabase()) { if (!mWorkingNote.existInDatabase()) {//如果不在数据库中
saveNote(); saveNote();//保存
} }
if (mWorkingNote.getNoteId() > 0) { if (mWorkingNote.getNoteId() > 0) {//如果id为有效id
Intent intent = new Intent(this, AlarmReceiver.class); Intent intent = new Intent(this, AlarmReceiver.class);//新建intent
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);//设置触发intent
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 {
/** /**
@ -647,162 +666,162 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} }
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) {//如果只有一个孩子
return; return;
} }
for (int i = index + 1; i < childCount; i++) { for (int i = index + 1; i < childCount; i++) {
((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text))
.setIndex(i - 1); .setIndex(i - 1);//将index后的文本往前移动
} }
mEditTextList.removeViewAt(index); mEditTextList.removeViewAt(index);//把对应下标的列表内容删除
NoteEditText edit = null; NoteEditText edit = null;
if(index == 0) { if(index == 0) {//如果下标是0那么就获取第一个标签
edit = (NoteEditText) mEditTextList.getChildAt(0).findViewById( edit = (NoteEditText) mEditTextList.getChildAt(0).findViewById(
R.id.et_edit_text); R.id.et_edit_text);
} else { } else {//否则就是下标减一,因为删除了一个元素
edit = (NoteEditText) mEditTextList.getChildAt(index - 1).findViewById( edit = (NoteEditText) mEditTextList.getChildAt(index - 1).findViewById(
R.id.et_edit_text); R.id.et_edit_text);
} }
int length = edit.length(); int length = edit.length();
edit.append(text); edit.append(text);//把对应的文本内容加入
edit.requestFocus(); edit.requestFocus();//获取焦点
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
*/ */
if(index > mEditTextList.getChildCount()) { if(index > mEditTextList.getChildCount()) {//如果输入的下标大于孩子的数量,越界访问
Log.e(TAG, "Index out of mEditTextList boundrary, should not happen"); Log.e(TAG, "Index out of mEditTextList boundrary, should not happen");
} }
View view = getListItem(text, index); View view = getListItem(text, index);//获取对应下标的列表物品的视图
mEditTextList.addView(view, index); mEditTextList.addView(view, index);//把对应下标的视图放到编辑文本的列表中
NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);//
edit.requestFocus(); edit.requestFocus();//获取编辑文本的焦点
edit.setSelection(0); edit.setSelection(0);//设置光标到最开始的位置
for (int i = index + 1; i < mEditTextList.getChildCount(); i++) { for (int i = index + 1; i < mEditTextList.getChildCount(); i++) {//保证NoteEditText的索引值和列表元素的实际位置一致
((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text))
.setIndex(i); .setIndex(i);
} }
} }
private void switchToListMode(String text) { private void switchToListMode(String text) {
mEditTextList.removeAllViews(); mEditTextList.removeAllViews();//关掉所有的视图
String[] items = text.split("\n"); String[] items = text.split("\n");//将对应的文本据回车分开
int index = 0; int index = 0;
for (String item : items) { for (String item : items) {//遍历里面的元素
if(!TextUtils.isEmpty(item)) { if(!TextUtils.isEmpty(item)) {//如果对应文本不是空
mEditTextList.addView(getListItem(item, index)); mEditTextList.addView(getListItem(item, index));//增加一个视图,并标上下标
index++; index++;//到达下一个
} }
} }
mEditTextList.addView(getListItem("", index)); mEditTextList.addView(getListItem("", index));//用于添加新的列表项目
mEditTextList.getChildAt(index).findViewById(R.id.et_edit_text).requestFocus(); mEditTextList.getChildAt(index).findViewById(R.id.et_edit_text).requestFocus();//请求焦点
mNoteEditor.setVisibility(View.GONE); mNoteEditor.setVisibility(View.GONE);//将便签编辑器取消
mEditTextList.setVisibility(View.VISIBLE); mEditTextList.setVisibility(View.VISIBLE);//将便文本列表显示出来
} }
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)) {//到达下一个位置
spannable.setSpan( spannable.setSpan(
new BackgroundColorSpan(this.getResources().getColor( new BackgroundColorSpan(this.getResources().getColor(
R.color.user_query_highlight)), m.start(), m.end(), R.color.user_query_highlight)), m.start(), m.end(),
Spannable.SPAN_INCLUSIVE_EXCLUSIVE); Spannable.SPAN_INCLUSIVE_EXCLUSIVE);//设置对应得高亮模式
start = m.end(); start = m.end();//更新扫描得开始位置
} }
} }
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);//找到对应id得控件对象
edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId));//设置文本形式
CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item)); CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item));//根据id找到对应的多选框
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {//监听复选框的变化
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {//勾选了对应的复选框
edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);//加上对应的删除线
} else { } else {//取消了勾选
edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);//删除对应的删除线
} }
} }
}); });
if (item.startsWith(TAG_CHECKED)) { if (item.startsWith(TAG_CHECKED)) {//如果该列表项已经被勾选了
cb.setChecked(true); cb.setChecked(true);//设置为选中状态
edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);//
item = item.substring(TAG_CHECKED.length(), item.length()).trim(); item = item.substring(TAG_CHECKED.length(), item.length()).trim();//修剪掉对应的空格
} else if (item.startsWith(TAG_UNCHECKED)) { } else if (item.startsWith(TAG_UNCHECKED)) {
cb.setChecked(false); cb.setChecked(false);
edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);//未勾选状态
item = item.substring(TAG_UNCHECKED.length(), item.length()).trim(); item = item.substring(TAG_UNCHECKED.length(), item.length()).trim();//去除TAG_UNCHECKED前缀
} }
edit.setOnTextViewChangeListener(this); edit.setOnTextViewChangeListener(this);//给当前事件捆绑监听器
edit.setIndex(index); edit.setIndex(index);
edit.setText(getHighlightQueryResult(item, mUserQuery)); edit.setText(getHighlightQueryResult(item, mUserQuery));//对用户的查询显示高亮
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");
return; return;
} }
if(hasText) { if(hasText) {//决定左侧检查框是否显示,如果是有文本的,获取对应位置的子控件
mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.VISIBLE); mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.VISIBLE);//将对应的多选框筛查出来
} else { } else {
mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE); mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE);
} }
} }
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());//转化为列表模式
} else { } else {
if (!getWorkingText()) { if (!getWorkingText()) {
mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ", mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ",
"")); ""));
} }
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery)); mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));//
mEditTextList.setVisibility(View.GONE); mEditTextList.setVisibility(View.GONE);//
mNoteEditor.setVisibility(View.VISIBLE); mNoteEditor.setVisibility(View.VISIBLE);//
} }
} }
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) {//如果是勾选列表模式
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < mEditTextList.getChildCount(); i++) { for (int i = 0; i < mEditTextList.getChildCount(); i++) {
View view = mEditTextList.getChildAt(i); View view = mEditTextList.getChildAt(i);//获取对应构件
NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
if (!TextUtils.isEmpty(edit.getText())) { if (!TextUtils.isEmpty(edit.getText())) {//获取输入框的内容
if (((CheckBox) view.findViewById(R.id.cb_edit_item)).isChecked()) { if (((CheckBox) view.findViewById(R.id.cb_edit_item)).isChecked()) {//如果当前的遍历的多选框被勾选了
sb.append(TAG_CHECKED).append(" ").append(edit.getText()).append("\n"); sb.append(TAG_CHECKED).append(" ").append(edit.getText()).append("\n");//将该信息加入到sb中
hasChecked = true; hasChecked = true;
} else { } else {
sb.append(TAG_UNCHECKED).append(" ").append(edit.getText()).append("\n"); sb.append(TAG_UNCHECKED).append(" ").append(edit.getText()).append("\n");//没有勾选
} }
} }
} }
mWorkingNote.setWorkingText(sb.toString()); mWorkingNote.setWorkingText(sb.toString());//将其转化为String类
} else { } else {
mWorkingNote.setWorkingText(mNoteEditor.getText().toString()); mWorkingNote.setWorkingText(mNoteEditor.getText().toString());//设置文本内容
} }
return hasChecked; return hasChecked;//存在勾选的选项
} }
private boolean saveNote() { private boolean saveNote() {
@ -833,19 +852,19 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (mWorkingNote.getNoteId() > 0) { if (mWorkingNote.getNoteId() > 0) {
Intent sender = new Intent(); Intent sender = new Intent();
Intent shortcutIntent = new Intent(this, NoteEditActivity.class); Intent shortcutIntent = new Intent(this, NoteEditActivity.class);//表示点击桌面快捷方式需要启动的activity
shortcutIntent.setAction(Intent.ACTION_VIEW); shortcutIntent.setAction(Intent.ACTION_VIEW);
shortcutIntent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId()); shortcutIntent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId());
sender.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); sender.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
sender.putExtra(Intent.EXTRA_SHORTCUT_NAME, sender.putExtra(Intent.EXTRA_SHORTCUT_NAME,
makeShortcutIconTitle(mWorkingNote.getContent())); makeShortcutIconTitle(mWorkingNote.getContent()));//表示快捷方式的名字
sender.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, sender.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(this, R.drawable.icon_app)); Intent.ShortcutIconResource.fromContext(this, R.drawable.icon_app));//快捷方式的图标
sender.putExtra("duplicate", true); sender.putExtra("duplicate", true);
sender.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); sender.setAction("com.android.launcher.action.INSTALL_SHORTCUT");//拟定发送的广播类型
showToast(R.string.info_note_enter_desktop); showToast(R.string.info_note_enter_desktop);
sendBroadcast(sender); sendBroadcast(sender);//创建对应的快捷方式
} else { } else {//对应的便签不存在
/** /**
* There is the condition that user has input nothing (the note is * There is the condition that user has input nothing (the note is
* not worthy saving), we have no note id, remind the user that he * not worthy saving), we have no note id, remind the user that he
@ -857,17 +876,17 @@ 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, "");
return content.length() > SHORTCUT_ICON_TITLE_MAX_LEN ? content.substring(0, return content.length() > SHORTCUT_ICON_TITLE_MAX_LEN ? content.substring(0,
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();//在指定时间内显示对应的信息
} }
} }

@ -31,6 +31,7 @@ import android.database.Cursor;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -78,7 +79,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashSet; import java.util.HashSet;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener { public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener {
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0; private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1; private static final int FOLDER_LIST_QUERY_TOKEN = 1;

@ -58,7 +58,7 @@
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/bg_btn_set_color" /> android:background="@drawable/bg_btn_set_color" />
</LinearLayout> </LinearLayout>
@ -76,12 +76,12 @@
<ScrollView <ScrollView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_height="616dp"
android:layout_gravity="left|top"
android:layout_weight="1" android:layout_weight="1"
android:scrollbars="none" android:fadingEdgeLength="0dip"
android:overScrollMode="never" android:overScrollMode="never"
android:layout_gravity="left|top" android:scrollbars="none">
android:fadingEdgeLength="0dip">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -91,20 +91,20 @@
android:id="@+id/note_edit_view" android:id="@+id/note_edit_view"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="left|top"
android:background="@null"
android:autoLink="all" android:autoLink="all"
android:background="@null"
android:gravity="left|top"
android:lineSpacingMultiplier="1.2"
android:linksClickable="false" android:linksClickable="false"
android:minLines="12" android:minLines="12"
android:textAppearance="@style/TextAppearancePrimaryItem" android:textAppearance="@style/TextAppearancePrimaryItem" />
android:lineSpacingMultiplier="1.2" />
<LinearLayout <LinearLayout
android:id="@+id/note_edit_list" android:id="@+id/note_edit_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="-10dip" android:layout_marginLeft="-10dip"
android:orientation="vertical"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

@ -15,7 +15,8 @@
limitations under the License. limitations under the License.
--> -->
<menu <menu xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
@ -45,4 +46,13 @@
<item <item
android:id="@+id/menu_delete_remind" android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" /> android:title="@string/menu_remove_remind" />
<item android:title="Item" />
<item
android:id="@+id/menu_Graffiti"
android:title="@string/Graffiti" />
<item
android:id="@+id/app_bar_search"
android:title="Search"
app:actionViewClass="android.widget.SearchView" />
</menu> </menu>

@ -45,7 +45,9 @@
<item <item
android:id="@+id/menu_alert" android:id="@+id/menu_alert"
android:title="@string/menu_alert" /> android:title="@string/menu_alert" />
<item
android:id="@+id/menu_Graffiti"
android:title="@string/Graffiti" />
<item <item
android:id="@+id/menu_delete_remind" android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" /> android:title="@string/menu_remove_remind" />

@ -15,8 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android" <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Notes</string> <string name="app_name">Notes</string>
<string name="app_widget2x2">Notes 2x2</string> <string name="app_widget2x2">Notes 2x2</string>
<string name="app_widget4x4">Notes 4x4</string> <string name="app_widget4x4">Notes 4x4</string>
@ -126,10 +125,11 @@
<string name="search">Notes</string> <string name="search">Notes</string>
<string name="datetime_dialog_ok">set</string> <string name="datetime_dialog_ok">set</string>
<string name="datetime_dialog_cancel">cancel</string> <string name="datetime_dialog_cancel">cancel</string>
<string name="Graffiti">Graffiti</string>
<plurals name="search_results_title"> <plurals name="search_results_title">
<item quantity="one"><xliff:g id="number" example="1">%1$s</xliff:g> result for \"<xliff:g id="search" example="???">%2$s</xliff:g>\"</item> <item quantity="one"><xliff:g example="1" id="number">%1$s</xliff:g> result for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item>
<!-- Case of 0 or 2 or more results. --> <!-- Case of 0 or 2 or more results. -->
<item quantity="other"><xliff:g id="number" example="15">%1$s</xliff:g> results for \"<xliff:g id="search" example="???">%2$s</xliff:g>\"</item> <item quantity="other"><xliff:g example="15" id="number">%1$s</xliff:g> results for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item>
</plurals> </plurals>
</resources> </resources>

Loading…
Cancel
Save