diff --git a/CloudKey/.gitignore b/CloudKey/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/CloudKey/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/CloudKey/.idea/.gitignore b/CloudKey/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/CloudKey/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/CloudKey/.idea/compiler.xml b/CloudKey/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/CloudKey/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CloudKey/.idea/gradle.xml b/CloudKey/.idea/gradle.xml new file mode 100644 index 0000000..22ffc66 --- /dev/null +++ b/CloudKey/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/CloudKey/.idea/jarRepositories.xml b/CloudKey/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/CloudKey/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/CloudKey/.idea/misc.xml b/CloudKey/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/CloudKey/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/CloudKey/.idea/vcs.xml b/CloudKey/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/CloudKey/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CloudKey/app/.gitignore b/CloudKey/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/CloudKey/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/CloudKey/app/build.gradle b/CloudKey/app/build.gradle new file mode 100644 index 0000000..a558b81 --- /dev/null +++ b/CloudKey/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.thankvinci.CloudKey" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} \ No newline at end of file diff --git a/CloudKey/app/proguard-rules.pro b/CloudKey/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/CloudKey/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/CloudKey/app/src/androidTest/java/com/thankvinci/CloudKey/ExampleInstrumentedTest.java b/CloudKey/app/src/androidTest/java/com/thankvinci/CloudKey/ExampleInstrumentedTest.java new file mode 100644 index 0000000..b4b07ac --- /dev/null +++ b/CloudKey/app/src/androidTest/java/com/thankvinci/CloudKey/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.thankvinci.CloudKey; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.thankvinci.CloudKey", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/CloudKey/app/src/main/AndroidManifest.xml b/CloudKey/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8dd7c21 --- /dev/null +++ b/CloudKey/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/java/com/thankvinci/CloudKey/MainActivity.java b/CloudKey/app/src/main/java/com/thankvinci/CloudKey/MainActivity.java new file mode 100644 index 0000000..5bd05e4 --- /dev/null +++ b/CloudKey/app/src/main/java/com/thankvinci/CloudKey/MainActivity.java @@ -0,0 +1,14 @@ +package com.thankvinci.CloudKey; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/CloudKey/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/CloudKey/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/CloudKey/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/drawable/ic_launcher_background.xml b/CloudKey/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/CloudKey/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CloudKey/app/src/main/res/layout/activity_main.xml b/CloudKey/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..4fc2444 --- /dev/null +++ b/CloudKey/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/CloudKey/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher.png b/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher.png b/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/CloudKey/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/CloudKey/app/src/main/res/values-night/themes.xml b/CloudKey/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..cab77ca --- /dev/null +++ b/CloudKey/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/values/colors.xml b/CloudKey/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/CloudKey/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/values/strings.xml b/CloudKey/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..7186b67 --- /dev/null +++ b/CloudKey/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + 云钥 + \ No newline at end of file diff --git a/CloudKey/app/src/main/res/values/themes.xml b/CloudKey/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..89c67c4 --- /dev/null +++ b/CloudKey/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/CloudKey/app/src/test/java/com/thankvinci/CloudKey/ExampleUnitTest.java b/CloudKey/app/src/test/java/com/thankvinci/CloudKey/ExampleUnitTest.java new file mode 100644 index 0000000..bd6ce38 --- /dev/null +++ b/CloudKey/app/src/test/java/com/thankvinci/CloudKey/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.thankvinci.CloudKey; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/CloudKey/build.gradle b/CloudKey/build.gradle new file mode 100644 index 0000000..dfbc7c1 --- /dev/null +++ b/CloudKey/build.gradle @@ -0,0 +1,24 @@ +// 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:4.1.2" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/CloudKey/gradle.properties b/CloudKey/gradle.properties new file mode 100644 index 0000000..52f5917 --- /dev/null +++ b/CloudKey/gradle.properties @@ -0,0 +1,19 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true \ No newline at end of file diff --git a/CloudKey/gradle/wrapper/gradle-wrapper.jar b/CloudKey/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/CloudKey/gradle/wrapper/gradle-wrapper.jar differ diff --git a/CloudKey/gradle/wrapper/gradle-wrapper.properties b/CloudKey/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a7092f9 --- /dev/null +++ b/CloudKey/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Jun 08 13:50:25 CST 2021 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/CloudKey/gradlew b/CloudKey/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/CloudKey/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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="" + +# 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, switch paths to Windows format before running java +if $cygwin ; 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=$((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" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/CloudKey/gradlew.bat b/CloudKey/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/CloudKey/gradlew.bat @@ -0,0 +1,84 @@ +@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 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= + +@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 init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +: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 %CMD_LINE_ARGS% + +: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/CloudKey/settings.gradle b/CloudKey/settings.gradle new file mode 100644 index 0000000..d7be446 --- /dev/null +++ b/CloudKey/settings.gradle @@ -0,0 +1,2 @@ +include ':app' +rootProject.name = "CloudKey" \ No newline at end of file diff --git a/README.md b/README.md index a0a7772..424c31d 100644 --- a/README.md +++ b/README.md @@ -5,42 +5,28 @@ Android课程设计,一款云分享压缩密码的APP #### 开发思路 初步开发思路: -1. 使用MD5或者SHA256校验文件的方式来确保文件的唯一性 -2. 用户点击压缩文件,可以使用从云上获取解压密码,获取不到时说明数据库中没有这个文件的数据,可以勾选分享解压密码(不默认勾选,遵从用户意见),在手动输入解压密码解压成功后,密码和文件校验码会被一并上传到数据库 -3. +1. 使用MD5或者SHA256校验文件的方式来确保文件的唯一性, +2. 用户点击压缩文件,可以使用从云上获取解压密码,获取不到时说明数据库中没有这个文件的数据,可以勾选分享解压密码(不默认勾选,遵从用户意见),在手动输入解压密码解压成功后,密码和文件校验码会被一并上传到数据库, +3. 使用JavaWeb用于对外提供接口,以用来查询密码, +4. 用户打开压缩包时直接http提交请求,然后web返回一个结果给用户; -#### 软件架构 -软件架构说明 +#### 数据库 +user表暂定(打算取消): -#### 安装教程 +| 表名 | user | +| ------ | ------------------------------------------------------------ | +| 数据项 | 用户设备识别码,每天的解压缩次数,分享密码次数 | +| 备注 | 可能获取不到识别码,要用其他方式去实现,每天凌晨重置解压缩次数,解压缩次数与分享密码次数有关 | -1. xxxx -2. xxxx -3. xxxx +| 表名 | passwd | +| ------ | ----------------------------------- | +| 数据项 | 文件校验码,密码,被调用次数 | +| 备注 | 为了保证隐私,只上传文件校验码和密码 | -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +#### 图标设计 +bili@伊鸭嗒 -#### 特技 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -#### 图标设计 -bili@伊鸭嗒 \ No newline at end of file diff --git a/开发历程.md b/开发历程.md new file mode 100644 index 0000000..b8fabd0 --- /dev/null +++ b/开发历程.md @@ -0,0 +1,120 @@ +##### 2021/6/8记 + +在此之前其实已经做了一点点,但因为是实验部分功能,并没有完全整合起来,也没有边开发边git的习惯,想了一下还是推倒重来. + +#### 后端部分的开发 + +##### 2021/6/6-2021/6/8 + +简单完成了web后端的代码,实现将Android端/Web端发送过来的请求解析,然后去数据库中查找对应的文件md5并返回一个如下的json到Web或者Android + +```json +{"pwd":"12341234","md5":"d62b6c2b514316641934899eae5b8c3d"} +``` + +Servlet核心代码如下: + +GET和POST + +```java +@Override +protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.setContentType("text/html;charset=UTF-8;pageEncoding=UTF-8"); //使页面支持中文,因为我的数据库是utf8的,为了应对密码有中文或者emoji表情符 + PrintWriter writer = resp.getWriter(); + String queryString = req.getQueryString(); + //定义:?function=update&md5=xxxxx&pwd=xxxx为添加数据的请求参数 + //?function=query&md5=xxxxx为查询数据的请求参数 + //如:http://ip:8080/cscp/cscp?function=query&MD5=d62b6c2b514316641934899eae5b8c3d为查询密码 这里避免暴露我自己服务器的IP + if(queryString == null || queryString.length() < 43){ + writer.print(""); + return ;//无请求参数或者参数过短时结束 + } + String function = req.getParameter("function"); //请求功能 + String md5 = req.getParameter("MD5"); //文件MD5码值 + String pwd; + + Connection conn = JDBCUtil.getConnection(); //获取数据库连接 + if(conn != null){ + //writer.print(""); + }else{ + writer.print(""); + return ; + } + if("update".equals(function)){ + pwd = req.getParameter("pwd"); + pwd = URLDecoder.decode(pwd,"UTF-8"); //解码,使中文显示正常 + //writer.print(pwd); + try { + addPassword(conn,md5,pwd); + } catch (SQLException e) { + writer.print("插入失败"); + e.printStackTrace(); + } + }else if("query".equals(function)){ + try { + pwd = queryPassword(writer,conn, md5); + Map map = new HashMap<>(); + map.put("md5",md5); + map.put("pwd",pwd); + String json = JSON.toJSONString(map); + writer.print(json); + } catch (SQLException e) { + writer.print("查询失败"); + e.printStackTrace(); + } + }else{ + return ; //无效参数 + } +} +@Override +protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + doGet(req,resp); +} + +``` + +插入 + +```java +//往数据库插入一条密码和md5 +private void addPassword(Connection conn,String filemd5,String passwd) throws SQLException { + String sql = "insert into password(fileMD5,passwd,count) values(?,?,?)"; + PreparedStatement statement = conn.prepareStatement(sql); + statement.setString(1,filemd5); + statement.setString(2,passwd); + statement.setInt(3,0); + statement.executeUpdate(); + statement.close(); + conn.close(); +} +``` + +查询 + +```java +//查询数据库中对应md5码的压缩密码 +private String queryPassword(PrintWriter writer, Connection conn, String filemd5) throws SQLException { + String sql = "select passwd from password where fileMD5=?"; + PreparedStatement statement = conn.prepareStatement(sql); + statement.setString(1,filemd5); + ResultSet rset = statement.executeQuery(); + String passwd = "查无结果"; + while(rset.next()) { + passwd = rset.getString("passwd"); + } + return passwd; +} +``` + +到此为止就是Java后端的实现内容 + +#### Android端的开发 + +##### 2021/6/8 + +重新建了一个Android项目,修改AndroidManifest文件的主题配置为黑色actionbar+白色主题,添加网络权限 + +由于AndroidP之后默认的互联网协议是https,而不能用http,申请https需要域名,还要备案,挺麻烦的,所以需要在AndroidManifest文件中标签下声明 android:usesCleartextTraffic="true" 才可使用http协议 + + +