bsk 7 months ago
parent 4dc681aa63
commit 80f3b5895a

@ -1,9 +0,0 @@
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
project.properties
.settings/
.classpath
.project

@ -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

@ -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

@ -1,2 +0,0 @@
# homework

@ -0,0 +1,2 @@
#Fri Mar 31 14:24:01 CST 2023
gradle.version=7.4

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,2 @@
#小米便签项目
11

@ -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'
}
}
}

@ -0,0 +1,2 @@
#doc
这里存放各类文档

Binary file not shown.

@ -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

185
sjw_project/gradlew vendored

@ -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" "$@"

@ -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

@ -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.)

Binary file not shown.

@ -0,0 +1,2 @@
#model
这里存放uml模型

@ -0,0 +1,2 @@
#other
这里存放综合实践的总结、自评和汇报PPT等

@ -0,0 +1 @@
include ':app'

@ -1,26 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="net.micode.notes" package="net.micode.notes"
android:versionCode="1" android:versionCode="1"
android:versionName="0.1" > android:versionName="0.1"
android:exported="true" >
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
@ -31,10 +15,27 @@
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<application <application
android:icon="@drawable/icon_app" android:icon="@drawable/icon_app"
android:label="@string/app_name" > android:label="@string/app_name"
android:theme="@style/Theme.Material3.DynamicColors.Dark"
android:exported="true" >
<activity
android:name=".ui.EditActivity"
android:exported="false" />
<activity
android:name=".ui.AddActivity"
android:exported="false"
android:label="add notes" />
<activity
android:name=".ui.SafeFolderActivity"
android:label="safe folder"
android:exported="false" />
<activity
android:name=".ui.pwdActivity"
android:exported="false" />
<activity <activity
android:name=".ui.NotesListActivity" android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
@ -42,36 +43,38 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" android:theme="@style/NoteTheme"
android:uiOptions="splitActionBarWhenNarrow" android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan" > android:windowSoftInputMode="adjustPan"
android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".ui.NoteEditActivity" android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" > android:theme="@style/NoteTheme"
android:exported="true" >
<intent-filter> <intent-filter android:scheme="http"
tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" /> <data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" /> <data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" /> <action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" /> <data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" /> <data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
@ -87,7 +90,8 @@
<receiver <receiver
android:name=".widget.NoteWidgetProvider_2x" android:name=".widget.NoteWidgetProvider_2x"
android:label="@string/app_widget2x2" > android:label="@string/app_widget2x2"
android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" /> <action android:name="android.appwidget.action.APPWIDGET_DELETED" />
@ -100,8 +104,8 @@
</receiver> </receiver>
<receiver <receiver
android:name=".widget.NoteWidgetProvider_4x" android:name=".widget.NoteWidgetProvider_4x"
android:label="@string/app_widget4x4" > android:label="@string/app_widget4x4"
android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" /> <action android:name="android.appwidget.action.APPWIDGET_DELETED" />
@ -112,39 +116,34 @@
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_4x_info" /> android:resource="@xml/widget_4x_info" />
</receiver> </receiver>
<receiver android:name=".ui.AlarmInitReceiver"
<receiver android:name=".ui.AlarmInitReceiver" > android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name="net.micode.notes.ui.AlarmReceiver" android:name=".ui.AlarmReceiver"
android:process=":remote" > android:process=":remote" />
</receiver>
<activity <activity
android:name=".ui.AlarmAlertActivity" android:name=".ui.AlarmAlertActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" > android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" />
</activity>
<activity <activity
android:name="net.micode.notes.ui.NotesPreferenceActivity" android:name=".ui.NotesPreferenceActivity"
android:label="@string/preferences_title" android:label="@string/preferences_title"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" > android:theme="@android:style/Theme.Holo.Light" />
</activity>
<service <service
android:name="net.micode.notes.gtask.remote.GTaskSyncService" android:name="net.micode.notes.gtask.remote.GTaskSyncService"
android:exported="false" > android:exported="false" />
</service>
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".ui.NoteEditActivity" /> android:value=".ui.NoteEditActivity" />
</application> </application>
</manifest> </manifest>

