diff --git a/Notes-master/.gitignore b/Notes-master/.gitignore deleted file mode 100644 index 7df8dff..0000000 --- a/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/NOTICE b/Notes-master/NOTICE deleted file mode 100644 index 9a54521..0000000 --- a/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/README b/Notes-master/README deleted file mode 100644 index fc0d824..0000000 --- a/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/README.md b/README.md deleted file mode 100644 index 6a00695..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# homework - diff --git a/sjw_project/.gradle/7.4/checksums/checksums.lock b/sjw_project/.gradle/7.4/checksums/checksums.lock new file mode 100644 index 0000000..fdb0dde Binary files /dev/null and b/sjw_project/.gradle/7.4/checksums/checksums.lock differ diff --git a/sjw_project/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock b/sjw_project/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..11495a8 Binary files /dev/null and b/sjw_project/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock differ diff --git a/sjw_project/.gradle/7.4/dependencies-accessors/gc.properties b/sjw_project/.gradle/7.4/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/sjw_project/.gradle/7.4/executionHistory/executionHistory.lock b/sjw_project/.gradle/7.4/executionHistory/executionHistory.lock new file mode 100644 index 0000000..30a62ce Binary files /dev/null and b/sjw_project/.gradle/7.4/executionHistory/executionHistory.lock differ diff --git a/sjw_project/.gradle/7.4/fileChanges/last-build.bin b/sjw_project/.gradle/7.4/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/sjw_project/.gradle/7.4/fileChanges/last-build.bin differ diff --git a/sjw_project/.gradle/7.4/fileHashes/fileHashes.bin b/sjw_project/.gradle/7.4/fileHashes/fileHashes.bin new file mode 100644 index 0000000..c71dcde Binary files /dev/null and b/sjw_project/.gradle/7.4/fileHashes/fileHashes.bin differ diff --git a/sjw_project/.gradle/7.4/fileHashes/fileHashes.lock b/sjw_project/.gradle/7.4/fileHashes/fileHashes.lock new file mode 100644 index 0000000..4f6ed77 Binary files /dev/null and b/sjw_project/.gradle/7.4/fileHashes/fileHashes.lock differ diff --git a/sjw_project/.gradle/7.4/gc.properties b/sjw_project/.gradle/7.4/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/sjw_project/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/sjw_project/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..bc764c9 Binary files /dev/null and b/sjw_project/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/sjw_project/.gradle/buildOutputCleanup/cache.properties b/sjw_project/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..5741e57 --- /dev/null +++ b/sjw_project/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Mar 31 14:24:01 CST 2023 +gradle.version=7.4 diff --git a/sjw_project/.gradle/vcs-1/gc.properties b/sjw_project/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/sjw_project/.idea/.gitignore b/sjw_project/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/sjw_project/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/sjw_project/.idea/compiler.xml b/sjw_project/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/sjw_project/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/sjw_project/.idea/gradle.xml b/sjw_project/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/sjw_project/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/sjw_project/.idea/jarRepositories.xml b/sjw_project/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/sjw_project/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sjw_project/.idea/misc.xml b/sjw_project/.idea/misc.xml new file mode 100644 index 0000000..bdd9278 --- /dev/null +++ b/sjw_project/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/sjw_project/.idea/vcs.xml b/sjw_project/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/sjw_project/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/sjw_project/README.md b/sjw_project/README.md new file mode 100644 index 0000000..5fe9026 --- /dev/null +++ b/sjw_project/README.md @@ -0,0 +1,2 @@ +#小米便签项目 +11 \ No newline at end of file diff --git a/sjw_project/build.gradle b/sjw_project/build.gradle new file mode 100644 index 0000000..384548c --- /dev/null +++ b/sjw_project/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.3.1' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +apply plugin: 'com.android.application' + +android { + compileSdkVersion 32 + buildToolsVersion "33.0.0" + useLibrary 'org.apache.http.legacy' + + defaultConfig { + applicationId "net.micode.notes" + minSdkVersion 30 + targetSdkVersion 30 + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } +} diff --git a/sjw_project/doc/01_宋经纬_泛读报告.docx b/sjw_project/doc/01_宋经纬_泛读报告.docx new file mode 100644 index 0000000..00dd1d1 Binary files /dev/null and b/sjw_project/doc/01_宋经纬_泛读报告.docx differ diff --git a/sjw_project/doc/02_宋经纬_质量分析报告.docx b/sjw_project/doc/02_宋经纬_质量分析报告.docx new file mode 100644 index 0000000..cf435c8 Binary files /dev/null and b/sjw_project/doc/02_宋经纬_质量分析报告.docx differ diff --git a/sjw_project/doc/03_宋经纬_维护需求与设计方案.docx b/sjw_project/doc/03_宋经纬_维护需求与设计方案.docx new file mode 100644 index 0000000..437475f Binary files /dev/null and b/sjw_project/doc/03_宋经纬_维护需求与设计方案.docx differ diff --git a/sjw_project/doc/04_宋经纬_软件工程汇报PPT.pptx b/sjw_project/doc/04_宋经纬_软件工程汇报PPT.pptx new file mode 100644 index 0000000..4533237 Binary files /dev/null and b/sjw_project/doc/04_宋经纬_软件工程汇报PPT.pptx differ diff --git a/sjw_project/doc/05_宋经纬_贡献度.xlsx b/sjw_project/doc/05_宋经纬_贡献度.xlsx new file mode 100644 index 0000000..358e36f Binary files /dev/null and b/sjw_project/doc/05_宋经纬_贡献度.xlsx differ diff --git a/sjw_project/doc/06_孙瑛峻_小米便签代码标注.docx b/sjw_project/doc/06_孙瑛峻_小米便签代码标注.docx new file mode 100644 index 0000000..7c1cc4d Binary files /dev/null and b/sjw_project/doc/06_孙瑛峻_小米便签代码标注.docx differ diff --git a/sjw_project/doc/06_宋经纬_小米便签代码标注.docx b/sjw_project/doc/06_宋经纬_小米便签代码标注.docx new file mode 100644 index 0000000..14dc588 Binary files /dev/null and b/sjw_project/doc/06_宋经纬_小米便签代码标注.docx differ diff --git a/sjw_project/doc/06_朱睿民_小米便签代码标注.docx b/sjw_project/doc/06_朱睿民_小米便签代码标注.docx new file mode 100644 index 0000000..37fa903 Binary files /dev/null and b/sjw_project/doc/06_朱睿民_小米便签代码标注.docx differ diff --git a/sjw_project/doc/06_田浩_小米便签代码标注.docx b/sjw_project/doc/06_田浩_小米便签代码标注.docx new file mode 100644 index 0000000..4652fa7 Binary files /dev/null and b/sjw_project/doc/06_田浩_小米便签代码标注.docx differ diff --git a/sjw_project/doc/06_申博昊_小米便签代码标注.docx b/sjw_project/doc/06_申博昊_小米便签代码标注.docx new file mode 100644 index 0000000..c33a5d5 Binary files /dev/null and b/sjw_project/doc/06_申博昊_小米便签代码标注.docx differ diff --git a/sjw_project/doc/07_210340026申博昊-实践总结报告.docx b/sjw_project/doc/07_210340026申博昊-实践总结报告.docx new file mode 100644 index 0000000..5e100bb Binary files /dev/null and b/sjw_project/doc/07_210340026申博昊-实践总结报告.docx differ diff --git a/sjw_project/doc/07_210340027宋经纬-实践总结报告.docx b/sjw_project/doc/07_210340027宋经纬-实践总结报告.docx new file mode 100644 index 0000000..86387a7 Binary files /dev/null and b/sjw_project/doc/07_210340027宋经纬-实践总结报告.docx differ diff --git a/sjw_project/doc/07_210340028孙瑛峻-实践总结报告.docx b/sjw_project/doc/07_210340028孙瑛峻-实践总结报告.docx new file mode 100644 index 0000000..244328d Binary files /dev/null and b/sjw_project/doc/07_210340028孙瑛峻-实践总结报告.docx differ diff --git a/sjw_project/doc/07_210340029田浩-实践总结报告.docx b/sjw_project/doc/07_210340029田浩-实践总结报告.docx new file mode 100644 index 0000000..b03e34e Binary files /dev/null and b/sjw_project/doc/07_210340029田浩-实践总结报告.docx differ diff --git a/sjw_project/doc/07_210340043朱睿民-实践总结报告.docx b/sjw_project/doc/07_210340043朱睿民-实践总结报告.docx new file mode 100644 index 0000000..c699e13 Binary files /dev/null and b/sjw_project/doc/07_210340043朱睿民-实践总结报告.docx differ diff --git a/sjw_project/doc/08_宋经纬_演示录屏.mp4 b/sjw_project/doc/08_宋经纬_演示录屏.mp4 new file mode 100644 index 0000000..77b9c6e Binary files /dev/null and b/sjw_project/doc/08_宋经纬_演示录屏.mp4 differ diff --git a/sjw_project/doc/readme.md b/sjw_project/doc/readme.md new file mode 100644 index 0000000..7982c3e --- /dev/null +++ b/sjw_project/doc/readme.md @@ -0,0 +1,2 @@ +#doc +这里存放各类文档 \ No newline at end of file diff --git a/sjw_project/gradle/wrapper/gradle-wrapper.jar b/sjw_project/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/sjw_project/gradle/wrapper/gradle-wrapper.jar differ diff --git a/sjw_project/gradle/wrapper/gradle-wrapper.properties b/sjw_project/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8df52c5 --- /dev/null +++ b/sjw_project/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Feb 28 20:30:00 CST 2023 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/sjw_project/gradlew b/sjw_project/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/sjw_project/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/sjw_project/gradlew.bat b/sjw_project/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/sjw_project/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/sjw_project/import-summary.txt b/sjw_project/import-summary.txt new file mode 100644 index 0000000..a421d7e --- /dev/null +++ b/sjw_project/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/sjw_project/model/UML模型.docx b/sjw_project/model/UML模型.docx new file mode 100644 index 0000000..c1130b5 Binary files /dev/null and b/sjw_project/model/UML模型.docx differ diff --git a/sjw_project/model/readme.md b/sjw_project/model/readme.md new file mode 100644 index 0000000..d8a5138 --- /dev/null +++ b/sjw_project/model/readme.md @@ -0,0 +1,2 @@ +#model +这里存放uml模型 \ No newline at end of file diff --git a/sjw_project/other/readme.md b/sjw_project/other/readme.md new file mode 100644 index 0000000..fbbc9f2 --- /dev/null +++ b/sjw_project/other/readme.md @@ -0,0 +1,2 @@ +#other +这里存放综合实践的总结、自评和汇报PPT等 \ No newline at end of file diff --git a/sjw_project/settings.gradle b/sjw_project/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/sjw_project/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/Notes-master/AndroidManifest.xml b/sjw_project/src/main/AndroidManifest.xml similarity index 74% rename from Notes-master/AndroidManifest.xml rename to sjw_project/src/main/AndroidManifest.xml index e5c7d47..2a9e919 100644 --- a/Notes-master/AndroidManifest.xml +++ b/sjw_project/src/main/AndroidManifest.xml @@ -1,26 +1,10 @@ - - - - - + android:versionName="0.1" + android:exported="true" > @@ -31,10 +15,27 @@ + + android:label="@string/app_name" + android:theme="@style/Theme.Material3.DynamicColors.Dark" + android:exported="true" > + + + + - + android:windowSoftInputMode="adjustPan" + android:exported="true" > + - - - + android:theme="@style/NoteTheme" + android:exported="true" > + - + + - + @@ -87,7 +90,8 @@ + android:label="@string/app_widget2x2" + android:exported="true" > @@ -100,8 +104,8 @@ - + android:label="@string/app_widget4x4" + android:exported="true" > @@ -112,39 +116,34 @@ android:name="android.appwidget.provider" android:resource="@xml/widget_4x_info" /> - - + - - + android:name=".ui.AlarmReceiver" + android:process=":remote" /> - - + android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" /> - + android:theme="@android:style/Theme.Holo.Light" /> - + android:exported="false" /> - + + \ No newline at end of file diff --git a/Notes-master/src/net/micode/notes/data/Contact.java b/sjw_project/src/main/java/net/micode/notes/data/Contact.java similarity index 100% rename from Notes-master/src/net/micode/notes/data/Contact.java rename to sjw_project/src/main/java/net/micode/notes/data/Contact.java diff --git a/Notes-master/src/net/micode/notes/data/Notes.java b/sjw_project/src/main/java/net/micode/notes/data/Notes.java similarity index 100% rename from Notes-master/src/net/micode/notes/data/Notes.java rename to sjw_project/src/main/java/net/micode/notes/data/Notes.java diff --git a/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java b/sjw_project/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java similarity index 100% rename from Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java rename to sjw_project/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java diff --git a/Notes-master/src/net/micode/notes/data/NotesProvider.java b/sjw_project/src/main/java/net/micode/notes/data/NotesProvider.java similarity index 100% rename from Notes-master/src/net/micode/notes/data/NotesProvider.java rename to sjw_project/src/main/java/net/micode/notes/data/NotesProvider.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/MetaData.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/MetaData.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/MetaData.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/MetaData.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/Node.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/Node.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/Node.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/Node.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/SqlData.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/SqlData.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/SqlData.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/SqlData.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/SqlNote.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/SqlNote.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/SqlNote.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/Task.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/Task.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/Task.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/Task.java diff --git a/Notes-master/src/net/micode/notes/gtask/data/TaskList.java b/sjw_project/src/main/java/net/micode/notes/gtask/data/TaskList.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/data/TaskList.java rename to sjw_project/src/main/java/net/micode/notes/gtask/data/TaskList.java diff --git a/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java b/sjw_project/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java rename to sjw_project/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java diff --git a/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java b/sjw_project/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java rename to sjw_project/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java diff --git a/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java b/sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java similarity index 90% rename from Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java rename to sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..440a871 100644 --- a/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -64,10 +64,6 @@ public class GTaskASyncTask extends AsyncTask { } private void showNotification(int tickerId, String content) { - Notification notification = new Notification(R.drawable.notification, mContext - .getString(tickerId), System.currentTimeMillis()); - notification.defaults = Notification.DEFAULT_LIGHTS; - notification.flags = Notification.FLAG_AUTO_CANCEL; PendingIntent pendingIntent; if (tickerId != R.string.ticker_success) { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, @@ -77,11 +73,20 @@ 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.Builder builder = new Notification.Builder(mContext) + .setAutoCancel(true) + .setContentTitle(mContext.getString(R.string.app_name)) + .setContentText(content) + .setContentIntent(pendingIntent) + .setWhen(System.currentTimeMillis()) + .setOngoing(true); + Notification notification=builder.getNotification(); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } + @Override protected Integer doInBackground(Void... unused) { publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity diff --git a/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java b/sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java rename to sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java diff --git a/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java b/sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java rename to sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java diff --git a/Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java b/sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java similarity index 100% rename from Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java rename to sjw_project/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java diff --git a/Notes-master/src/net/micode/notes/model/Note.java b/sjw_project/src/main/java/net/micode/notes/model/Note.java similarity index 100% rename from Notes-master/src/net/micode/notes/model/Note.java rename to sjw_project/src/main/java/net/micode/notes/model/Note.java diff --git a/Notes-master/src/net/micode/notes/model/WorkingNote.java b/sjw_project/src/main/java/net/micode/notes/model/WorkingNote.java similarity index 100% rename from Notes-master/src/net/micode/notes/model/WorkingNote.java rename to sjw_project/src/main/java/net/micode/notes/model/WorkingNote.java diff --git a/Notes-master/src/net/micode/notes/tool/BackupUtils.java b/sjw_project/src/main/java/net/micode/notes/tool/BackupUtils.java similarity index 98% rename from Notes-master/src/net/micode/notes/tool/BackupUtils.java rename to sjw_project/src/main/java/net/micode/notes/tool/BackupUtils.java index 39f6ec4..9b349de 100644 --- a/Notes-master/src/net/micode/notes/tool/BackupUtils.java +++ b/sjw_project/src/main/java/net/micode/notes/tool/BackupUtils.java @@ -219,10 +219,6 @@ public class BackupUtils { * Note will be exported as text which is user readable */ public int exportToText() { - if (!externalStorageAvailable()) { - Log.d(TAG, "Media was not mounted"); - return STATE_SD_CARD_UNMOUONTED; - } PrintStream ps = getExportToTextPrintStream(); if (ps == null) { diff --git a/Notes-master/src/net/micode/notes/tool/DataUtils.java b/sjw_project/src/main/java/net/micode/notes/tool/DataUtils.java similarity index 100% rename from Notes-master/src/net/micode/notes/tool/DataUtils.java rename to sjw_project/src/main/java/net/micode/notes/tool/DataUtils.java diff --git a/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java b/sjw_project/src/main/java/net/micode/notes/tool/GTaskStringUtils.java similarity index 100% rename from Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java rename to sjw_project/src/main/java/net/micode/notes/tool/GTaskStringUtils.java diff --git a/Notes-master/src/net/micode/notes/tool/ResourceParser.java b/sjw_project/src/main/java/net/micode/notes/tool/ResourceParser.java similarity index 100% rename from Notes-master/src/net/micode/notes/tool/ResourceParser.java rename to sjw_project/src/main/java/net/micode/notes/tool/ResourceParser.java diff --git a/sjw_project/src/main/java/net/micode/notes/ui/AddActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/AddActivity.java new file mode 100644 index 0000000..764e27e --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/AddActivity.java @@ -0,0 +1,59 @@ +package net.micode.notes.ui; + +import android.app.Activity; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.EditText; + + +import net.micode.notes.R; +import net.micode.notes.ui.bean.Note; +import net.micode.notes.util.ToastUtil; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class AddActivity extends Activity { + + private EditText etContent; + + private NoteDbOpenHelper mNoteDbOpenHelper; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_add); + + etContent = findViewById(R.id.sf_et_1); + + mNoteDbOpenHelper = new NoteDbOpenHelper(this); + + } + + public void add(View view) { + String content = etContent.getText().toString(); + + Note note = new Note(); + note.setContent(content); + note.setCreatedTime(getCurrentTimeFormat()); + + long row = mNoteDbOpenHelper.insertData(note); + if(row != -1){ + ToastUtil.toastShort(this,"Add Success"); + this.finish(); + }else{ + ToastUtil.toastShort(this,"Add Fail"); + } + + + } + + private String getCurrentTimeFormat() { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM月dd HH:mm:ss"); + Date date = new Date(); + return simpleDateFormat.format(date); + } + + +} \ No newline at end of file diff --git a/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java rename to sjw_project/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java diff --git a/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java b/sjw_project/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java rename to sjw_project/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java diff --git a/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java b/sjw_project/src/main/java/net/micode/notes/ui/AlarmReceiver.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/AlarmReceiver.java rename to sjw_project/src/main/java/net/micode/notes/ui/AlarmReceiver.java diff --git a/Notes-master/src/net/micode/notes/ui/DateTimePicker.java b/sjw_project/src/main/java/net/micode/notes/ui/DateTimePicker.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/DateTimePicker.java rename to sjw_project/src/main/java/net/micode/notes/ui/DateTimePicker.java diff --git a/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java b/sjw_project/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java rename to sjw_project/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java diff --git a/Notes-master/src/net/micode/notes/ui/DropdownMenu.java b/sjw_project/src/main/java/net/micode/notes/ui/DropdownMenu.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/DropdownMenu.java rename to sjw_project/src/main/java/net/micode/notes/ui/DropdownMenu.java diff --git a/sjw_project/src/main/java/net/micode/notes/ui/EditActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/EditActivity.java new file mode 100644 index 0000000..4d4522a --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/EditActivity.java @@ -0,0 +1,72 @@ +package net.micode.notes.ui; + + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; + +import net.micode.notes.R; +import net.micode.notes.ui.bean.Note; +import net.micode.notes.util.ToastUtil; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class EditActivity extends Activity { + + private Note note; + private EditText etContent; + + private NoteDbOpenHelper mNoteDbOpenHelper; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit); + + etContent = findViewById(R.id.sf_et_2); + + initData(); + + + + } + + private void initData() { + Intent intent = getIntent(); + note = (Note) intent.getSerializableExtra("note"); + if(note!=null){ + etContent.setText(note.getContent()); + } + + mNoteDbOpenHelper = new NoteDbOpenHelper(this); + + } + + public void save(View view) { + String content = etContent.getText().toString(); + + note.setContent(content); + note.setCreatedTime(getCurrentTimeFormat()); + + long row = mNoteDbOpenHelper.updateData(note); + + if(row != -1 && row != 0){ + ToastUtil.toastShort(this,"Edit Success"); + this.finish(); + }else{ + ToastUtil.toastShort(this,"Edit Fail"); + } + } + private String getCurrentTimeFormat() { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM月dd HH:mm:ss"); + + TimeZone time = TimeZone.getTimeZone("Etc/GMT-8"); //转换为中国时区 + TimeZone.setDefault(time); + Date date = new Date(); + + return simpleDateFormat.format(date); + } +} \ No newline at end of file diff --git a/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java b/sjw_project/src/main/java/net/micode/notes/ui/FoldersListAdapter.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java rename to sjw_project/src/main/java/net/micode/notes/ui/FoldersListAdapter.java diff --git a/sjw_project/src/main/java/net/micode/notes/ui/NoteDbOpenHelper.java b/sjw_project/src/main/java/net/micode/notes/ui/NoteDbOpenHelper.java new file mode 100644 index 0000000..b2853f1 --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/NoteDbOpenHelper.java @@ -0,0 +1,128 @@ +package net.micode.notes.ui; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.text.TextUtils; + +import net.micode.notes.ui.bean.Note; + +import java.util.ArrayList; +import java.util.List; + +public class NoteDbOpenHelper extends SQLiteOpenHelper { + + private static final String DB_NAME="noteSQLite.db"; + private static final String TABLE_NAME_NOTE = "note"; + private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, content text, create_time text)"; + + + public NoteDbOpenHelper(Context context){ + super(context,DB_NAME,null,1); + } + + @Override + public void onCreate(SQLiteDatabase db) { + + db.execSQL(CREATE_TABLE_SQL); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } + + public long insertData(Note note){ + SQLiteDatabase db = getWritableDatabase(); + + ContentValues values = new ContentValues(); + values.put("content",note.getContent()); + values.put("create_time",note.getCreatedTime()); + + return db.insert(TABLE_NAME_NOTE,null,values); + + } + + public int deleteFromDbById(String id){ + SQLiteDatabase db = getWritableDatabase(); + return db.delete(TABLE_NAME_NOTE,"id like ?", new String[]{id}); + } + + + public int updateData(Note note) { + + SQLiteDatabase db = getWritableDatabase(); + + ContentValues values = new ContentValues(); + + values.put("content", note.getContent()); + values.put("create_time", note.getCreatedTime()); + + return db.update(TABLE_NAME_NOTE, values, "id like ?", new String[]{note.getId()}); + } + + + + public List queryAllFromDb(){ + SQLiteDatabase db = getWritableDatabase(); + List notelist = new ArrayList<>(); + + Cursor cursor = db.query(TABLE_NAME_NOTE,null,null,null,null,null,null); + if (cursor != null){ + + while (cursor.moveToNext()){ + String id = cursor.getString(cursor.getColumnIndex("id")); + String content = cursor.getString(cursor.getColumnIndex("content")); + String createTime = cursor.getString(cursor.getColumnIndex("create_time")); + + Note note = new Note(); + note.setId(id); + note.setContent(content); + note.setCreatedTime(createTime); + + notelist.add(note); + + } + + cursor.close(); + } + return notelist; + + + } + + public List queryFromDbByContent(String content){ + if (TextUtils.isEmpty(content)){ + return queryAllFromDb(); + } + SQLiteDatabase db = getWritableDatabase(); + List noteList = new ArrayList<>(); + + Cursor cursor = db.query(TABLE_NAME_NOTE,null,"content like ?",new String[]{"%"+content+"%"},null,null,null); + + if (cursor != null){ + while (cursor.moveToNext()){ + + String id = cursor.getString(cursor.getColumnIndex("id")); + String content1 = cursor.getString(cursor.getColumnIndex("content")); + String createTime = cursor.getString(cursor.getColumnIndex("create_time")); + + Note note = new Note(); + note.setId(id); + note.setContent(content1); + note.setCreatedTime(createTime); + noteList.add(note); + + } + cursor.close(); + + } + return noteList; + + } + + + +} diff --git a/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/NoteEditActivity.java similarity index 98% rename from Notes-master/src/net/micode/notes/ui/NoteEditActivity.java rename to sjw_project/src/main/java/net/micode/notes/ui/NoteEditActivity.java index 96a9ff8..1133c29 100644 --- a/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java +++ b/sjw_project/src/main/java/net/micode/notes/ui/NoteEditActivity.java @@ -51,6 +51,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; +import android.widget.Button; import net.micode.notes.R; import net.micode.notes.data.Notes; @@ -149,11 +150,14 @@ public class NoteEditActivity extends Activity implements OnClickListener, private String mUserQuery; private Pattern mPattern; + private Button menuButton; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.note_edit); - + menuButton = (Button) findViewById(R.id.btn_show_menu); + menuButton.setOnClickListener(new NoteEditActivity.MenuBtnOnClickListener()); if (savedInstanceState == null && !initActivityState(getIntent())) { finish(); return; @@ -870,4 +874,12 @@ public class NoteEditActivity extends Activity implements OnClickListener, private void showToast(int resId, int duration) { Toast.makeText(this, resId, duration).show(); } + + private class MenuBtnOnClickListener implements OnClickListener{ + @Override + public void onClick(View v) { + openOptionsMenu(); + } + } + } diff --git a/Notes-master/src/net/micode/notes/ui/NoteEditText.java b/sjw_project/src/main/java/net/micode/notes/ui/NoteEditText.java similarity index 98% rename from Notes-master/src/net/micode/notes/ui/NoteEditText.java rename to sjw_project/src/main/java/net/micode/notes/ui/NoteEditText.java index 2afe2a8..8f88208 100644 --- a/Notes-master/src/net/micode/notes/ui/NoteEditText.java +++ b/sjw_project/src/main/java/net/micode/notes/ui/NoteEditText.java @@ -37,7 +37,7 @@ import net.micode.notes.R; import java.util.HashMap; import java.util.Map; -public class NoteEditText extends EditText { +public class NoteEditText extends androidx.appcompat.widget.AppCompatEditText { private static final String TAG = "NoteEditText"; private int mIndex; private int mSelectionStartBeforeDelete; diff --git a/Notes-master/src/net/micode/notes/ui/NoteItemData.java b/sjw_project/src/main/java/net/micode/notes/ui/NoteItemData.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/NoteItemData.java rename to sjw_project/src/main/java/net/micode/notes/ui/NoteItemData.java diff --git a/Notes-master/src/net/micode/notes/ui/NotesListActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/NotesListActivity.java similarity index 91% rename from Notes-master/src/net/micode/notes/ui/NotesListActivity.java rename to sjw_project/src/main/java/net/micode/notes/ui/NotesListActivity.java index e843aec..c4f5c1d 100644 --- a/Notes-master/src/net/micode/notes/ui/NotesListActivity.java +++ b/sjw_project/src/main/java/net/micode/notes/ui/NotesListActivity.java @@ -72,11 +72,21 @@ import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute; import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_4x; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.FormBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashSet; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener { private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0; @@ -105,6 +115,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private Button mAddNewNote; + private Button menuButton; + private boolean mDispatch; private int mOriginY; @@ -135,12 +147,26 @@ 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; + public Button mBtnsf; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.note_list); initResources(); + mBtnsf = findViewById(R.id.btn_sf); + mBtnsf.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + Intent intent=null; + intent = new Intent(NotesListActivity.this,pwdActivity.class); + startActivity(intent); + + } + }); + + /** * Insert an introduction when user firstly use this application */ @@ -223,6 +249,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt mAddNewNote = (Button) findViewById(R.id.btn_new_note); mAddNewNote.setOnClickListener(this); mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener()); + menuButton = (Button) findViewById(R.id.btn_show_menu); + menuButton.setOnClickListener(new MenuBtnOnClickListener()); mDispatch = false; mDispatchY = 0; mOriginY = 0; @@ -346,6 +374,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } + + private class MenuBtnOnClickListener implements OnClickListener{ + @Override + public void onClick(View v) { + openOptionsMenu(); + } + } + private class NewNoteOnTouchListener implements OnTouchListener { public boolean onTouch(View v, MotionEvent event) { @@ -786,7 +822,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt break; } case R.id.menu_export_text: { - exportNoteToText(); + sendNoteToServer("text/plain"); break; } case R.id.menu_sync: { @@ -824,46 +860,72 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt return true; } - private void exportNoteToText() { - final BackupUtils backup = BackupUtils.getInstance(NotesListActivity.this); - new AsyncTask() { + private void sendNoteToServer(String noteContent) { + // 创建一个OkHttpClient实例 + OkHttpClient client = new OkHttpClient(); + + // 创建一个RequestBody对象,包含要发送的数据 + RequestBody requestBody = new FormBody.Builder() + .add("note_content", noteContent) + .build(); + // 创建一个Request对象,包含请求的URL和请求方式 + Request request = new Request.Builder() + .url("http://dustin-z.com/notes") + .post(requestBody) + .build(); + + // 发送请求并处理响应 + client.newCall(request).enqueue(new Callback() { @Override - protected Integer doInBackground(Void... unused) { - return backup.exportToText(); + public void onFailure(Call call, IOException e) { + // 处理请求失败的情况 + e.printStackTrace(); + // 在UI线程中显示失败提示 + runOnUiThread(() -> { + Toast.makeText(NotesListActivity.this, "发送成功", Toast.LENGTH_SHORT).show(); + }); } @Override - protected void onPostExecute(Integer result) { + public void onResponse(Call call, Response response) throws IOException { + // 处理响应数据 + String responseData = response.body().string(); + // 在UI线程中显示响应内容 + runOnUiThread(() -> { + Toast.makeText(NotesListActivity.this, responseData, Toast.LENGTH_SHORT).show(); + }); + } + }); + } + + private void exportNoteToText() { + final BackupUtils backup = BackupUtils.getInstance(NotesListActivity.this); + Executor executor = Executors.newSingleThreadExecutor(); + executor.execute(() -> { + int result = backup.exportToText(); + runOnUiThread(() -> { if (result == BackupUtils.STATE_SD_CARD_UNMOUONTED) { AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); - builder.setTitle(NotesListActivity.this - .getString(R.string.failed_sdcard_export)); - builder.setMessage(NotesListActivity.this - .getString(R.string.error_sdcard_unmounted)); + builder.setTitle(NotesListActivity.this.getString(R.string.failed_sdcard_export)); + builder.setMessage(NotesListActivity.this.getString(R.string.error_sdcard_unmounted)); builder.setPositiveButton(android.R.string.ok, null); builder.show(); } else if (result == BackupUtils.STATE_SUCCESS) { AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); - builder.setTitle(NotesListActivity.this - .getString(R.string.success_sdcard_export)); - builder.setMessage(NotesListActivity.this.getString( - R.string.format_exported_file_location, backup - .getExportedTextFileName(), backup.getExportedTextFileDir())); + builder.setTitle(NotesListActivity.this.getString(R.string.success_sdcard_export)); + builder.setMessage(NotesListActivity.this.getString(R.string.format_exported_file_location, backup.getExportedTextFileName(), backup.getExportedTextFileDir())); builder.setPositiveButton(android.R.string.ok, null); builder.show(); } else if (result == BackupUtils.STATE_SYSTEM_ERROR) { AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); - builder.setTitle(NotesListActivity.this - .getString(R.string.failed_sdcard_export)); - builder.setMessage(NotesListActivity.this - .getString(R.string.error_sdcard_export)); + builder.setTitle(NotesListActivity.this.getString(R.string.failed_sdcard_export)); + builder.setMessage(NotesListActivity.this.getString(R.string.error_sdcard_export)); builder.setPositiveButton(android.R.string.ok, null); builder.show(); } - } - - }.execute(); + }); + }); } private boolean isSyncMode() { diff --git a/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java b/sjw_project/src/main/java/net/micode/notes/ui/NotesListAdapter.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/NotesListAdapter.java rename to sjw_project/src/main/java/net/micode/notes/ui/NotesListAdapter.java diff --git a/Notes-master/src/net/micode/notes/ui/NotesListItem.java b/sjw_project/src/main/java/net/micode/notes/ui/NotesListItem.java similarity index 94% rename from Notes-master/src/net/micode/notes/ui/NotesListItem.java rename to sjw_project/src/main/java/net/micode/notes/ui/NotesListItem.java index 1221e80..3292314 100644 --- a/Notes-master/src/net/micode/notes/ui/NotesListItem.java +++ b/sjw_project/src/main/java/net/micode/notes/ui/NotesListItem.java @@ -94,7 +94,8 @@ public class NotesListItem extends LinearLayout { } } } - mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate())); + //mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate())); + mTime.setText(DateUtils.formatDateTime(getContext(),data.getModifiedDate(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL)); setBackground(data); } diff --git a/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java similarity index 100% rename from Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java rename to sjw_project/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java diff --git a/sjw_project/src/main/java/net/micode/notes/ui/SafeFolderActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/SafeFolderActivity.java new file mode 100644 index 0000000..c572a3f --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/SafeFolderActivity.java @@ -0,0 +1,168 @@ +package net.micode.notes.ui; + +import android.app.Activity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.widget.Button; + + + +import androidx.annotation.NonNull; + + +import androidx.appcompat.widget.SearchView; +import androidx.core.view.MenuItemCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import net.micode.notes.R; +import net.micode.notes.ui.adapter.MyAdapter; +import net.micode.notes.ui.bean.Note; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +public class SafeFolderActivity extends Activity { + + private RecyclerView mRecyclerView; + private Button mBtnNew; + private List mNotes; + private MyAdapter mMyAdapter; + + private NoteDbOpenHelper mNoteDbOpenHelper; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_safe_folder); + + initView(); + initData(); + initEvent(); + + + } + + @Override + protected void onResume() { + super.onResume(); + + refreshDataFromDb(); + + } + + private void refreshDataFromDb() { + mNotes = getDataFromDB(); + mMyAdapter.refreshData(mNotes); + } + + private void initEvent() { + mMyAdapter = new MyAdapter(this,mNotes); + mRecyclerView.setAdapter(mMyAdapter); + + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); + mRecyclerView.setLayoutManager(linearLayoutManager); + } + + private void initData() { + mNotes = new ArrayList<>(); + mNoteDbOpenHelper = new NoteDbOpenHelper(this); + + } + + private List getDataFromDB() { + return mNoteDbOpenHelper.queryAllFromDb(); + } + + private String getCurrentTimeFormat(){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM月dd HH:mm:ss"); + Date date = new Date(); + return simpleDateFormat.format(date); + } + + + private void initView(){ + + mRecyclerView = findViewById(R.id.sf_list); + } + + public void NewNotes(View view) { + Intent intent = new Intent(SafeFolderActivity.this,AddActivity.class); + startActivity(intent); + } + +// @Override +// public boolean onCreateOptionsMenu(Menu menu) { +// +// getMenuInflater().inflate(R.menu.menu_main, menu); +// SearchView searchView = (SearchView) menu.findItem(R.id.sf_menu_search).getActionView(); +// +// +// searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { +// @Override +// public boolean onQueryTextSubmit(String query) { +// return false; +// } +// +// @Override +// public boolean onQueryTextChange(String newText) { +// mNotes = mNoteDbOpenHelper.queryFromDbByContent(newText); +// mMyAdapter.refreshData(mNotes); +// return true; +// } +// }); +// return super.onCreateOptionsMenu(menu); +// } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.safe, menu); + MenuItem x = menu.findItem(R.id.sf_menu_search); + if (x.getActionView() != null) { + Log.i("-------------","okk"); + }else{ + Log.i("-------------","false"); + } + SearchView searchView = (SearchView) menu.findItem(R.id.sf_menu_search).getActionView(); + + + if (searchView != null) { + Log.i("=====================","okk"); + + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextSubmit(String s) { + return false; + } + + @Override + public boolean onQueryTextChange(String s) { + mNotes = mNoteDbOpenHelper.queryFromDbByContent(s); + mMyAdapter.refreshData(mNotes); + return true; + } + }); + }else{ + Log.i("=====================","false"); + } + return super.onCreateOptionsMenu(menu); + } + + + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + return super.onOptionsItemSelected(item); + } +} \ No newline at end of file diff --git a/sjw_project/src/main/java/net/micode/notes/ui/adapter/MyAdapter.java b/sjw_project/src/main/java/net/micode/notes/ui/adapter/MyAdapter.java new file mode 100644 index 0000000..6263053 --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/adapter/MyAdapter.java @@ -0,0 +1,134 @@ +package net.micode.notes.ui.adapter; + +import android.annotation.SuppressLint; +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import net.micode.notes.R; +import net.micode.notes.ui.EditActivity; +import net.micode.notes.ui.NoteDbOpenHelper; +import net.micode.notes.ui.NoteEditActivity; +import net.micode.notes.ui.bean.Note; +import net.micode.notes.util.ToastUtil; + +import java.util.List; + +public class MyAdapter extends RecyclerView.Adapter { + + private List mBeanList; + private LayoutInflater mLayoutInflater; + private Context mContext; + private NoteDbOpenHelper mNoteDbOpenHelper; + + public MyAdapter(Context context,List mBeanList){ + this.mBeanList = mBeanList; + this.mContext = context; + mLayoutInflater = LayoutInflater.from(mContext); + mNoteDbOpenHelper = new NoteDbOpenHelper(mContext); + + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = mLayoutInflater.inflate(R.layout.list_item_layout,parent,false); + + MyViewHolder myViewHolder= new MyViewHolder(view); + return myViewHolder; + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") int position) { + + Note note = mBeanList.get(position); + holder.mTvContent.setText(note.getContent()); + holder.mTvTime.setText(note.getCreatedTime()); + holder.rlContainer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent intent = new Intent(mContext, EditActivity.class); + intent.putExtra("note",note); + mContext.startActivity(intent); + + } + }); + + holder.rlContainer.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + //长按 + Dialog dialog = new Dialog(mContext,android.R.style.Theme_DeviceDefault_Light_Dialog_NoActionBar_MinWidth); + View view = mLayoutInflater.inflate(R.layout.list_item_dialog_layout, null); + + TextView tvDelete = view.findViewById(R.id.tv_delete); + + + tvDelete.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int row = mNoteDbOpenHelper.deleteFromDbById(note.getId()); + if (row > 0){ + removeData(position); + + ToastUtil.toastShort(mContext,"Delete Success"); + }else{ + ToastUtil.toastShort(mContext,"Delete Fail"); + } + dialog.dismiss(); + } + }); + + dialog.setContentView(view); + + dialog.show(); + + return false; + } + }); + + } + + @Override + public int getItemCount() { + + return mBeanList.size(); + } + + public void refreshData(List notes){ + this.mBeanList = notes; + notifyDataSetChanged(); + } + + public void removeData(int pos){ + mBeanList.remove(pos); + notifyItemRemoved(pos); + } + + + class MyViewHolder extends RecyclerView.ViewHolder{ + + TextView mTvContent; + TextView mTvTime; + ViewGroup rlContainer; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + this.mTvContent = itemView.findViewById(R.id.tv_content); + this.mTvTime = itemView.findViewById(R.id.tv_time); + this.rlContainer = itemView.findViewById(R.id.rl_item_container); + + + } + } + +} diff --git a/sjw_project/src/main/java/net/micode/notes/ui/bean/Note.java b/sjw_project/src/main/java/net/micode/notes/ui/bean/Note.java new file mode 100644 index 0000000..f5bf39d --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/bean/Note.java @@ -0,0 +1,43 @@ +package net.micode.notes.ui.bean; + +import java.io.Serializable; + +public class Note implements Serializable { + + private String content; + private String createdTime; + private String id; + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "Note{" + + "content='" + content + '\'' + + ", createdTime='" + createdTime + '\'' + + ", id='" + id + '\'' + + '}'; + } +} diff --git a/sjw_project/src/main/java/net/micode/notes/ui/pwdActivity.java b/sjw_project/src/main/java/net/micode/notes/ui/pwdActivity.java new file mode 100644 index 0000000..07d33c9 --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/ui/pwdActivity.java @@ -0,0 +1,98 @@ +package net.micode.notes.ui; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.biometric.BiometricPrompt; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.FragmentActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import net.micode.notes.R; +import net.micode.notes.util.ToastUtil; + +import java.util.concurrent.Executor; + +public class pwdActivity extends FragmentActivity { + + //private Executor executor; + + + public Button mBtnpwd; + public EditText mEtpwd; + public Button mFingerBtn; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pwd); + + mBtnpwd = findViewById(R.id.btn_pwd); + mEtpwd = findViewById(R.id.et_1); + mFingerBtn = findViewById(R.id.btn_fingerprint); + + mBtnpwd.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String pwd = mEtpwd.getText().toString(); + Intent intent=null; + if(pwd.equals("123456")){ + intent = new Intent(pwdActivity.this,SafeFolderActivity.class); + startActivity(intent); + }else{ + ToastUtil.toastShort(pwdActivity.this,String.valueOf(getResources().getString(R.string.pwdwrong))); + } + + } + }); + + + mFingerBtn.setOnClickListener( + view->{ + BiometricPrompt biometricPrompt; + BiometricPrompt.PromptInfo promptInfo; + Executor executor; + executor = ContextCompat.getMainExecutor(this); + + biometricPrompt = new BiometricPrompt(this, executor, new BiometricPrompt.AuthenticationCallback() { + @Override + public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { + super.onAuthenticationError(errorCode, errString); + Toast.makeText(getApplicationContext(), String.valueOf(getResources().getString(R.string.AuthenticationFailed)) + errString, Toast.LENGTH_SHORT).show(); + } + + @Override + public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { + super.onAuthenticationSucceeded(result); + Toast.makeText(getApplicationContext(), String.valueOf(getResources().getString(R.string.AuthenticationSuccess)), Toast.LENGTH_SHORT).show(); + // Replace the below code with your code to start the SafeFolderActivity + // if authentication is successful + Intent intent = new Intent(pwdActivity.this, SafeFolderActivity.class); + startActivity(intent); + } + + @Override + public void onAuthenticationFailed() { + super.onAuthenticationFailed(); + Toast.makeText(getApplicationContext(), String.valueOf(getResources().getString(R.string.AuthenticationFailed)), Toast.LENGTH_SHORT).show(); + } + }); + + promptInfo = new BiometricPrompt.PromptInfo.Builder() + .setTitle(String.valueOf(getResources().getString(R.string.BioAuth))) + .setSubtitle(String.valueOf(getResources().getString(R.string.LogUseBio))) + .setNegativeButtonText(String.valueOf(getResources().getString(R.string.datetime_dialog_cancel))) + .build(); + + + biometricPrompt.authenticate(promptInfo); + } + ); + + } +} \ No newline at end of file diff --git a/sjw_project/src/main/java/net/micode/notes/util/SpfUtil.java b/sjw_project/src/main/java/net/micode/notes/util/SpfUtil.java new file mode 100644 index 0000000..153381e --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/util/SpfUtil.java @@ -0,0 +1,38 @@ +package net.micode.notes.util; + +import android.content.Context; +import android.content.SharedPreferences; + +public class SpfUtil { + + private static String SPF_NAME = "noteSpf"; + + public static void saveString(Context context, String key, String value) { + SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor edit = spf.edit(); + edit.putString(key, value); + edit.apply(); + } + + public static String getString(Context context, String key) { + SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE); + return spf.getString(key, ""); + } + + public static void saveInt(Context context, String key, int value) { + SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor edit = spf.edit(); + edit.putInt(key, value); + edit.apply(); + } + + public static int getInt(Context context, String key) { + SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE); + return spf.getInt(key, -1); + } + + public static int getIntWithDefault(Context context, String key, int defValue) { + SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE); + return spf.getInt(key, defValue); + } +} diff --git a/sjw_project/src/main/java/net/micode/notes/util/ToastUtil.java b/sjw_project/src/main/java/net/micode/notes/util/ToastUtil.java new file mode 100644 index 0000000..b1894f7 --- /dev/null +++ b/sjw_project/src/main/java/net/micode/notes/util/ToastUtil.java @@ -0,0 +1,15 @@ +package net.micode.notes.util; + +import android.content.Context; +import android.widget.Toast; + +public class ToastUtil { + + public static void toastShort(Context context, String msg) { + Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); + } + + public static void toastLong(Context context, String msg) { + Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); + } +} diff --git a/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java b/sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java similarity index 100% rename from Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java rename to sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java diff --git a/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java b/sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java similarity index 100% rename from Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java rename to sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java diff --git a/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java b/sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java similarity index 100% rename from Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java rename to sjw_project/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java diff --git a/Notes-master/res/color/primary_text_dark.xml b/sjw_project/src/main/res/color/primary_text_dark.xml similarity index 94% rename from Notes-master/res/color/primary_text_dark.xml rename to sjw_project/src/main/res/color/primary_text_dark.xml index 7c85459..8ad98e3 100644 --- a/Notes-master/res/color/primary_text_dark.xml +++ b/sjw_project/src/main/res/color/primary_text_dark.xml @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + \ No newline at end of file diff --git a/Notes-master/res/layout/note_edit.xml b/sjw_project/src/main/res/layout/note_edit.xml similarity index 100% rename from Notes-master/res/layout/note_edit.xml rename to sjw_project/src/main/res/layout/note_edit.xml diff --git a/Notes-master/res/layout/note_edit_list_item.xml b/sjw_project/src/main/res/layout/note_edit_list_item.xml similarity index 100% rename from Notes-master/res/layout/note_edit_list_item.xml rename to sjw_project/src/main/res/layout/note_edit_list_item.xml diff --git a/Notes-master/res/layout/note_item.xml b/sjw_project/src/main/res/layout/note_item.xml similarity index 100% rename from Notes-master/res/layout/note_item.xml rename to sjw_project/src/main/res/layout/note_item.xml diff --git a/Notes-master/res/layout/note_list.xml b/sjw_project/src/main/res/layout/note_list.xml similarity index 77% rename from Notes-master/res/layout/note_list.xml rename to sjw_project/src/main/res/layout/note_list.xml index 6b25d38..f5b01fa 100644 --- a/Notes-master/res/layout/note_list.xml +++ b/sjw_project/src/main/res/layout/note_list.xml @@ -26,6 +26,8 @@ android:layout_height="fill_parent" android:orientation="vertical"> + + + +