diff --git a/.gradle/6.5/executionHistory/executionHistory.bin b/.gradle/6.5/executionHistory/executionHistory.bin new file mode 100644 index 0000000..e33cade Binary files /dev/null and b/.gradle/6.5/executionHistory/executionHistory.bin differ diff --git a/.gradle/6.5/executionHistory/executionHistory.lock b/.gradle/6.5/executionHistory/executionHistory.lock new file mode 100644 index 0000000..c5ec9eb Binary files /dev/null and b/.gradle/6.5/executionHistory/executionHistory.lock differ diff --git a/.gradle/6.5/fileChanges/last-build.bin b/.gradle/6.5/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/6.5/fileChanges/last-build.bin differ diff --git a/.gradle/6.5/fileContent/fileContent.lock b/.gradle/6.5/fileContent/fileContent.lock new file mode 100644 index 0000000..5b880d3 Binary files /dev/null and b/.gradle/6.5/fileContent/fileContent.lock differ diff --git a/.gradle/6.5/fileHashes/fileHashes.bin b/.gradle/6.5/fileHashes/fileHashes.bin new file mode 100644 index 0000000..46501fe Binary files /dev/null and b/.gradle/6.5/fileHashes/fileHashes.bin differ diff --git a/.gradle/6.5/fileHashes/fileHashes.lock b/.gradle/6.5/fileHashes/fileHashes.lock new file mode 100644 index 0000000..547e70a Binary files /dev/null and b/.gradle/6.5/fileHashes/fileHashes.lock differ diff --git a/.gradle/6.5/fileHashes/resourceHashesCache.bin b/.gradle/6.5/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..527395b Binary files /dev/null and b/.gradle/6.5/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/6.5/gc.properties b/.gradle/6.5/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/6.5/javaCompile/classAnalysis.bin b/.gradle/6.5/javaCompile/classAnalysis.bin new file mode 100644 index 0000000..b3de157 Binary files /dev/null and b/.gradle/6.5/javaCompile/classAnalysis.bin differ diff --git a/.gradle/6.5/javaCompile/jarAnalysis.bin b/.gradle/6.5/javaCompile/jarAnalysis.bin new file mode 100644 index 0000000..dcb1377 Binary files /dev/null and b/.gradle/6.5/javaCompile/jarAnalysis.bin differ diff --git a/.gradle/6.5/javaCompile/javaCompile.lock b/.gradle/6.5/javaCompile/javaCompile.lock new file mode 100644 index 0000000..cbcae44 Binary files /dev/null and b/.gradle/6.5/javaCompile/javaCompile.lock differ diff --git a/.gradle/6.5/javaCompile/taskHistory.bin b/.gradle/6.5/javaCompile/taskHistory.bin new file mode 100644 index 0000000..fb24d9c Binary files /dev/null and b/.gradle/6.5/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..7b91a34 Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..c762b13 --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Jan 05 17:28:35 CST 2021 +gradle.version=6.5 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..6b29ff6 Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/checksums/checksums.lock b/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..5c5aa2b Binary files /dev/null and b/.gradle/checksums/checksums.lock differ diff --git a/.gradle/checksums/md5-checksums.bin b/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..2d82535 Binary files /dev/null and b/.gradle/checksums/md5-checksums.bin differ diff --git a/.gradle/checksums/sha1-checksums.bin b/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..5e1adb8 Binary files /dev/null and b/.gradle/checksums/sha1-checksums.bin differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml new file mode 100644 index 0000000..a0c807c --- /dev/null +++ b/.idea/assetWizardSettings.xml @@ -0,0 +1,306 @@ + + + + + + \ No newline at end of file diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000..0682e35 Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/dictionaries b/.idea/dictionaries new file mode 100644 index 0000000..f0e04e3 --- /dev/null +++ b/.idea/dictionaries @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..23a89bb --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle____app_libs_mysql_connector_java_5_1_48_jar.xml b/.idea/libraries/Gradle____app_libs_mysql_connector_java_5_1_48_jar.xml new file mode 100644 index 0000000..3d8ef4b --- /dev/null +++ b/.idea/libraries/Gradle____app_libs_mysql_connector_java_5_1_48_jar.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml new file mode 100644 index 0000000..2902934 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml new file mode 100644 index 0000000..b2158ac --- /dev/null +++ b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml new file mode 100644 index 0000000..c3d49a4 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml new file mode 100644 index 0000000..24c0cac --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml new file mode 100644 index 0000000..2208415 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml new file mode 100644 index 0000000..7a0cb24 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml new file mode 100644 index 0000000..f22d0fb --- /dev/null +++ b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml new file mode 100644 index 0000000..eafc05e --- /dev/null +++ b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml new file mode 100644 index 0000000..69fce3f --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3.xml new file mode 100644 index 0000000..e040f45 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml new file mode 100644 index 0000000..bdd5476 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml new file mode 100644 index 0000000..f482d16 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml new file mode 100644 index 0000000..bdf2742 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml new file mode 100644 index 0000000..3aa48dd --- /dev/null +++ b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml new file mode 100644 index 0000000..761cef2 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml new file mode 100644 index 0000000..edf7af8 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml new file mode 100644 index 0000000..f5b22e9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml new file mode 100644 index 0000000..9354d44 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml new file mode 100644 index 0000000..fa92cb5 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml new file mode 100644 index 0000000..2f3c08d --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml new file mode 100644 index 0000000..49854e0 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml new file mode 100644 index 0000000..808f6e8 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml new file mode 100644 index 0000000..312e097 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml new file mode 100644 index 0000000..1ffb628 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml new file mode 100644 index 0000000..eea9f84 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml new file mode 100644 index 0000000..1dc345b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml new file mode 100644 index 0000000..d73e37a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml new file mode 100644 index 0000000..1038a6d --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml b/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml new file mode 100644 index 0000000..b6ac850 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml new file mode 100644 index 0000000..120a6fe --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml new file mode 100644 index 0000000..5191874 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml new file mode 100644 index 0000000..f510712 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml new file mode 100644 index 0000000..71ba2f5 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml new file mode 100644 index 0000000..f8af8a9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml new file mode 100644 index 0000000..7e0dc4c --- /dev/null +++ b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml new file mode 100644 index 0000000..0e986e2 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml new file mode 100644 index 0000000..ef93f4c --- /dev/null +++ b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml new file mode 100644 index 0000000..2301a6f --- /dev/null +++ b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml new file mode 100644 index 0000000..2b834ea --- /dev/null +++ b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml b/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml new file mode 100644 index 0000000..662b001 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml b/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml new file mode 100644 index 0000000..62012ea --- /dev/null +++ b/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_12.xml b/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..6c078d6 --- /dev/null +++ b/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_13_2.xml b/.idea/libraries/Gradle__junit_junit_4_13_2.xml new file mode 100644 index 0000000..c2cb45d --- /dev/null +++ b/.idea/libraries/Gradle__junit_junit_4_13_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml new file mode 100644 index 0000000..fbe9697 --- /dev/null +++ b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..09cf23d --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml new file mode 100644 index 0000000..1a77dd8 --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml new file mode 100644 index 0000000..3d45e8e --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4a3a892 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/SchoolHelper.iml b/.idea/modules/SchoolHelper.iml new file mode 100644 index 0000000..f5a71ad --- /dev/null +++ b/.idea/modules/SchoolHelper.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/app/SchoolHelper.app.iml b/.idea/modules/app/SchoolHelper.app.iml new file mode 100644 index 0000000..30f8dfb --- /dev/null +++ b/.idea/modules/app/SchoolHelper.app.iml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..830a534 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..bbd64cc --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,44 @@ +# built application files +*.apk +*.ap_ +# files for the dex VM +*.dex +# Java class files +*.class +# built native files(如果使用了第三方库,就移除该项) +*.o +*.so +# generated files +bin/ +gen/ +# Ignore gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Eclipse Metadata +.metadata/ + +# Mac OS X clutter +*.DS_Store + +# Windows clutter +Thumbs.db + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067) +.idea/workspace.xml +.idea/tasks.xml +#In IDEA 13 及早期版本中,dataSources.ids, datasources.xml 可以包含数据库密码.IDEA 14 解决了这个问题.所以可以不加 +.idea/datasources.xml +.idea/dataSources.ids \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..91c5c07 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,42 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + + defaultConfig { + applicationId "com.example.schoolhelper" + minSdkVersion 22 + targetSdkVersion 29 + 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' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation files('G:\\androidproject\\SchoolHelper\\app\\libs\\mysql-connector-java-5.1.48.jar') + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + //implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.48' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/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/app/src/androidTest/java/com/example/schoolhelper/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/schoolhelper/ExampleInstrumentedTest.java new file mode 100644 index 0000000..87f0b08 --- /dev/null +++ b/app/src/androidTest/java/com/example/schoolhelper/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.schoolhelper; + +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.example.schoolhelper", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..73efe77 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..65f7c56 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/schoolhelper/AboutMainActivity.java b/app/src/main/java/com/example/schoolhelper/AboutMainActivity.java new file mode 100644 index 0000000..ce4ca98 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/AboutMainActivity.java @@ -0,0 +1,25 @@ +package com.example.schoolhelper; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class AboutMainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about_main); + Button cometo = (Button) findViewById(R.id.cometo); + cometo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(AboutMainActivity.this,main_page.class); + startActivity(intent); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/schoolhelper/AddItem.java b/app/src/main/java/com/example/schoolhelper/AddItem.java new file mode 100644 index 0000000..85d4d28 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/AddItem.java @@ -0,0 +1,174 @@ +package com.example.schoolhelper; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import android.Manifest; +import android.app.Activity; +import android.content.ContentValues; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; +import android.os.Bundle; +import android.provider.MediaStore; +import android.util.Log; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.Spinner; +import android.widget.Toast; + +import java.io.ByteArrayOutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import static com.example.schoolhelper.start_page.LoginMainActivity.post_userid; +public class AddItem extends AppCompatActivity { + private static final byte REQUEST_SYSTEM_PIC = 10; + private ImageButton imageButton; + private byte[] image; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main_m1); + final SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss "); + //dbHelper=new MyDatabaseHelper(this,"1600802129.db",null,1); + DatabaseHelper dbHelper = new DatabaseHelper(this); + final SQLiteDatabase db = dbHelper.getReadableDatabase(); + String[] ctype = new String[]{"生活用品", "学习用品", "电子产品", "体育用品"}; + ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, ctype); //创建一个数组适配器 + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式 + Spinner spinner = (Spinner) super.findViewById(R.id.m1_style); + spinner.setAdapter(adapter); + Spinner sp = (Spinner) findViewById(R.id.m1_style); + + final String kind = (String) sp.getSelectedItem(); + + imageButton=(ImageButton)findViewById(R.id.m1_image); + imageButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (ContextCompat.checkSelfPermission(AddItem.this, + Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(AddItem.this, new + String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } else { + //打开系统相册 + Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,"image/*"); + startActivityForResult(intent, 1); + } + + } + }); + + Button fabu=(Button)findViewById(R.id.fabu); + fabu.setOnClickListener(new View.OnClickListener() { + // @RequiresApi(api = Build.VERSION_CODES.O) + @Override + public void onClick(View v) { + EditText title=(EditText)findViewById(R.id.m1_title); + EditText price=(EditText)findViewById(R.id.m1_price); + EditText phone=(EditText)findViewById(R.id.m1_phone); + EditText nr=(EditText)findViewById(R.id.m1_nr); + Date curDate = new Date(System.currentTimeMillis()); + String time = formatter.format(curDate); + ContentValues values=new ContentValues(); + String kind = (String) sp.getSelectedItem(); + values.put("title",title.getText().toString()); + + Log.d("AddItem",title.getText().toString()); + + values.put("userId",post_userid); + Log.d("AddItem",post_userid); + + values.put("kind", kind); + Log.d("AddItem",post_userid); + values.put("time",time); + Log.d("AddItem",time); + + values.put("price",price.getText().toString()); + Log.d("AddItem",price.getText().toString()); + + values.put("contact",phone.getText().toString()); + Log.d("AddItem",phone.getText().toString()); + + values.put("info",nr.getText().toString()); + Log.d("AddItem",nr.getText().toString()); + + values.put("image",image); + Log.d("AddItem",image.toString()); + + Toast.makeText(getApplicationContext(), "发布成功", Toast.LENGTH_SHORT).show(); + Log.d("AddItem","OK1"); + db.insert("iteminfo",null,values); + Log.d("AddItem","OK2"); + Intent intent=new Intent(AddItem.this, MyItems.class); + startActivity(intent); + Log.d("AddItem","OK3"); + } + }); + + Button but1 = (Button)findViewById(R.id.but1_m1); + Button but2 = (Button)findViewById(R.id.but2_m1); + but2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(AddItem.this,MyItems.class); + startActivity(intent); + } + }); + but1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(AddItem.this,main_page.class); + startActivity(intent); + } + }); + + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + //获取图片路径 + if (requestCode == 1 && resultCode == Activity.RESULT_OK && data != null) { + Uri selectedImage = data.getData(); + String[] filePathColumns = {MediaStore.Images.Media.DATA}; + assert selectedImage != null; + Cursor c = getContentResolver().query(selectedImage, filePathColumns, null, null, null); + assert c != null; + c.moveToFirst(); + int columnIndex = c.getColumnIndex(filePathColumns[0]); + String imagePath = c.getString(columnIndex); + showImage(imagePath); + c.close(); + } + } + + //加载图片 + private void showImage(String imaePath) { + Bitmap bm = BitmapFactory.decodeFile(imaePath); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + bm.compress(Bitmap.CompressFormat.PNG, 100, baos); + image = baos.toByteArray(); + imageButton.setImageBitmap(bm); + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + if (requestCode == 1) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + } else { + Toast.makeText(this, "You denied the permission", Toast.LENGTH_SHORT).show(); + } + } + } +} diff --git a/app/src/main/java/com/example/schoolhelper/DatabaseHelper.java b/app/src/main/java/com/example/schoolhelper/DatabaseHelper.java new file mode 100644 index 0000000..ec301e5 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/DatabaseHelper.java @@ -0,0 +1,49 @@ +package com.example.schoolhelper; + + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class DatabaseHelper extends SQLiteOpenHelper{ + private static final String dbname="mydb"; + public DatabaseHelper(Context context) { + super(context, dbname, null, 1); + } + + @Override + public void onCreate(SQLiteDatabase db) { + //账号userId,密码passWord,姓名name,专业subject,电话phone,QQ号qq,地址address + db.execSQL("create table if not exists users" + + "(userId varchar(20) primary key," + + "passWord varchar(20) not null," + + "name varchar(20)," + + "subject varchar(20)," + + "phone varchar(15)," + + "qq varchar(15)," + + "address varchar(50))"); + //商品编号id,发布者账号userId,标题title,类别kind,内容info,价格price,图片image + db.execSQL("create table if not exists iteminfo(" + + "id integer primary key AUTOINCREMENT," + + "userId varchar(100)," + + "title varchar(200)," + + "kind varchar(100)," + + "info varchar(1000)," + + "price varchar(100)," + + "image blob," + + "time DATETIME," + + "contact varchar(50))"); + //评论者账号userId,评论商品编号itemId,评论内容comment,评论时间time + db.execSQL("create table if not exists comments(" + + "userId varchar(100)," + + "itemId integer," + + "comment varchar(1000)," + + "time DATETIME)"); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } +} + diff --git a/app/src/main/java/com/example/schoolhelper/MyItems.java b/app/src/main/java/com/example/schoolhelper/MyItems.java new file mode 100644 index 0000000..7b5e613 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/MyItems.java @@ -0,0 +1,115 @@ +package com.example.schoolhelper; + + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MyItems extends AppCompatActivity implements View.OnClickListener{ + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + DatabaseHelper database = new DatabaseHelper(this); + final SQLiteDatabase db = database.getWritableDatabase(); + ListView listView = (ListView)findViewById(R.id.show_fabu); + Map item; // 列表项内容用Map存储 + final List> data = new ArrayList>(); // 列表 + Cursor cursor = db.query(TABLENAME,null,null,null,null,null,null,null); // 数据库查询 + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("id",cursor.getInt(0)); + item.put("userid",cursor.getString(1)); + item.put("title",cursor.getString(2)); + item.put("kind",cursor.getString(3)); + item.put("info",cursor.getString(4)); + item.put("price",cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + //kind1.setImageBitmap(imagebm); + item.put("image",imagebm); + cursor.moveToNext(); + data.add(item); // 加入到列表中 + } + } + + + + // 使用SimpleAdapter布局listview + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.activity_my_fabu, new String[] { "image", "title", "kind", "info", "price" }, + new int[] { R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price }); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if(view instanceof ImageView && data instanceof Bitmap){ + ImageView iv = (ImageView)view; + iv.setImageBitmap( (Bitmap)data ); + return true; + }else{ + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + + Button button1=(Button)findViewById(R.id.but1); + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(MyItems.this,main_page.class); + startActivity(intent); + } + }); + + Button button2=(Button)findViewById(R.id.but2); + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(MyItems.this, MyItems.class); + startActivity(intent); + } + }); + listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + String delId = data.get(position).get("id").toString(); + if(db.delete(TABLENAME,"id=?",new String[]{delId}) > 0) { + Toast.makeText(getApplicationContext(), "删除成功,请刷新", Toast.LENGTH_SHORT).show(); + return true; + } + else { + return false; + } + } + }); + + } + + + @Override + public void onClick(View v){ + switch (v.getId()){ + } + } +} diff --git a/app/src/main/java/com/example/schoolhelper/MyselfActivity.java b/app/src/main/java/com/example/schoolhelper/MyselfActivity.java new file mode 100644 index 0000000..3c797db --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/MyselfActivity.java @@ -0,0 +1,164 @@ +package com.example.schoolhelper; +//个人中心 + +import android.content.Intent; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.RadioButton; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.start_page.LoginMainActivity; + +public class MyselfActivity extends AppCompatActivity { + + private RadioButton button1; + private RadioButton button2; + private RadioButton button3; + private Button myself; + private Button myshow; + private Button changepwd; + private Button about; + private Button login; + private Button tongxu; + private TextView myId; + protected Intent intent; + private String a; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_myself); + + button1=(RadioButton)findViewById(R.id.button_1); + button2=(RadioButton)findViewById(R.id.button_2); + button3=(RadioButton)findViewById(R.id.button_3); + myself=(Button)findViewById(R.id.myself); + myshow=(Button)findViewById(R.id.myShow); + changepwd=(Button)findViewById(R.id.changepwd); + about=(Button)findViewById(R.id.about); + login=(Button)findViewById(R.id.login) ; + tongxu=(Button)findViewById(R.id.tongxu); + myId=(TextView)findViewById(R.id.myId); + + a= LoginMainActivity.post_userid; + myId.setText(a);//显示用户账号 + + Log.i("123",a); + if(a.equals("")||a==null){ + login.setText("登 录"); + }else{ + login.setText("退出登录"); + } + //跳转到主页 + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(MyselfActivity.this,main_page.class); + startActivity(intent); + } + }); + tongxu.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(MyselfActivity.this,com.example.schoolhelper.chat.Index.class); + startActivity(intent); + } + }); + //跳转到发布闲置 + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) {if(a.equals("")||a==null){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + } + intent = new Intent(MyselfActivity.this,AddItem.class); + startActivity(intent); + } + }); + +// //跳转到个人中心 +// button3.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// intent = new Intent(MyselfActivity.this, MyselfActivity.class); +// startActivity(intent); +// } +// }); + + //跳转到个人信息页面 + myself.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(a.equals("")){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + } + Log.i("123","111111111"); + intent = new Intent(MyselfActivity.this,userMsgActivity.class); + startActivity(intent); + } + }); + + //跳转到个人发布页面 + myshow.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(a.equals("")||a==null){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + } + else { + intent = new Intent(MyselfActivity.this, MyItems.class); + startActivity(intent); + } + } + }); + + //跳转到修改密码页面 + changepwd.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(a.equals("")||a==null){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + } + intent = new Intent(MyselfActivity.this,changepwdActivity.class); + startActivity(intent); + } + }); + + //跳转到关于页面 + about.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(MyselfActivity.this,AboutMainActivity.class); + startActivity(intent); + } + }); + + //跳转到登录页面 + login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(a.equals("")||a==null){ + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + }else{ + Toast.makeText(getApplicationContext(), "退出成功", Toast.LENGTH_SHORT).show(); + LoginMainActivity.post_userid=""; + intent = new Intent(MyselfActivity.this,LoginMainActivity.class); + startActivity(intent); + } + + } + }); + + } +} diff --git a/app/src/main/java/com/example/schoolhelper/changepwdActivity.java b/app/src/main/java/com/example/schoolhelper/changepwdActivity.java new file mode 100644 index 0000000..5750ac6 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/changepwdActivity.java @@ -0,0 +1,106 @@ +package com.example.schoolhelper; + +import android.content.ContentValues; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.start_page.LoginMainActivity; + +public class changepwdActivity extends AppCompatActivity { + private TextView showuser; + private EditText oldpwd; + private EditText newpwd; + private EditText newpwd1; + private Button change; + private Button back; + private String oldpass,newpass,newpass1,user; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_changepwd); + + showuser=(TextView)findViewById(R.id.showuser); + oldpwd=(EditText)findViewById(R.id.oldpwd); + newpwd=(EditText)findViewById(R.id.newpwd); + newpwd1=(EditText)findViewById(R.id.newpwd1); + change=(Button)findViewById(R.id.change); + back=(Button)findViewById(R.id.back); + user= LoginMainActivity.post_userid; + showuser.setText(user); + if(user.equals("")||user==null){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(changepwdActivity.this,LoginMainActivity.class); + startActivity(intent); + } + change.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.i("用户数据",user); + oldpass=oldpwd.getText().toString(); + newpass=newpwd.getText().toString(); + newpass1=newpwd1.getText().toString(); + + boolean flag=true; + if(oldpass.equals("")||oldpass==null){ + Toast.makeText(getApplicationContext(), "请输入旧密码!", Toast.LENGTH_SHORT).show(); + flag=false; + } + if(newpass.equals("")||newpass==null){ + Toast.makeText(getApplicationContext(), "请输入新密码!", Toast.LENGTH_SHORT).show(); + flag=false; + } + if (!newpass.equals(newpass1)){ + Toast.makeText(getApplicationContext(), "两次密码不一致!", Toast.LENGTH_SHORT).show(); + flag=false; + } + if(flag){ + checkpass(oldpass,newpass); + } + + } + }); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(changepwdActivity.this, MyselfActivity.class); + startActivity(intent); + } + }); + + } + + private void checkpass(String oldpass,String newpass){ + DatabaseHelper dbhelper = new DatabaseHelper(this); + SQLiteDatabase db=dbhelper.getReadableDatabase(); + try{ + String sql="SELECT * FROM users WHERE userId=? and passWord=?"; + Cursor cursor=db.rawQuery(sql,new String[]{user,oldpass}); + if(cursor.getCount()==0){ + Toast.makeText(getApplicationContext(), "用户旧密码错误!", Toast.LENGTH_SHORT).show(); + } + else{ + ContentValues values=new ContentValues(); + values.put("passWord",newpass); + db.update("users",values,"userId=?",new String[] {user}); + Toast.makeText(getApplicationContext(), "修改成功", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(changepwdActivity.this, MyselfActivity.class); + startActivity(intent); + } + cursor.close(); + db.close(); + }catch (SQLiteException e){ + Toast.makeText(getApplicationContext(), "修改失败", Toast.LENGTH_SHORT).show(); + } + } +} diff --git a/app/src/main/java/com/example/schoolhelper/chat/ChatActivity.java b/app/src/main/java/com/example/schoolhelper/chat/ChatActivity.java new file mode 100644 index 0000000..388725e --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/chat/ChatActivity.java @@ -0,0 +1,158 @@ +package com.example.schoolhelper.chat; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.schoolhelper.R; + +import java.util.ArrayList; +import java.util.List; + +public class ChatActivity extends AppCompatActivity { + private ListView msgListView; + + private EditText inputText; + + private Button send; + + private MsgAdapter adapter; + + private List msgList = new ArrayList(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestWindowFeature(Window.FEATURE_NO_TITLE);//设置窗口没有标题栏 + setContentView(R.layout.activity_chat); + initMsg(); + adapter = new MsgAdapter(com.example.schoolhelper.chat.ChatActivity.this, R.layout.msg_item, msgList); + inputText = (EditText) findViewById(R.id.input_text); + send = (Button) findViewById(R.id.send); + msgListView = (ListView) findViewById(R.id.msg_list_view); + msgListView.setAdapter(adapter); + send.setOnClickListener(new View.OnClickListener(){ + + @Override + public void onClick(View v) { + String content = inputText.getText().toString(); + if(!"".equals(content)){ + Msg msg = new Msg(content, Msg.SENT); + msgList.add(msg); + adapter.notifyDataSetChanged();//有新消息时,刷新ListView中的显示 + msgListView.setSelection(msgList.size());//将ListView定位到最后一行 + inputText.setText("");//清空输入框的内容 + } + } + + }); + } + + private void initMsg() { + Msg msg1 = new Msg("I miss you!", Msg.RECEIVED); + msgList.add(msg1); + + Msg msg2 = new Msg("I miss you,too!", Msg.SENT); + msgList.add(msg2); + + Msg msg3 = new Msg("I will come back soon!", Msg.RECEIVED); + msgList.add(msg3); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + // getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + + + public class Msg{ + + public static final int RECEIVED = 0;//收到一条消息 + + public static final int SENT = 1;//发出一条消息 + + private String content;//消息的内容 + + private int type;//消息的类型 + + public Msg(String content,int type){ + this.content = content; + this.type = type; + } + + public String getContent(){ + return content; + } + + public int getType(){ + return type; + } + } + + public class MsgAdapter extends ArrayAdapter { + private int resourceId; + + public MsgAdapter(Context context, int textViewresourceId, List objects) { + super(context, textViewresourceId, objects); + resourceId = textViewresourceId; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + Msg msg = getItem(position); + View view; + ViewHolder viewHolder; + + if(convertView == null){ + view = LayoutInflater.from(getContext()).inflate(resourceId, null); + viewHolder = new ViewHolder(); + viewHolder.leftLayout = (LinearLayout)view.findViewById(R.id.left_layout); + viewHolder.rightLayout = (LinearLayout)view.findViewById(R.id.right_Layout); + viewHolder.leftMsg = (TextView)view.findViewById(R.id.left_msg); + viewHolder.rightMsg = (TextView)view.findViewById(R.id.right_msg); + view.setTag(viewHolder); + }else{ + view = convertView; + viewHolder = (ViewHolder) view.getTag(); + } + + if(msg.getType()== Msg.RECEIVED){ + //如果是收到的消息,则显示左边消息布局,将右边消息布局隐藏 + viewHolder.leftLayout.setVisibility(View.VISIBLE); + viewHolder.rightLayout.setVisibility(View.GONE); + viewHolder.leftMsg.setText(msg.getContent()); + }else if(msg.getType()== Msg.SENT){ + //如果是发出去的消息,显示右边布局的消息布局,将左边的消息布局隐藏 + viewHolder.rightLayout.setVisibility(View.VISIBLE); + viewHolder.leftLayout.setVisibility(View.GONE); + viewHolder.rightMsg.setText(msg.getContent()); + } + return view; + } + + class ViewHolder{ + LinearLayout leftLayout; + LinearLayout rightLayout; + TextView leftMsg; + TextView rightMsg; + } + } + +} + diff --git a/app/src/main/java/com/example/schoolhelper/chat/Index.java b/app/src/main/java/com/example/schoolhelper/chat/Index.java new file mode 100644 index 0000000..3e02ed8 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/chat/Index.java @@ -0,0 +1,55 @@ +package com.example.schoolhelper.chat; + +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.util.Log; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.R; +import com.google.android.material.tabs.TabLayout; + + +import java.util.ArrayList; +import java.util.List; + +public class Index extends AppCompatActivity { + + private List userList=new ArrayList<>(); + private DatabaseHelper dbHelper; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_index); + dbHelper = new DatabaseHelper(this); + inintUsers(); + RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); + RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); + recyclerView.setLayoutManager(layoutManager); + UserAdapter adapter=new UserAdapter(userList); + recyclerView.setAdapter(adapter); + } + + private void inintUsers() { +// LitePal.getDatabase(); +// List users = DataSupport.select("name").find(User.class); + + SQLiteDatabase db = dbHelper.getWritableDatabase(); + Cursor cursor = db.query("users",null,null,null,null,null,null); + if(cursor.moveToFirst()){ + do{ + User user=new User(); + String useid=cursor.getString(cursor.getColumnIndex("userId")); + user.setuserId(useid); + Log.d("Index",useid); + Log.d("Index",user.getuserId()); + userList.add(user); + }while (cursor.moveToNext()); + } + cursor.close(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/schoolhelper/chat/User.java b/app/src/main/java/com/example/schoolhelper/chat/User.java new file mode 100644 index 0000000..646ce86 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/chat/User.java @@ -0,0 +1,44 @@ +package com.example.schoolhelper.chat; + + +import org.w3c.dom.Text; + +public class User { + private String userId; + private String name; + private String password; + private String sex; + + public String getuserId() { + return userId; + } + + public void setuserId(String userId) { + this.userId = userId; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } +} diff --git a/app/src/main/java/com/example/schoolhelper/chat/UserAdapter.java b/app/src/main/java/com/example/schoolhelper/chat/UserAdapter.java new file mode 100644 index 0000000..6d6b0ae --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/chat/UserAdapter.java @@ -0,0 +1,66 @@ +package com.example.schoolhelper.chat; + +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.recyclerview.widget.RecyclerView; + +import com.example.schoolhelper.R; + +import java.util.List; + +public class UserAdapter extends RecyclerView.Adapter { + + private List mUserList; + static class ViewHolder extends RecyclerView.ViewHolder{ + //监听点击 + View userView; + TextView userName; + public ViewHolder( View view) { + super(view); + userView = view; + userName = (TextView)view.findViewById(R.id.user_name); + } + } + public UserAdapter(List userList){ + mUserList=userList; + } + + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.user_item,parent,false); + final ViewHolder holder = new ViewHolder(view); + //点击事件 + holder.userView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int position = holder.getAdapterPosition(); + com.example.schoolhelper.chat.User user = mUserList.get(position); + Toast.makeText(v.getContext(), user.getuserId(), Toast.LENGTH_SHORT).show(); + //跳入聊天界面 + Intent intent = new Intent(v.getContext(),com.example.schoolhelper.socket.SocketActivity.class); + v.getContext().startActivity(intent); + + } + }); + return holder; + } + + @Override + public void onBindViewHolder(com.example.schoolhelper.chat.UserAdapter.ViewHolder holder, int position) { + User user = mUserList.get(position); + holder.userName.setText(user.getuserId()); + + } + + @Override + public int getItemCount() { + return mUserList.size(); + } +} diff --git a/app/src/main/java/com/example/schoolhelper/databases/DBConnection.java b/app/src/main/java/com/example/schoolhelper/databases/DBConnection.java new file mode 100644 index 0000000..68dd5e1 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/databases/DBConnection.java @@ -0,0 +1,57 @@ +package com.example.schoolhelper.databases; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +public class DBConnection { + + public static PreparedStatement link (String sql){ + //要连接的数据库url,注意:此处连接的应该是服务器上的MySQl的地址 + String url = "jdbc:mysql://47.106.86.203:3306/mydb?useUnicode=true&characterEncoding=utf8&useSSL=false"; + //连接数据库使用的用户名 + String userName = "root"; + //连接的数据库时使用的密码 + String password = "123456"; + Connection connection; + PreparedStatement pstmt = null; + try { + //1、加载驱动 + Class.forName("com.mysql.jdbc.Driver").newInstance(); + System.out.println("=====================================/n"); + System.out.println("驱动加载成功!!!"); + System.out.println("=====================================/n"); + } + catch (Exception e){ + e.printStackTrace(); + } + try { + //2、获取与数据库的连接 + connection = DriverManager.getConnection(url, userName, password); + System.out.println("=====================================/n"); + System.out.println("连接数据库成功!!!"); + System.out.println("=====================================/n"); + + pstmt = connection.prepareStatement(sql); + + + + + + System.out.println("1111111"); + + + + + + }catch (Exception e) { + e.printStackTrace(); + } + + + + return pstmt; + } + } + diff --git a/app/src/main/java/com/example/schoolhelper/item_info.java b/app/src/main/java/com/example/schoolhelper/item_info.java new file mode 100644 index 0000000..2fe0c09 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/item_info.java @@ -0,0 +1,102 @@ +package com.example.schoolhelper; +//商品信息 + +import android.content.ContentValues; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.example.schoolhelper.start_page.LoginMainActivity.post_userid; + +public class item_info extends AppCompatActivity { + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.item_info); + final DatabaseHelper dbtest = new DatabaseHelper(this); + final Intent intent = getIntent(); + final SQLiteDatabase db = dbtest.getWritableDatabase(); + ImageView image = (ImageView)findViewById(R.id.imageView); + TextView price = (TextView)findViewById(R.id.item_price); + TextView title = (TextView)findViewById(R.id.item_title) ; + TextView info = (TextView)findViewById(R.id.item_info); + TextView contact = (TextView)findViewById(R.id.contact); + Cursor cursor = db.query(TABLENAME,null,"id=?",new String[]{intent.getStringExtra("id")},null,null,null,null); // 根据接收到的id进行数据库查询 + Log.i("商品的id是",intent.getStringExtra("id")); + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + image.setImageBitmap(imagebm); + title.setText(cursor.getString(2)); + price.setText(cursor.getString(5)); + info.setText(cursor.getString(4)); + contact.setText(cursor.getString(8)); + cursor.moveToNext(); + } + } + ListView commentList = (ListView)findViewById(R.id.commentList); + Map item; // 列表项内容用Map存储 + final List> data = new ArrayList>(); // 列表 + Cursor cursor_ = db.query("comments",null,"itemId=?",new String[]{intent.getStringExtra("id")},null,null,null,null); // 数据库查询 + if (cursor_.moveToFirst()){ + while (!cursor_.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("userId",cursor_.getString(0)); + item.put("comment",cursor_.getString(2)); + item.put("time",cursor_.getString(3)); + cursor_.moveToNext(); + data.add(item); // 加入到列表中 + } + } + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.comment_item, new String[] { "userId", "comment", "time"}, + new int[] { R.id.userId, R.id.commentInfo, R.id.time }); + commentList.setAdapter(simpleAdapter); + Button submit = (Button)findViewById(R.id.submit); + submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + EditText comment = (EditText)findViewById(R.id.comment); + String submit_comment = comment.getText().toString(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss "); + Date curDate = new Date(System.currentTimeMillis()); + String time = formatter.format(curDate); + ContentValues values=new ContentValues(); + values.put("userId",post_userid); + values.put("itemId",intent.getStringExtra("id")); + values.put("comment",submit_comment); + values.put("time",time); + db.insert("comments",null,values); + Log.i("1","评论成功"); + Toast.makeText(getApplicationContext(), "评论成功", Toast.LENGTH_SHORT).show(); + Intent intent_=new Intent(item_info.this,item_info.class); + intent_.putExtra("id",intent.getStringExtra("id")); + startActivity(intent_); + } + }); + } +} diff --git a/app/src/main/java/com/example/schoolhelper/kind_page/kind_page1.java b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page1.java new file mode 100644 index 0000000..17edc35 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page1.java @@ -0,0 +1,122 @@ +package com.example.schoolhelper.kind_page; +//体育用品列表 + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.SimpleAdapter; + +import com.example.schoolhelper.AddItem; +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.MyselfActivity; +import com.example.schoolhelper.R; +import com.example.schoolhelper.item_info; +import com.example.schoolhelper.main_page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class kind_page1 extends AppCompatActivity { + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.kind_page1); + DatabaseHelper dbtest = new DatabaseHelper(this); + final SQLiteDatabase db = dbtest.getWritableDatabase(); + ListView listView = (ListView)findViewById(R.id.kind_list1); + Map item = new HashMap(); + List> data = new ArrayList>(); + + + RadioButton btn1 = (RadioButton) findViewById(R.id.button_1); + RadioButton btn2 = (RadioButton) findViewById(R.id.button_2); + RadioButton btn3 = (RadioButton) findViewById(R.id.button_3); + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page1.this, main_page.class); + startActivity(button1); + } + }); + btn2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page1.this, AddItem.class); + startActivity(button1); + } + }); + btn3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page1.this, MyselfActivity.class); + startActivity(button1); + } + }); + + + + + + + + + + Cursor cursor = db.query(TABLENAME,null,"kind=?",new String[]{"体育用品"},null,null,null,null); // 数据库查询 + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("id",cursor.getInt(0)); + item.put("userid",cursor.getString(1)); + item.put("title",cursor.getString(2)); + item.put("kind",cursor.getString(3)); + item.put("info",cursor.getString(4)); + item.put("price",cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + //kind1.setImageBitmap(imagebm); + item.put("image",imagebm); + cursor.moveToNext(); + data.add(item);// 加入到列表中 + } + } + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.listitem, new String[] { "image", "title", "kind", "info", "price" }, + new int[] { R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price }); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if(view instanceof ImageView && data instanceof Bitmap){ + ImageView iv = (ImageView)view; + iv.setImageBitmap( (Bitmap)data ); + return true; + }else{ + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent = new Intent(kind_page1.this, item_info.class); + intent.putExtra("id", data.get(position).get("id").toString()); // 获取该列表项的key为id的键值,即商品的id,将其储存在Bundle传递给打开的页面 + startActivity(intent); + } + }); + } + +} diff --git a/app/src/main/java/com/example/schoolhelper/kind_page/kind_page2.java b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page2.java new file mode 100644 index 0000000..806dff0 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page2.java @@ -0,0 +1,110 @@ +package com.example.schoolhelper.kind_page; + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.SimpleAdapter; + +import com.example.schoolhelper.AddItem; +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.MyselfActivity; +import com.example.schoolhelper.R; +import com.example.schoolhelper.item_info; +import com.example.schoolhelper.main_page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class kind_page2 extends AppCompatActivity { + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_kind_page2); + DatabaseHelper dbtest = new DatabaseHelper(this); + + RadioButton btn1 = (RadioButton) findViewById(R.id.button_1); + RadioButton btn2 = (RadioButton) findViewById(R.id.button_2); + RadioButton btn3 = (RadioButton) findViewById(R.id.button_3); + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page2.this, main_page.class); + startActivity(button1); + } + }); + btn2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page2.this, AddItem.class); + startActivity(button1); + } + }); + btn3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page2.this, MyselfActivity.class); + startActivity(button1); + } + }); + + final SQLiteDatabase db = dbtest.getWritableDatabase(); + ListView listView = (ListView)findViewById(R.id.kind_list1); + Map item = new HashMap(); + List> data = new ArrayList>(); + Cursor cursor = db.query(TABLENAME,null,"kind=?",new String[]{"生活用品"},null,null,null,null); // 数据库查询 + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("id",cursor.getInt(0)); + item.put("userid",cursor.getString(1)); + item.put("title",cursor.getString(2)); + item.put("kind",cursor.getString(3)); + item.put("info",cursor.getString(4)); + item.put("price",cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + //kind1.setImageBitmap(imagebm); + item.put("image",imagebm); + cursor.moveToNext(); + data.add(item); // 加入到列表中 + } + } + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.listitem, new String[] { "image", "title", "kind", "info", "price" }, + new int[] { R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price }); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if(view instanceof ImageView && data instanceof Bitmap){ + ImageView iv = (ImageView)view; + iv.setImageBitmap( (Bitmap)data ); + return true; + }else{ + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent = new Intent(kind_page2.this, item_info.class); + intent.putExtra("id", data.get(position).get("id").toString()); // 获取该列表项的key为id的键值,即商品的id,将其储存在Bundle传递给打开的页面 + startActivity(intent); + } + }); + } +} diff --git a/app/src/main/java/com/example/schoolhelper/kind_page/kind_page3.java b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page3.java new file mode 100644 index 0000000..e8a1a2f --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page3.java @@ -0,0 +1,112 @@ +package com.example.schoolhelper.kind_page; + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.SimpleAdapter; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.schoolhelper.AddItem; +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.MyselfActivity; +import com.example.schoolhelper.R; +import com.example.schoolhelper.item_info; +import com.example.schoolhelper.main_page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class kind_page3 extends AppCompatActivity { + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_kind_page3); + DatabaseHelper dbtest = new DatabaseHelper(this); + + RadioButton btn1 = (RadioButton) findViewById(R.id.button_1); + RadioButton btn2 = (RadioButton) findViewById(R.id.button_2); + RadioButton btn3 = (RadioButton) findViewById(R.id.button_3); + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page3.this, main_page.class); + startActivity(button1); + } + }); + btn2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page3.this, AddItem.class); + startActivity(button1); + } + }); + btn3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page3.this, MyselfActivity.class); + startActivity(button1); + } + }); + + final SQLiteDatabase db = dbtest.getWritableDatabase(); + ListView listView = (ListView)findViewById(R.id.kind_list1); + Map item = new HashMap(); + List> data = new ArrayList>(); + Cursor cursor = db.query(TABLENAME,null,"kind=?",new String[]{"电子产品"},null,null,null,null); // 数据库查询 + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("id",cursor.getInt(0)); + item.put("userid",cursor.getString(1)); + item.put("title",cursor.getString(2)); + item.put("kind",cursor.getString(3)); + item.put("info",cursor.getString(4)); + item.put("price",cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + //kind1.setImageBitmap(imagebm); + item.put("image",imagebm); + cursor.moveToNext(); + data.add(item); // 加入到列表中 + } + } + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.listitem, new String[] { "image", "title", "kind", "info", "price" }, + new int[] { R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price }); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if(view instanceof ImageView && data instanceof Bitmap){ + ImageView iv = (ImageView)view; + iv.setImageBitmap( (Bitmap)data ); + return true; + }else{ + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent = new Intent(kind_page3.this, item_info.class); + intent.putExtra("id", data.get(position).get("id").toString()); // 获取该列表项的key为id的键值,即商品的id,将其储存在Bundle传递给打开的页面 + startActivity(intent); + } + }); + } +} diff --git a/app/src/main/java/com/example/schoolhelper/kind_page/kind_page4.java b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page4.java new file mode 100644 index 0000000..e382b03 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/kind_page/kind_page4.java @@ -0,0 +1,111 @@ +package com.example.schoolhelper.kind_page; + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.SimpleAdapter; + +import com.example.schoolhelper.AddItem; +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.MyselfActivity; +import com.example.schoolhelper.R; +import com.example.schoolhelper.item_info; +import com.example.schoolhelper.main_page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class kind_page4 extends AppCompatActivity { + String TABLENAME = "iteminfo"; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_kind_page4); + DatabaseHelper dbtest = new DatabaseHelper(this); + + RadioButton btn1 = (RadioButton) findViewById(R.id.button_1); + RadioButton btn2 = (RadioButton) findViewById(R.id.button_2); + RadioButton btn3 = (RadioButton) findViewById(R.id.button_3); + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page4.this, main_page.class); + startActivity(button1); + } + }); + btn2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page4.this, AddItem.class); + startActivity(button1); + } + }); + btn3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent button1 = new Intent(kind_page4.this, MyselfActivity.class); + startActivity(button1); + } + }); + + final SQLiteDatabase db = dbtest.getWritableDatabase(); + ListView listView = (ListView)findViewById(R.id.kind_list1); + Map item = new HashMap(); + List> data = new ArrayList>(); + Cursor cursor = db.query(TABLENAME,null,"kind=?",new String[]{"学习用品"},null,null,null,null); // 数据库查询 + if (cursor.moveToFirst()){ + while (!cursor.isAfterLast()){ + item = new HashMap(); // 为列表项赋值 + item.put("id",cursor.getInt(0)); + item.put("userid",cursor.getString(1)); + item.put("title",cursor.getString(2)); + item.put("kind",cursor.getString(3)); + item.put("info",cursor.getString(4)); + item.put("price",cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + //kind1.setImageBitmap(imagebm); + item.put("image",imagebm); + cursor.moveToNext(); + data.add(item); // 加入到列表中 + } + } + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.listitem, new String[] { "image", "title", "kind", "info", "price" }, + new int[] { R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price }); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if(view instanceof ImageView && data instanceof Bitmap){ + ImageView iv = (ImageView)view; + iv.setImageBitmap( (Bitmap)data ); + return true; + }else{ + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent = new Intent(kind_page4.this, item_info.class); + intent.putExtra("id", data.get(position).get("id").toString()); // 获取该列表项的key为id的键值,即商品的id,将其储存在Bundle传递给打开的页面 + startActivity(intent); + } + }); + } +} diff --git a/app/src/main/java/com/example/schoolhelper/main_page.java b/app/src/main/java/com/example/schoolhelper/main_page.java new file mode 100644 index 0000000..e692a77 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/main_page.java @@ -0,0 +1,139 @@ +package com.example.schoolhelper; +//首页 + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.SimpleAdapter; + +import com.example.schoolhelper.kind_page.kind_page1; +import com.example.schoolhelper.kind_page.kind_page2; +import com.example.schoolhelper.kind_page.kind_page3; +import com.example.schoolhelper.kind_page.kind_page4; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class main_page extends AppCompatActivity implements View.OnClickListener{ + + String TABLENAME = "iteminfo"; + Intent intent; + byte[] imagedata; + Bitmap imagebm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main_page); + DatabaseHelper database = new DatabaseHelper(this); + final SQLiteDatabase db = database.getWritableDatabase(); + ListView listView = (ListView) findViewById(R.id.listView); + Map item; // 列表项内容用Map存储 + final List> data = new ArrayList>(); // 列表 + Cursor cursor = db.query(TABLENAME, null, null, null, null, null, null, null); // 数据库查询 + if (cursor.moveToFirst()) { + while (!cursor.isAfterLast()) { + item = new HashMap(); // 为列表项赋值 + item.put("id", cursor.getInt(0)); + item.put("userid", cursor.getString(1)); + item.put("title", cursor.getString(2)); + item.put("kind", cursor.getString(3)); + item.put("info", cursor.getString(4)); + item.put("price", cursor.getString(5)); + imagedata = cursor.getBlob(6); + imagebm = BitmapFactory.decodeByteArray(imagedata, 0, imagedata.length); + item.put("image", imagebm); + cursor.moveToNext(); + data.add(item); // 加入到列表中 + } + } + + + // 使用SimpleAdapter布局listview + SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, R.layout.listitem, new String[]{"image", "title", "kind", "info", "price"}, + new int[]{R.id.item_image, R.id.title, R.id.kind, R.id.info, R.id.price}); + simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { + @Override + public boolean setViewValue(View view, Object data, String textRepresentation) { + if (view instanceof ImageView && data instanceof Bitmap) { + ImageView iv = (ImageView) view; + iv.setImageBitmap((Bitmap) data); + return true; + } else { + return false; + } + } + }); + listView.setAdapter(simpleAdapter); + + + ImageView kind1 = (ImageView) findViewById(R.id.kind1); + kind1.setOnClickListener(this); + ImageView kind2 = (ImageView) findViewById(R.id.kind2); + kind2.setOnClickListener(this); + ImageView kind3 = (ImageView) findViewById(R.id.kind3); + kind3.setOnClickListener(this); + ImageView kind4 = (ImageView) findViewById(R.id.kind4); + kind4.setOnClickListener(this); + // 为列表项设置监听器 + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + intent = new Intent(main_page.this, item_info.class); + intent.putExtra("id", data.get(position).get("id").toString()); // 获取该列表项的key为id的键值,即商品的id,将其储存在Bundle传递给打开的页面 + startActivity(intent); + } + }); + + RadioButton btn1 = (RadioButton) findViewById(R.id.button_1); + RadioButton btn2 = (RadioButton) findViewById(R.id.button_2); + RadioButton btn3 = (RadioButton) findViewById(R.id.button_3); + btn1.setOnClickListener(this); + btn2.setOnClickListener(this); + btn3.setOnClickListener(this); + } + @SuppressLint("NonConstantResourceId") + @Override + public void onClick (View v){ + switch (v.getId()) { + case R.id.kind1: + Intent KindIntent1 = new Intent(this, kind_page1.class); + startActivity(KindIntent1); + break; + case R.id.kind2: + Intent KindIntent2 = new Intent(this, kind_page2.class); + startActivity(KindIntent2); + break; + case R.id.kind3: + Intent KindIntent3 = new Intent(this, kind_page3.class); + startActivity(KindIntent3); + break; + case R.id.kind4: + Intent KindIntent4 = new Intent(this, kind_page4.class); + startActivity(KindIntent4); + break; + + case R.id.button_2: + Intent button2 = new Intent(this, AddItem.class); + startActivity(button2); + break; + case R.id.button_3: + Intent button3 = new Intent(this, MyselfActivity.class); + startActivity(button3); + break; + + } + } + +} diff --git a/app/src/main/java/com/example/schoolhelper/setMymsgActivity.java b/app/src/main/java/com/example/schoolhelper/setMymsgActivity.java new file mode 100644 index 0000000..a690910 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/setMymsgActivity.java @@ -0,0 +1,106 @@ +package com.example.schoolhelper; + + +import android.content.ContentValues; +import android.content.Intent; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.start_page.LoginMainActivity; + +import static com.example.schoolhelper.R.id.address; +import static com.example.schoolhelper.R.id.phone; +import static com.example.schoolhelper.R.id.qq; +import static com.example.schoolhelper.R.id.subject; + +public class setMymsgActivity extends AppCompatActivity { + private TextView userid; + private EditText username; + private EditText usersubject; + private EditText userphone; + private EditText userqq; + private EditText useraddress; + private Button usersave; + private Button back; + protected Intent intent; + private String post_name=null,post_subject=null,post_phone=null,post_qq=null,post_address=null,id; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_set_mymsg); + + userid=(TextView)findViewById(R.id.showUser); + username=(EditText)findViewById(R.id.name); + usersubject=(EditText)findViewById(subject); + userphone=(EditText)findViewById(phone); + userqq=(EditText)findViewById(qq); + useraddress=(EditText)findViewById(address); + usersave=(Button)findViewById(R.id.save); + back=(Button)findViewById(R.id.back); + + id= LoginMainActivity.post_userid; + userid.setText(id); + if(id.equals("")||id==null){ + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(setMymsgActivity.this, MyselfActivity.class); + startActivity(intent); + } + //账号userId,密码passWord,姓名name,专业subject,电话phone,QQ号qq,地址address + DatabaseHelper dbhelper = new DatabaseHelper(this); + SQLiteDatabase db=dbhelper.getReadableDatabase(); + + usersave.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) {//账号userId,密码passWord,姓名name,专业subject,电话phone,QQ号qq,地址address + post_name=username.getText().toString(); + post_subject=usersubject.getText().toString(); + post_phone=userphone.getText().toString(); + post_qq=userqq.getText().toString(); + post_address=useraddress.getText().toString(); + ContentValues values=new ContentValues(); + if(!post_name.equals("")) { + values.put("name", post_name); + } + if(!post_subject.equals("")) { + values.put("subject", post_subject); + } + if(!post_phone.equals("")) { + values.put("phone", post_phone); + } + if(!post_qq.equals("")) { + values.put("qq", post_qq); + } + if(!post_address.equals("")) { + values.put("address", post_address); + } + saveValues(values); + Toast.makeText(getApplicationContext(), "修改成功", Toast.LENGTH_SHORT).show(); + intent = new Intent(setMymsgActivity.this, userMsgActivity.class); + startActivity(intent); + } + }); + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(setMymsgActivity.this, userMsgActivity.class); + startActivity(intent); + } + }); + } + private void saveValues(ContentValues values){ + DatabaseHelper dbhelper = new DatabaseHelper(this); + SQLiteDatabase db=dbhelper.getReadableDatabase(); + db.update("users",values,"userId=?",new String[] {id}); + db.close(); + } +} + diff --git a/app/src/main/java/com/example/schoolhelper/socket/MyAdapter.java b/app/src/main/java/com/example/schoolhelper/socket/MyAdapter.java new file mode 100644 index 0000000..17029c6 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/socket/MyAdapter.java @@ -0,0 +1,99 @@ +package com.example.schoolhelper.socket; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + +import com.example.schoolhelper.R; + +import java.util.ArrayList; + + +public class MyAdapter extends RecyclerView.Adapter { + + private Context context; + private ArrayList data; + private static final int TYPEONE = 1; + private static final int TYPETWO = 2; + + public MyAdapter(Context context) { + this.context = context; + } + + public void setData(ArrayList data) { + this.data = data; + notifyDataSetChanged(); + } + + @Override + public int getItemViewType(int position) { + return data.get(position).getNumber(); + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + RecyclerView.ViewHolder holder = null; + switch (viewType){ + case TYPEONE: + View view = LayoutInflater.from(context).inflate(R.layout.item,parent,false); + holder = new OneViewHolder(view); + break; + case TYPETWO: + View view1 = LayoutInflater.from(context).inflate(R.layout.item2,parent,false); + holder = new TwoViewHolder(view1); + break; + } + return holder; + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + int itemViewType = getItemViewType(position); + switch (itemViewType){ + case TYPEONE: + OneViewHolder oneViewHolder = (OneViewHolder) holder; + oneViewHolder.tv1.setText(data.get(position).getData()); + oneViewHolder.name1.setText(data.get(position).getName()); + oneViewHolder.time1.setText(data.get(position).getTime()); + break; + case TYPETWO: + TwoViewHolder twoViewHolder = (TwoViewHolder) holder; + twoViewHolder.tv2.setText(data.get(position).getData()); + twoViewHolder.name2.setText(data.get(position).getName()); + twoViewHolder.time2.setText(data.get(position).getTime()); + break; + } + } + + @Override + public int getItemCount() { + return data != null && data.size() > 0 ? data.size() : 0; + } + + class OneViewHolder extends RecyclerView.ViewHolder{ + private TextView tv1; + private TextView name1,time1; + public OneViewHolder(View itemView) { + super(itemView); + tv1 = (TextView) itemView.findViewById(R.id.tv); + name1 = (TextView) itemView.findViewById(R.id.tv_name); + time1 = (TextView) itemView.findViewById(R.id.tv_time); + } + } + + class TwoViewHolder extends RecyclerView.ViewHolder{ + private TextView tv2; + private TextView name2,time2; + public TwoViewHolder(View itemView) { + super(itemView); + tv2 = (TextView) itemView.findViewById(R.id.tv2); + name2 = (TextView) itemView.findViewById(R.id.tv_name2); + time2 = (TextView) itemView.findViewById(R.id.tv_time2); + } + } + +} diff --git a/app/src/main/java/com/example/schoolhelper/socket/MyBean.java b/app/src/main/java/com/example/schoolhelper/socket/MyBean.java new file mode 100644 index 0000000..eef0ab8 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/socket/MyBean.java @@ -0,0 +1,50 @@ +package com.example.schoolhelper.socket; + + +public class MyBean { + private String data; + private String time,name; + private int number; + + public MyBean() { + } + + public MyBean(String data, int number,String time,String name) { + this.data = data; + this.number = number; + this.name = name; + this.time = time; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } +} diff --git a/app/src/main/java/com/example/schoolhelper/socket/SocketActivity.java b/app/src/main/java/com/example/schoolhelper/socket/SocketActivity.java new file mode 100644 index 0000000..55009cb --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/socket/SocketActivity.java @@ -0,0 +1,125 @@ +package com.example.schoolhelper.socket; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import com.example.schoolhelper.R; +import com.example.schoolhelper.start_page.LoginMainActivity; +public class SocketActivity extends AppCompatActivity { + + private RecyclerView rv; + private EditText et; + private Button btn; + private Socket socket; + private ArrayList list; + private MyAdapter adapter; + private String Myname=LoginMainActivity.Myname; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_socket); + + rv = (RecyclerView) findViewById(R.id.rv); + et = (EditText) findViewById(R.id.et); + btn = (Button) findViewById(R.id.btn); + list = new ArrayList<>(); + adapter = new MyAdapter(this); + + final Handler handler = new MyHandler(); + Log.d("SocketActivity","ok"); + new Thread(new Runnable() { + @Override + public void run() { + try { + Log.d("SocketActivity","run"); + + socket = new Socket("47.119.203.28", 10086); + String address = socket.getRemoteSocketAddress().toString(); + + Log.d("SocketActivity",address); + + InputStream inputStream = socket.getInputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = inputStream.read(buffer)) != -1) { + String data = new String(buffer, 0, len); + // 发到主线程中 收到的数据 + Message message = Message.obtain(); + message.what = 1; + message.obj = data; + handler.sendMessage(message); + } + + } catch (IOException e) { + e.printStackTrace(); + } + } + }).start(); + + btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final String data = et.getText().toString(); + et.setText("");//清空输入框的内容 + + new Thread(new Runnable() { + @Override + public void run() { + try { + OutputStream outputStream = socket.getOutputStream(); + SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); //设置日期格式 + outputStream.write((socket.getLocalPort() +"//"+ data + "//" + df.format(new Date())+ "//" + Myname).getBytes("utf-8")); + outputStream.flush(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + }).start(); + } + }); + + } + + private class MyHandler extends Handler { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == 1) { + // + int localPort = socket.getLocalPort(); + String[] split = ((String) msg.obj).split("//"); + if (split[0].equals(localPort + "")) { + MyBean bean = new MyBean(split[1],1,split[2],"我:"); + list.add(bean); + } else { + MyBean bean = new MyBean(split[1],2,split[2],("来自:" + split[3])); + list.add(bean); + } + + // 向适配器set数据 + adapter.setData(list); + rv.setAdapter(adapter); + LinearLayoutManager manager = new LinearLayoutManager(SocketActivity.this, LinearLayoutManager.VERTICAL, false); + rv.setLayoutManager(manager); + rv.scrollToPosition(adapter.getItemCount()-1); + } + } + } +} diff --git a/app/src/main/java/com/example/schoolhelper/start_page/LoginMainActivity.java b/app/src/main/java/com/example/schoolhelper/start_page/LoginMainActivity.java new file mode 100644 index 0000000..bfb5861 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/start_page/LoginMainActivity.java @@ -0,0 +1,169 @@ +package com.example.schoolhelper.start_page; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.RadioButton; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.R; +import com.example.schoolhelper.databases.DBConnection; +import com.example.schoolhelper.main_page; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Timer; +import java.util.TimerTask; + + +public class LoginMainActivity extends Activity { + private EditText User; + private EditText Password; + private Button button_login; + private TextView first; + private TextView toRegister; + private RadioButton button1; + private RadioButton button2; + private RadioButton button3; + protected Intent intent; + public static String post_userid; + public static String Myname; + String user=null; + String password=null; + + + static boolean flag_rs; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login_main); + + User=(EditText)findViewById(R.id.login_user); + Password=(EditText)findViewById(R.id.login_password); + button_login=(Button)findViewById(R.id.login); + toRegister=(TextView)findViewById(R.id.toRegister); + post_userid=""; + + //登录验证,成功后跳转到主页 + button_login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + user=User.getText().toString(); + password=Password.getText().toString(); + + if(user.equals("")||user==null){ + Toast.makeText(getApplicationContext(), "请输入用户账号!", Toast.LENGTH_SHORT).show(); + } + if(password.equals("")||password==null){ + Toast.makeText(getApplicationContext(), "请输入用户密码!", Toast.LENGTH_SHORT).show(); + } + + @SuppressLint("HandlerLeak") Handler handler = new Handler(){ + public void handleMessage(Message msg){ + super.handleMessage(msg); + switch (msg.what){ + case 1: + flag_rs= (boolean) msg.obj; + if (!flag_rs){ + Toast.makeText(getApplicationContext(), "用户密码错误!'"+flag_rs+"'", Toast.LENGTH_SHORT).show(); + } else{ + Toast.makeText(getApplicationContext(), "登录成功", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(LoginMainActivity.this, main_page.class); + post_userid=user; + startActivity(intent); + flag_rs=false; + } + break; + } + } + }; + + + + + + + new Thread(new Runnable() { + @Override + public void run() { + + Message msg =Message.obtain(); + msg.obj =checkUser(user,password); + msg.what=1; + handler.sendMessage(msg); + + } + }).start(); + + + + + + System.out.println("============="); + System.out.println(flag_rs); + + + + + + + + + } + + }); + + //跳转到注册页面 + toRegister.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(LoginMainActivity.this, RegisterMainActivity.class); + startActivity(intent); + } + }); + + + } + private boolean checkUser(String user,String password){ + + boolean i =false; + + + String sql ="SELECT * FROM users WHERE userId=? and passWord=?"; + PreparedStatement preparedStatement =DBConnection.link(sql); + try { + preparedStatement.setString(1,user); + preparedStatement.setString(2,password); + ResultSet rs=preparedStatement.executeQuery(); + i=rs.next(); + rs.close(); + preparedStatement.close(); + + } catch (SQLException throwables) { + throwables.printStackTrace(); + } + + System.out.println("success!!!!"); + System.out.println(i); + return i; + } + + + + } + diff --git a/app/src/main/java/com/example/schoolhelper/start_page/RegisterMainActivity.java b/app/src/main/java/com/example/schoolhelper/start_page/RegisterMainActivity.java new file mode 100644 index 0000000..1e0c0e0 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/start_page/RegisterMainActivity.java @@ -0,0 +1,150 @@ +package com.example.schoolhelper.start_page; + + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Handler; +import android.os.Message; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.DatabaseHelper; +import com.example.schoolhelper.R; +import com.example.schoolhelper.databases.DBConnection; +import com.example.schoolhelper.main_page; + + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class RegisterMainActivity extends AppCompatActivity { + private EditText User; + private EditText Password1; + private EditText Password2; + private Button button_register; + private Button button_return; + private TextView first; + String user=null; + String password1=null; + String password2=null; + //定义连接 + Connection connection; + Handler handler; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register_main); + + User=(EditText)findViewById(R.id.user); + Password1=(EditText)findViewById(R.id.password1); + Password2=(EditText)findViewById(R.id.password2); + button_register=(Button)findViewById(R.id.register); + button_return=(Button)findViewById(R.id.toReturn); + + //点击注册 + button_register.setOnClickListener(new View.OnClickListener() { + @SuppressLint("HandlerLeak") + @Override + public void onClick(View v) { + user=User.getText().toString(); + password1=Password1.getText().toString(); + password2=Password2.getText().toString(); + + if(user==null||user.equals("")){ + Toast.makeText(getApplicationContext(), "请输入用户学号!", Toast.LENGTH_SHORT).show(); + } + else if(password1==null||password1.equals("")){ + Toast.makeText(getApplicationContext(), "请输入密码!", Toast.LENGTH_SHORT).show(); + } + else if(!password1.equals(password2)){ + Toast.makeText(getApplicationContext(), "两次输入的密码不一致!", Toast.LENGTH_SHORT).show(); + } + else { + + + checkUser(user,password1); + handler=new Handler(){ + + public void handleMessage(Message msg) { + super.handleMessage(msg); + boolean flag=(boolean) msg.obj; + switch (msg.what) { + case 1: + if (flag){ + Toast.makeText(getApplicationContext(), "用户已经存在!", Toast.LENGTH_SHORT).show(); + }else { + Toast.makeText(getApplicationContext(), "注册成功!", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(RegisterMainActivity.this, LoginMainActivity.class); + startActivity(intent); + } + break; + } + } + + }; + + + } + + } + }); + + //返回登录 + button_return.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(RegisterMainActivity.this, LoginMainActivity.class); + startActivity(intent); + } + }); + } + + //检查学号是否存在 + private void checkUser(String user,String pwd) { + + new Thread(new Runnable() { + @Override + public void run() { + boolean i=false; + String sql ="SELECT * FROM users WHERE userId='"+user+"'"; + PreparedStatement preparedStatement =DBConnection.link(sql); + try { + + ResultSet rs=preparedStatement.executeQuery(); + i =rs.next(); + Message msg=Message.obtain(); + msg.obj =i; + msg.what=1; + handler.sendMessage(msg); + if(!i){ + String sql1 ="insert into users(userId,passWord) values(?,?)"; + preparedStatement=DBConnection.link(sql1); + preparedStatement.setString(1,user); + preparedStatement.setString(2,pwd); + int row= preparedStatement.executeUpdate(); + } + rs.close(); + preparedStatement.close(); + + } catch (SQLException throwables) { + throwables.printStackTrace(); + } + } + }).start(); + + + } +} diff --git a/app/src/main/java/com/example/schoolhelper/start_page/SplashActivity.java b/app/src/main/java/com/example/schoolhelper/start_page/SplashActivity.java new file mode 100644 index 0000000..18e87ab --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/start_page/SplashActivity.java @@ -0,0 +1,106 @@ +package com.example.schoolhelper.start_page; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.WindowManager; +import android.widget.Button; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.schoolhelper.R; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Timer; +import java.util.TimerTask; + +public class SplashActivity extends AppCompatActivity { + public static int i = 1; + + + @Override + public void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + + //定义全屏参数 + int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN; + + //设置当前窗体为全屏显示 + getWindow().setFlags(flag, flag); + //this.getWindow().setBackgroundDrawableResource(R.drawable.splash); + setContentView(R.layout.activity_splash); + Button jump = (Button) this.findViewById(R.id.jump); + jump.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(SplashActivity.this, LoginMainActivity.class); + startActivity(intent); + i=0; + finish(); + } + }); + + + final Intent it = new Intent(SplashActivity.this, LoginMainActivity.class); //你要转向的Activity + Timer timer = new Timer(); + TimerTask task = new TimerTask() { + @Override + public void run() { + if (i==1){ + startActivity(it); //执行 + finish(); + } + + } + }; + timer.schedule(task, 1000 * 5); + i=1; + + + /** + //渐变效果 + //AlphaAnimation anima = new AlphaAnimation(0.1f, 1.0f); + //向下滑入 + TranslateAnimation translate_down=new TranslateAnimation + (0,-250,-200,1100); + //(开始时离原图x的距离,结束时离原图x的距离,开始时离原图y的距离,结束时离原图y的距离) + //向上滑入 + TranslateAnimation translate_up=new TranslateAnimation + (0,250,+700,-1100); + //设置动画显示时间、启动 + anima.setDuration(5000); + //持续时间和最后停留的位置,true为结束位置不动 + translate_down.setDuration(2000);translate_down.setFillAfter(true); + translate_up.setDuration(2000); translate_up.setFillAfter(true); + + image2.startAnimation(translate_down); + image3.startAnimation(translate_up); + anima.setAnimationListener(new AnimationImpl()); //设置监听*/ + } +// private class AnimationImpl implements Animation.AnimationListener { +// @Override +// public void onAnimationStart(Animation animation) { +// } +// @Override +// public void onAnimationEnd(Animation animation) { +// // 动画结束后跳转到别的页面 +// startActivity(new Intent(SplashActivity.this,LoginMainActivity.class)); +// finish(); +// } +// @Override +// public void onAnimationRepeat(Animation animation) { +// } +// } + + + + + + +} + diff --git a/app/src/main/java/com/example/schoolhelper/userMsgActivity.java b/app/src/main/java/com/example/schoolhelper/userMsgActivity.java new file mode 100644 index 0000000..53b6457 --- /dev/null +++ b/app/src/main/java/com/example/schoolhelper/userMsgActivity.java @@ -0,0 +1,95 @@ +package com.example.schoolhelper; + +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +import com.example.schoolhelper.start_page.LoginMainActivity; + +public class userMsgActivity extends AppCompatActivity { + private TextView userid; + private TextView username; + private TextView usersubject; + private TextView userphone; + private TextView userqq; + private TextView useraddress; + private Button userchange; + private Button back; + protected Intent intent; + private String id,name,subject,phone,qq,address; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_user_msg); + + userid = (TextView) findViewById(R.id.showUser); + username = (TextView) findViewById(R.id.name); + usersubject = (TextView) findViewById(R.id.subject); + userphone = (TextView) findViewById(R.id.phone); + userqq = (TextView) findViewById(R.id.qq); + useraddress = (TextView) findViewById(R.id.address); + userchange = (Button) findViewById(R.id.changemsg); + back = (Button) findViewById(R.id.back); + id = LoginMainActivity.post_userid; + userid.setText(id); + if (id.equals("") || id == null) { + Toast.makeText(getApplicationContext(), "请先登录!", Toast.LENGTH_SHORT).show(); + intent = new Intent(userMsgActivity.this, LoginMainActivity.class); + startActivity(intent); + } else {//账号userId,密码passWord,姓名name,专业subject,电话phone,QQ号qq,地址address + DatabaseHelper dbhelper = new DatabaseHelper(this); + SQLiteDatabase db = dbhelper.getReadableDatabase(); + try { + String sql = "SELECT * FROM users WHERE userId=?"; + Cursor cursor = db.rawQuery(sql, new String[]{id}); + if (cursor.getCount() == 0) { + Toast.makeText(getApplicationContext(), "用户不存在!", Toast.LENGTH_SHORT).show(); + } else { + if (cursor.moveToFirst()) { + name = cursor.getString(cursor.getColumnIndex("name")); + subject = cursor.getString(cursor.getColumnIndex("subject")); + phone = cursor.getString(cursor.getColumnIndex("phone")); + qq = cursor.getString(cursor.getColumnIndex("qq")); + address = cursor.getString(cursor.getColumnIndex("address")); + } + Log.i("123","1233333"); + username.setText(name); + userphone.setText(phone); + usersubject.setText(subject); + userqq.setText(qq); + useraddress.setText(address); + Log.i("123","12344444"); + + } + cursor.close(); + db.close(); + } catch (SQLiteException e) { + Toast.makeText(getApplicationContext(), "无法显示个人信息", Toast.LENGTH_SHORT).show(); + } + } + + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(userMsgActivity.this, MyselfActivity.class); + startActivity(intent); + } + }); + + userchange.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + intent = new Intent(userMsgActivity.this,setMymsgActivity.class); + startActivity(intent); + } + }); + } +} diff --git a/app/src/main/res/app_pic.png b/app/src/main/res/app_pic.png new file mode 100644 index 0000000..86d68f7 Binary files /dev/null and b/app/src/main/res/app_pic.png differ diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/an.png b/app/src/main/res/drawable/an.png new file mode 100644 index 0000000..e34cb3f Binary files /dev/null and b/app/src/main/res/drawable/an.png differ diff --git a/app/src/main/res/drawable/app_pic.png b/app/src/main/res/drawable/app_pic.png new file mode 100644 index 0000000..86d68f7 Binary files /dev/null and b/app/src/main/res/drawable/app_pic.png differ diff --git a/app/src/main/res/drawable/beijing.png b/app/src/main/res/drawable/beijing.png new file mode 100644 index 0000000..de9dc44 Binary files /dev/null and b/app/src/main/res/drawable/beijing.png differ diff --git a/app/src/main/res/drawable/beijing1.png b/app/src/main/res/drawable/beijing1.png new file mode 100644 index 0000000..e29eb51 Binary files /dev/null and b/app/src/main/res/drawable/beijing1.png differ diff --git a/app/src/main/res/drawable/beijing2.jpg b/app/src/main/res/drawable/beijing2.jpg new file mode 100644 index 0000000..b6540d9 Binary files /dev/null and b/app/src/main/res/drawable/beijing2.jpg differ diff --git a/app/src/main/res/drawable/biankuang.xml b/app/src/main/res/drawable/biankuang.xml new file mode 100644 index 0000000..740cc05 --- /dev/null +++ b/app/src/main/res/drawable/biankuang.xml @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/biankuang2.xml b/app/src/main/res/drawable/biankuang2.xml new file mode 100644 index 0000000..70be843 --- /dev/null +++ b/app/src/main/res/drawable/biankuang2.xml @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_drawable.xml b/app/src/main/res/drawable/button_drawable.xml new file mode 100644 index 0000000..4fc85e9 --- /dev/null +++ b/app/src/main/res/drawable/button_drawable.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/buy_item1.jpg b/app/src/main/res/drawable/buy_item1.jpg new file mode 100644 index 0000000..71c0ddc Binary files /dev/null and b/app/src/main/res/drawable/buy_item1.jpg differ diff --git a/app/src/main/res/drawable/buy_item2.jpg b/app/src/main/res/drawable/buy_item2.jpg new file mode 100644 index 0000000..40a9b1d Binary files /dev/null and b/app/src/main/res/drawable/buy_item2.jpg differ diff --git a/app/src/main/res/drawable/buy_item3.jpg b/app/src/main/res/drawable/buy_item3.jpg new file mode 100644 index 0000000..3e779c0 Binary files /dev/null and b/app/src/main/res/drawable/buy_item3.jpg differ diff --git a/app/src/main/res/drawable/buy_item4.jpg b/app/src/main/res/drawable/buy_item4.jpg new file mode 100644 index 0000000..11bea18 Binary files /dev/null and b/app/src/main/res/drawable/buy_item4.jpg differ diff --git a/app/src/main/res/drawable/buy_kind1.png b/app/src/main/res/drawable/buy_kind1.png new file mode 100644 index 0000000..706a80a Binary files /dev/null and b/app/src/main/res/drawable/buy_kind1.png differ diff --git a/app/src/main/res/drawable/buy_kind2.png b/app/src/main/res/drawable/buy_kind2.png new file mode 100644 index 0000000..6406648 Binary files /dev/null and b/app/src/main/res/drawable/buy_kind2.png differ diff --git a/app/src/main/res/drawable/buy_kind3.png b/app/src/main/res/drawable/buy_kind3.png new file mode 100644 index 0000000..6066316 Binary files /dev/null and b/app/src/main/res/drawable/buy_kind3.png differ diff --git a/app/src/main/res/drawable/buy_kind4.png b/app/src/main/res/drawable/buy_kind4.png new file mode 100644 index 0000000..148e102 Binary files /dev/null and b/app/src/main/res/drawable/buy_kind4.png differ diff --git a/app/src/main/res/drawable/friend.png b/app/src/main/res/drawable/friend.png new file mode 100644 index 0000000..6f558ae Binary files /dev/null and b/app/src/main/res/drawable/friend.png differ diff --git a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml new file mode 100644 index 0000000..ae6a446 --- /dev/null +++ b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml new file mode 100644 index 0000000..0c36320 --- /dev/null +++ b/app/src/main/res/drawable/ic_home_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..911536e --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 0000000..0262382 --- /dev/null +++ b/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/jump.xml b/app/src/main/res/drawable/jump.xml new file mode 100644 index 0000000..1134b79 --- /dev/null +++ b/app/src/main/res/drawable/jump.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/left.9.png b/app/src/main/res/drawable/left.9.png new file mode 100644 index 0000000..86e0ad0 Binary files /dev/null and b/app/src/main/res/drawable/left.9.png differ diff --git a/app/src/main/res/drawable/line.jpg b/app/src/main/res/drawable/line.jpg new file mode 100644 index 0000000..894d6c5 Binary files /dev/null and b/app/src/main/res/drawable/line.jpg differ diff --git a/app/src/main/res/drawable/line1.jpg b/app/src/main/res/drawable/line1.jpg new file mode 100644 index 0000000..a365a9e Binary files /dev/null and b/app/src/main/res/drawable/line1.jpg differ diff --git a/app/src/main/res/drawable/m1_sc.png b/app/src/main/res/drawable/m1_sc.png new file mode 100644 index 0000000..f74f015 Binary files /dev/null and b/app/src/main/res/drawable/m1_sc.png differ diff --git a/app/src/main/res/drawable/main_header.png b/app/src/main/res/drawable/main_header.png new file mode 100644 index 0000000..ac1d995 Binary files /dev/null and b/app/src/main/res/drawable/main_header.png differ diff --git a/app/src/main/res/drawable/passwd.png b/app/src/main/res/drawable/passwd.png new file mode 100644 index 0000000..04bb4c2 Binary files /dev/null and b/app/src/main/res/drawable/passwd.png differ diff --git a/app/src/main/res/drawable/person.png b/app/src/main/res/drawable/person.png new file mode 100644 index 0000000..424736a Binary files /dev/null and b/app/src/main/res/drawable/person.png differ diff --git a/app/src/main/res/drawable/pic_about.png b/app/src/main/res/drawable/pic_about.png new file mode 100644 index 0000000..5586946 Binary files /dev/null and b/app/src/main/res/drawable/pic_about.png differ diff --git a/app/src/main/res/drawable/pic_add.png b/app/src/main/res/drawable/pic_add.png new file mode 100644 index 0000000..ced3567 Binary files /dev/null and b/app/src/main/res/drawable/pic_add.png differ diff --git a/app/src/main/res/drawable/pic_home.png b/app/src/main/res/drawable/pic_home.png new file mode 100644 index 0000000..a2540fc Binary files /dev/null and b/app/src/main/res/drawable/pic_home.png differ diff --git a/app/src/main/res/drawable/pic_login.png b/app/src/main/res/drawable/pic_login.png new file mode 100644 index 0000000..a3227cd Binary files /dev/null and b/app/src/main/res/drawable/pic_login.png differ diff --git a/app/src/main/res/drawable/pic_my.png b/app/src/main/res/drawable/pic_my.png new file mode 100644 index 0000000..996ad08 Binary files /dev/null and b/app/src/main/res/drawable/pic_my.png differ diff --git a/app/src/main/res/drawable/pic_myself.png b/app/src/main/res/drawable/pic_myself.png new file mode 100644 index 0000000..7dc6930 Binary files /dev/null and b/app/src/main/res/drawable/pic_myself.png differ diff --git a/app/src/main/res/drawable/pic_search.png b/app/src/main/res/drawable/pic_search.png new file mode 100644 index 0000000..3e09f75 Binary files /dev/null and b/app/src/main/res/drawable/pic_search.png differ diff --git a/app/src/main/res/drawable/pic_set.png b/app/src/main/res/drawable/pic_set.png new file mode 100644 index 0000000..40bc591 Binary files /dev/null and b/app/src/main/res/drawable/pic_set.png differ diff --git a/app/src/main/res/drawable/right.9.png b/app/src/main/res/drawable/right.9.png new file mode 100644 index 0000000..127dad5 Binary files /dev/null and b/app/src/main/res/drawable/right.9.png differ diff --git a/app/src/main/res/drawable/splash.jpg b/app/src/main/res/drawable/splash.jpg new file mode 100644 index 0000000..d0720c4 Binary files /dev/null and b/app/src/main/res/drawable/splash.jpg differ diff --git a/app/src/main/res/drawable/timg.jpg b/app/src/main/res/drawable/timg.jpg new file mode 100644 index 0000000..7263eb5 Binary files /dev/null and b/app/src/main/res/drawable/timg.jpg differ diff --git a/app/src/main/res/drawable/touxiang.png b/app/src/main/res/drawable/touxiang.png new file mode 100644 index 0000000..7dc6930 Binary files /dev/null and b/app/src/main/res/drawable/touxiang.png differ diff --git a/app/src/main/res/drawable/user.png b/app/src/main/res/drawable/user.png new file mode 100644 index 0000000..0c88ef3 Binary files /dev/null and b/app/src/main/res/drawable/user.png differ diff --git a/app/src/main/res/layout/activity_about_main.xml b/app/src/main/res/layout/activity_about_main.xml new file mode 100644 index 0000000..17c56a4 --- /dev/null +++ b/app/src/main/res/layout/activity_about_main.xml @@ -0,0 +1,66 @@ + + + + + + + + + + +