diff --git a/Notes-master/.idea/.gitignore b/Notes-master/.idea/.gitignore
deleted file mode 100644
index 35410ca..0000000
--- a/Notes-master/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# 默认忽略的文件
-/shelf/
-/workspace.xml
-# 基于编辑器的 HTTP 客户端请求
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/Notes-master/.idea/misc.xml b/Notes-master/.idea/misc.xml
deleted file mode 100644
index 639900d..0000000
--- a/Notes-master/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Notes-master/.idea/modules.xml b/Notes-master/.idea/modules.xml
deleted file mode 100644
index 7800270..0000000
--- a/Notes-master/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Notes-master/Notes-master.iml b/Notes-master/Notes-master.iml
deleted file mode 100644
index 0c84021..0000000
--- a/Notes-master/Notes-master.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Notes-master/Notes-master/.gitignore b/Notes-master/Notes-master/.gitignore
deleted file mode 100644
index 7df8dff..0000000
--- a/Notes-master/Notes-master/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-# generated files
-bin/
-gen/
-
-# Local configuration file (sdk path, etc)
-project.properties
-.settings/
-.classpath
-.project
diff --git a/Notes-master/Notes-master/NOTICE b/Notes-master/Notes-master/NOTICE
deleted file mode 100644
index 9a54521..0000000
--- a/Notes-master/Notes-master/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/Notes-master/Notes-master/README b/Notes-master/Notes-master/README
deleted file mode 100644
index fc0d824..0000000
--- a/Notes-master/Notes-master/README
+++ /dev/null
@@ -1,23 +0,0 @@
-[中文]
-
-1. MiCode便签是小米便签的社区开源版,由MIUI团队(www.miui.com) 发起并贡献第一批代码,遵循NOTICE文件所描述的开源协议,
- 今后为MiCode社区(www.micode.net) 拥有,并由社区发布和维护。
-
-2. Bug反馈和跟踪,请访问Github,
- https://github.com/MiCode/Notes/issues?sort=created&direction=desc&state=open
-
-3. 功能建议和综合讨论,请访问MiCode,
- http://micode.net/forum.php?mod=forumdisplay&fid=38
-
-
-[English]
-
-1. MiCode Notes is open source edition of XM notepad, it's first initiated and sponsored by MIUI team (www.miui.com).
- It's opened under license described by NOTICE file. It's owned by the MiCode community (www.micode.net). In future,
- the MiCode community will release and maintain this project.
-
-2. Regarding issue tracking, please visit Github,
- https://github.com/MiCode/Notes/issues?sort=created&direction=desc&state=open
-
-3. Regarding feature request and general discussion, please visit Micode forum,
- http://micode.net/forum.php?mod=forumdisplay&fid=38
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png b/Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png
deleted file mode 100644
index 08d8644..0000000
Binary files a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png and /dev/null differ
diff --git a/NotesMaster/.gitignore b/NotesMaster/.gitignore
new file mode 100644
index 0000000..2a08bc8
--- /dev/null
+++ b/NotesMaster/.gitignore
@@ -0,0 +1,5 @@
+/.gradle/
+/.idea/
+/app/build/
+/gradle/wrapper/gradle-wrapper.jar
+/local.properties
diff --git a/NotesMaster/README.md b/NotesMaster/README.md
new file mode 100644
index 0000000..b3bbdb2
--- /dev/null
+++ b/NotesMaster/README.md
@@ -0,0 +1,2 @@
+# MayWeSeeYouAgian
+
diff --git a/NotesMaster/app/build.gradle b/NotesMaster/app/build.gradle
new file mode 100644
index 0000000..7438e65
--- /dev/null
+++ b/NotesMaster/app/build.gradle
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 33
+ buildToolsVersion "33.0.2"
+
+ defaultConfig {
+ applicationId "net.micode.notes"
+ minSdkVersion 33
+ //noinspection ExpiredTargetSdkVersion
+ targetSdkVersion 33
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+
+ }
+
+ dependencies {
+ implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version: '5.2.1'
+ implementation group: 'androidx.appcompat', name: 'appcompat', version: '1.6.0'
+ implementation 'com.google.android.material:material:1.7.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'com.android.support:support-annotations:28.0.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
+ }
+
+ packagingOptions {
+ exclude 'META-INF/*'
+ }
+}
+
diff --git a/Notes-master/Notes-master/AndroidManifest.xml b/NotesMaster/app/src/main/AndroidManifest.xml
similarity index 75%
rename from Notes-master/Notes-master/AndroidManifest.xml
rename to NotesMaster/app/src/main/AndroidManifest.xml
index e5c7d47..40fe148 100644
--- a/Notes-master/Notes-master/AndroidManifest.xml
+++ b/NotesMaster/app/src/main/AndroidManifest.xml
@@ -16,13 +16,13 @@
-->
-
-
-
+
+
@@ -32,17 +32,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:theme="@style/AppTheme.Base"
+ android:label="@string/app_name"
+ android:requestLegacyExternalStorage="true"
+ >
+ android:windowSoftInputMode="adjustPan"
+ >
@@ -51,12 +70,15 @@
+ android:theme="@style/Theme.AppCompat.Light"
+ >
-
+
@@ -86,6 +108,7 @@
android:multiprocess="true" />
@@ -99,6 +122,7 @@
android:resource="@xml/widget_2x_info" />
@@ -113,7 +137,7 @@
android:resource="@xml/widget_4x_info" />
-
+
@@ -126,9 +150,8 @@
+ android:theme="@android:style/Theme.Black" >
-
-
+
+
+
+
Type : INTEGER (long)
*/
public static final String VERSION = "version";
+
+ public static final String LOCKED = "lock_type";
}
public interface DataColumns {
@@ -206,35 +214,35 @@ public class Notes {
/**
- * Generic data column, the meaning is {@link #MIMETYPE} specific, used for
+ * Generic data column, the meaning is specific, used for
* integer data type
*
Type: INTEGER
*/
public static final String DATA1 = "data1";
/**
- * Generic data column, the meaning is {@link #MIMETYPE} specific, used for
+ * Generic data column, the meaning is specific, used for
* integer data type
*
Type: INTEGER
*/
public static final String DATA2 = "data2";
/**
- * Generic data column, the meaning is {@link #MIMETYPE} specific, used for
+ * Generic data column, the meaning is specific, used for
* TEXT data type
*
Type: TEXT
*/
public static final String DATA3 = "data3";
/**
- * Generic data column, the meaning is {@link #MIMETYPE} specific, used for
+ * Generic data column, the meaning is specific, used for
* TEXT data type
*
Type: TEXT
*/
public static final String DATA4 = "data4";
/**
- * Generic data column, the meaning is {@link #MIMETYPE} specific, used for
+ * Generic data column, the meaning is specific, used for
* TEXT data type
*
Type: TEXT
*/
diff --git a/Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
similarity index 55%
rename from Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java
rename to NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
index ffe5d57..7fb3222 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
@@ -28,7 +28,7 @@ import net.micode.notes.data.Notes.NoteColumns;
public class NotesDatabaseHelper extends SQLiteOpenHelper {
- private static final String DB_NAME = "note.db";
+ private static final String DB_NAME = "note4.db";
private static final int DB_VERSION = 4;
@@ -43,168 +43,169 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
private static NotesDatabaseHelper mInstance;
private static final String CREATE_NOTE_TABLE_SQL =
- "CREATE TABLE " + TABLE.NOTE + "(" +
- NoteColumns.ID + " INTEGER PRIMARY KEY," +
- NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
- NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
- NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," +
- NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," +
- NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
- NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +
- ")";
+ "CREATE TABLE " + TABLE.NOTE + "(" +
+ NoteColumns.ID + " INTEGER PRIMARY KEY," +
+ NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
+ NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
+ NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," +
+ NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," +
+ NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.LOCKED + " TEXT NOT NULL DEFAULT '"+Notes.UNLOCKED+"'," +
+ NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
+ NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +
+ ")";
private static final String CREATE_DATA_TABLE_SQL =
- "CREATE TABLE " + TABLE.DATA + "(" +
- DataColumns.ID + " INTEGER PRIMARY KEY," +
- DataColumns.MIME_TYPE + " TEXT NOT NULL," +
- DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," +
- NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
- NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
- DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," +
- DataColumns.DATA1 + " INTEGER," +
- DataColumns.DATA2 + " INTEGER," +
- DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
- DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
- DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
- ")";
+ "CREATE TABLE " + TABLE.DATA + "(" +
+ DataColumns.ID + " INTEGER PRIMARY KEY," +
+ DataColumns.MIME_TYPE + " TEXT NOT NULL," +
+ DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
+ NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
+ DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," +
+ DataColumns.DATA1 + " INTEGER," +
+ DataColumns.DATA2 + " INTEGER," +
+ DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
+ DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
+ DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
+ ")";
private static final String CREATE_DATA_NOTE_ID_INDEX_SQL =
- "CREATE INDEX IF NOT EXISTS note_id_index ON " +
- TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";
+ "CREATE INDEX IF NOT EXISTS note_id_index ON " +
+ TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";
/**
* Increase folder's note count when move note to the folder
*/
private static final String NOTE_INCREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER =
- "CREATE TRIGGER increase_folder_count_on_update "+
- " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
- " BEGIN " +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
- " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
- " END";
+ "CREATE TRIGGER increase_folder_count_on_update "+
+ " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
+ " BEGIN " +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
+ " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
+ " END";
/**
* Decrease folder's note count when move note from folder
*/
private static final String NOTE_DECREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER =
- "CREATE TRIGGER decrease_folder_count_on_update " +
- " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
- " BEGIN " +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
- " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
- " AND " + NoteColumns.NOTES_COUNT + ">0" + ";" +
- " END";
+ "CREATE TRIGGER decrease_folder_count_on_update " +
+ " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
+ " BEGIN " +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
+ " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
+ " AND " + NoteColumns.NOTES_COUNT + ">0" + ";" +
+ " END";
/**
* Increase folder's note count when insert new note to the folder
*/
private static final String NOTE_INCREASE_FOLDER_COUNT_ON_INSERT_TRIGGER =
- "CREATE TRIGGER increase_folder_count_on_insert " +
- " AFTER INSERT ON " + TABLE.NOTE +
- " BEGIN " +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
- " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
- " END";
+ "CREATE TRIGGER increase_folder_count_on_insert " +
+ " AFTER INSERT ON " + TABLE.NOTE +
+ " BEGIN " +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
+ " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
+ " END";
/**
* Decrease folder's note count when delete note from the folder
*/
private static final String NOTE_DECREASE_FOLDER_COUNT_ON_DELETE_TRIGGER =
- "CREATE TRIGGER decrease_folder_count_on_delete " +
- " AFTER DELETE ON " + TABLE.NOTE +
- " BEGIN " +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
- " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
- " AND " + NoteColumns.NOTES_COUNT + ">0;" +
- " END";
+ "CREATE TRIGGER decrease_folder_count_on_delete " +
+ " AFTER DELETE ON " + TABLE.NOTE +
+ " BEGIN " +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
+ " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
+ " AND " + NoteColumns.NOTES_COUNT + ">0;" +
+ " END";
/**
* Update note's content when insert data with type {@link DataConstants#NOTE}
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_INSERT_TRIGGER =
- "CREATE TRIGGER update_note_content_on_insert " +
- " AFTER INSERT ON " + TABLE.DATA +
- " WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
- " BEGIN" +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
- " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
- " END";
+ "CREATE TRIGGER update_note_content_on_insert " +
+ " AFTER INSERT ON " + TABLE.DATA +
+ " WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
+ " BEGIN" +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
+ " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
+ " END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has changed
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_UPDATE_TRIGGER =
- "CREATE TRIGGER update_note_content_on_update " +
- " AFTER UPDATE ON " + TABLE.DATA +
- " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
- " BEGIN" +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
- " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
- " END";
+ "CREATE TRIGGER update_note_content_on_update " +
+ " AFTER UPDATE ON " + TABLE.DATA +
+ " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
+ " BEGIN" +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
+ " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
+ " END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has deleted
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER =
- "CREATE TRIGGER update_note_content_on_delete " +
- " AFTER delete ON " + TABLE.DATA +
- " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
- " BEGIN" +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.SNIPPET + "=''" +
- " WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" +
- " END";
+ "CREATE TRIGGER update_note_content_on_delete " +
+ " AFTER delete ON " + TABLE.DATA +
+ " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
+ " BEGIN" +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.SNIPPET + "=''" +
+ " WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" +
+ " END";
/**
* Delete datas belong to note which has been deleted
*/
private static final String NOTE_DELETE_DATA_ON_DELETE_TRIGGER =
- "CREATE TRIGGER delete_data_on_delete " +
- " AFTER DELETE ON " + TABLE.NOTE +
- " BEGIN" +
- " DELETE FROM " + TABLE.DATA +
- " WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" +
- " END";
+ "CREATE TRIGGER delete_data_on_delete " +
+ " AFTER DELETE ON " + TABLE.NOTE +
+ " BEGIN" +
+ " DELETE FROM " + TABLE.DATA +
+ " WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" +
+ " END";
/**
* Delete notes belong to folder which has been deleted
*/
private static final String FOLDER_DELETE_NOTES_ON_DELETE_TRIGGER =
- "CREATE TRIGGER folder_delete_notes_on_delete " +
- " AFTER DELETE ON " + TABLE.NOTE +
- " BEGIN" +
- " DELETE FROM " + TABLE.NOTE +
- " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
- " END";
+ "CREATE TRIGGER folder_delete_notes_on_delete " +
+ " AFTER DELETE ON " + TABLE.NOTE +
+ " BEGIN" +
+ " DELETE FROM " + TABLE.NOTE +
+ " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
+ " END";
/**
* Move notes belong to folder which has been moved to trash folder
*/
private static final String FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER =
- "CREATE TRIGGER folder_move_notes_on_trash " +
- " AFTER UPDATE ON " + TABLE.NOTE +
- " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
- " BEGIN" +
- " UPDATE " + TABLE.NOTE +
- " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
- " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
- " END";
+ "CREATE TRIGGER folder_move_notes_on_trash " +
+ " AFTER UPDATE ON " + TABLE.NOTE +
+ " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
+ " BEGIN" +
+ " UPDATE " + TABLE.NOTE +
+ " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
+ " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
+ " END";
public NotesDatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
diff --git a/Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java
similarity index 92%
rename from Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java
rename to NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java
index edb0a60..71a1d47 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java
@@ -66,18 +66,18 @@ public class NotesProvider extends ContentProvider {
* we will trim '\n' and white space in order to show more information.
*/
private static final String NOTES_SEARCH_PROJECTION = NoteColumns.ID + ","
- + NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + ","
- + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + ","
- + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + ","
- + R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + ","
- + "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + ","
- + "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA;
+ + NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + ","
+ + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + ","
+ + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + ","
+ + R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + ","
+ + "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + ","
+ + "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA;
private static String NOTES_SNIPPET_SEARCH_QUERY = "SELECT " + NOTES_SEARCH_PROJECTION
- + " FROM " + TABLE.NOTE
- + " WHERE " + NoteColumns.SNIPPET + " LIKE ?"
- + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER
- + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE;
+ + " FROM " + TABLE.NOTE
+ + " WHERE " + NoteColumns.SNIPPET + " LIKE ?"
+ + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER
+ + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE;
@Override
public boolean onCreate() {
@@ -87,7 +87,7 @@ public class NotesProvider extends ContentProvider {
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
- String sortOrder) {
+ String sortOrder) {
Cursor c = null;
SQLiteDatabase db = mHelper.getReadableDatabase();
String id = null;
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/MetaData.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/MetaData.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/MetaData.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/MetaData.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/Node.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Node.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/Node.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Node.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java
similarity index 98%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java
index d3ec3be..2bf0273 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java
@@ -167,7 +167,7 @@ public class SqlData {
Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, null, null);
} else {
result = mContentResolver.update(ContentUris.withAppendedId(
- Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues,
+ Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues,
" ? in (SELECT " + NoteColumns.ID + " FROM " + TABLE.NOTE
+ " WHERE " + NoteColumns.VERSION + "=?)", new String[] {
String.valueOf(noteId), String.valueOf(version)
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java
similarity index 98%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java
index 79a4095..5d46d01 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java
@@ -171,7 +171,7 @@ public class SqlNote {
try {
c = mContentResolver.query(Notes.CONTENT_NOTE_URI, PROJECTION_NOTE, "(_id=?)",
new String[] {
- String.valueOf(id)
+ String.valueOf(id)
}, null);
if (c != null) {
c.moveToNext();
@@ -206,7 +206,7 @@ public class SqlNote {
try {
c = mContentResolver.query(Notes.CONTENT_DATA_URI, SqlData.PROJECTION_DATA,
"(note_id=?)", new String[] {
- String.valueOf(mId)
+ String.valueOf(mId)
}, null);
if (c != null) {
if (c.getCount() == 0) {
@@ -473,11 +473,11 @@ public class SqlNote {
if (!validateVersion) {
result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "("
+ NoteColumns.ID + "=?)", new String[] {
- String.valueOf(mId)
+ String.valueOf(mId)
});
} else {
result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "("
- + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)",
+ + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)",
new String[] {
String.valueOf(mId), String.valueOf(mVersion)
});
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/Task.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Task.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/Task.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Task.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/TaskList.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/TaskList.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/TaskList.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/TaskList.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
similarity index 96%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
index b3b61e7..7abccfd 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
@@ -59,7 +59,7 @@ public class GTaskASyncTask extends AsyncTask {
public void publishProgess(String message) {
publishProgress(new String[] {
- message
+ message
});
}
@@ -77,8 +77,7 @@ public class GTaskASyncTask extends AsyncTask {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0);
}
- notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
- pendingIntent);
+// notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, pendingIntent);
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
similarity index 84%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
index c67dfdf..199785f 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
@@ -32,33 +32,28 @@ import net.micode.notes.gtask.exception.NetworkFailureException;
import net.micode.notes.tool.GTaskStringUtils;
import net.micode.notes.ui.NotesPreferenceActivity;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.cookie.Cookie;
-import org.apache.http.impl.client.BasicCookieStore;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
+import org.apache.hc.client5.http.ClientProtocolException;
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.classic.methods.HttpPost;
+import org.apache.hc.client5.http.config.RequestConfig;
+import org.apache.hc.client5.http.cookie.BasicCookieStore;
+import org.apache.hc.client5.http.cookie.Cookie;
+import org.apache.hc.client5.http.cookie.CookieStore;
+import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
+import org.apache.hc.client5.http.impl.classic.BasicHttpClientResponseHandler;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClients;
+import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.http.message.BasicNameValuePair;
+import org.apache.hc.core5.util.Timeout;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import java.util.LinkedList;
import java.util.List;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
public class GTaskClient {
@@ -72,7 +67,7 @@ public class GTaskClient {
private static GTaskClient mInstance = null;
- private DefaultHttpClient mHttpClient;
+ private CloseableHttpClient mHttpClient;
private String mGetUrl;
@@ -143,8 +138,8 @@ public class GTaskClient {
int index = mAccount.name.indexOf('@') + 1;
String suffix = mAccount.name.substring(index);
url.append(suffix + "/");
- mGetUrl = url.toString() + "ig";
- mPostUrl = url.toString() + "r/ig";
+ mGetUrl = url + "ig";
+ mPostUrl = url + "r/ig";
if (tryToLoginGtask(activity, authToken)) {
mLoggedin = true;
@@ -226,25 +221,33 @@ public class GTaskClient {
}
private boolean loginGtask(String authToken) {
+ // 连接超时的毫秒数
int timeoutConnection = 10000;
- int timeoutSocket = 15000;
- HttpParams httpParameters = new BasicHttpParams();
- HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
- HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
- mHttpClient = new DefaultHttpClient(httpParameters);
- BasicCookieStore localBasicCookieStore = new BasicCookieStore();
- mHttpClient.setCookieStore(localBasicCookieStore);
- HttpProtocolParams.setUseExpectContinue(mHttpClient.getParams(), false);
+ // 响应超时的毫秒数
+ int timeoutResponse = 15000;
+ // 实例HttpClient对象
+ mHttpClient= HttpClients.createDefault();
+ // 设置请求配置
+ RequestConfig requestConfig=RequestConfig.custom()
+ .setConnectionRequestTimeout(Timeout.ofMilliseconds(timeoutConnection))
+ .setResponseTimeout(Timeout.ofMilliseconds(timeoutResponse))
+ .build();
+
// login gtask
try {
String loginUrl = mGetUrl + "?auth=" + authToken;
- HttpGet httpGet = new HttpGet(loginUrl);
- HttpResponse response = null;
- response = mHttpClient.execute(httpGet);
+ // 创建Get请求
+ HttpGet httpGet=new HttpGet(loginUrl);
+ httpGet.setConfig(requestConfig);
+ // 创建Cookie存储器
+ CookieStore cookieStore=new BasicCookieStore();
+ HttpClientContext httpClientContext=HttpClientContext.create();
+ httpClientContext.setCookieStore(cookieStore);
+ String resString = mHttpClient.execute(httpGet, httpClientContext,new BasicHttpClientResponseHandler());
// get the cookie now
- List cookies = mHttpClient.getCookieStore().getCookies();
+ List cookies = cookieStore.getCookies();
boolean hasAuthCookie = false;
for (Cookie cookie : cookies) {
if (cookie.getName().contains("GTL")) {
@@ -256,7 +259,6 @@ public class GTaskClient {
}
// get the client version
- String resString = getResponseContent(response.getEntity());
String jsBegin = "_setup(";
String jsEnd = ")}";
int begin = resString.indexOf(jsBegin);
@@ -291,37 +293,6 @@ public class GTaskClient {
return httpPost;
}
- private String getResponseContent(HttpEntity entity) throws IOException {
- String contentEncoding = null;
- if (entity.getContentEncoding() != null) {
- contentEncoding = entity.getContentEncoding().getValue();
- Log.d(TAG, "encoding: " + contentEncoding);
- }
-
- InputStream input = entity.getContent();
- if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) {
- input = new GZIPInputStream(entity.getContent());
- } else if (contentEncoding != null && contentEncoding.equalsIgnoreCase("deflate")) {
- Inflater inflater = new Inflater(true);
- input = new InflaterInputStream(entity.getContent(), inflater);
- }
-
- try {
- InputStreamReader isr = new InputStreamReader(input);
- BufferedReader br = new BufferedReader(isr);
- StringBuilder sb = new StringBuilder();
-
- while (true) {
- String buff = br.readLine();
- if (buff == null) {
- return sb.toString();
- }
- sb = sb.append(buff);
- }
- } finally {
- input.close();
- }
- }
private JSONObject postRequest(JSONObject js) throws NetworkFailureException {
if (!mLoggedin) {
@@ -331,14 +302,13 @@ public class GTaskClient {
HttpPost httpPost = createHttpPost();
try {
- LinkedList list = new LinkedList();
+ LinkedList list = new LinkedList<>();
list.add(new BasicNameValuePair("r", js.toString()));
- UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, "UTF-8");
+ UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, Charset.forName("utf8"));
httpPost.setEntity(entity);
// execute the post
- HttpResponse response = mHttpClient.execute(httpPost);
- String jsString = getResponseContent(response.getEntity());
+ String jsString = mHttpClient.execute(httpPost,new BasicHttpClientResponseHandler());
return new JSONObject(jsString);
} catch (ClientProtocolException e) {
@@ -517,11 +487,9 @@ public class GTaskClient {
try {
HttpGet httpGet = new HttpGet(mGetUrl);
- HttpResponse response = null;
- response = mHttpClient.execute(httpGet);
// get the task list
- String resString = getResponseContent(response.getEntity());
+ String resString = mHttpClient.execute(httpGet,new BasicHttpClientResponseHandler());
String jsBegin = "_setup(";
String jsEnd = ")}";
int begin = resString.indexOf(jsBegin);
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
similarity index 99%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
index d2b4082..73c80f0 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
@@ -219,7 +219,7 @@ public class GTaskManager {
if (name.startsWith(GTaskStringUtils.MIUI_FOLDER_PREFFIX)
&& !name.equals(GTaskStringUtils.MIUI_FOLDER_PREFFIX
- + GTaskStringUtils.FOLDER_META)) {
+ + GTaskStringUtils.FOLDER_META)) {
TaskList tasklist = new TaskList();
tasklist.setContentByRemoteJSON(object);
mGTaskListHashMap.put(gid, tasklist);
@@ -394,7 +394,7 @@ public class GTaskManager {
try {
c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(_id=?)",
new String[] {
- String.valueOf(Notes.ID_CALL_RECORD_FOLDER)
+ String.valueOf(Notes.ID_CALL_RECORD_FOLDER)
}, null);
if (c != null) {
if (c.moveToNext()) {
diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java
rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/model/Note.java b/NotesMaster/app/src/main/java/net/micode/notes/model/Note.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/model/Note.java
rename to NotesMaster/app/src/main/java/net/micode/notes/model/Note.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java b/NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java
similarity index 90%
rename from Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java
rename to NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java
index be081e4..3560ace 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java
@@ -38,7 +38,7 @@ public class WorkingNote {
// Note Id
private long mNoteId;
// Note content
- private String mContent;
+ public String mContent;
// Note mode
private int mMode;
@@ -60,6 +60,8 @@ public class WorkingNote {
private boolean mIsDeleted;
+ private boolean mIsLocked;
+
private NoteSettingChangedListener mNoteSettingStatusListener;
public static final String[] DATA_PROJECTION = new String[] {
@@ -78,7 +80,8 @@ public class WorkingNote {
NoteColumns.BG_COLOR_ID,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
- NoteColumns.MODIFIED_DATE
+ NoteColumns.MODIFIED_DATE,
+ NoteColumns.LOCKED,
};
private static final int DATA_ID_COLUMN = 0;
@@ -101,6 +104,11 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
+ private static final int NOTE_LOCKED_COLUMN = 6;
+
+ private static final String LOCKED = "locked";
+ private static final String UNLOCKED = "unlocked";
+
// New note construct
private WorkingNote(Context context, long folderId) {
mContext = context;
@@ -137,6 +145,8 @@ public class WorkingNote {
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
+
+ mIsLocked = !cursor.getString(NOTE_LOCKED_COLUMN).equals(UNLOCKED);
}
cursor.close();
} else {
@@ -149,7 +159,7 @@ public class WorkingNote {
private void loadNoteData() {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
- String.valueOf(mNoteId)
+ String.valueOf(mNoteId)
}, null);
if (cursor != null) {
@@ -175,7 +185,7 @@ public class WorkingNote {
}
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
- int widgetType, int defaultBgColorId) {
+ int widgetType, int defaultBgColorId) {
WorkingNote note = new WorkingNote(context, folderId);
note.setBgColorId(defaultBgColorId);
note.setWidgetId(widgetId);
@@ -217,12 +227,8 @@ public class WorkingNote {
}
private boolean isWorthSaving() {
- if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
- || (existInDatabase() && !mNote.isLocalModified())) {
- return false;
- } else {
- return true;
- }
+ return !mIsDeleted && (existInDatabase() || !TextUtils.isEmpty(mContent))
+ && (!existInDatabase() || mNote.isLocalModified());
}
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
@@ -243,7 +249,7 @@ public class WorkingNote {
mIsDeleted = mark;
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
- mNoteSettingStatusListener.onWidgetChanged();
+ mNoteSettingStatusListener.onWidgetChanged();
}
}
@@ -257,6 +263,17 @@ public class WorkingNote {
}
}
+ public void setLock(boolean lock) {
+ if (lock != mIsLocked) {
+ mIsLocked = lock;
+ if(lock){
+ mNote.setNoteValue(NoteColumns.LOCKED, LOCKED);
+ }else {
+ mNote.setNoteValue(NoteColumns.LOCKED, UNLOCKED);
+ }
+ }
+ }
+
public void setCheckListMode(int mode) {
if (mMode != mode) {
if (mNoteSettingStatusListener != null) {
@@ -295,7 +312,7 @@ public class WorkingNote {
}
public boolean hasClockAlert() {
- return (mAlertDate > 0 ? true : false);
+ return mAlertDate > 0;
}
public String getContent() {
@@ -342,6 +359,14 @@ public class WorkingNote {
return mWidgetType;
}
+ public boolean getIsLocked(){
+ return mIsLocked;
+ }
+
+ public void setIsLocked(boolean locked){
+ mIsLocked = locked;
+ }
+
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed
@@ -365,4 +390,5 @@ public class WorkingNote {
*/
void onCheckListModeChanged(int oldMode, int newMode);
}
+
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java
similarity index 99%
rename from Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java
rename to NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java
index 39f6ec4..c26472a 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java
@@ -143,7 +143,7 @@ public class BackupUtils {
// Query notes belong to this folder
Cursor notesCursor = mContext.getContentResolver().query(Notes.CONTENT_NOTE_URI,
NOTE_PROJECTION, NoteColumns.PARENT_ID + "=?", new String[] {
- folderId
+ folderId
}, null);
if (notesCursor != null) {
@@ -168,7 +168,7 @@ public class BackupUtils {
private void exportNoteToText(String noteId, PrintStream ps) {
Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI,
DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] {
- noteId
+ noteId
}, null);
if (dataCursor != null) {
diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java
similarity index 75%
rename from Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java
rename to NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java
index 2a14982..81b6bcc 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java
@@ -64,9 +64,7 @@ public class DataUtils {
return false;
}
return true;
- } catch (RemoteException e) {
- Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
- } catch (OperationApplicationException e) {
+ } catch (RemoteException | OperationApplicationException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
}
return false;
@@ -81,7 +79,7 @@ public class DataUtils {
}
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet ids,
- long folderId) {
+ long folderId) {
if (ids == null) {
Log.d(TAG, "the ids is null");
return true;
@@ -184,8 +182,8 @@ public class DataUtils {
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
- " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER +
- " AND " + NoteColumns.SNIPPET + "=?",
+ " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER +
+ " AND " + NoteColumns.SNIPPET + "=?",
new String[] { name }, null);
boolean exist = false;
if(cursor != null) {
@@ -197,6 +195,22 @@ public class DataUtils {
return exist;
}
+ public static boolean checkFolderId(ContentResolver resolver, long id) {
+ Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
+ NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
+ " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER +
+ " AND " + NoteColumns.ID + "=?",
+ new String[] { String.valueOf(id) }, null);
+ boolean exist = false;
+ if(cursor != null) {
+ if(cursor.getCount() > 0) {
+ exist = true;
+ }
+ cursor.close();
+ }
+ return exist;
+ }
+
public static HashSet getFolderNoteWidget(ContentResolver resolver, long folderId) {
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE },
@@ -247,7 +261,7 @@ public class DataUtils {
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
new String [] { CallNote.NOTE_ID },
CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL("
- + CallNote.PHONE_NUMBER + ",?)",
+ + CallNote.PHONE_NUMBER + ",?)",
new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber },
null);
@@ -282,6 +296,73 @@ public class DataUtils {
throw new IllegalArgumentException("Note is not found with id: " + noteId);
}
+ public static long getTrashIdByName(ContentResolver resolver, String name) {
+ Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
+ new String [] { NoteColumns.ID },
+ NoteColumns.SNIPPET + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER,
+ new String [] { name },
+ null);
+ if (cursor != null) {
+ long id = 0;
+ if (cursor.moveToFirst()) {
+ id = cursor.getLong(0);
+ }
+ cursor.close();
+ return id;
+ }
+ throw new IllegalArgumentException("getTrashIdByName is not found");
+ }
+
+ public static long getParentIdbyId(ContentResolver resolver,long id){
+ Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
+ new String [] { NoteColumns.PARENT_ID },
+ NoteColumns.ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER,
+ new String [] { String.valueOf(id) },
+ null);
+ if (cursor != null) {
+ long pid = 0;
+ if (cursor.moveToFirst()) {
+ pid = cursor.getLong(0);
+ }
+ cursor.close();
+ return pid;
+ }
+ throw new IllegalArgumentException("getParentIdbyId is not found");
+ }
+
+ public static HashSet getHasLockedByFolderId(ContentResolver resolver,long fid){
+ HashSet sset = new HashSet<>();
+ Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
+ new String [] { NoteColumns.LOCKED },
+ NoteColumns.PARENT_ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
+ new String [] { String.valueOf(fid) },
+ null);
+ if (cursor != null) {
+ if (cursor.moveToFirst()) {
+ do{
+ sset.add(cursor.getString(0));
+ } while (cursor.moveToNext());
+ }
+ cursor.close();
+ }
+
+ Cursor cursor2 = resolver.query(Notes.CONTENT_NOTE_URI,
+ new String [] { NoteColumns.ID },
+ NoteColumns.PARENT_ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER,
+ new String [] { String.valueOf(fid) },
+ null);
+ if (cursor2 != null) {
+ if(cursor2.moveToFirst()){
+ do{
+ HashSet tmp = getHasLockedByFolderId(resolver,cursor2.getLong(0));
+ sset.addAll(tmp);
+ } while (cursor2.moveToNext());
+ }
+ cursor2.close();
+ }
+ return sset;
+ }
+
public static String getFormattedSnippet(String snippet) {
if (snippet != null) {
snippet = snippet.trim();
diff --git a/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java
new file mode 100644
index 0000000..1429829
--- /dev/null
+++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java
@@ -0,0 +1,135 @@
+package net.micode.notes.tool;
+
+import android.annotation.TargetApi;
+import android.app.DialogFragment;
+import android.content.Context;
+import android.hardware.fingerprint.FingerprintManager;
+import android.os.Bundle;
+import android.os.CancellationSignal;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+
+import net.micode.notes.R;
+import net.micode.notes.ui.NotesListActivity;
+
+import javax.crypto.Cipher;
+
+@TargetApi(23)
+public class FingerprintDialogFragment extends DialogFragment {
+
+ private FingerprintManager fingerprintManager;
+
+ private CancellationSignal mCancellationSignal;
+
+ private Cipher mCipher;
+
+ private NotesListActivity mActivity;
+
+ private TextView errorMsg;
+
+ /**
+ * 标识是否是用户主动取消的认证。
+ */
+ private boolean isSelfCancelled;
+
+ public void setCipher(Cipher cipher) {
+ mCipher = cipher;
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ mActivity = (NotesListActivity) getActivity();
+ }
+
+
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ fingerprintManager = getContext().getSystemService(FingerprintManager.class);
+ setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog);
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.fingerprint_dialog, container, false);
+ errorMsg = v.findViewById(R.id.error_msg);
+ TextView cancel = v.findViewById(R.id.cancel);
+ cancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dismiss();
+ stopListening();
+ }
+ });
+ return v;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ // 开始指纹认证监听
+ startListening(mCipher);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ // 停止指纹认证监听
+ stopListening();
+ }
+
+ //监听认证成功与失败
+ private void startListening(Cipher cipher) {
+ isSelfCancelled = false;
+ mCancellationSignal = new CancellationSignal();
+ fingerprintManager.authenticate(new FingerprintManager.CryptoObject(cipher), mCancellationSignal, 0, new FingerprintManager.AuthenticationCallback() {
+ @Override
+ public void onAuthenticationError(int errorCode, CharSequence errString) {
+ if (!isSelfCancelled) {
+ errorMsg.setText(errString);
+ if (errorCode == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT) {
+ Toast.makeText(mActivity, errString, Toast.LENGTH_SHORT).show();
+ dismiss();
+ }
+ }
+ mActivity.onStopAuthenticated();
+ }
+
+ @Override
+ public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
+ errorMsg.setText(helpString);
+ }
+
+ @Override
+ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
+ Toast.makeText(mActivity, "指纹认证成功", Toast.LENGTH_SHORT).show();
+ mActivity.onAuthenticated();
+ dismiss();
+// mActivity.onAuthenticated();//认证成功后就可以写成功后的代码逻辑
+ }
+
+ @Override
+ public void onAuthenticationFailed() {
+ errorMsg.setText("指纹认证失败,请再试一次");
+ }
+ }, null);
+ }
+
+ private void stopListening() {
+ if (mCancellationSignal != null) {
+ mCancellationSignal.cancel();
+ mCancellationSignal = null;
+ isSelfCancelled = true;
+ }
+ mActivity.onStopAuthenticated();
+ }
+
+}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java
rename to NotesMaster/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java
similarity index 66%
rename from Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java
rename to NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java
index 1ad3ad6..2d574c3 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java
@@ -30,7 +30,7 @@ public class ResourceParser {
public static final int GREEN = 3;
public static final int RED = 4;
- public static final int BG_DEFAULT_COLOR = YELLOW;
+ public static final int BG_DEFAULT_COLOR = WHITE;
public static final int TEXT_SMALL = 0;
public static final int TEXT_MEDIUM = 1;
@@ -41,19 +41,19 @@ public class ResourceParser {
public static class NoteBgResources {
private final static int [] BG_EDIT_RESOURCES = new int [] {
- R.drawable.edit_yellow,
- R.drawable.edit_blue,
- R.drawable.edit_white,
- R.drawable.edit_green,
- R.drawable.edit_red
+ R.drawable.edit_yellow,
+ R.drawable.edit_blue,
+ R.drawable.edit_white,
+ R.drawable.edit_green,
+ R.drawable.edit_red
};
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
- R.drawable.edit_title_yellow,
- R.drawable.edit_title_blue,
- R.drawable.edit_title_white,
- R.drawable.edit_title_green,
- R.drawable.edit_title_red
+ R.drawable.edit_title_yellow,
+ R.drawable.edit_title_blue,
+ R.drawable.edit_title_white,
+ R.drawable.edit_title_green,
+ R.drawable.edit_title_red
};
public static int getNoteBgResource(int id) {
@@ -76,35 +76,35 @@ public class ResourceParser {
public static class NoteItemBgResources {
private final static int [] BG_FIRST_RESOURCES = new int [] {
- R.drawable.list_yellow_up,
- R.drawable.list_blue_up,
- R.drawable.list_white_up,
- R.drawable.list_green_up,
- R.drawable.list_red_up
+ R.drawable.list_yellow_up,
+ R.drawable.list_blue_up,
+ R.drawable.list_white_up,
+ R.drawable.list_green_up,
+ R.drawable.list_red_up
};
private final static int [] BG_NORMAL_RESOURCES = new int [] {
- R.drawable.list_yellow_middle,
- R.drawable.list_blue_middle,
- R.drawable.list_white_middle,
- R.drawable.list_green_middle,
- R.drawable.list_red_middle
+ R.drawable.list_yellow_middle,
+ R.drawable.list_blue_middle,
+ R.drawable.list_white_middle,
+ R.drawable.list_green_middle,
+ R.drawable.list_red_middle
};
private final static int [] BG_LAST_RESOURCES = new int [] {
- R.drawable.list_yellow_down,
- R.drawable.list_blue_down,
- R.drawable.list_white_down,
- R.drawable.list_green_down,
- R.drawable.list_red_down,
+ R.drawable.list_yellow_down,
+ R.drawable.list_blue_down,
+ R.drawable.list_white_down,
+ R.drawable.list_green_down,
+ R.drawable.list_red_down,
};
private final static int [] BG_SINGLE_RESOURCES = new int [] {
- R.drawable.list_yellow_single,
- R.drawable.list_blue_single,
- R.drawable.list_white_single,
- R.drawable.list_green_single,
- R.drawable.list_red_single
+ R.drawable.list_yellow_single,
+ R.drawable.list_blue_single,
+ R.drawable.list_white_single,
+ R.drawable.list_green_single,
+ R.drawable.list_red_single
};
public static int getNoteBgFirstRes(int id) {
@@ -125,41 +125,42 @@ public class ResourceParser {
public static int getFolderBgRes() {
return R.drawable.list_folder;
+// return R.drawable.listtest;
}
}
public static class WidgetBgResources {
private final static int [] BG_2X_RESOURCES = new int [] {
- R.drawable.widget_2x_yellow,
- R.drawable.widget_2x_blue,
- R.drawable.widget_2x_white,
- R.drawable.widget_2x_green,
- R.drawable.widget_2x_red,
+ R.drawable.widget_2x_yellow,
+ R.drawable.widget_2x_blue,
+ R.drawable.widget_2x_white,
+ R.drawable.widget_2x_green,
+ R.drawable.widget_2x_red,
};
public static int getWidget2xBgResource(int id) {
- return BG_2X_RESOURCES[id];
+ return BG_2X_RESOURCES[2];
}
private final static int [] BG_4X_RESOURCES = new int [] {
- R.drawable.widget_4x_yellow,
- R.drawable.widget_4x_blue,
- R.drawable.widget_4x_white,
- R.drawable.widget_4x_green,
- R.drawable.widget_4x_red
+ R.drawable.widget_4x_yellow,
+ R.drawable.widget_4x_blue,
+ R.drawable.widget_4x_white,
+ R.drawable.widget_4x_green,
+ R.drawable.widget_4x_red
};
public static int getWidget4xBgResource(int id) {
- return BG_4X_RESOURCES[id];
+ return BG_4X_RESOURCES[2];
}
}
public static class TextAppearanceResources {
private final static int [] TEXTAPPEARANCE_RESOURCES = new int [] {
- R.style.TextAppearanceNormal,
- R.style.TextAppearanceMedium,
- R.style.TextAppearanceLarge,
- R.style.TextAppearanceSuper
+ R.style.TextAppearanceNormal,
+ R.style.TextAppearanceMedium,
+ R.style.TextAppearanceLarge,
+ R.style.TextAppearanceSuper
};
public static int getTexAppearanceResource(int id) {
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
similarity index 61%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
index 85723be..b71e250 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
@@ -41,56 +41,75 @@ import java.io.IOException;
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
- private long mNoteId;
- private String mSnippet;
+ private long mNoteId;//文本在数据库存储中的ID号
+ private String mSnippet;//闹钟提示时出现的文本片段
private static final int SNIPPET_PREW_MAX_LEN = 60;
MediaPlayer mPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ //Bundle类型的数据与Map类型的数据相似,都是以key-value的形式存储数据的
+ //onsaveInstanceState方法是用来保存Activity的状态的
+ //能从onCreate的参数savedInsanceState中获得状态数据
requestWindowFeature(Window.FEATURE_NO_TITLE);
-
+ //界面显示——无标题
final Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
if (!isScreenOn()) {
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
+ //保持窗体点亮
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
+ //将窗体点亮
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
+ //允许窗体点亮时锁屏
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
+ //在手机锁屏后如果到了闹钟提示时间,点亮屏幕
}
Intent intent = getIntent();
try {
- mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
+ mNoteId = Long.parseLong(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
+ //根据ID从数据库中获取标签的内容;
+ //getContentResolver()是实现数据共享,实例存储。
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)
: mSnippet;
+ //判断标签片段是否达到符合长度
} catch (IllegalArgumentException e) {
e.printStackTrace();
return;
}
-
+ /*try
+ {
+ //代码区
+ }
+ catch(Exception e){
+ //异常处理
+ }
+ 代码区如果有错误,就会返回所写异常的处理。*/
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
- showActionDialog();
- playAlarmSound();
+ showActionDialog();//弹出对话框
+ playAlarmSound();//闹钟提示音激发
} else {
- finish();
+ finish();//完成闹钟动作
}
}
private boolean isScreenOn() {
+ //判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
return pm.isScreenOn();
}
private void playAlarmSound() {
+ //闹钟提示音激发
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
-
+ //调用系统的铃声管理URI,得到闹钟提示音
int silentModeStreams = Settings.System.getInt(getContentResolver(),
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
@@ -101,12 +120,19 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
}
try {
mPlayer.setDataSource(this, url);
+ //方法:setDataSource(Context context, Uri uri)
+ //解释:无返回值,设置多媒体数据来源【根据 Uri】
mPlayer.prepare();
+ //准备同步
mPlayer.setLooping(true);
+ //设置是否循环播放
mPlayer.start();
+ //开始播放
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ //e.printStackTrace()函数功能是抛出异常, 还将显示出更深的调用信息;
+ //System.out.println(e),这个方法打印出异常,并且输出在哪里出现的异常;
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -121,37 +147,48 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
private void showActionDialog() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
- dialog.setTitle(R.string.app_name);
- dialog.setMessage(mSnippet);
- dialog.setPositiveButton(R.string.notealert_ok, this);
+ //AlertDialog的构造方法全部是Protected的;
+ //所以不能直接通过new一个AlertDialog来创建出一个AlertDialog;
+ //要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法;
+ //如这里的dialog就是新建了一个AlertDialog;
+ dialog.setTitle(R.string.app_name);//为对话框设置标题
+ dialog.setMessage(mSnippet);//为对话框设置内容
+ dialog.setPositiveButton(R.string.notealert_ok, this);//给对话框添加"Yes"按钮
if (isScreenOn()) {
dialog.setNegativeButton(R.string.notealert_enter, this);
- }
+ }//对话框添加"No"按钮;
dialog.show().setOnDismissListener(this);
}
public void onClick(DialogInterface dialog, int which) {
- switch (which) {
+ switch (which) {//用which来选择click后下一步的操作
case DialogInterface.BUTTON_NEGATIVE:
+ //这是取消操作;
Intent intent = new Intent(this, NoteEditActivity.class);
+ //实现两个类间的数据传输;
intent.setAction(Intent.ACTION_VIEW);
+ //设置动作属性;
intent.putExtra(Intent.EXTRA_UID, mNoteId);
+ //实现key-value对;
+ //EXTRA_UID为key;mNoteId为键;
startActivity(intent);
+ //开始动作;
break;
default:
+ //这是确定操作;
break;
}
}
- public void onDismiss(DialogInterface dialog) {
- stopAlarmSound();
- finish();
+ public void onDismiss(DialogInterface dialog) {//忽略
+ stopAlarmSound();//停止闹钟声音
+ finish();//完成该动作
}
private void stopAlarmSound() {
if (mPlayer != null) {
- mPlayer.stop();
- mPlayer.release();
+ mPlayer.stop();//停止播放
+ mPlayer.release();//释放MediaPlayer对象
mPlayer = null;
}
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
similarity index 69%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
index f221202..bec850f 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
@@ -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.AlarmManager;
@@ -31,21 +15,25 @@ import net.micode.notes.data.Notes.NoteColumns;
public class AlarmInitReceiver extends BroadcastReceiver {
private static final String [] PROJECTION = new String [] {
- NoteColumns.ID,
- NoteColumns.ALERTED_DATE
+ NoteColumns.ID,
+ NoteColumns.ALERTED_DATE
};
-
+ //对数据库的操作,调用标签ID和闹钟时间;
private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1;
@Override
public void onReceive(Context context, Intent intent) {
long currentDate = System.currentTimeMillis();
+ //System.currentTimeMillis()产生一个当前的毫秒;
+ //这个毫秒其实就是自1970年1月1日0时起的毫秒数;
Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION,
NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
new String[] { String.valueOf(currentDate) },
+ //将long变量currentDate转化为字符串;
null);
+ //Cursor在这里的作用是通过查找数据库中的标签内容,找到和当前系统时间相等的标签;
if (c != null) {
if (c.moveToFirst()) {
@@ -53,7 +41,8 @@ public class AlarmInitReceiver extends BroadcastReceiver {
long alertDate = c.getLong(COLUMN_ALERTED_DATE);
Intent sender = new Intent(context, AlarmReceiver.class);
sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID)));
- PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0);
+
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, PendingIntent.FLAG_IMMUTABLE);
AlarmManager alermManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
alermManager.set(AlarmManager.RTC_WAKEUP, alertDate, pendingIntent);
@@ -61,5 +50,8 @@ public class AlarmInitReceiver extends BroadcastReceiver {
}
c.close();
}
+ //然而通过网上查找资料发现,对于闹钟机制的启动,通常需要上面的几个步骤;
+ //如新建Intent、PendingIntent以及AlarmManager等;
+ //这里就是根据数据库里的闹钟时间创建一个闹钟机制;
}
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java
similarity index 83%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java
index 54e503b..cacce64 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java
@@ -24,7 +24,10 @@ public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
intent.setClass(context, AlarmAlertActivity.class);
+ //启动AlarmAlertActivity
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ //activity要存在于activity的栈中,而非activity的途径启动activity时必然不存在一个activity的栈
+ //所以要新起一个栈装入启动的activity
context.startActivity(intent);
}
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java
similarity index 86%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java
index 496b0cd..02227df 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java
@@ -30,8 +30,10 @@ import android.widget.NumberPicker;
public class DateTimePicker extends FrameLayout {
+ //所有的子元素全部在屏幕的右上方
private static final boolean DEFAULT_ENABLE_STATE = true;
+ //初始化控件
private static final int HOURS_IN_HALF_DAY = 12;
private static final int HOURS_IN_ALL_DAY = 24;
private static final int DAYS_IN_ALL_WEEK = 7;
@@ -46,10 +48,14 @@ public class DateTimePicker extends FrameLayout {
private static final int AMPM_SPINNER_MIN_VAL = 0;
private static final int AMPM_SPINNER_MAX_VAL = 1;
+ //NumberPicker是数字选择器
+ //这里定义的四个变量全部是在设置闹钟时需要选择的变量(如日期、时、分、上午或者下午)
private final NumberPicker mDateSpinner;
private final NumberPicker mHourSpinner;
private final NumberPicker mMinuteSpinner;
private final NumberPicker mAmPmSpinner;
+
+ //定义了Calendar类型的变量mDate,用于操作时间
private Calendar mDate;
private String[] mDateDisplayValues = new String[DAYS_IN_ALL_WEEK];
@@ -66,46 +72,54 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
+ //OnValueChangeListener,这是时间改变监听器,这里主要是对日期的监听
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal);
+ //将现在日期的值传递给mDate;updateDateControl是同步操作
updateDateControl();
onDateTimeChanged();
}
};
+
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
+ //这里是对 小时(Hour) 的监听
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
boolean isDateChanged = false;
- Calendar cal = Calendar.getInstance();
+ Calendar cal = Calendar.getInstance(); //声明一个Calendar的变量cal,便于后续的操作
if (!mIs24HourView) {
if (!mIsAm && oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1);
isDateChanged = true;
+ //这里是对于12小时制时,晚上11点和12点交替时对日期的更改
} else if (mIsAm && oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1);
isDateChanged = true;
}
+ //这里是对于12小时制时,晚上11点和12点交替时对日期的更改
if (oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY ||
oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
mIsAm = !mIsAm;
updateAmPmControl();
- }
+ }//这里是对于12小时制时,中午11点和12点交替时对AM和PM的更改
} else {
if (oldVal == HOURS_IN_ALL_DAY - 1 && newVal == 0) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1);
isDateChanged = true;
+ //这里是对于24小时制时,晚上11点和12点交替时对日期的更改
} else if (oldVal == 0 && newVal == HOURS_IN_ALL_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1);
isDateChanged = true;
}
- }
- int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY);
+ } //这里是对于24小时制时,晚上11点和12点交替时对日期的更改
+ int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY); //通过数字选择器对newHour的赋值
mDate.set(Calendar.HOUR_OF_DAY, newHour);
+ //通过数字选择器对newHour的赋值
onDateTimeChanged();
if (isDateChanged) {
setCurrentYear(cal.get(Calendar.YEAR));
@@ -117,15 +131,19 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
+ //这里是对 分钟(Minute)改变的监听
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
int minValue = mMinuteSpinner.getMinValue();
int maxValue = mMinuteSpinner.getMaxValue();
int offset = 0;
+ //这里是对 分钟(Minute)改变的监听
if (oldVal == maxValue && newVal == minValue) {
offset += 1;
} else if (oldVal == minValue && newVal == maxValue) {
offset -= 1;
}
+ //如果原值为59,新值为0,则offset加1
+ //如果原值为0,新值为59,则offset减1
if (offset != 0) {
mDate.add(Calendar.HOUR_OF_DAY, offset);
mHourSpinner.setValue(getCurrentHour());
@@ -146,6 +164,7 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
+ //对AM和PM的监听
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm;
if (mIsAm) {
@@ -160,24 +179,26 @@ public class DateTimePicker extends FrameLayout {
public interface OnDateTimeChangedListener {
void onDateTimeChanged(DateTimePicker view, int year, int month,
- int dayOfMonth, int hourOfDay, int minute);
+ int dayOfMonth, int hourOfDay, int minute);
}
public DateTimePicker(Context context) {
this(context, System.currentTimeMillis());
}
-
+ //通过对数据库的访问,获取当前的系统时间
public DateTimePicker(Context context, long date) {
this(context, date, DateFormat.is24HourFormat(context));
- }
+ }//上面函数的得到的是一个天文数字(1970至今的秒数),需要DateFormat将其变得有意义
public DateTimePicker(Context context, long date, boolean is24HourView) {
- super(context);
+ super(context); //获取系统时间
mDate = Calendar.getInstance();
mInitialising = true;
mIsAm = getCurrentHourOfDay() >= HOURS_IN_HALF_DAY;
inflate(context, R.layout.datetime_picker, this);
-
+ //如果当前Activity里用到别的layout,比如对话框layout
+ //还要设置这个layout上的其他组件的内容,就必须用inflate()方法先将对话框的layout找出来
+ //然后再用findViewById()找到它上面的其它组件
mDateSpinner = (NumberPicker) findViewById(R.id.date);
mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL);
mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL);
@@ -237,9 +258,10 @@ public class DateTimePicker extends FrameLayout {
*
* @return the current date in millis
*/
+
public long getCurrentDateInTimeMillis() {
return mDate.getTimeInMillis();
- }
+ }//实现函数——得到当前的秒数
/**
* Set the current date
@@ -251,7 +273,7 @@ public class DateTimePicker extends FrameLayout {
cal.setTimeInMillis(date);
setCurrentDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE));
- }
+ }//实现函数功能——设置当前的时间,参数是date
/**
* Set the current date
@@ -263,13 +285,13 @@ public class DateTimePicker extends FrameLayout {
* @param minute The current minute
*/
public void setCurrentDate(int year, int month,
- int dayOfMonth, int hourOfDay, int minute) {
+ int dayOfMonth, int hourOfDay, int minute) {
setCurrentYear(year);
setCurrentMonth(month);
setCurrentDay(dayOfMonth);
setCurrentHour(hourOfDay);
setCurrentMinute(minute);
- }
+ }//实现函数功能——设置当前的时间,参数是各详细的变量
/**
* Get current year
@@ -446,7 +468,7 @@ public class DateTimePicker extends FrameLayout {
mDateSpinner.setDisplayedValues(mDateDisplayValues);
mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2);
mDateSpinner.invalidate();
- }
+ }// 对于星期几的算法
private void updateAmPmControl() {
if (mIs24HourView) {
@@ -456,7 +478,7 @@ public class DateTimePicker extends FrameLayout {
mAmPmSpinner.setValue(index);
mAmPmSpinner.setVisibility(View.VISIBLE);
}
- }
+ }// 对于星期几的算法
private void updateHourControl() {
if (mIs24HourView) {
@@ -466,7 +488,7 @@ public class DateTimePicker extends FrameLayout {
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW);
}
- }
+ }// 对于星期几的算法
/**
* Set the callback that indicates the 'Set' button has been pressed.
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
similarity index 69%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
index 2c47ba4..cf41fd5 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
@@ -31,10 +31,13 @@ import android.text.format.DateUtils;
public class DateTimePickerDialog extends AlertDialog implements OnClickListener {
- private Calendar mDate = Calendar.getInstance();
+ private Calendar mDate = Calendar.getInstance(); //创建一个Calendar类型的变量 mDate,方便时间的操作
+
private boolean mIs24HourView;
- private OnDateTimeSetListener mOnDateTimeSetListener;
+ private OnDateTimeSetListener mOnDateTimeSetListener; //声明一个时间日期滚动选择控件 mOnDateTimeSetListener
private DateTimePicker mDateTimePicker;
+ //DateTimePicker控件,控件一般用于让用户可以从日期列表中选择单个值。
+ //运行时,单击控件边上的下拉箭头,会显示为两个部分:一个下拉列表,一个用于选择日期的
public interface OnDateTimeSetListener {
void OnDateTimeSet(AlertDialog dialog, long date);
@@ -42,25 +45,29 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
public DateTimePickerDialog(Context context, long date) {
super(context);
+ //对该界面对话框的实例化
mDateTimePicker = new DateTimePicker(context);
+ //对该界面对话框的实例化
setView(mDateTimePicker);
+ //添加一个子视图
mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() {
public void onDateTimeChanged(DateTimePicker view, int year, int month,
- int dayOfMonth, int hourOfDay, int minute) {
+ int dayOfMonth, int hourOfDay, int minute) {
mDate.set(Calendar.YEAR, year);
mDate.set(Calendar.MONTH, month);
mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
mDate.set(Calendar.MINUTE, minute);
+ //将视图中的各选项设置为系统当前时间
updateTitle(mDate.getTimeInMillis());
}
});
- mDate.setTimeInMillis(date);
- mDate.set(Calendar.SECOND, 0);
+ mDate.setTimeInMillis(date); //得到系统时间
+ mDate.set(Calendar.SECOND, 0);//将秒数设置为0
mDateTimePicker.setCurrentDate(mDate.getTimeInMillis());
setButton(context.getString(R.string.datetime_dialog_ok), this);
- setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null);
- set24HourView(DateFormat.is24HourFormat(this.getContext()));
+ setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null); //设置按钮
+ set24HourView(DateFormat.is24HourFormat(this.getContext())); //时间标准化打印
updateTitle(mDate.getTimeInMillis());
}
@@ -70,21 +77,20 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
mOnDateTimeSetListener = callBack;
- }
+ } //时间标准化打印
private void updateTitle(long date) {
int flag =
- DateUtils.FORMAT_SHOW_YEAR |
- DateUtils.FORMAT_SHOW_DATE |
- DateUtils.FORMAT_SHOW_TIME;
+ DateUtils.FORMAT_SHOW_YEAR |
+ DateUtils.FORMAT_SHOW_DATE |
+ DateUtils.FORMAT_SHOW_TIME;
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
- }
+ } //android开发中常见日期管理工具类(API)——DateUtils:按照上下午显示时间
public void onClick(DialogInterface arg0, int arg1) {
if (mOnDateTimeSetListener != null) {
mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis());
}
- }
-
+ }//第一个参数arg0是接收到点击事件的对话框 第二个参数arg1是该对话框上的按钮
}
\ No newline at end of file
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java
similarity index 83%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java
index 613dc74..f2cc0e0 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java
@@ -29,15 +29,17 @@ import net.micode.notes.R;
public class DropdownMenu {
private Button mButton;
- private PopupMenu mPopupMenu;
+ private PopupMenu mPopupMenu; //声明一个下拉菜单
private Menu mMenu;
public DropdownMenu(Context context, Button button, int menuId) {
mButton = button;
- mButton.setBackgroundResource(R.drawable.dropdown_icon);
+ mButton.setBackgroundResource(R.drawable.dropdown_icon); //设置这个view的背景
mPopupMenu = new PopupMenu(context, mButton);
mMenu = mPopupMenu.getMenu();
mPopupMenu.getMenuInflater().inflate(menuId, mMenu);
+ //MenuInflater是用来实例化Menu目录下的Menu布局文件
+ //根据ID来确认menu的内容选项
mButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mPopupMenu.show();
@@ -48,14 +50,14 @@ public class DropdownMenu {
public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) {
if (mPopupMenu != null) {
mPopupMenu.setOnMenuItemClickListener(listener);
- }
+ }//设置菜单的监听
}
public MenuItem findItem(int id) {
return mMenu.findItem(id);
- }
+ }//对于菜单选项的初始化,根据索引搜索菜单需要的选项
public void setTitle(CharSequence title) {
mButton.setText(title);
- }
+ }//布局文件,设置标题
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
similarity index 79%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
index 96b77da..dfb5f8f 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
@@ -30,10 +30,14 @@ import net.micode.notes.data.Notes.NoteColumns;
public class FoldersListAdapter extends CursorAdapter {
+ //CursorAdapter是Cursor和ListView的接口
+ //FoldersListAdapter继承了CursorAdapter的类
+ //主要作用是便签数据库和用户的交互
+ //这里就是用folder(文件夹)的形式展现给用户
public static final String [] PROJECTION = {
- NoteColumns.ID,
- NoteColumns.SNIPPET
- };
+ NoteColumns.ID,
+ NoteColumns.SNIPPET
+ };//调用数据库中便签的ID和片段
public static final int ID_COLUMN = 0;
public static final int NAME_COLUMN = 1;
@@ -41,12 +45,13 @@ public class FoldersListAdapter extends CursorAdapter {
public FoldersListAdapter(Context context, Cursor c) {
super(context, c);
// TODO Auto-generated constructor stub
- }
+ }//数据库操作
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ //ViewGroup是容器
return new FolderListItem(context);
- }
+ }//创建一个文件夹,对于各文件夹中子标签的初始化
@Override
public void bindView(View view, Context context, Cursor cursor) {
@@ -55,20 +60,22 @@ public class FoldersListAdapter extends CursorAdapter {
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
((FolderListItem) view).bind(folderName);
}
- }
+ }//将各个布局文件绑定起来
public String getFolderName(Context context, int position) {
Cursor cursor = (Cursor) getItem(position);
return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
- }
+ }//根据数据库中标签的ID得到标签的各项内容
private class FolderListItem extends LinearLayout {
private TextView mName;
public FolderListItem(Context context) {
super(context);
+ //操作数据库
inflate(context, R.layout.folder_list_item, this);
+ //根据布局文件的名字等信息将其找出来
mName = (TextView) findViewById(R.id.tv_folder_name);
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
similarity index 64%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
index 96a9ff8..dcfa201 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java
@@ -16,25 +16,36 @@
package net.micode.notes.ui;
-import android.app.Activity;
+import android.Manifest;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.SearchManager;
import android.appwidget.AppWidgetManager;
+import android.content.ContentResolver;
import android.content.ContentUris;
+import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.graphics.Paint;
+import android.net.Uri;
import android.os.Bundle;
+import android.os.Environment;
import android.preference.PreferenceManager;
+import android.provider.DocumentsContract;
+import android.provider.MediaStore;
+import android.text.Editable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.BackgroundColorSpan;
+import android.text.style.ImageSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -47,11 +58,18 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.activity.result.ActivityResult;
+import androidx.activity.result.ActivityResultCallback;
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
+import androidx.appcompat.app.AppCompatActivity;
+
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.TextNote;
@@ -65,6 +83,7 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
+import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -72,8 +91,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class NoteEditActivity extends Activity implements OnClickListener,
+public class NoteEditActivity extends AppCompatActivity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
+ //该类主要是针对标签的编辑
+ //继承了系统内部许多和监听有关的类
private class HeadViewHolder {
public TextView tvModified;
@@ -82,8 +103,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public TextView tvAlertDate;
public ImageView ibSetBgColor;
- }
+ public ImageView ivLocked;
+
+ public ImageView ivUnlocked;
+ }
+ //使用Map实现数据存储
private static final Map sBgSelectorBtnsMap = new HashMap();
static {
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
@@ -91,6 +116,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sBgSelectorBtnsMap.put(R.id.iv_bg_blue, ResourceParser.BLUE);
sBgSelectorBtnsMap.put(R.id.iv_bg_green, ResourceParser.GREEN);
sBgSelectorBtnsMap.put(R.id.iv_bg_white, ResourceParser.WHITE);
+ //put函数是将指定值和指定键相连
}
private static final Map sBgSelectorSelectionMap = new HashMap();
@@ -100,6 +126,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sBgSelectorSelectionMap.put(ResourceParser.BLUE, R.id.iv_bg_blue_select);
sBgSelectorSelectionMap.put(ResourceParser.GREEN, R.id.iv_bg_green_select);
sBgSelectorSelectionMap.put(ResourceParser.WHITE, R.id.iv_bg_white_select);
+ //put函数是将指定值和指定键相连
}
private static final Map sFontSizeBtnsMap = new HashMap();
@@ -108,6 +135,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sFontSizeBtnsMap.put(R.id.ll_font_small, ResourceParser.TEXT_SMALL);
sFontSizeBtnsMap.put(R.id.ll_font_normal, ResourceParser.TEXT_MEDIUM);
sFontSizeBtnsMap.put(R.id.ll_font_super, ResourceParser.TEXT_SUPER);
+ //put函数是将指定值和指定键相连
}
private static final Map sFontSelectorSelectionMap = new HashMap();
@@ -116,26 +144,29 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sFontSelectorSelectionMap.put(ResourceParser.TEXT_SMALL, R.id.iv_small_select);
sFontSelectorSelectionMap.put(ResourceParser.TEXT_MEDIUM, R.id.iv_medium_select);
sFontSelectorSelectionMap.put(ResourceParser.TEXT_SUPER, R.id.iv_super_select);
+ //put函数是将指定值和指定键相连
}
private static final String TAG = "NoteEditActivity";
private HeadViewHolder mNoteHeaderHolder;
- private View mHeadViewPanel;
+ private View mHeadViewPanel; //私有化一个界面操作mHeadViewPanel,对表头的操作
- private View mNoteBgColorSelector;
+ private View mNoteBgColorSelector; //私有化一个界面操作mHeadViewPanel,对表头的操作
+ private View mFontSizeSelector;//私有化一个界面操作mFontSizeSelector,对标签字体的操作
- private View mFontSizeSelector;
-
- private EditText mNoteEditor;
+ private EditText mNoteEditor; //声明编辑控件,对文本操作
private View mNoteEditorPanel;
-
- private WorkingNote mWorkingNote;
+ //私有化一个界面操作mNoteEditorPanel,文本编辑的控制板
+ //private WorkingNote mWorkingNote;
+ private WorkingNote mWorkingNote; //对模板WorkingNote的初始化
private SharedPreferences mSharedPrefs;
- private int mFontSizeId;
+ //私有化SharedPreferences的数据存储方式
+ //它的本质是基于XML文件存储key-value键值对数据
+ private int mFontSizeId; //用于操作字体的大小
private static final String PREFERENCE_FONT_SIZE = "pref_font_size";
@@ -144,15 +175,19 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public static final String TAG_CHECKED = String.valueOf('\u221A');
public static final String TAG_UNCHECKED = String.valueOf('\u25A1');
- private LinearLayout mEditTextList;
-
+ private LinearLayout mEditTextList; //线性布局
private String mUserQuery;
private Pattern mPattern;
+ private ImageButton mImageButton; // 添加图片按钮
+
+ private ActivityResultLauncher requestPermissionLauncher; //获取存储权限
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.note_edit);
+ //对数据库的访问操作
+// setContentView(R.layout.activity_main);
if (savedInstanceState == null && !initActivityState(getIntent())) {
finish();
@@ -176,7 +211,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
return;
}
Log.d(TAG, "Restoring from killed activity");
- }
+ }//为防止内存不足时程序的终止,在这里有一个保存现场的函数
}
private boolean initActivityState(Intent intent) {
@@ -188,7 +223,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) {
long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0);
mUserQuery = "";
-
+ //如果用户实例化标签时,系统并未给出标签ID
/**
* Starting from the searched result
*/
@@ -196,26 +231,33 @@ public class NoteEditActivity extends Activity implements OnClickListener,
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;
}
}
+ //setSoftInputMode——软键盘输入模式
getWindow().setSoftInputMode(
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
+ // intent.getAction()
+ // 大多用于broadcast发送广播时给机制(intent)设置一个action,就是一个字符串
+ // 用户可以通过receive(接受)intent,通过 getAction得到的字符串,来决定做什么
long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0);
int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
@@ -223,7 +265,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
Notes.TYPE_WIDGET_INVALIDE);
int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID,
ResourceParser.getDefaultBgId(this));
-
+ // intent.getInt(Long、String)Extra是对各变量的语法分析
// Parse call-record note
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0);
@@ -240,7 +282,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
finish();
return false;
}
- } else {
+ } //将电话号码与手机的号码簿相关
+ else {
mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId,
widgetType, bgResId);
mWorkingNote.convertToCallNote(phoneNumber, callDate);
@@ -248,7 +291,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} else {
mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType,
bgResId);
- }
+ }//创建一个新的WorkingNote
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
@@ -269,8 +312,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private void initNoteScreen() {
+ //对界面的初始化操作
mNoteEditor.setTextAppearance(this, TextAppearanceResources
.getTexAppearanceResource(mFontSizeId));
+ //设置外观
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
switchToListMode(mWorkingNote.getContent());
} else {
@@ -293,23 +338,35 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* is not ready
*/
showAlertHeader();
+ //将有图片路径的位置转换为图片
+ requestPermissionLauncher.launch(Manifest.permission.READ_MEDIA_IMAGES);
}
-
+ //设置闹钟的显示
private void showAlertHeader() {
if (mWorkingNote.hasClockAlert()) {
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));
}
mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE);
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE);
+ //显示闹钟开启的图标
} else {
mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE);
mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE);
- };
+ }
+ if(mWorkingNote.getIsLocked()){
+ mNoteHeaderHolder.ivUnlocked.setVisibility(View.GONE);
+ mNoteHeaderHolder.ivLocked.setVisibility(View.VISIBLE);
+ }else{
+ mNoteHeaderHolder.ivUnlocked.setVisibility(View.VISIBLE);
+ mNoteHeaderHolder.ivLocked.setVisibility(View.GONE);
+ }
+
}
@Override
@@ -329,26 +386,29 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (!mWorkingNote.existInDatabase()) {
saveNote();
}
+ //在创建一个新的标签时,先在数据库中匹配
+ //如果不存在,那么先在数据库中存储
outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId());
Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState");
}
@Override
+ //MotionEvent是对屏幕触控的传递机制
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);
@@ -358,8 +418,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|| ev.getX() > (x + view.getWidth())
|| ev.getY() < y
|| ev.getY() > (y + view.getHeight())) {
- return false;
- }
+ //如果触控的位置超出了给定的范围,返回false
+ return false;
+ }
return true;
}
@@ -371,19 +432,23 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
+
+ mNoteHeaderHolder.ivLocked = (ImageView) findViewById(R.id.tv_locked);
+ mNoteHeaderHolder.ivUnlocked = (ImageView) findViewById(R.id.tv_unlocked);
+
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
for (int id : sBgSelectorBtnsMap.keySet()) {
ImageView iv = (ImageView) findViewById(id);
iv.setOnClickListener(this);
- }
+ }//对标签各项属性内容的初始化
mFontSizeSelector = findViewById(R.id.font_size_selector);
for (int id : sFontSizeBtnsMap.keySet()) {
View view = findViewById(id);
view.setOnClickListener(this);
- };
+ };//对字体大小的选择
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE);
/**
@@ -395,6 +460,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
}
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
+
+ // 获取读取存储权限
+ requestPermissionLauncher=getrequestDataLauncher();
+ // 初始化添加图片按钮
+ mImageButton = (ImageButton) findViewById(R.id.add_img_btn);
+ ActivityResultLauncher intentActivityResultLauncher=getActivityResultLauncher();
+ mImageButton.setOnClickListener(view -> onAddImage(intentActivityResultLauncher));
}
@Override
@@ -405,7 +477,7 @@ 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) {
@@ -418,7 +490,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {
- mWorkingNote.getWidgetId()
+ mWorkingNote.getWidgetId()
});
sendBroadcast(intent);
@@ -430,7 +502,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (id == R.id.btn_set_bg_color) {
mNoteBgColorSelector.setVisibility(View.VISIBLE);
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
- - View.VISIBLE);
+ View.VISIBLE);
} else if (sBgSelectorBtnsMap.containsKey(id)) {
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.GONE);
@@ -452,6 +524,20 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
}
+ public void onChangeLock(View v){
+ int id = v.getId();
+ switch (id){
+ case R.id.tv_locked:
+ mWorkingNote.setLock(false);
+ break;
+ case R.id.tv_unlocked:
+
+ mWorkingNote.setLock(true);
+ break;
+ }
+ showAlertHeader();
+ }
+
@Override
public void onBackPressed() {
if(clearSettingState()) {
@@ -480,8 +566,34 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
}
+// @Override
+// public boolean onCreateOptionsMenu(Menu menu){
+// if (isFinishing()) {
+// return true;
+// }
+// clearSettingState();
+// menu.clear();
+// if (mWorkingNote.getFolderId() == Notes.ID_CALL_RECORD_FOLDER) {
+// getMenuInflater().inflate(R.menu.call_note_edit, menu);
+// } else {
+// getMenuInflater().inflate(R.menu.note_edit, menu);
+// }
+// if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
+// menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_normal_mode);
+// } else {
+// menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_list_mode);
+// }
+// if (mWorkingNote.hasClockAlert()) {
+// menu.findItem(R.id.menu_alert).setVisible(false);
+// } else {
+// menu.findItem(R.id.menu_delete_remind).setVisible(false);
+// }
+// return true;
+// }
+
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
+// getMenuInflater().inflate(R.menu.call_note_edit, menu);
if (isFinishing()) {
return true;
}
@@ -587,6 +699,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private void deleteCurrentNote() {
+ saveNote();
if (mWorkingNote.existInDatabase()) {
HashSet ids = new HashSet();
long id = mWorkingNote.getNoteId();
@@ -596,9 +709,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
Log.d(TAG, "Wrong note id, should not happen");
}
if (!isSyncMode()) {
- if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) {
- Log.e(TAG, "Delete Note error");
- }
+// if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) {
+// Log.e(TAG, "Delete Note error");
+// }
} else {
if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLER)) {
Log.e(TAG, "Move notes to trash folder error, should not happens");
@@ -609,7 +722,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private boolean isSyncMode() {
- return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
+ return true;
}
public void onClockAlertChanged(long date, boolean set) {
@@ -623,7 +736,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (mWorkingNote.getNoteId() > 0) {
Intent intent = new Intent(this, AlarmReceiver.class);
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, PendingIntent.FLAG_IMMUTABLE);
AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE));
showAlertHeader();
if(!set) {
@@ -852,22 +965,265 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* should input something
*/
Log.e(TAG, "Send to desktop error");
- showToast(R.string.error_note_empty_for_send_to_desktop);
+ 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);
}
+ /*
+ * 函数功能:持续显示提示的视图
+ * 函数实现:根据下标和持续的时间(duration)编辑提示视图并显示
+ */
private void showToast(int resId, int duration) {
Toast.makeText(this, resId, duration).show();
}
+
+ /**
+ * @author: ClearDewy
+ * @date: 2023/3/9 11:20
+ * @param: [android.content.Context, android.net.Uri]
+ * @return: java.lang.String
+ * @description:根据Url解析文件路径
+ **/
+ public static String getPathFromUri(final Context context, final Uri uri) {
+ if (uri == null) {
+ return null;
+ }
+ // 判斷是否為Android 4.4之後的版本
+ if (DocumentsContract.isDocumentUri(context, uri)) {
+ // 如果是Android 4.4之後的版本,而且屬於文件URI
+ final String authority = uri.getAuthority();
+ // 判斷Authority是否為本地端檔案所使用的
+ if ("com.android.externalstorage.documents".equals(authority)) {
+ // 外部儲存空間
+ final String docId = DocumentsContract.getDocumentId(uri);
+ final String[] divide = docId.split(":");
+ final String type = divide[0];
+ if ("primary".equals(type)) {
+ String path = Environment.getExternalStorageDirectory().getAbsolutePath().concat("/").concat(divide[1]);
+ return path;
+ } else {
+ String path = "/storage/".concat(type).concat("/").concat(divide[1]);
+ return path;
+ }
+ } else if ("com.android.providers.downloads.documents".equals(authority)) {
+ // 下載目錄
+ final String docId = DocumentsContract.getDocumentId(uri);
+ if (docId.startsWith("raw:")) {
+ final String path = docId.replaceFirst("raw:", "");
+ return path;
+ }
+ final Uri downloadUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(docId));
+ String path = queryAbsolutePath(context, downloadUri);
+ return path;
+ } else if ("com.android.providers.media.documents".equals(authority)) {
+ // 圖片、影音檔案
+ final String docId = DocumentsContract.getDocumentId(uri);
+ final String[] divide = docId.split(":");
+ final String type = divide[0];
+ Uri mediaUri = null;
+ if ("image".equals(type)) {
+ mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
+ } else if ("video".equals(type)) {
+ mediaUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
+ } else if ("audio".equals(type)) {
+ mediaUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
+ } else {
+ return null;
+ }
+ mediaUri = ContentUris.withAppendedId(mediaUri, Long.parseLong(divide[1]));
+ String path = queryAbsolutePath(context, mediaUri);
+ return path;
+ }
+ } else {
+ // 如果是一般的URI
+ final String scheme = uri.getScheme();
+ String path = null;
+ if ("content".equals(scheme)) {
+ // 內容URI
+ path = queryAbsolutePath(context, uri);
+ } else if ("file".equals(scheme)) {
+ // 檔案URI
+ path = uri.getPath();
+ }
+ return path;
+ }
+ return null;
+ }
+
+ public static String queryAbsolutePath(final Context context, final Uri uri) {
+ final String[] projection = {MediaStore.MediaColumns.DATA};
+ Cursor cursor = null;
+ try {
+ cursor = context.getContentResolver().query(uri, projection, null, null, null);
+ if (cursor != null && cursor.moveToFirst()) {
+ final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
+ return cursor.getString(index);
+ }
+ } catch (final Exception ex) {
+ ex.printStackTrace();
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return null;
+ }
+
+ private ActivityResultLauncher getActivityResultLauncher(){
+ return registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback(){
+ // 重写回调方法
+ @Override
+ public void onActivityResult(ActivityResult result) {
+ if (result.getResultCode() != RESULT_OK) return;
+ ContentResolver resolver = getContentResolver();
+ Uri originalUri = result.getData().getData(); //1.获得图片的真实路径
+ Bitmap bitmap = null;
+ try {
+ bitmap = BitmapFactory.decodeStream(resolver.openInputStream(originalUri));//2.解码图片
+ } catch (FileNotFoundException e) {
+ Log.d(TAG, "onActivityResult: get file_exception");
+ e.printStackTrace();
+ }
+
+ if (bitmap != null) {
+ //3.根据Bitmap对象创建ImageSpan对象
+ Log.d(TAG, "onActivityResult: bitmap is not null");
+ ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap);
+ String path = getPathFromUri(NoteEditActivity.this, originalUri);
+ //4.使用[local][/local]将path括起来,用于之后方便识别图片路径在note中的位置
+ String img_fragment = "" + path + "";
+ //创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像
+ SpannableString spannableString = new SpannableString(img_fragment);
+ spannableString.setSpan(imageSpan, 0, img_fragment.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ //5.将选择的图片追加到EditText中光标所在位置
+ NoteEditText e = (NoteEditText) findViewById(R.id.note_edit_view);
+ int index = e.getSelectionStart(); //获取光标所在位置
+ Log.d(TAG, "Index是: " + index);
+ Editable edit_text = e.getEditableText();
+ edit_text.insert(index, spannableString); //将图片插入到光标所在位置
+
+ mWorkingNote.mContent = e.getText().toString();
+ //6.把改动提交到数据库中,两个数据库表都要改的
+ ContentResolver contentResolver = getContentResolver();
+ ContentValues contentValues = new ContentValues();
+ final long id = mWorkingNote.getNoteId();
+ contentValues.put("snippet", mWorkingNote.mContent);
+ contentResolver.update(Uri.parse("content://micode_notes/note"), contentValues, "_id=?", new String[]{"" + id});
+ ContentValues contentValues1 = new ContentValues();
+ contentValues1.put("content", mWorkingNote.mContent);
+ contentResolver.update(Uri.parse("content://micode_notes/data"), contentValues1, "mime_type=? and note_id=?", new String[]{"vnd.android.cursor.item/text_note", "" + id});
+
+ }
+ }
+ });
+ }
+ /**
+ * @author: ClearDewy
+ * @date: 2023/3/10 12:43
+ * @param: []
+ * @return: androidx.activity.result.ActivityResultLauncher
+ * @description:当API>=33时,申请读取存储授权
+ **/
+ private ActivityResultLauncher getrequestDataLauncher(){
+ return registerForActivityResult(new ActivityResultContracts.RequestPermission(), result -> {
+ if (result){
+ Log.d(TAG,"用户已授权");
+ convertToImage();
+ }else{
+ Log.d(TAG,"用户取消授权");
+ }
+ });
+ }
+
+ //路径字符串格式 转换为 图片image格式
+ private void convertToImage() {
+ NoteEditText noteEditText = (NoteEditText) findViewById(R.id.note_edit_view); //获取当前的edit
+ Editable editable = noteEditText.getText();//1.获取text
+ String noteText = editable.toString(); //2.将note内容转换为字符串
+ int length = editable.length(); //内容的长度
+ //3.截取img片段 [local]+uri+[local],提取uri
+ for(int i = 0; i < length; i++) {
+ for(int j = i; j < length; j++) {
+ String img_fragment = noteText.substring(i, j+1); //img_fragment:关于图片路径的片段
+ if(img_fragment.length() > 15 && img_fragment.endsWith("[/local]") && img_fragment.startsWith("[local]")){
+ int limit = 7; //[local]为7个字符
+ //[local][/local]共15个字符,剩下的为真正的path长度
+ int len = img_fragment.length()-15;
+ //从[local]之后的len个字符就是path
+ String path = img_fragment.substring(limit,limit+len);//获取到了图片路径
+
+
+ }
+ }
+ }
+
+ for (int i = 0; i < length; i++) {
+ if (noteText.startsWith("", i)){
+ for(int j=i+5;j< length;j++){
+ if (noteText.substring(i,j+1).endsWith("")){
+ Bitmap bitmap = null;
+ String path=noteText.substring(i+5,j-5);
+ Log.d(TAG, "图片的路径是:"+path);
+ try {
+ bitmap = BitmapFactory.decodeFile(path);//将图片路径解码为图片格式
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if(bitmap!=null){ //若图片存在
+ Log.d(TAG, "图片不为null");
+ ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap);
+ //4.创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像
+ String ss = "" + path + "";
+ SpannableString spannableString = new SpannableString(ss);
+ //5.将指定的标记对象附加到文本的开始...结束范围
+ spannableString.setSpan(imageSpan, 0, ss.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ Log.d(TAG, "Create spannable string success!");
+ Editable edit_text = noteEditText.getEditableText();
+ edit_text.delete(i,j-i+1); //6.删掉图片路径的文字
+ edit_text.insert(i, spannableString); //7.在路径的起始位置插入图片
+
+ i=j;break;
+ }
+
+ }
+ }
+ }
+ }
+
+
+
+ }
+
+
+
+ // 添加图片按钮点击时触发
+ private void onAddImage(ActivityResultLauncher intentActivityResultLauncher){
+ Intent imgIntent=new Intent(Intent.ACTION_GET_CONTENT);
+ //Category属性用于指定当前动作(Action)被执行的环境.
+ //CATEGORY_OPENABLE; 用来指示一个ACTION_GET_CONTENT的intent
+ imgIntent.addCategory(Intent.CATEGORY_OPENABLE);
+ imgIntent.setType("image/*");
+ intentActivityResultLauncher.launch(imgIntent);
+ }
+
+
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditText.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditText.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditText.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditText.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java
similarity index 73%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java
index 0f5a878..d1cf2d2 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java
@@ -28,20 +28,22 @@ import net.micode.notes.tool.DataUtils;
public class NoteItemData {
static final String [] PROJECTION = new String [] {
- NoteColumns.ID,
- NoteColumns.ALERTED_DATE,
- NoteColumns.BG_COLOR_ID,
- NoteColumns.CREATED_DATE,
- NoteColumns.HAS_ATTACHMENT,
- NoteColumns.MODIFIED_DATE,
- NoteColumns.NOTES_COUNT,
- NoteColumns.PARENT_ID,
- NoteColumns.SNIPPET,
- NoteColumns.TYPE,
- NoteColumns.WIDGET_ID,
- NoteColumns.WIDGET_TYPE,
+ NoteColumns.ID,
+ NoteColumns.ALERTED_DATE,
+ NoteColumns.BG_COLOR_ID,
+ NoteColumns.CREATED_DATE,
+ NoteColumns.HAS_ATTACHMENT,
+ NoteColumns.MODIFIED_DATE,
+ NoteColumns.NOTES_COUNT,
+ NoteColumns.PARENT_ID,
+ NoteColumns.SNIPPET,
+ NoteColumns.TYPE,
+ NoteColumns.WIDGET_ID,
+ NoteColumns.WIDGET_TYPE,
+ NoteColumns.LOCKED
};
+ //常量标记和数据就不一一标记了,意义翻译基本就知道
private static final int ID_COLUMN = 0;
private static final int ALERTED_DATE_COLUMN = 1;
private static final int BG_COLOR_ID_COLUMN = 2;
@@ -54,6 +56,10 @@ public class NoteItemData {
private static final int TYPE_COLUMN = 9;
private static final int WIDGET_ID_COLUMN = 10;
private static final int WIDGET_TYPE_COLUMN = 11;
+ private static final int LOCKED_COLUMN = 12;
+
+ private static final String LOCKED = "locked";
+ private static final String UNLOCKED = "unlocked";
private long mId;
private long mAlertDate;
@@ -75,8 +81,10 @@ public class NoteItemData {
private boolean mIsOnlyOneItem;
private boolean mIsOneNoteFollowingFolder;
private boolean mIsMultiNotesFollowingFolder;
+ //初始化NoteItemData,主要利用光标cursor获取的东西
+ private boolean mIsLocked;
- public NoteItemData(Context context, Cursor cursor) {
+ public NoteItemData(Context context, Cursor cursor) {//getxxx为转换格式
mId = cursor.getLong(ID_COLUMN);
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);
mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN);
@@ -92,10 +100,12 @@ public class NoteItemData {
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
- mPhoneNumber = "";
+ mIsLocked = !cursor.getString(LOCKED_COLUMN).equals(UNLOCKED);
+
+ mPhoneNumber = "";//getxxx为转换格式
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId);
- if (!TextUtils.isEmpty(mPhoneNumber)) {
+ if (!TextUtils.isEmpty(mPhoneNumber)) {//mphonenumber里有符合字符串,则用contart功能连接
mName = Contact.getContact(context, mPhoneNumber);
if (mName == null) {
mName = mPhoneNumber;
@@ -108,26 +118,30 @@ public class NoteItemData {
}
checkPostion(cursor);
}
+ //根据鼠标的位置设置标记,和位置
private void checkPostion(Cursor cursor) {
+ //初始化几个标记,cursor具体功能笔记中已提到,不一一叙述
mIsLastItem = cursor.isLast() ? true : false;
mIsFirstItem = cursor.isFirst() ? true : false;
mIsOnlyOneItem = (cursor.getCount() == 1);
+ //初始化“多重子文件”“单一子文件”2个标记
mIsMultiNotesFollowingFolder = false;
mIsOneNoteFollowingFolder = false;
- if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {
+ //主要是设置上诉2标记
+ if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {//若是note格式并且不是第一个元素
int position = cursor.getPosition();
- if (cursor.moveToPrevious()) {
+ if (cursor.moveToPrevious()) {//获取光标位置后看上一行
if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER
- || cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {
+ || cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {//若光标满足系统或note格式
if (cursor.getCount() > (position + 1)) {
- mIsMultiNotesFollowingFolder = true;
+ mIsMultiNotesFollowingFolder = true;//若是数据行数大于但前位置+1则设置成正确
} else {
- mIsOneNoteFollowingFolder = true;
+ mIsOneNoteFollowingFolder = true;//否则单一文件夹标记为true
}
}
- if (!cursor.moveToNext()) {
+ if (!cursor.moveToNext()) {//若不能再往下走则报错
throw new IllegalStateException("cursor move to previous but can't move back");
}
}
@@ -214,6 +228,7 @@ public class NoteItemData {
return (mAlertDate > 0);
}
+ //若数据父id为保存至文件夹模式的id且满足电话号码单元不为空,则isCallRecord为true
public boolean isCallRecord() {
return (mParentId == Notes.ID_CALL_RECORD_FOLDER && !TextUtils.isEmpty(mPhoneNumber));
}
@@ -221,4 +236,11 @@ public class NoteItemData {
public static int getNoteType(Cursor cursor) {
return cursor.getInt(TYPE_COLUMN);
}
+
+ public boolean getIsLocked(){
+ return mIsLocked;
+ }
+ public void setIsLocked(boolean islocked){
+ mIsLocked = islocked;
+ }
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
similarity index 67%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
index e843aec..093a0d1 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java
@@ -16,9 +16,11 @@
package net.micode.notes.ui;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.KeyguardManager;
import android.appwidget.AppWidgetManager;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
@@ -28,9 +30,13 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
+import android.hardware.fingerprint.FingerprintManager;
import android.os.AsyncTask;
+import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.security.keystore.KeyGenParameterSpec;
+import android.security.keystore.KeyProperties;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -60,25 +66,27 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.appcompat.app.AppCompatActivity;
+
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.remote.GTaskSyncService;
-import net.micode.notes.model.WorkingNote;
import net.micode.notes.tool.BackupUtils;
import net.micode.notes.tool.DataUtils;
-import net.micode.notes.tool.ResourceParser;
+import net.micode.notes.tool.FingerprintDialogFragment;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.security.KeyStore;
import java.util.HashSet;
-public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+
+public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener {
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1;
@@ -89,6 +97,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private static final int MENU_FOLDER_CHANGE_NAME = 2;
+ private static final int MENU_FOLDER_MOVE_OUT = 3;
+
private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction";
private enum ListEditState {
@@ -135,11 +145,25 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private final static int REQUEST_CODE_OPEN_NODE = 102;
private final static int REQUEST_CODE_NEW_NODE = 103;
+ private static final String DEFAULT_KEY_NAME = "default_key";
+ private static final int OPEN_NOTE = 0;
+ private static final int DELETE_NOTE = 1;
+ private static final int MOVE_NOTE = 2;
+ private static final int NONE_ACTION = -1;
+ KeyStore keyStore;
+ private NoteItemData mNoteDataItem;
+ private int mAuthenticatedType;
+ private long mAuthenticated_FOLDER;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note_list);
initResources();
+ if (supportFingerprint()) {
+ initKey();
+ }
+
/**
* Insert an introduction when user firstly use this application
@@ -160,47 +184,56 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private void setAppInfoFromRawRes() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (!sp.getBoolean(PREFERENCE_ADD_INTRODUCTION, false)) {
- StringBuilder sb = new StringBuilder();
- InputStream in = null;
- try {
- in = getResources().openRawResource(R.raw.introduction);
- if (in != null) {
- InputStreamReader isr = new InputStreamReader(in);
- BufferedReader br = new BufferedReader(isr);
- char [] buf = new char[1024];
- int len = 0;
- while ((len = br.read(buf)) > 0) {
- sb.append(buf, 0, len);
- }
- } else {
- Log.e(TAG, "Read introduction file error");
- return;
- }
- } catch (IOException e) {
- e.printStackTrace();
- return;
- } finally {
- if(in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- WorkingNote note = WorkingNote.createEmptyNote(this, Notes.ID_ROOT_FOLDER,
- AppWidgetManager.INVALID_APPWIDGET_ID, Notes.TYPE_WIDGET_INVALIDE,
- ResourceParser.RED);
- note.setWorkingText(sb.toString());
- if (note.saveNote()) {
- sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit();
- } else {
- Log.e(TAG, "Save introduction note error");
- return;
+ if(!DataUtils.checkFolderId(mContentResolver,Long.valueOf(Notes.ID_TRASH_FOLER)) && !DataUtils.checkVisibleFolderName(mContentResolver,this.getString(R.string.trash_name))){
+ ContentValues values = new ContentValues();
+ values.put(NoteColumns.SNIPPET, this.getString(R.string.trash_name));
+ values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER);
+// values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER);
+ mContentResolver.insert(Notes.CONTENT_NOTE_URI, values);
}
+// StringBuilder sb = new StringBuilder();
+// InputStream in = null;
+// try {
+// in = getResources().openRawResource(R.raw.introduction);
+// if (in != null) {
+// InputStreamReader isr = new InputStreamReader(in);
+// BufferedReader br = new BufferedReader(isr);
+// char [] buf = new char[1024];
+// int len = 0;
+// while ((len = br.read(buf)) > 0) {
+// sb.append(buf, 0, len);
+// }
+// } else {
+// Log.e(TAG, "Read introduction file error");
+// return;
+// }
+// } catch (IOException e) {
+// e.printStackTrace();
+// return;
+// } finally {
+// if(in != null) {
+// try {
+// in.close();
+// } catch (IOException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
+// }
+//
+// WorkingNote note = WorkingNote.createEmptyNote(this, Notes.ID_ROOT_FOLDER,
+// AppWidgetManager.INVALID_APPWIDGET_ID, Notes.TYPE_WIDGET_INVALIDE,
+// ResourceParser.RED);
+// note.setWorkingText(sb.toString());
+// if (note.saveNote()) {
+// sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit();
+// } else {
+// Log.e(TAG, "Save introduction note error");
+// return;
+// }
}
+ long id = DataUtils.getTrashIdByName(mContentResolver,this.getString(R.string.trash_name));
+ Notes.setID_TRASH_FOLER((int)id);
}
@Override
@@ -307,7 +340,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
public void onItemCheckedStateChanged(ActionMode mode, int position, long id,
- boolean checked) {
+ boolean checked) {
mNotesListAdapter.setCheckedItem(position, checked);
updateMenu();
}
@@ -325,14 +358,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
builder.setTitle(getString(R.string.alert_title_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setMessage(getString(R.string.alert_message_delete_notes,
- mNotesListAdapter.getSelectedCount()));
+ mNotesListAdapter.getSelectedCount()));
builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
- batchDelete();
- }
- });
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ batchDelete();
+ }
+ });
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
break;
@@ -413,7 +446,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
: NORMAL_SELECTION;
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {
- String.valueOf(mCurrentFolderId)
+ String.valueOf(mCurrentFolderId)
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
}
@@ -441,6 +474,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
}
+
private void showFolderListMenu(Cursor cursor) {
AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this);
builder.setTitle(R.string.menu_title_select_folder);
@@ -448,14 +482,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- DataUtils.batchMoveToFolder(mContentResolver,
- mNotesListAdapter.getSelectedItemIds(), adapter.getItemId(which));
- Toast.makeText(
- NotesListActivity.this,
- getString(R.string.format_move_notes_to_folder,
- mNotesListAdapter.getSelectedCount(),
- adapter.getFolderName(NotesListActivity.this, which)),
- Toast.LENGTH_SHORT).show();
+ if(adapter.getItemId(which)==Notes.ID_TRASH_FOLER){
+ Toast.makeText(
+ NotesListActivity.this,
+ R.string.forbidden_move_to_trash,
+ Toast.LENGTH_SHORT).show();
+ }else{
+ if(mNotesListAdapter.getHasLocked() && false){
+ //not ready
+ initCipher();
+ mAuthenticatedType = MOVE_NOTE;
+ }else {
+ DataUtils.batchMoveToFolder(mContentResolver,
+ mNotesListAdapter.getSelectedItemIds(), adapter.getItemId(which));
+ Toast.makeText(
+ NotesListActivity.this,
+ getString(R.string.format_move_notes_to_folder,
+ mNotesListAdapter.getSelectedCount(),
+ adapter.getFolderName(NotesListActivity.this, which)),
+ Toast.LENGTH_SHORT).show();
+ }
+ }
mModeCallBack.finishActionMode();
}
});
@@ -469,11 +516,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
}
- private void batchDelete() {
+ private void reallyBatchDelete(){
new AsyncTask>() {
protected HashSet doInBackground(Void... unused) {
HashSet widgets = mNotesListAdapter.getSelectedWidget();
- if (!isSyncMode()) {
+ HashSet folers = mNotesListAdapter.getSelectedFolderIds();
+ if (folers.contains(new Long( Notes.ID_TRASH_FOLER))) {
// if not synced, delete notes directly
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
.getSelectedItemIds())) {
@@ -506,17 +554,22 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}.execute();
}
- private void deleteFolder(long folderId) {
- if (folderId == Notes.ID_ROOT_FOLDER) {
- Log.e(TAG, "Wrong folder id, should not happen " + folderId);
- return;
+ private void batchDelete() {
+ if(ifHaveLocked()){
+ initCipher();
+ mAuthenticatedType = DELETE_NOTE;
+ }else {
+ reallyBatchDelete();
}
+ }
+ private void reallyDeleteFolder(long folderId){
HashSet ids = new HashSet();
+
ids.add(folderId);
HashSet widgets = DataUtils.getFolderNoteWidget(mContentResolver,
folderId);
- if (!isSyncMode()) {
+ if (DataUtils.getParentIdbyId(mContentResolver,folderId)==Notes.ID_TRASH_FOLER) {
// if not synced, delete folder directly
DataUtils.batchDeleteNotes(mContentResolver, ids);
} else {
@@ -533,38 +586,120 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
}
- private void openNode(NoteItemData data) {
- Intent intent = new Intent(this, NoteEditActivity.class);
- intent.setAction(Intent.ACTION_VIEW);
- intent.putExtra(Intent.EXTRA_UID, data.getId());
- this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE);
- }
- private void openFolder(NoteItemData data) {
- mCurrentFolderId = data.getId();
- startAsyncNotesListQuery();
- if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
- mState = ListEditState.CALL_RECORD_FOLDER;
- mAddNewNote.setVisibility(View.GONE);
- } else {
- mState = ListEditState.SUB_FOLDER;
+ private void deleteFolder(long folderId) {
+ if (folderId == Notes.ID_ROOT_FOLDER) {
+ Log.e(TAG, "Wrong folder id, should not happen " + folderId);
+ return;
}
- if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
- mTitleBar.setText(R.string.call_record_folder_name);
- } else {
- mTitleBar.setText(data.getSnippet());
+ if(folderId == Notes.ID_TRASH_FOLER){
+ Toast.makeText(
+ NotesListActivity.this,
+ R.string.forbidden_delete_trash,
+ Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ if(DataUtils.getHasLockedByFolderId(mContentResolver,folderId).contains(Notes.LOCKED)){
+ initCipher();
+ mAuthenticatedType = MOVE_NOTE;
+ mAuthenticated_FOLDER = folderId;
+ }else {
+ reallyDeleteFolder(folderId);
}
- mTitleBar.setVisibility(View.VISIBLE);
}
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btn_new_note:
- createNewNote();
+ private boolean ifHaveLocked(){
+ return mNotesListAdapter.getHasLocked();
+ }
+
+
+ private void openNode(NoteItemData data) {
+ if(!data.getIsLocked()){
+ Intent intent = new Intent(this, NoteEditActivity.class);
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.putExtra(Intent.EXTRA_UID, data.getId());
+ this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE);
+ }else{
+ this.openLockedNote();
+ mNoteDataItem = data;
+ mAuthenticatedType = OPEN_NOTE;
+ }
+ }
+
+ private void openLockedNote(){
+ initCipher();
+ }
+
+ public void onAuthenticated() {
+ switch (mAuthenticatedType){
+ case OPEN_NOTE:
+ switch (mNoteDataItem.getType()){
+ case Notes.TYPE_FOLDER:
+ mCurrentFolderId = mNoteDataItem.getId();
+ startAsyncNotesListQuery();
+ if (mNoteDataItem.getId() == Notes.ID_CALL_RECORD_FOLDER) {
+ mState = ListEditState.CALL_RECORD_FOLDER;
+ mAddNewNote.setVisibility(View.GONE);
+ } else {
+ mState = ListEditState.SUB_FOLDER;
+ }
+ if (mNoteDataItem.getId() == Notes.ID_CALL_RECORD_FOLDER) {
+ mTitleBar.setText(R.string.call_record_folder_name);
+ } else {
+ mTitleBar.setText(mNoteDataItem.getSnippet());
+ }
+ mTitleBar.setVisibility(View.VISIBLE);
+ break;
+ case Notes.TYPE_NOTE:
+ Intent intent = new Intent(this, NoteEditActivity.class);
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.putExtra(Intent.EXTRA_UID, mNoteDataItem.getId());
+ this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE);
+ break;
+ }
break;
- default:
+ case DELETE_NOTE:
+ reallyBatchDelete();
+ break;
+ case MOVE_NOTE:
+ reallyDeleteFolder(mAuthenticated_FOLDER);
break;
}
+ mNoteDataItem = null;
+ mAuthenticated_FOLDER = -1;
+ mAuthenticatedType = NONE_ACTION;
+ }
+
+ public void onStopAuthenticated() {
+ mNoteDataItem = null;
+ }
+
+ private void openFolder(NoteItemData data) {
+ if(!data.getIsLocked()){
+ mCurrentFolderId = data.getId();
+ startAsyncNotesListQuery();
+ if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
+ mState = ListEditState.CALL_RECORD_FOLDER;
+ mAddNewNote.setVisibility(View.GONE);
+ } else {
+ mState = ListEditState.SUB_FOLDER;
+ }
+ if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
+ mTitleBar.setText(R.string.call_record_folder_name);
+ } else {
+ mTitleBar.setText(data.getSnippet());
+ }
+ mTitleBar.setVisibility(View.VISIBLE);
+ }else{
+ this.openLockedNote();
+ mNoteDataItem = data;
+ mAuthenticatedType = OPEN_NOTE;
+ }
+ }
+
+ public void onClick(View v) {
+ createNewNote();
}
private void showSoftInput() {
@@ -586,8 +721,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
showSoftInput();
if (!create) {
if (mFocusNoteDataItem != null) {
- etName.setText(mFocusNoteDataItem.getSnippet());
- builder.setTitle(getString(R.string.menu_folder_change_name));
+ if(mFocusNoteDataItem.getId()==(long)Notes.ID_TRASH_FOLER){
+ Toast.makeText(this, R.string.forbidden_change_trash_name, Toast.LENGTH_SHORT).show();
+ return;
+ }else{
+ etName.setText(mFocusNoteDataItem.getSnippet());
+ builder.setTitle(getString(R.string.menu_folder_change_name));
+ }
} else {
Log.e(TAG, "The long click data item is null");
return;
@@ -624,7 +764,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
values.put(NoteColumns.LOCAL_MODIFIED, 1);
mContentResolver.update(Notes.CONTENT_NOTE_URI, values, NoteColumns.ID
+ "=?", new String[] {
- String.valueOf(mFocusNoteDataItem.getId())
+ String.valueOf(mFocusNoteDataItem.getId())
});
}
} else if (!TextUtils.isEmpty(name)) {
@@ -700,7 +840,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {
- appWidgetId
+ appWidgetId
});
sendBroadcast(intent);
@@ -710,10 +850,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private final OnCreateContextMenuListener mFolderOnCreateContextMenuListener = new OnCreateContextMenuListener() {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
if (mFocusNoteDataItem != null) {
- menu.setHeaderTitle(mFocusNoteDataItem.getSnippet());
- menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view);
- menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete);
- menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name);
+ if(mFocusNoteDataItem.getParentId()==Notes.ID_TRASH_FOLER){
+ menu.setHeaderTitle(mFocusNoteDataItem.getSnippet());
+ menu.add(0, MENU_FOLDER_MOVE_OUT, 0, R.string.menu_folder_move_out);
+ menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete);
+ }else {
+ menu.setHeaderTitle(mFocusNoteDataItem.getSnippet());
+ menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view);
+ menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete);
+ menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name);
+ }
}
}
};
@@ -732,31 +878,56 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
Log.e(TAG, "The long click data item is null");
return false;
}
- switch (item.getItemId()) {
- case MENU_FOLDER_VIEW:
- openFolder(mFocusNoteDataItem);
- break;
- case MENU_FOLDER_DELETE:
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(getString(R.string.alert_title_delete));
- builder.setIcon(android.R.drawable.ic_dialog_alert);
- builder.setMessage(getString(R.string.alert_message_delete_folder));
- builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- deleteFolder(mFocusNoteDataItem.getId());
- }
- });
- builder.setNegativeButton(android.R.string.cancel, null);
- builder.show();
- break;
- case MENU_FOLDER_CHANGE_NAME:
- showCreateOrModifyFolderDialog(false);
- break;
- default:
- break;
+ if(mFocusNoteDataItem.getParentId()==Notes.ID_TRASH_FOLER){
+ switch (item.getItemId()) {
+ case MENU_FOLDER_MOVE_OUT:
+ HashSet ids = new HashSet();
+ ids.add(mFocusNoteDataItem.getId());
+ DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_ROOT_FOLDER);
+ break;
+ case MENU_FOLDER_DELETE:
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(getString(R.string.alert_title_delete));
+ builder.setIcon(android.R.drawable.ic_dialog_alert);
+ builder.setMessage(getString(R.string.alert_message_delete_folder));
+ builder.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ deleteFolder(mFocusNoteDataItem.getId());
+ }
+ });
+ builder.setNegativeButton(android.R.string.cancel, null);
+ builder.show();
+ break;
+ default:
+ break;
+ }
+ }else {
+ switch (item.getItemId()) {
+ case MENU_FOLDER_VIEW:
+ openFolder(mFocusNoteDataItem);
+ break;
+ case MENU_FOLDER_DELETE:
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(getString(R.string.alert_title_delete));
+ builder.setIcon(android.R.drawable.ic_dialog_alert);
+ builder.setMessage(getString(R.string.alert_message_delete_folder));
+ builder.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ deleteFolder(mFocusNoteDataItem.getId());
+ }
+ });
+ builder.setNegativeButton(android.R.string.cancel, null);
+ builder.show();
+ break;
+ case MENU_FOLDER_CHANGE_NAME:
+ showCreateOrModifyFolderDialog(false);
+ break;
+ default:
+ break;
+ }
}
-
return true;
}
@@ -806,7 +977,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
break;
}
case R.id.menu_new_note: {
- createNewNote();
+// createNewNote();
break;
}
case R.id.menu_search:
@@ -867,7 +1038,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
private boolean isSyncMode() {
- return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
+ return true;
}
private void startPreferenceActivity() {
@@ -918,9 +1089,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
private void startQueryDestinationFolders() {
- String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?";
+ String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>? AND "+ NoteColumns.ID + "<>?";
selection = (mState == ListEditState.NOTE_LIST) ? selection:
- "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")";
+ "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")";
mBackgroundQueryHandler.startQuery(FOLDER_LIST_QUERY_TOKEN,
null,
@@ -930,7 +1101,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
new String[] {
String.valueOf(Notes.TYPE_FOLDER),
String.valueOf(Notes.ID_TRASH_FOLER),
- String.valueOf(mCurrentFolderId)
+ String.valueOf(mCurrentFolderId),
+ String.valueOf(Notes.ID_TRASH_FOLER)
},
NoteColumns.MODIFIED_DATE + " DESC");
}
@@ -951,4 +1123,68 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
return false;
}
+
+
+
+ public boolean supportFingerprint() {
+ if (Build.VERSION.SDK_INT < 23) {
+ Toast.makeText(this, "您的系统版本过低,不支持指纹功能", Toast.LENGTH_SHORT).show();
+ return false;
+ } else {
+ KeyguardManager keyguardManager = getSystemService(KeyguardManager.class);
+ FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
+ if (!fingerprintManager.isHardwareDetected()) {
+ Toast.makeText(this, "您的手机不支持指纹功能", Toast.LENGTH_SHORT).show();
+ return false;
+ } else if (!keyguardManager.isKeyguardSecure()) {
+ Toast.makeText(this, "您还未设置锁屏,请先设置锁屏并添加一个指纹", Toast.LENGTH_SHORT).show();
+ return false;
+ } else if (!fingerprintManager.hasEnrolledFingerprints()) {
+ Toast.makeText(this, "您至少需要在系统设置中添加一个指纹", Toast.LENGTH_SHORT).show();
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @TargetApi(23)
+ private void initKey() {
+ try {
+ keyStore = KeyStore.getInstance("AndroidKeyStore");
+ keyStore.load(null);
+ KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
+ KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder(DEFAULT_KEY_NAME,
+ KeyProperties.PURPOSE_ENCRYPT |
+ KeyProperties.PURPOSE_DECRYPT)
+ .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
+ .setUserAuthenticationRequired(true)
+ .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7);
+ keyGenerator.init(builder.build());
+ keyGenerator.generateKey();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @TargetApi(23)
+ private void initCipher() {
+ try {
+ SecretKey key = (SecretKey) keyStore.getKey(DEFAULT_KEY_NAME, null);
+ Cipher cipher = Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/"
+ + KeyProperties.BLOCK_MODE_CBC + "/"
+ + KeyProperties.ENCRYPTION_PADDING_PKCS7);
+ cipher.init(Cipher.ENCRYPT_MODE, key);
+ showFingerPrintDialog(cipher);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void showFingerPrintDialog(Cipher cipher) {
+ FingerprintDialogFragment fragment = new FingerprintDialogFragment();
+ fragment.setCipher(cipher);
+ fragment.show(getFragmentManager(), "fingerprint");
+ }
+
+
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java
similarity index 50%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java
index 51c9cb9..1135239 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java
@@ -30,54 +30,87 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-
+/*
+ * 功能:直译为便签表连接器,继承了CursorAdapter,它为cursor和ListView提供了连接的桥梁。
+ * 所以NotesListAdapter实现的是鼠标和编辑便签链接的桥梁
+ */
public class NotesListAdapter extends CursorAdapter {
private static final String TAG = "NotesListAdapter";
private Context mContext;
private HashMap mSelectedIndex;
- private int mNotesCount;
- private boolean mChoiceMode;
+ private int mNotesCount;//便签数
+ private boolean mChoiceMode;//选择模式标记
+ /*
+ * 桌面widget的属性,包括编号和类型
+ */
public static class AppWidgetAttribute {
public int widgetId;
public int widgetType;
};
+ /*
+ * 函数功能:初始化便签链接器
+ * 函数实现:根据传进来的内容设置相关变量
+ */
public NotesListAdapter(Context context) {
- super(context, null);
- mSelectedIndex = new HashMap();
+ super(context, null);//父类对象置空
+ mSelectedIndex = new HashMap();//新建选项下标的hash表
mContext = context;
mNotesCount = 0;
}
@Override
+ /*
+ * 函数功能:新建一个视图来存储光标所指向的数据
+ * 函数实现:使用兄弟类NotesListItem新建一个项目选项
+ */
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return new NotesListItem(context);
}
@Override
+ /*
+ * 函数功能:将已经存在的视图和鼠标指向的数据进行捆绑
+ * 函数实现:如下注释
+ */
public void bindView(View view, Context context, Cursor cursor) {
- if (view instanceof NotesListItem) {
+ if (view instanceof NotesListItem) {//若view是NotesListItem的一个实例
NoteItemData itemData = new NoteItemData(context, cursor);
((NotesListItem) view).bind(context, itemData, mChoiceMode,
- isSelectedItem(cursor.getPosition()));
+ isSelectedItem(cursor.getPosition()));//则新建一个项目选项并且用bind跟将view和鼠标,内容,便签数据捆绑在一起
}
}
+ /*
+ * 函数功能:设置勾选框
+ * 函数实现:如下注释
+ */
public void setCheckedItem(final int position, final boolean checked) {
- mSelectedIndex.put(position, checked);
- notifyDataSetChanged();
+ mSelectedIndex.put(position, checked);//根据定位和是否勾选设置下标
+ notifyDataSetChanged();//在修改后刷新activity
}
+ /*
+ * 函数功能:判断单选按钮是否勾选
+ */
public boolean isInChoiceMode() {
return mChoiceMode;
}
+ /*
+ * 函数功能:设置单项选项框
+ * 函数实现:重置下标并且根据参数mode设置选项
+ */
public void setChoiceMode(boolean mode) {
mSelectedIndex.clear();
mChoiceMode = mode;
}
+ /*
+ * 函数功能:选择全部选项
+ * 函数实现:如下注释
+ */
public void selectAll(boolean checked) {
Cursor cursor = getCursor();
for (int i = 0; i < getCount(); i++) {
@@ -86,31 +119,60 @@ public class NotesListAdapter extends CursorAdapter {
setCheckedItem(i, checked);
}
}
- }
+ }//遍历所有光标可用的位置在判断为便签类型之后勾选单项框
}
+ /*
+ * 函数功能:建立选择项的下标列表
+ * 函数实现:如下注释
+ */
public HashSet getSelectedItemIds() {
- HashSet itemSet = new HashSet();
- for (Integer position : mSelectedIndex.keySet()) {
- if (mSelectedIndex.get(position) == true) {
+ HashSet itemSet = new HashSet();//建立hash表
+ for (Integer position : mSelectedIndex.keySet()) {//遍历所有的关键
+ if (mSelectedIndex.get(position) == true) {//若光标位置可用
Long id = getItemId(position);
- if (id == Notes.ID_ROOT_FOLDER) {
+ if (id == Notes.ID_ROOT_FOLDER) {//原文件不需要添加
Log.d(TAG, "Wrong item id, should not happen");
} else {
itemSet.add(id);
- }
+ }//则将id该下标假如选项集合中
}
}
return itemSet;
}
- public HashSet getSelectedWidget() {
- HashSet itemSet = new HashSet();
+
+ public HashSet getSelectedFolderIds() {
+ HashSet itemSet = new HashSet();
for (Integer position : mSelectedIndex.keySet()) {
if (mSelectedIndex.get(position) == true) {
Cursor c = (Cursor) getItem(position);
if (c != null) {
+ NoteItemData item = new NoteItemData(mContext, c);
+ itemSet.add(item.getFolderId());
+ /**
+ * Don't close cursor here, only the adapter could close it
+ */
+ } else {
+ Log.e(TAG, "Invalid cursor");
+ return null;
+ }
+ }
+ }
+ return itemSet;
+ }
+
+ /*
+ * 函数功能:建立桌面Widget的选项表
+ * 函数实现:如下注释
+ */
+ public HashSet getSelectedWidget() {
+ HashSet itemSet = new HashSet();
+ for (Integer position : mSelectedIndex.keySet()) {
+ if (mSelectedIndex.get(position) == true) {
+ Cursor c = (Cursor) getItem(position);//以上4句和getSelectedItemIds一样,不再重复
+ if (c != null) {//光标位置可用的话就建立新的Widget属性并编辑下标和类型,最后添加到选项集中
AppWidgetAttribute widget = new AppWidgetAttribute();
NoteItemData item = new NoteItemData(mContext, c);
widget.widgetId = item.getWidgetId();
@@ -128,26 +190,57 @@ public class NotesListAdapter extends CursorAdapter {
return itemSet;
}
+ public boolean getHasLocked(){
+ HashSet itemSet = new HashSet();
+ for (Integer position : mSelectedIndex.keySet()) {
+ if (mSelectedIndex.get(position) == true) {
+ Cursor c = (Cursor) getItem(position);
+ if (c != null) {
+ NoteItemData item = new NoteItemData(mContext, c);
+ if(item.getIsLocked()){
+ return true;
+ }
+ } else {
+ Log.e(TAG, "Invalid cursor");
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * 函数功能:获取选项个数
+ * 函数实现:如下注释
+ */
public int getSelectedCount() {
- Collection values = mSelectedIndex.values();
+ Collection values = mSelectedIndex.values();//首先获取选项下标的值
if (null == values) {
return 0;
}
- Iterator iter = values.iterator();
+ Iterator iter = values.iterator();//初始化叠加器
int count = 0;
while (iter.hasNext()) {
- if (true == iter.next()) {
+ if (true == iter.next()) {//若value值为真计数+1
count++;
}
}
return count;
}
+ /*
+ * 函数功能:判断是否全部选中
+ * 函数实现:如下注释
+ */
public boolean isAllSelected() {
int checkedCount = getSelectedCount();
- return (checkedCount != 0 && checkedCount == mNotesCount);
+ return (checkedCount != 0 && checkedCount == mNotesCount);//获取选项数看是否等于便签的个数
}
+ /*
+ * 函数功能:判断是否为选项表
+ * 函数实现:通过传递的下标来确定
+ */
public boolean isSelectedItem(final int position) {
if (null == mSelectedIndex.get(position)) {
return false;
@@ -156,29 +249,41 @@ public class NotesListAdapter extends CursorAdapter {
}
@Override
+ /*
+ * 函数功能:在activity内容发生局部变动的时候回调该函数计算便签的数量
+ * 函数实现:如下注释
+ */
protected void onContentChanged() {
- super.onContentChanged();
+ super.onContentChanged();//执行基类函数
calcNotesCount();
}
@Override
+ /*
+ * 函数功能:在activity光标发生局部变动的时候回调该函数计算便签的数量
+ */
public void changeCursor(Cursor cursor) {
- super.changeCursor(cursor);
+ super.changeCursor(cursor);//执行基类函数
calcNotesCount();
}
+ /*
+ * 函数功能:计算便签数量
+ *
+ */
private void calcNotesCount() {
mNotesCount = 0;
- for (int i = 0; i < getCount(); i++) {
+ for (int i = 0; i < getCount(); i++) {//获取总数同时遍历
Cursor c = (Cursor) getItem(i);
if (c != null) {
if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) {
- mNotesCount++;
+ mNotesCount++; //若该位置不为空并且文本类型为便签就+1
}
} else {
Log.e(TAG, "Invalid cursor");
return;
}
+ //否则报错
}
}
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java
similarity index 69%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java
index 1221e80..85d3481 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java
@@ -29,18 +29,21 @@ import net.micode.notes.data.Notes;
import net.micode.notes.tool.DataUtils;
import net.micode.notes.tool.ResourceParser.NoteItemBgResources;
-
+//创建便签列表项目选项
public class NotesListItem extends LinearLayout {
- private ImageView mAlert;
- private TextView mTitle;
- private TextView mTime;
+ private ImageView mAlert;//闹钟图片
+ private TextView mTitle;//标题
+ private TextView mTime;//时间
private TextView mCallName;
- private NoteItemData mItemData;
- private CheckBox mCheckBox;
+ private NoteItemData mItemData;//标签数据
+ private CheckBox mCheckBox;//打钩框
+
+ /*初始化基本信息*/
public NotesListItem(Context context) {
- super(context);
- inflate(context, R.layout.note_item, this);
+ super(context);//super()它的主要作用是调整调用父类构造函数的顺序
+ inflate(context, R.layout.note_item, this);//Inflate可用于将一个xml中定义的布局控件找出来,这里的xml是r。layout
+ //findViewById用于从contentView中查找指定ID的View,转换出来的形式根据需要而定;
mAlert = (ImageView) findViewById(R.id.iv_alert_icon);
mTitle = (TextView) findViewById(R.id.tv_title);
mTime = (TextView) findViewById(R.id.tv_time);
@@ -48,19 +51,23 @@ public class NotesListItem extends LinearLayout {
mCheckBox = (CheckBox) findViewById(android.R.id.checkbox);
}
+ //根据data的属性对各个控件的属性的控制,主要是可见性Visibility,内容setText,格式setTextAppearance
public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) {
if (choiceMode && data.getType() == Notes.TYPE_NOTE) {
- mCheckBox.setVisibility(View.VISIBLE);
- mCheckBox.setChecked(checked);
+ mCheckBox.setVisibility(View.VISIBLE);//设置可见行为可见
+ mCheckBox.setChecked(checked);//格子打钩
} else {
mCheckBox.setVisibility(View.GONE);
}
mItemData = data;
+ //设置控件属性,一共三种情况,由data的id和父id是否与保存到文件夹的id一致来决定
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
mCallName.setVisibility(View.GONE);
mAlert.setVisibility(View.VISIBLE);
+ //设置该textview的style
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
+ //settext为设置内容
mTitle.setText(context.getString(R.string.call_record_folder_name)
+ context.getString(R.string.format_folder_files_count, data.getNotesCount()));
mAlert.setImageResource(R.drawable.call_record);
@@ -69,8 +76,9 @@ public class NotesListItem extends LinearLayout {
mCallName.setText(data.getCallName());
mTitle.setTextAppearance(context,R.style.TextAppearanceSecondaryItem);
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
+ //关于闹钟的设置
if (data.hasAlert()) {
- mAlert.setImageResource(R.drawable.clock);
+ mAlert.setImageResource(R.drawable.clock);//图片来源的设置
mAlert.setVisibility(View.VISIBLE);
} else {
mAlert.setVisibility(View.GONE);
@@ -78,40 +86,50 @@ public class NotesListItem extends LinearLayout {
} else {
mCallName.setVisibility(View.GONE);
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
+ //设置title格式
if (data.getType() == Notes.TYPE_FOLDER) {
mTitle.setText(data.getSnippet()
+ context.getString(R.string.format_folder_files_count,
- data.getNotesCount()));
+ data.getNotesCount()));
mAlert.setVisibility(View.GONE);
} else {
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
if (data.hasAlert()) {
- mAlert.setImageResource(R.drawable.clock);
+ mAlert.setImageResource(R.drawable.clock);//设置图片来源
mAlert.setVisibility(View.VISIBLE);
} else {
mAlert.setVisibility(View.GONE);
}
}
}
+ //设置内容,获取相关时间,从data里编辑的日期中获取
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));
setBackground(data);
}
+ //根据data的文件属性来设置背景
private void setBackground(NoteItemData data) {
int id = data.getBgColorId();
+ //若是note型文件,则4种情况,对于4种不同情况的背景来源
+// setBackgroundResource(R.color.user_query_highlight);
+// setBackgroundColor(0xFF888888);
+// setX(500);
+// setWeightSum((float)1);
+// setw
if (data.getType() == Notes.TYPE_NOTE) {
if (data.isSingle() || data.isOneFollowingFolder()) {
setBackgroundResource(NoteItemBgResources.getNoteBgSingleRes(id));
- } else if (data.isLast()) {
+ } else if (data.isLast()) {//是最后一个数据
setBackgroundResource(NoteItemBgResources.getNoteBgLastRes(id));
- } else if (data.isFirst() || data.isMultiFollowingFolder()) {
+ } else if (data.isFirst() || data.isMultiFollowingFolder()) {//是一个数据并有多个子文件夹
setBackgroundResource(NoteItemBgResources.getNoteBgFirstRes(id));
} else {
setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(id));
}
} else {
+ //若不是note直接调用文件夹的背景来源
setBackgroundResource(NoteItemBgResources.getFolderBgRes());
}
}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java
similarity index 64%
rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java
rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java
index 07c5f7e..5520104 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java
@@ -47,66 +47,79 @@ import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.remote.GTaskSyncService;
-
+/*
+ *该类功能:NotesPreferenceActivity,在小米便签中主要实现的是对背景颜色和字体大小的数据储存。
+ * 继承了PreferenceActivity主要功能为对系统信息和配置进行自动保存的Activity
+ */
public class NotesPreferenceActivity extends PreferenceActivity {
public static final String PREFERENCE_NAME = "notes_preferences";
-
+ //优先名
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";
-
+ //同步账号
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";
-
+ //同步时间
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";
-
+ //同步密码
private static final String AUTHORITIES_FILTER_KEY = "authorities";
-
+ //本地密码
private PreferenceCategory mAccountCategory;
-
+ //账户分组
private GTaskReceiver mReceiver;
-
+ //同步任务接收器
private Account[] mOriAccounts;
-
+ //账户
private boolean mHasAddedAccount;
-
+ //账户的hash标记
@Override
- protected void onCreate(Bundle icicle) {
+ /*
+ *函数功能:创建一个activity,在函数里要完成所有的正常静态设置
+ *参数:Bundle icicle:存放了 activity 当前的状态
+ *函数实现:如下注释
+ */
+ protected void onCreate(Bundle icicle) {//先执行父类的创建函数
super.onCreate(icicle);
/* using the app icon for navigation */
getActionBar().setDisplayHomeAsUpEnabled(true);
-
- addPreferencesFromResource(R.xml.preferences);
- mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);
+ //给左上角图标的左边加上一个返回的图标
+ addPreferencesFromResource(R.xml.preferences);//添加xml来源并显示 xml
+ mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY); //根据同步账户关键码来初始化分组
mReceiver = new GTaskReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME);
- registerReceiver(mReceiver, filter);
+ registerReceiver(mReceiver, filter);//初始化同步组件
mOriAccounts = null;
- View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);
- getListView().addHeaderView(header, null, true);
+ View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);//获取listvivew,ListView的作用:用于列出所有选择
+ getListView().addHeaderView(header, null, true);//在listview组件上方添加其他组件
}
@Override
- protected void onResume() {
+ /*
+ * 函数功能:activity交互功能的实现,用于接受用户的输入
+ * 函数实现:如下注释
+ */
+ protected void onResume() {//先执行父类 的交互实现
super.onResume();
// need to set sync account automatically if user has added a new
// account
- if (mHasAddedAccount) {
- Account[] accounts = getGoogleAccounts();
- if (mOriAccounts != null && accounts.length > mOriAccounts.length) {
+ if (mHasAddedAccount) {//若用户新加了账户则自动设置同步账户
+ Account[] accounts = getGoogleAccounts();//获取google同步账户
+ if (mOriAccounts != null && accounts.length > mOriAccounts.length) {//若原账户不为空且当前账户有增加
for (Account accountNew : accounts) {
boolean found = false;
for (Account accountOld : mOriAccounts) {
if (TextUtils.equals(accountOld.name, accountNew.name)) {
+ //更新账户
found = true;
break;
}
}
if (!found) {
- setSyncAccount(accountNew.name);
+ setSyncAccount(accountNew.name);//若是没有找到旧的账户,那么同步账号中就只添加新账户
break;
}
}
@@ -114,109 +127,141 @@ public class NotesPreferenceActivity extends PreferenceActivity {
}
refreshUI();
+ //刷新标签界面
}
@Override
+ /*
+ * 函数功能:销毁一个activity
+ * 函数实现:如下注释
+ */
protected void onDestroy() {
if (mReceiver != null) {
- unregisterReceiver(mReceiver);
+ unregisterReceiver(mReceiver);//注销接收器
}
super.onDestroy();
+ //执行父类的销毁动作
}
+ /*
+ * 函数功能:重新设置账户信息
+ * 函数实现:如下注释
+ */
private void loadAccountPreference() {
mAccountCategory.removeAll();
-
- Preference accountPref = new Preference(this);
+ //销毁所有的分组
+ Preference accountPref = new Preference(this);//建立首选项
final String defaultAccount = getSyncAccountName(this);
accountPref.setTitle(getString(R.string.preferences_account_title));
- accountPref.setSummary(getString(R.string.preferences_account_summary));
+ accountPref.setSummary(getString(R.string.preferences_account_summary));//设置首选项的大标题和小标题
accountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- public boolean onPreferenceClick(Preference preference) {
+ public boolean onPreferenceClick(Preference preference) {//建立监听器
if (!GTaskSyncService.isSyncing()) {
if (TextUtils.isEmpty(defaultAccount)) {
// the first time to set account
+ //若是第一次建立账户显示选择账户提示对话框
showSelectAccountAlertDialog();
} else {
// if the account has already been set, we need to promp
// user about the risk
+ //若是已经建立则显示修改对话框并进行修改操作
showChangeAccountConfirmAlertDialog();
}
} else {
+ //若在没有同步的情况下,则在toast中显示不能修改
Toast.makeText(NotesPreferenceActivity.this,
- R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
+ R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
.show();
}
return true;
}
});
-
+ //根据新建首选项编辑新的账户分组
mAccountCategory.addPreference(accountPref);
}
+ /*
+ *函数功能:设置按键的状态和最后同步的时间
+ *函数实现:如下注释
+ */
private void loadSyncButton() {
Button syncButton = (Button) findViewById(R.id.preference_sync_button);
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
+ //获取同步按钮控件和最终同步时间的的窗口
+ //设置按钮的状态
// set button state
- if (GTaskSyncService.isSyncing()) {
+ if (GTaskSyncService.isSyncing()) {//若是在同步状态下
syncButton.setText(getString(R.string.preferences_button_sync_cancel));
syncButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GTaskSyncService.cancelSync(NotesPreferenceActivity.this);
}
});
+ //设置按钮显示的文本为“取消同步”以及监听器
} else {
syncButton.setText(getString(R.string.preferences_button_sync_immediately));
syncButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GTaskSyncService.startSync(NotesPreferenceActivity.this);
+ //若是不同步则设置按钮显示的文本为“立即同步”以及对应监听器
}
});
}
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));
-
+ //设置按键可用还是不可用
// set last sync time
- if (GTaskSyncService.isSyncing()) {
+ // 设置最终同步时间
+ if (GTaskSyncService.isSyncing()) {//若是在同步的情况下
lastSyncTimeView.setText(GTaskSyncService.getProgressString());
- lastSyncTimeView.setVisibility(View.VISIBLE);
- } else {
+ lastSyncTimeView.setVisibility(View.VISIBLE);// 根据当前同步服务器设置时间显示框的文本以及可见性
+ } else {//若是非同步情况
long lastSyncTime = getLastSyncTime(this);
if (lastSyncTime != 0) {
lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time,
DateFormat.format(getString(R.string.preferences_last_sync_time_format),
lastSyncTime)));
lastSyncTimeView.setVisibility(View.VISIBLE);
+ //则根据最后同步时间的信息来编辑时间显示框的文本内容和可见性
} else {
+ //若时间为空直接设置为不可见状态
lastSyncTimeView.setVisibility(View.GONE);
}
}
}
+ /*
+ *函数功能:刷新标签界面
+ *函数实现:调用上文设置账号和设置按键两个函数来实现
+ */
private void refreshUI() {
loadAccountPreference();
loadSyncButton();
}
+ /*
+ * 函数功能:显示账户选择的对话框并进行账户的设置
+ * 函数实现:如下注释
+ */
private void showSelectAccountAlertDialog() {
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);//创建一个新的对话框
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_select_account_title));
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
- subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));
+ subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));//设置标题以及子标题的内容
dialogBuilder.setCustomTitle(titleView);
- dialogBuilder.setPositiveButton(null, null);
+ dialogBuilder.setPositiveButton(null, null);//设置对话框的自定义标题,建立一个YES的按钮
Account[] accounts = getGoogleAccounts();
- String defAccount = getSyncAccountName(this);
+ String defAccount = getSyncAccountName(this);//获取同步账户信息
mOriAccounts = accounts;
mHasAddedAccount = false;
- if (accounts.length > 0) {
+ if (accounts.length > 0) {//若账户不为空
CharSequence[] items = new CharSequence[accounts.length];
final CharSequence[] itemMapping = items;
int checkedItem = -1;
@@ -224,83 +269,110 @@ public class NotesPreferenceActivity extends PreferenceActivity {
for (Account account : accounts) {
if (TextUtils.equals(account.name, defAccount)) {
checkedItem = index;
+ //在账户列表中查询到所需账户
}
items[index++] = account.name;
}
- dialogBuilder.setSingleChoiceItems(items, checkedItem,
+ dialogBuilder.setSingleChoiceItems(items, checkedItem,//在对话框建立一个单选的复选框
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setSyncAccount(itemMapping[which].toString());
dialog.dismiss();
+ //取消对话框
refreshUI();
}
- });
+ //设置点击后执行的事件,包括检录新同步账户和刷新标签界面
+ });//建立对话框网络版的监听器
}
View addAccountView = LayoutInflater.from(this).inflate(R.layout.add_account_text, null);
- dialogBuilder.setView(addAccountView);
+ dialogBuilder.setView(addAccountView);//给新加账户对话框设置自定义样式
- final AlertDialog dialog = dialogBuilder.show();
+ final AlertDialog dialog = dialogBuilder.show(); //显示对话框
addAccountView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
- mHasAddedAccount = true;
- Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
+ mHasAddedAccount = true;//将新加账户的hash置true
+ Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");//建立网络建立组件
intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] {
- "gmail-ls"
+ "gmail-ls"
});
- startActivityForResult(intent, -1);
+ startActivityForResult(intent, -1);//跳回上一个选项
dialog.dismiss();
}
});
+ //建立新加账户对话框的监听器
}
+ /*
+ * 函数功能:显示账户选择对话框和相关账户操作
+ * 函数实现:如下注释
+ */
private void showChangeAccountConfirmAlertDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
-
+ //创建一个新的对话框
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_change_account_title,
getSyncAccountName(this)));
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg));
+ //根据同步修改的账户信息设置标题以及子标题的内容
dialogBuilder.setCustomTitle(titleView);
-
+ //设置对话框的自定义标题
CharSequence[] menuItemArray = new CharSequence[] {
getString(R.string.preferences_menu_change_account),
getString(R.string.preferences_menu_remove_account),
getString(R.string.preferences_menu_cancel)
};
+ //定义一些标记字符串
dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() {
+ //设置对话框要显示的一个list,用于显示几个命令时,即change,remove,cancel
public void onClick(DialogInterface dialog, int which) {
+ //按键功能,由which来决定
if (which == 0) {
+ //进入账户选择对话框
showSelectAccountAlertDialog();
} else if (which == 1) {
+ //删除账户并且跟新便签界面
removeSyncAccount();
refreshUI();
}
}
});
dialogBuilder.show();
+ //显示对话框
}
+ /*
+ *函数功能:获取谷歌账户
+ *函数实现:通过账户管理器直接获取
+ */
private Account[] getGoogleAccounts() {
AccountManager accountManager = AccountManager.get(this);
return accountManager.getAccountsByType("com.google");
}
+ /*
+ * 函数功能:设置同步账户
+ * 函数实现:如下注释:
+ */
private void setSyncAccount(String account) {
- if (!getSyncAccountName(this).equals(account)) {
+ if (!getSyncAccountName(this).equals(account)) {//假如该账号不在同步账号列表中
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
+ //编辑共享的首选项
if (account != null) {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account);
} else {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
}
+ //编辑共享的首选项
editor.commit();
+ //提交修改的数据
// clean up last sync time
setLastSyncTime(this, 0);
+ //将最后同步时间清零
// clean up local gtask related info
new Thread(new Runnable() {
@@ -311,23 +383,32 @@ public class NotesPreferenceActivity extends PreferenceActivity {
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
}
}).start();
+ //重置当地同步任务的信息
Toast.makeText(NotesPreferenceActivity.this,
getString(R.string.preferences_toast_success_set_accout, account),
Toast.LENGTH_SHORT).show();
+ //将toast的文本信息置为“设置账户成功”并显示出来
}
}
+ /*
+ * 函数功能:删除同步账户
+ * 函数实现:如下注释:
+ */
private void removeSyncAccount() {
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = settings.edit();
+ SharedPreferences.Editor editor = settings.edit();//设置共享首选项
if (settings.contains(PREFERENCE_SYNC_ACCOUNT_NAME)) {
editor.remove(PREFERENCE_SYNC_ACCOUNT_NAME);
+ //假如当前首选项中有账户就删除
}
if (settings.contains(PREFERENCE_LAST_SYNC_TIME)) {
editor.remove(PREFERENCE_LAST_SYNC_TIME);
+ //删除当前首选项中有账户时间
}
editor.commit();
+ //提交更新后的数据
// clean up local gtask related info
new Thread(new Runnable() {
@@ -338,49 +419,73 @@ public class NotesPreferenceActivity extends PreferenceActivity {
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
}
}).start();
+ //重置当地同步任务的信息
}
+ /*
+ * 函数功能:获取同步账户名称
+ * 函数实现:通过共享的首选项里的信息直接获取
+ */
public static String getSyncAccountName(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
}
+ /*
+ * 函数功能:设置最终同步的时间
+ * 函数实现:如下注释
+ */
public static void setLastSyncTime(Context context, long time) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = settings.edit();
+ SharedPreferences.Editor editor = settings.edit();// 从共享首选项中找到相关账户并获取其编辑器
editor.putLong(PREFERENCE_LAST_SYNC_TIME, time);
- editor.commit();
+ editor.commit();//编辑最终同步时间并提交更新
}
+ /*
+ * 函数功能:获取最终同步时间
+ * 函数实现:通过共享的首选项里的信息直接获取
+ */
public static long getLastSyncTime(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);
}
+ /*
+ * 函数功能:接受同步信息
+ * 函数实现:继承BroadcastReceiver
+ */
private class GTaskReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
refreshUI();
if (intent.getBooleanExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_IS_SYNCING, false)) {
+ //获取随广播而来的Intent中的同步服务的数据
TextView syncStatus = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
syncStatus.setText(intent
.getStringExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_PROGRESS_MSG));
+ //通过获取的数据在设置系统的状态
}
}
}
+ /*
+ * 函数功能:处理菜单的选项
+ * 函数实现:如下注释
+ * 参数:MenuItem菜单选项
+ */
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
+ switch (item.getItemId()) {//根据选项的id选择,这里只有一个主页
case android.R.id.home:
Intent intent = new Intent(this, NotesListActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
- return true;
+ return true;//在主页情况下在创建连接组件intent,发出清空的信号并开始一个相应的activity
default:
return false;
}
diff --git a/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java
new file mode 100644
index 0000000..1662f29
--- /dev/null
+++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java
@@ -0,0 +1,47 @@
+package net.micode.notes.ui;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.speech.RecognizerIntent;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+public class VoiceNoteActivity extends Activity {
+ private static final int REQUEST_CODE_SPEECH_INPUT = 1000;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ startVoiceRecognition();
+ }
+
+ private void startVoiceRecognition() {
+ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
+ intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
+ intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
+ intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak now...");
+ try {
+ startActivityForResult(intent, REQUEST_CODE_SPEECH_INPUT);
+ } catch (Exception e) {
+ Toast.makeText(this, "Speech recognition is not supported on this device.", Toast.LENGTH_SHORT).show();
+ finish();
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == REQUEST_CODE_SPEECH_INPUT && resultCode == RESULT_OK && data != null) {
+ ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
+ if (result != null && !result.isEmpty()) {
+ Intent intent = new Intent();
+ intent.putExtra("recognizedText", result.get(0));
+ setResult(RESULT_OK, intent);
+ }
+ }
+ finish();
+ }
+}
diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
similarity index 97%
rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java
rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
index ec6f819..2bdb5c2 100644
--- a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java
+++ b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
@@ -34,9 +34,9 @@ import net.micode.notes.ui.NotesListActivity;
public abstract class NoteWidgetProvider extends AppWidgetProvider {
public static final String [] PROJECTION = new String [] {
- NoteColumns.ID,
- NoteColumns.BG_COLOR_ID,
- NoteColumns.SNIPPET
+ NoteColumns.ID,
+ NoteColumns.BG_COLOR_ID,
+ NoteColumns.SNIPPET
};
public static final int COLUMN_ID = 0;
@@ -70,7 +70,7 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
}
private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds,
- boolean privacyMode) {
+ boolean privacyMode) {
for (int i = 0; i < appWidgetIds.length; i++) {
if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) {
int bgId = ResourceParser.getDefaultBgId(context);
diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java
rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java
diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java
similarity index 100%
rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java
rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java
diff --git a/Notes-master/Notes-master/res/color/primary_text_dark.xml b/NotesMaster/app/src/main/res/color/primary_text_dark.xml
similarity index 100%
rename from Notes-master/Notes-master/res/color/primary_text_dark.xml
rename to NotesMaster/app/src/main/res/color/primary_text_dark.xml
diff --git a/Notes-master/Notes-master/res/color/secondary_text_dark.xml b/NotesMaster/app/src/main/res/color/secondary_text_dark.xml
similarity index 100%
rename from Notes-master/Notes-master/res/color/secondary_text_dark.xml
rename to NotesMaster/app/src/main/res/color/secondary_text_dark.xml
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/add_node.png b/NotesMaster/app/src/main/res/drawable-hdpi/add_node.png
new file mode 100644
index 0000000..f122cfb
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/add_node.png differ
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/bg_btn_set_color.png b/NotesMaster/app/src/main/res/drawable-hdpi/bg_btn_set_color.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/bg_btn_set_color.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/bg_btn_set_color.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/bg_color_btn_mask.png b/NotesMaster/app/src/main/res/drawable-hdpi/bg_color_btn_mask.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/bg_color_btn_mask.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/bg_color_btn_mask.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/call_record.png b/NotesMaster/app/src/main/res/drawable-hdpi/call_record.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/call_record.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/call_record.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/clock.png b/NotesMaster/app/src/main/res/drawable-hdpi/clock.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/clock.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/clock.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/delete.png b/NotesMaster/app/src/main/res/drawable-hdpi/delete.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/delete.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/delete.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/dropdown_icon.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/dropdown_icon.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/dropdown_icon.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/dropdown_icon.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_blue.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_blue.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_blue.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_blue.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_green.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_green.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_green.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_green.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_red.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_red.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_red.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_red.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_blue.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_blue.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_blue.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_blue.9.png
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_green.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_green.9.png
new file mode 100644
index 0000000..f0046a6
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_green.9.png differ
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_red.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_red.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_red.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_red.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_white.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_white.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_white.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_white.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_yellow.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_yellow.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_yellow.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_yellow.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_white.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_white.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_white.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_white.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_yellow.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_yellow.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/edit_yellow.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_yellow.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_large.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_large.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/font_large.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/font_large.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_normal.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_normal.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/font_normal.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/font_normal.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_size_selector_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_size_selector_bg.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/font_size_selector_bg.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/font_size_selector_bg.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_small.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_small.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/font_small.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/font_small.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_super.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_super.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/font_super.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/font_super.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/icon_app.png b/NotesMaster/app/src/main/res/drawable-hdpi/icon_app.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/icon_app.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/icon_app.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_background.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_background.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_background.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_background.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_down.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_down.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_down.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_middle.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_middle.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_middle.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_single.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_single.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_single.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_up.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_up.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_up.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_folder.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_folder.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_folder.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_folder.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_footer_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_footer_bg.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_footer_bg.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_footer_bg.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_down.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_down.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_down.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_middle.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_middle.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_middle.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_single.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_single.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_single.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_up.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_up.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_up.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_down.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_down.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_down.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_middle.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_middle.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_middle.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_single.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_single.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_single.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_up.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_up.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_up.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_down.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_down.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_down.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_middle.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_middle.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_middle.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_single.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_single.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_single.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_up.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_up.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_up.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_down.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_down.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_down.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_middle.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_middle.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_middle.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_single.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_single.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_single.9.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_up.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_up.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_up.9.png
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/listtest.png b/NotesMaster/app/src/main/res/drawable-hdpi/listtest.png
new file mode 100644
index 0000000..edd692a
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/listtest.png differ
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/lock.png b/NotesMaster/app/src/main/res/drawable-hdpi/lock.png
new file mode 100644
index 0000000..900f4c7
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/lock.png differ
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/menu_delete.png b/NotesMaster/app/src/main/res/drawable-hdpi/menu_delete.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/menu_delete.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/menu_delete.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/menu_move.png b/NotesMaster/app/src/main/res/drawable-hdpi/menu_move.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/menu_move.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/menu_move.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/new_note_normal.png b/NotesMaster/app/src/main/res/drawable-hdpi/new_note_normal.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/new_note_normal.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/new_note_normal.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/new_note_pressed.png b/NotesMaster/app/src/main/res/drawable-hdpi/new_note_pressed.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/new_note_pressed.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/new_note_pressed.png
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png b/NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png
new file mode 100644
index 0000000..61cf055
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png differ
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/note_edit_color_selector_panel.png b/NotesMaster/app/src/main/res/drawable-hdpi/note_edit_color_selector_panel.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/note_edit_color_selector_panel.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/note_edit_color_selector_panel.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/notification.png b/NotesMaster/app/src/main/res/drawable-hdpi/notification.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/notification.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/notification.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/search_result.png b/NotesMaster/app/src/main/res/drawable-hdpi/search_result.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/search_result.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/search_result.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/selected.png b/NotesMaster/app/src/main/res/drawable-hdpi/selected.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/selected.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/selected.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/title_alert.png b/NotesMaster/app/src/main/res/drawable-hdpi/title_alert.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/title_alert.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/title_alert.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/title_bar_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/title_bar_bg.9.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/title_bar_bg.9.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/title_bar_bg.9.png
diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/unlock.png b/NotesMaster/app/src/main/res/drawable-hdpi/unlock.png
new file mode 100644
index 0000000..d4eb1a1
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable-hdpi/unlock.png differ
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_blue.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_blue.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_blue.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_blue.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_green.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_green.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_green.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_green.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_red.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_red.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_red.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_red.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_white.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_white.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_white.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_white.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_yellow.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_yellow.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_yellow.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_yellow.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_blue.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_blue.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_blue.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_blue.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_green.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_green.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_green.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_green.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_red.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_red.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_red.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_red.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_white.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_white.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_white.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_white.png
diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_yellow.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_yellow.png
similarity index 100%
rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_yellow.png
rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_yellow.png
diff --git a/NotesMaster/app/src/main/res/drawable/ic_fp_40px.png b/NotesMaster/app/src/main/res/drawable/ic_fp_40px.png
new file mode 100644
index 0000000..122f442
Binary files /dev/null and b/NotesMaster/app/src/main/res/drawable/ic_fp_40px.png differ
diff --git a/Notes-master/Notes-master/res/drawable/new_note.xml b/NotesMaster/app/src/main/res/drawable/new_note.xml
similarity index 100%
rename from Notes-master/Notes-master/res/drawable/new_note.xml
rename to NotesMaster/app/src/main/res/drawable/new_note.xml
diff --git a/Notes-master/Notes-master/res/layout/account_dialog_title.xml b/NotesMaster/app/src/main/res/layout/account_dialog_title.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/account_dialog_title.xml
rename to NotesMaster/app/src/main/res/layout/account_dialog_title.xml
diff --git a/NotesMaster/app/src/main/res/layout/activity_main.xml b/NotesMaster/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..d5f2e7e
--- /dev/null
+++ b/NotesMaster/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NotesMaster/app/src/main/res/layout/activity_voice_note.xml b/NotesMaster/app/src/main/res/layout/activity_voice_note.xml
new file mode 100644
index 0000000..45d6670
--- /dev/null
+++ b/NotesMaster/app/src/main/res/layout/activity_voice_note.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
diff --git a/Notes-master/Notes-master/res/layout/add_account_text.xml b/NotesMaster/app/src/main/res/layout/add_account_text.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/add_account_text.xml
rename to NotesMaster/app/src/main/res/layout/add_account_text.xml
diff --git a/Notes-master/Notes-master/res/layout/datetime_picker.xml b/NotesMaster/app/src/main/res/layout/datetime_picker.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/datetime_picker.xml
rename to NotesMaster/app/src/main/res/layout/datetime_picker.xml
diff --git a/Notes-master/Notes-master/res/layout/dialog_edit_text.xml b/NotesMaster/app/src/main/res/layout/dialog_edit_text.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/dialog_edit_text.xml
rename to NotesMaster/app/src/main/res/layout/dialog_edit_text.xml
diff --git a/NotesMaster/app/src/main/res/layout/fingerprint_dialog.xml b/NotesMaster/app/src/main/res/layout/fingerprint_dialog.xml
new file mode 100644
index 0000000..e406551
--- /dev/null
+++ b/NotesMaster/app/src/main/res/layout/fingerprint_dialog.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Notes-master/Notes-master/res/layout/folder_list_item.xml b/NotesMaster/app/src/main/res/layout/folder_list_item.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/folder_list_item.xml
rename to NotesMaster/app/src/main/res/layout/folder_list_item.xml
diff --git a/Notes-master/Notes-master/res/layout/note_edit.xml b/NotesMaster/app/src/main/res/layout/note_edit.xml
similarity index 93%
rename from Notes-master/Notes-master/res/layout/note_edit.xml
rename to NotesMaster/app/src/main/res/layout/note_edit.xml
index 10b2aa7..857e384 100644
--- a/Notes-master/Notes-master/res/layout/note_edit.xml
+++ b/NotesMaster/app/src/main/res/layout/note_edit.xml
@@ -26,10 +26,25 @@
android:layout_height="fill_parent"
android:orientation="vertical">
+
+
+
+
+ android:layout_height="fill_parent"
+ android:orientation="horizontal">
+
+
diff --git a/Notes-master/Notes-master/res/layout/note_edit_list_item.xml b/NotesMaster/app/src/main/res/layout/note_edit_list_item.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/note_edit_list_item.xml
rename to NotesMaster/app/src/main/res/layout/note_edit_list_item.xml
diff --git a/Notes-master/Notes-master/res/layout/note_item.xml b/NotesMaster/app/src/main/res/layout/note_item.xml
similarity index 94%
rename from Notes-master/Notes-master/res/layout/note_item.xml
rename to NotesMaster/app/src/main/res/layout/note_item.xml
index d541f6a..fa28808 100644
--- a/Notes-master/Notes-master/res/layout/note_item.xml
+++ b/NotesMaster/app/src/main/res/layout/note_item.xml
@@ -15,11 +15,12 @@
limitations under the License.
-->
-
+ android:layout_height="fill_parent"
+ >
+
@@ -74,5 +75,5 @@
android:id="@+id/iv_alert_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="top|right"/>
+ android:layout_gravity="top|right" />
diff --git a/Notes-master/Notes-master/res/layout/note_list.xml b/NotesMaster/app/src/main/res/layout/note_list.xml
similarity index 83%
rename from Notes-master/Notes-master/res/layout/note_list.xml
rename to NotesMaster/app/src/main/res/layout/note_list.xml
index 6b25d38..bec977d 100644
--- a/Notes-master/Notes-master/res/layout/note_list.xml
+++ b/NotesMaster/app/src/main/res/layout/note_list.xml
@@ -19,7 +19,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="@drawable/list_background">
+ android:background="#C1F5FFF9"
+ >
+ android:layout_width="200px"
+ android:layout_height="200px"
+ android:layout_gravity="bottom|right"
+ android:layout_marginBottom="80px"
+ android:layout_marginRight="80px"
+ android:background="@drawable/add_node"
+ android:focusable="auto"
+ android:visibility="visible" />
diff --git a/Notes-master/Notes-master/res/layout/note_list_dropdown_menu.xml b/NotesMaster/app/src/main/res/layout/note_list_dropdown_menu.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/note_list_dropdown_menu.xml
rename to NotesMaster/app/src/main/res/layout/note_list_dropdown_menu.xml
diff --git a/Notes-master/Notes-master/res/layout/note_list_footer.xml b/NotesMaster/app/src/main/res/layout/note_list_footer.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/note_list_footer.xml
rename to NotesMaster/app/src/main/res/layout/note_list_footer.xml
diff --git a/Notes-master/Notes-master/res/layout/settings_header.xml b/NotesMaster/app/src/main/res/layout/settings_header.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/settings_header.xml
rename to NotesMaster/app/src/main/res/layout/settings_header.xml
diff --git a/Notes-master/Notes-master/res/layout/widget_2x.xml b/NotesMaster/app/src/main/res/layout/widget_2x.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/widget_2x.xml
rename to NotesMaster/app/src/main/res/layout/widget_2x.xml
diff --git a/Notes-master/Notes-master/res/layout/widget_4x.xml b/NotesMaster/app/src/main/res/layout/widget_4x.xml
similarity index 100%
rename from Notes-master/Notes-master/res/layout/widget_4x.xml
rename to NotesMaster/app/src/main/res/layout/widget_4x.xml
diff --git a/Notes-master/Notes-master/res/menu/call_note_edit.xml b/NotesMaster/app/src/main/res/menu/call_note_edit.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/call_note_edit.xml
rename to NotesMaster/app/src/main/res/menu/call_note_edit.xml
diff --git a/Notes-master/Notes-master/res/menu/call_record_folder.xml b/NotesMaster/app/src/main/res/menu/call_record_folder.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/call_record_folder.xml
rename to NotesMaster/app/src/main/res/menu/call_record_folder.xml
diff --git a/Notes-master/Notes-master/res/menu/note_edit.xml b/NotesMaster/app/src/main/res/menu/note_edit.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/note_edit.xml
rename to NotesMaster/app/src/main/res/menu/note_edit.xml
diff --git a/Notes-master/Notes-master/res/menu/note_list.xml b/NotesMaster/app/src/main/res/menu/note_list.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/note_list.xml
rename to NotesMaster/app/src/main/res/menu/note_list.xml
diff --git a/Notes-master/Notes-master/res/menu/note_list_dropdown.xml b/NotesMaster/app/src/main/res/menu/note_list_dropdown.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/note_list_dropdown.xml
rename to NotesMaster/app/src/main/res/menu/note_list_dropdown.xml
diff --git a/Notes-master/Notes-master/res/menu/note_list_options.xml b/NotesMaster/app/src/main/res/menu/note_list_options.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/note_list_options.xml
rename to NotesMaster/app/src/main/res/menu/note_list_options.xml
diff --git a/Notes-master/Notes-master/res/menu/sub_folder.xml b/NotesMaster/app/src/main/res/menu/sub_folder.xml
similarity index 100%
rename from Notes-master/Notes-master/res/menu/sub_folder.xml
rename to NotesMaster/app/src/main/res/menu/sub_folder.xml
diff --git a/Notes-master/Notes-master/res/raw-zh-rCN/introduction b/NotesMaster/app/src/main/res/raw-zh-rCN/introduction
similarity index 100%
rename from Notes-master/Notes-master/res/raw-zh-rCN/introduction
rename to NotesMaster/app/src/main/res/raw-zh-rCN/introduction
diff --git a/Notes-master/Notes-master/res/raw/introduction b/NotesMaster/app/src/main/res/raw/introduction
similarity index 100%
rename from Notes-master/Notes-master/res/raw/introduction
rename to NotesMaster/app/src/main/res/raw/introduction
diff --git a/Notes-master/Notes-master/res/values-zh-rCN/arrays.xml b/NotesMaster/app/src/main/res/values-zh-rCN/arrays.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values-zh-rCN/arrays.xml
rename to NotesMaster/app/src/main/res/values-zh-rCN/arrays.xml
diff --git a/Notes-master/Notes-master/res/values-zh-rCN/strings.xml b/NotesMaster/app/src/main/res/values-zh-rCN/strings.xml
similarity index 92%
rename from Notes-master/Notes-master/res/values-zh-rCN/strings.xml
rename to NotesMaster/app/src/main/res/values-zh-rCN/strings.xml
index 09f75ed..32cf020 100644
--- a/Notes-master/Notes-master/res/values-zh-rCN/strings.xml
+++ b/NotesMaster/app/src/main/res/values-zh-rCN/strings.xml
@@ -17,6 +17,8 @@
+ 编辑信息
+ 发送便签便签2x2便签4x4
@@ -71,10 +73,16 @@
确认要删除该条便签吗?确认删除文件夹及所包含的便签吗?已将所选 %1$d 条便签移到 %2$s 文件夹
+ 禁止移动到垃圾箱
+ 禁止删除垃圾箱
+ 禁止在垃圾箱中新建便签
+ 禁止更改垃圾箱的名字
+ 回收站
+ 恢复文件夹SD卡被占用,不能操作导出文本时发生错误,请检查SD卡
- 要查看的便签不存在
+ 禁止在垃圾箱中打开便签不能为空便签设置闹钟提醒不能将空便签发送到桌面导出成功
diff --git a/Notes-master/Notes-master/res/values-zh-rTW/arrays.xml b/NotesMaster/app/src/main/res/values-zh-rTW/arrays.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values-zh-rTW/arrays.xml
rename to NotesMaster/app/src/main/res/values-zh-rTW/arrays.xml
diff --git a/Notes-master/Notes-master/res/values-zh-rTW/strings.xml b/NotesMaster/app/src/main/res/values-zh-rTW/strings.xml
similarity index 93%
rename from Notes-master/Notes-master/res/values-zh-rTW/strings.xml
rename to NotesMaster/app/src/main/res/values-zh-rTW/strings.xml
index 3c41894..2b94d7d 100644
--- a/Notes-master/Notes-master/res/values-zh-rTW/strings.xml
+++ b/NotesMaster/app/src/main/res/values-zh-rTW/strings.xml
@@ -17,6 +17,8 @@
+ 編輯信息
+ 發送便簽便簽2x2便簽4x4
@@ -71,6 +73,12 @@
确认要刪除所選的 %d 條便籤嗎?确认要删除該條便籤嗎?確認刪除檔夾及所包含的便簽嗎?
+ 禁止移動到垃圾箱
+ 禁止刪除垃圾箱
+ 禁止在垃圾箱中新建便籤
+ 禁止更改垃圾箱名字
+ 恢復文件夾
+ 回收站SD卡被佔用,不能操作導出TXT時發生錯誤,請檢查SD卡要查看的便籤不存在
diff --git a/NotesMaster/app/src/main/res/values/NoteTheme.xml b/NotesMaster/app/src/main/res/values/NoteTheme.xml
new file mode 100644
index 0000000..fa8a74c
--- /dev/null
+++ b/NotesMaster/app/src/main/res/values/NoteTheme.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Notes-master/Notes-master/res/values/arrays.xml b/NotesMaster/app/src/main/res/values/arrays.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values/arrays.xml
rename to NotesMaster/app/src/main/res/values/arrays.xml
diff --git a/Notes-master/Notes-master/res/values/colors.xml b/NotesMaster/app/src/main/res/values/colors.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values/colors.xml
rename to NotesMaster/app/src/main/res/values/colors.xml
diff --git a/Notes-master/Notes-master/res/values/dimens.xml b/NotesMaster/app/src/main/res/values/dimens.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values/dimens.xml
rename to NotesMaster/app/src/main/res/values/dimens.xml
diff --git a/Notes-master/Notes-master/res/values/strings.xml b/NotesMaster/app/src/main/res/values/strings.xml
similarity index 89%
rename from Notes-master/Notes-master/res/values/strings.xml
rename to NotesMaster/app/src/main/res/values/strings.xml
index 55df868..ea0b974 100644
--- a/Notes-master/Notes-master/res/values/strings.xml
+++ b/NotesMaster/app/src/main/res/values/strings.xml
@@ -17,6 +17,8 @@
+ Enter a message
+ SendNotesNotes 2x2Notes 4x4
@@ -36,10 +38,10 @@
Browse webOpen map
- /MIUI/notes/
- notes_%s.txt
+ /MIUI/notes/
+ notes_%s.txt
- (%d)
+ (%d)New FolderExport textSync
@@ -75,10 +77,16 @@
Confirm to delete the selected %d notes?Confirm to delete this note?Have moved selected %1$d notes to %2$s folder
+ Forbidden move to trash folder
+ Forbidden delete trash folder
+ Forbidden add in trash folder
+ Forbidden change trash folder name
+ Move out folder
+ TRASHSD card busy, not available nowExport failed, please check SD card
- The note is not exist
+ Forbidden open note in trashSorry, can not set clock on empty noteSorry, can not send and empty note to homeExport successful
@@ -101,7 +109,7 @@
Sync accountSync notes with google taskLast sync time %1$s
- yyyy-MM-dd hh:mm:ss
+ yyyy-MM-dd hh:mm:ssAdd accountChange sync accountRemove sync account
diff --git a/Notes-master/Notes-master/res/values/styles.xml b/NotesMaster/app/src/main/res/values/styles.xml
similarity index 100%
rename from Notes-master/Notes-master/res/values/styles.xml
rename to NotesMaster/app/src/main/res/values/styles.xml
diff --git a/Notes-master/Notes-master/res/xml/preferences.xml b/NotesMaster/app/src/main/res/xml/preferences.xml
similarity index 100%
rename from Notes-master/Notes-master/res/xml/preferences.xml
rename to NotesMaster/app/src/main/res/xml/preferences.xml
diff --git a/Notes-master/Notes-master/res/xml/searchable.xml b/NotesMaster/app/src/main/res/xml/searchable.xml
similarity index 100%
rename from Notes-master/Notes-master/res/xml/searchable.xml
rename to NotesMaster/app/src/main/res/xml/searchable.xml
diff --git a/Notes-master/Notes-master/res/xml/widget_2x_info.xml b/NotesMaster/app/src/main/res/xml/widget_2x_info.xml
similarity index 100%
rename from Notes-master/Notes-master/res/xml/widget_2x_info.xml
rename to NotesMaster/app/src/main/res/xml/widget_2x_info.xml
diff --git a/Notes-master/Notes-master/res/xml/widget_4x_info.xml b/NotesMaster/app/src/main/res/xml/widget_4x_info.xml
similarity index 100%
rename from Notes-master/Notes-master/res/xml/widget_4x_info.xml
rename to NotesMaster/app/src/main/res/xml/widget_4x_info.xml
diff --git a/NotesMaster/build.gradle b/NotesMaster/build.gradle
new file mode 100644
index 0000000..5ad7f02
--- /dev/null
+++ b/NotesMaster/build.gradle
@@ -0,0 +1,17 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.4.1'
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
diff --git a/NotesMaster/gradle.properties b/NotesMaster/gradle.properties
new file mode 100644
index 0000000..5465fec
--- /dev/null
+++ b/NotesMaster/gradle.properties
@@ -0,0 +1,2 @@
+android.enableJetifier=true
+android.useAndroidX=true
\ No newline at end of file
diff --git a/NotesMaster/gradle/wrapper/gradle-wrapper.properties b/NotesMaster/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..789502b
--- /dev/null
+++ b/NotesMaster/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+#Fri Feb 24 19:59:47 CST 2023
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+
diff --git a/NotesMaster/gradlew b/NotesMaster/gradlew
new file mode 100644
index 0000000..4f906e0
--- /dev/null
+++ b/NotesMaster/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# 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
+#
+# https://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.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/NotesMaster/gradlew.bat b/NotesMaster/gradlew.bat
new file mode 100644
index 0000000..107acd3
--- /dev/null
+++ b/NotesMaster/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/NotesMaster/import-summary.txt b/NotesMaster/import-summary.txt
new file mode 100644
index 0000000..f2e6428
--- /dev/null
+++ b/NotesMaster/import-summary.txt
@@ -0,0 +1,36 @@
+ECLIPSE ANDROID PROJECT IMPORT SUMMARY
+======================================
+
+Ignored Files:
+--------------
+The following files were *not* copied into the new Gradle project; you
+should evaluate whether these are still needed in your project and if
+so manually move them:
+
+* .gitignore
+* NOTICE
+* README
+
+Moved Files:
+------------
+Android Gradle projects use a different directory structure than ADT
+Eclipse projects. Here's how the projects were restructured:
+
+* AndroidManifest.xml => app\src\main\AndroidManifest.xml
+* res\ => app\src\main\res\
+* src\ => app\src\main\java\
+
+Next Steps:
+-----------
+You can now build the project. The Gradle project needs network
+connectivity to download dependencies.
+
+Bugs:
+-----
+If for some reason your project does not build, and you determine that
+it is due to a bug or limitation of the Eclipse to Gradle importer,
+please file a bug at http://b.android.com with category
+Component-Tools.
+
+(This import summary is for your information only, and can be deleted
+after import once you are satisfied with the results.)
diff --git a/NotesMaster/settings.gradle b/NotesMaster/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/NotesMaster/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/README.md b/README.md
deleted file mode 100644
index dd7be94..0000000
--- a/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# lza_gitpractice
-
-## 项目概述
-
-## 项目结构
-
-## 核心组件
-
-## 用户界面
-
-## 功能实现
-
-## 数据管理
-
-## 网络通信
-
-## 测试
-
-## 构建和部署
-
-## 第三方库和依赖