@ -64,10 +64,6 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
} }
private void showNotification(int tickerId, String content) { 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; PendingIntent pendingIntent;
if (tickerId != R.string.ticker_success) { if (tickerId != R.string.ticker_success) {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
@ -77,11 +73,20 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0); 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); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
} }
@Override @Override
protected Integer doInBackground(Void... unused) { protected Integer doInBackground(Void... unused) {
publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity

@ -219,10 +219,6 @@ public class BackupUtils {
* Note will be exported as text which is user readable * Note will be exported as text which is user readable
*/ */
public int exportToText() { public int exportToText() {
if (!externalStorageAvailable()) {
Log.d(TAG, "Media was not mounted");
return STATE_SD_CARD_UNMOUONTED;
}
PrintStream ps = getExportToTextPrintStream(); PrintStream ps = getExportToTextPrintStream();
if (ps == null) { if (ps == null) {

@ -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);
}
}

@ -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);
}
}

@ -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<Note> queryAllFromDb(){
SQLiteDatabase db = getWritableDatabase();
List<Note> 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<Note> queryFromDbByContent(String content){
if (TextUtils.isEmpty(content)){
return queryAllFromDb();
}
SQLiteDatabase db = getWritableDatabase();
List<Note> 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;
}
}

@ -51,6 +51,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.Button;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
@ -149,11 +150,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery; private String mUserQuery;
private Pattern mPattern; private Pattern mPattern;
private Button menuButton;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.setContentView(R.layout.note_edit); this.setContentView(R.layout.note_edit);
menuButton = (Button) findViewById(R.id.btn_show_menu);
menuButton.setOnClickListener(new NoteEditActivity.MenuBtnOnClickListener());
if (savedInstanceState == null && !initActivityState(getIntent())) { if (savedInstanceState == null && !initActivityState(getIntent())) {
finish(); finish();
return; return;
@ -870,4 +874,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private void showToast(int resId, int duration) { private void showToast(int resId, int duration) {
Toast.makeText(this, resId, duration).show(); Toast.makeText(this, resId, duration).show();
} }
private class MenuBtnOnClickListener implements OnClickListener{
@Override
public void onClick(View v) {
openOptionsMenu();
}
}
} }

@ -37,7 +37,7 @@ import net.micode.notes.R;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class NoteEditText extends EditText { public class NoteEditText extends androidx.appcompat.widget.AppCompatEditText {
private static final String TAG = "NoteEditText"; private static final String TAG = "NoteEditText";
private int mIndex; private int mIndex;
private int mSelectionStartBeforeDelete; private int mSelectionStartBeforeDelete;

@ -72,11 +72,21 @@ import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x; import net.micode.notes.widget.NoteWidgetProvider_4x;
import 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.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashSet; import java.util.HashSet;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener { public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0; 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 mAddNewNote;
private Button menuButton;
private boolean mDispatch; private boolean mDispatch;
private int mOriginY; 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_OPEN_NODE = 102;
private final static int REQUEST_CODE_NEW_NODE = 103; private final static int REQUEST_CODE_NEW_NODE = 103;
public Button mBtnsf;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.note_list); setContentView(R.layout.note_list);
initResources(); 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 * 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 = (Button) findViewById(R.id.btn_new_note);
mAddNewNote.setOnClickListener(this); mAddNewNote.setOnClickListener(this);
mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener()); mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener());
menuButton = (Button) findViewById(R.id.btn_show_menu);
menuButton.setOnClickListener(new MenuBtnOnClickListener());
mDispatch = false; mDispatch = false;
mDispatchY = 0; mDispatchY = 0;
mOriginY = 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 { private class NewNoteOnTouchListener implements OnTouchListener {
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
@ -786,7 +822,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
break; break;
} }
case R.id.menu_export_text: { case R.id.menu_export_text: {
exportNoteToText(); sendNoteToServer("text/plain");
break; break;
} }
case R.id.menu_sync: { case R.id.menu_sync: {
@ -824,46 +860,72 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
return true; return true;
} }
private void exportNoteToText() { private void sendNoteToServer(String noteContent) {
final BackupUtils backup = BackupUtils.getInstance(NotesListActivity.this); // 创建一个OkHttpClient实例
new AsyncTask<Void, Void, Integer>() { 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 @Override
protected Integer doInBackground(Void... unused) { public void onFailure(Call call, IOException e) {
return backup.exportToText(); // 处理请求失败的情况
e.printStackTrace();
// 在UI线程中显示失败提示
runOnUiThread(() -> {
Toast.makeText(NotesListActivity.this, "发送成功", Toast.LENGTH_SHORT).show();
});
} }
@Override @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) { if (result == BackupUtils.STATE_SD_CARD_UNMOUONTED) {
AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this);
builder.setTitle(NotesListActivity.this builder.setTitle(NotesListActivity.this.getString(R.string.failed_sdcard_export));
.getString(R.string.failed_sdcard_export)); builder.setMessage(NotesListActivity.this.getString(R.string.error_sdcard_unmounted));
builder.setMessage(NotesListActivity.this
.getString(R.string.error_sdcard_unmounted));
builder.setPositiveButton(android.R.string.ok, null); builder.setPositiveButton(android.R.string.ok, null);
builder.show(); builder.show();
} else if (result == BackupUtils.STATE_SUCCESS) { } else if (result == BackupUtils.STATE_SUCCESS) {
AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this);
builder.setTitle(NotesListActivity.this builder.setTitle(NotesListActivity.this.getString(R.string.success_sdcard_export));
.getString(R.string.success_sdcard_export)); builder.setMessage(NotesListActivity.this.getString(R.string.format_exported_file_location, backup.getExportedTextFileName(), backup.getExportedTextFileDir()));
builder.setMessage(NotesListActivity.this.getString(
R.string.format_exported_file_location, backup
.getExportedTextFileName(), backup.getExportedTextFileDir()));
builder.setPositiveButton(android.R.string.ok, null); builder.setPositiveButton(android.R.string.ok, null);
builder.show(); builder.show();
} else if (result == BackupUtils.STATE_SYSTEM_ERROR) { } else if (result == BackupUtils.STATE_SYSTEM_ERROR) {
AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this);
builder.setTitle(NotesListActivity.this builder.setTitle(NotesListActivity.this.getString(R.string.failed_sdcard_export));
.getString(R.string.failed_sdcard_export)); builder.setMessage(NotesListActivity.this.getString(R.string.error_sdcard_export));
builder.setMessage(NotesListActivity.this
.getString(R.string.error_sdcard_export));
builder.setPositiveButton(android.R.string.ok, null); builder.setPositiveButton(android.R.string.ok, null);
builder.show(); builder.show();
} }
} });
});
}.execute();
} }
private boolean isSyncMode() { private boolean isSyncMode() {

@ -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); setBackground(data);
} }

@ -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<Note> 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<Note> 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);
}
}

@ -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<MyAdapter.MyViewHolder> {
private List<Note> mBeanList;
private LayoutInflater mLayoutInflater;
private Context mContext;
private NoteDbOpenHelper mNoteDbOpenHelper;
public MyAdapter(Context context,List<Note> 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<Note> 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);
}
}
}

@ -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 + '\'' +
'}';
}
}

@ -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);
}
);
}
}

@ -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);
}
}

@ -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();
}
}

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save