diff --git a/11.txt.txt b/11.txt.txt deleted file mode 100644 index b4de394..0000000 --- a/11.txt.txt +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/README.md b/README.md deleted file mode 100644 index 2a7ca20..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# SchoolProject - diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..de63084 --- /dev/null +++ b/README.txt @@ -0,0 +1,7 @@ +本软件的配置如下: +Android Studio 2021.2.1 Patch 2 +截止2022/11/26 百度地图官方提供的插件与接口 + +注意: +在软件的AndroidManifest.xml文件中的107行需要填写自己在百度地图官方网站上申请的key值 +详情请跳转https://lbsyun.baidu.com/index.php?title=androidsdk去获取密钥 \ No newline at end of file diff --git a/doc b/doc deleted file mode 100644 index e69de29..0000000 diff --git a/doc/01_软件系统的需求构思及描述-模板.docx b/doc/01_软件系统的需求构思及描述-模板.docx new file mode 100644 index 0000000..cd43b97 Binary files /dev/null and b/doc/01_软件系统的需求构思及描述-模板.docx differ diff --git a/doc/02_软件需求规格说明书.docx b/doc/02_软件需求规格说明书.docx new file mode 100644 index 0000000..5558a81 Binary files /dev/null and b/doc/02_软件需求规格说明书.docx differ diff --git a/doc/03_软件设计规格说明书.docx b/doc/03_软件设计规格说明书.docx new file mode 100644 index 0000000..67452aa Binary files /dev/null and b/doc/03_软件设计规格说明书.docx differ diff --git a/model/UML模型/UML模型/校园通系统“导航”用例设计顺序图.jpg b/model/UML模型/UML模型/校园通系统“导航”用例设计顺序图.jpg new file mode 100644 index 0000000..83967a2 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统“导航”用例设计顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统“添加课表”用例设计顺序图.jpg b/model/UML模型/UML模型/校园通系统“添加课表”用例设计顺序图.jpg new file mode 100644 index 0000000..d303b01 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统“添加课表”用例设计顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统“用户登录”用例设计顺序图.jpg b/model/UML模型/UML模型/校园通系统“用户登录”用例设计顺序图.jpg new file mode 100644 index 0000000..a2c12ce Binary files /dev/null and b/model/UML模型/UML模型/校园通系统“用户登录”用例设计顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统主页面UML类图.jpg b/model/UML模型/UML模型/校园通系统主页面UML类图.jpg new file mode 100644 index 0000000..743592a Binary files /dev/null and b/model/UML模型/UML模型/校园通系统主页面UML类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统体系结构逻辑视图.jpg b/model/UML模型/UML模型/校园通系统体系结构逻辑视图.jpg new file mode 100644 index 0000000..d706755 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统体系结构逻辑视图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统分析类图.jpg b/model/UML模型/UML模型/校园通系统分析类图.jpg new file mode 100644 index 0000000..24ee359 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统分析类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统地图导航用例的顺序图.jpg b/model/UML模型/UML模型/校园通系统地图导航用例的顺序图.jpg new file mode 100644 index 0000000..71ce9d3 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统地图导航用例的顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统导航页面UML类图.jpg b/model/UML模型/UML模型/校园通系统导航页面UML类图.jpg new file mode 100644 index 0000000..9b486b0 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统导航页面UML类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统查看校园地图用例的顺序图.jpg b/model/UML模型/UML模型/校园通系统查看校园地图用例的顺序图.jpg new file mode 100644 index 0000000..ed23746 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统查看校园地图用例的顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统查看课表用例的顺序图.jpg b/model/UML模型/UML模型/校园通系统查看课表用例的顺序图.jpg new file mode 100644 index 0000000..be8f6e3 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统查看课表用例的顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统用例.jpg b/model/UML模型/UML模型/校园通系统用例.jpg new file mode 100644 index 0000000..ef9ecb3 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统用例.jpg differ diff --git a/model/UML模型/UML模型/校园通系统用户数据设计类图.jpg b/model/UML模型/UML模型/校园通系统用户数据设计类图.jpg new file mode 100644 index 0000000..93f8e1e Binary files /dev/null and b/model/UML模型/UML模型/校园通系统用户数据设计类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统用户界面UML类图.jpg b/model/UML模型/UML模型/校园通系统用户界面UML类图.jpg new file mode 100644 index 0000000..de50ba5 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统用户界面UML类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统界面流的顺序图.jpg b/model/UML模型/UML模型/校园通系统界面流的顺序图.jpg new file mode 100644 index 0000000..14b6d59 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统界面流的顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统登录账号用例的顺序图.jpg b/model/UML模型/UML模型/校园通系统登录账号用例的顺序图.jpg new file mode 100644 index 0000000..c1fda8a Binary files /dev/null and b/model/UML模型/UML模型/校园通系统登录账号用例的顺序图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统设计类图.jpg b/model/UML模型/UML模型/校园通系统设计类图.jpg new file mode 100644 index 0000000..5821419 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统设计类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统课程数据设计类图.jpg b/model/UML模型/UML模型/校园通系统课程数据设计类图.jpg new file mode 100644 index 0000000..bb6bbd7 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统课程数据设计类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统课表页面UML类图.jpg b/model/UML模型/UML模型/校园通系统课表页面UML类图.jpg new file mode 100644 index 0000000..1fda9f8 Binary files /dev/null and b/model/UML模型/UML模型/校园通系统课表页面UML类图.jpg differ diff --git a/model/UML模型/UML模型/校园通系统部署图.jpg b/model/UML模型/UML模型/校园通系统部署图.jpg new file mode 100644 index 0000000..c8bab6d Binary files /dev/null and b/model/UML模型/UML模型/校园通系统部署图.jpg differ diff --git a/other/04_软件工程课程设计汇报PPT.pptx b/other/04_软件工程课程设计汇报PPT.pptx new file mode 100644 index 0000000..aa07591 Binary files /dev/null and b/other/04_软件工程课程设计汇报PPT.pptx differ diff --git a/other/05_软件开发项目的个人自评报告(每个成员都要填写).xlsx b/other/05_软件开发项目的个人自评报告(每个成员都要填写).xlsx new file mode 100644 index 0000000..678840b Binary files /dev/null and b/other/05_软件开发项目的个人自评报告(每个成员都要填写).xlsx differ diff --git a/other/06_软件开发项目的团队自评报告.xlsx b/other/06_软件开发项目的团队自评报告.xlsx new file mode 100644 index 0000000..1eebc10 Binary files /dev/null and b/other/06_软件开发项目的团队自评报告.xlsx differ diff --git a/other/07_200340064刘博洋-实践总结报告.docx b/other/07_200340064刘博洋-实践总结报告.docx new file mode 100644 index 0000000..83a2c8d Binary files /dev/null and b/other/07_200340064刘博洋-实践总结报告.docx differ diff --git a/other/07_200340065秦晟颢-实践总结报告.docx b/other/07_200340065秦晟颢-实践总结报告.docx new file mode 100644 index 0000000..b07b715 Binary files /dev/null and b/other/07_200340065秦晟颢-实践总结报告.docx differ diff --git a/other/07_200340067阙申申-实践总结报告.docx b/other/07_200340067阙申申-实践总结报告.docx new file mode 100644 index 0000000..92f67a5 Binary files /dev/null and b/other/07_200340067阙申申-实践总结报告.docx differ diff --git a/other/08_演示运行视频.mp4 b/other/08_演示运行视频.mp4 new file mode 100644 index 0000000..24567f7 Binary files /dev/null and b/other/08_演示运行视频.mp4 differ diff --git a/other/sonarqube.png b/other/sonarqube.png new file mode 100644 index 0000000..bd8348c Binary files /dev/null and b/other/sonarqube.png differ diff --git a/src b/src deleted file mode 100644 index e69de29..0000000 diff --git a/src/README.txt b/src/README.txt new file mode 100644 index 0000000..de63084 --- /dev/null +++ b/src/README.txt @@ -0,0 +1,7 @@ +本软件的配置如下: +Android Studio 2021.2.1 Patch 2 +截止2022/11/26 百度地图官方提供的插件与接口 + +注意: +在软件的AndroidManifest.xml文件中的107行需要填写自己在百度地图官方网站上申请的key值 +详情请跳转https://lbsyun.baidu.com/index.php?title=androidsdk去获取密钥 \ No newline at end of file diff --git a/src/map3demo/.gitignore b/src/map3demo/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/src/map3demo/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/src/map3demo/.idea/.gitignore b/src/map3demo/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/map3demo/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/map3demo/.idea/.name b/src/map3demo/.idea/.name new file mode 100644 index 0000000..e9589e4 --- /dev/null +++ b/src/map3demo/.idea/.name @@ -0,0 +1 @@ +map \ No newline at end of file diff --git a/src/map3demo/.idea/codeStyles/Project.xml b/src/map3demo/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..4bec4ea --- /dev/null +++ b/src/map3demo/.idea/codeStyles/Project.xml @@ -0,0 +1,117 @@ + + + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/codeStyles/codeStyleConfig.xml b/src/map3demo/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/src/map3demo/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/compiler.xml b/src/map3demo/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/src/map3demo/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/copyright/Baidu.xml b/src/map3demo/.idea/copyright/Baidu.xml new file mode 100644 index 0000000..94fc8f6 --- /dev/null +++ b/src/map3demo/.idea/copyright/Baidu.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/copyright/profiles_settings.xml b/src/map3demo/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..b3170e3 --- /dev/null +++ b/src/map3demo/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/dbnavigator.xml b/src/map3demo/.idea/dbnavigator.xml new file mode 100644 index 0000000..22b24ed --- /dev/null +++ b/src/map3demo/.idea/dbnavigator.xml @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/gradle.xml b/src/map3demo/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/src/map3demo/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/src/map3demo/.idea/misc.xml b/src/map3demo/.idea/misc.xml new file mode 100644 index 0000000..95f51d6 --- /dev/null +++ b/src/map3demo/.idea/misc.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map3demo/app/.gitignore b/src/map3demo/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/src/map3demo/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/src/map3demo/app/build.gradle b/src/map3demo/app/build.gradle new file mode 100644 index 0000000..763635e --- /dev/null +++ b/src/map3demo/app/build.gradle @@ -0,0 +1,50 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "com.example.map" + minSdk 26 + targetSdk 32 + 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 + } + + sourceSets{ + main{ + jniLibs.srcDirs = ['libs'] + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation files('libs\\BaiduLBS_Android.jar') + implementation fileTree(dir:'libs',include:['*.jar']) + implementation 'com.google.android.gms:play-services-maps:17.0.1' + implementation files('libs\\BaiduLBS_Android.jar') + implementation files('libs\\BaiduLBS_Android.jar') + + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} diff --git a/src/map3demo/app/libs/BaiduLBS_Android.aar b/src/map3demo/app/libs/BaiduLBS_Android.aar new file mode 100644 index 0000000..a5ebf7a Binary files /dev/null and b/src/map3demo/app/libs/BaiduLBS_Android.aar differ diff --git a/src/map3demo/app/libs/BaiduLBS_Android.jar b/src/map3demo/app/libs/BaiduLBS_Android.jar new file mode 100644 index 0000000..7d1958c Binary files /dev/null and b/src/map3demo/app/libs/BaiduLBS_Android.jar differ diff --git a/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so b/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so new file mode 100644 index 0000000..2935c4c Binary files /dev/null and b/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so b/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so new file mode 100644 index 0000000..09c6817 Binary files /dev/null and b/src/map3demo/app/libs/arm64-v8a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so differ diff --git a/src/map3demo/app/libs/arm64-v8a/libgnustl_shared.so b/src/map3demo/app/libs/arm64-v8a/libgnustl_shared.so new file mode 100644 index 0000000..be99b75 Binary files /dev/null and b/src/map3demo/app/libs/arm64-v8a/libgnustl_shared.so differ diff --git a/src/map3demo/app/libs/arm64-v8a/libindoor.so b/src/map3demo/app/libs/arm64-v8a/libindoor.so new file mode 100644 index 0000000..bfb6f75 Binary files /dev/null and b/src/map3demo/app/libs/arm64-v8a/libindoor.so differ diff --git a/src/map3demo/app/libs/arm64-v8a/liblocSDK8b.so b/src/map3demo/app/libs/arm64-v8a/liblocSDK8b.so new file mode 100644 index 0000000..9bd868a Binary files /dev/null and b/src/map3demo/app/libs/arm64-v8a/liblocSDK8b.so differ diff --git a/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so b/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so new file mode 100644 index 0000000..9aab5e6 Binary files /dev/null and b/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so b/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so new file mode 100644 index 0000000..366104e Binary files /dev/null and b/src/map3demo/app/libs/armeabi-v7a/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so differ diff --git a/src/map3demo/app/libs/armeabi-v7a/libgnustl_shared.so b/src/map3demo/app/libs/armeabi-v7a/libgnustl_shared.so new file mode 100644 index 0000000..96c22a2 Binary files /dev/null and b/src/map3demo/app/libs/armeabi-v7a/libgnustl_shared.so differ diff --git a/src/map3demo/app/libs/armeabi-v7a/libindoor.so b/src/map3demo/app/libs/armeabi-v7a/libindoor.so new file mode 100644 index 0000000..b59be91 Binary files /dev/null and b/src/map3demo/app/libs/armeabi-v7a/libindoor.so differ diff --git a/src/map3demo/app/libs/armeabi-v7a/liblocSDK8b.so b/src/map3demo/app/libs/armeabi-v7a/liblocSDK8b.so new file mode 100644 index 0000000..aa90e76 Binary files /dev/null and b/src/map3demo/app/libs/armeabi-v7a/liblocSDK8b.so differ diff --git a/src/map3demo/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so b/src/map3demo/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so new file mode 100644 index 0000000..373e67f Binary files /dev/null and b/src/map3demo/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/map3demo/app/libs/armeabi/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so b/src/map3demo/app/libs/armeabi/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so new file mode 100644 index 0000000..aa43d34 Binary files /dev/null and b/src/map3demo/app/libs/armeabi/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so differ diff --git a/src/map3demo/app/libs/armeabi/libgnustl_shared.so b/src/map3demo/app/libs/armeabi/libgnustl_shared.so new file mode 100644 index 0000000..5cf6d20 Binary files /dev/null and b/src/map3demo/app/libs/armeabi/libgnustl_shared.so differ diff --git a/src/map3demo/app/libs/armeabi/libindoor.so b/src/map3demo/app/libs/armeabi/libindoor.so new file mode 100644 index 0000000..a0879cf Binary files /dev/null and b/src/map3demo/app/libs/armeabi/libindoor.so differ diff --git a/src/map3demo/app/libs/armeabi/liblocSDK8b.so b/src/map3demo/app/libs/armeabi/liblocSDK8b.so new file mode 100644 index 0000000..4083291 Binary files /dev/null and b/src/map3demo/app/libs/armeabi/liblocSDK8b.so differ diff --git a/src/map3demo/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so b/src/map3demo/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so new file mode 100644 index 0000000..5554ff8 Binary files /dev/null and b/src/map3demo/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/map3demo/app/libs/x86/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so b/src/map3demo/app/libs/x86/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so new file mode 100644 index 0000000..c0dc6ef Binary files /dev/null and b/src/map3demo/app/libs/x86/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so differ diff --git a/src/map3demo/app/libs/x86/libgnustl_shared.so b/src/map3demo/app/libs/x86/libgnustl_shared.so new file mode 100644 index 0000000..1eae31c Binary files /dev/null and b/src/map3demo/app/libs/x86/libgnustl_shared.so differ diff --git a/src/map3demo/app/libs/x86/libindoor.so b/src/map3demo/app/libs/x86/libindoor.so new file mode 100644 index 0000000..1de0a2c Binary files /dev/null and b/src/map3demo/app/libs/x86/libindoor.so differ diff --git a/src/map3demo/app/libs/x86/liblocSDK8b.so b/src/map3demo/app/libs/x86/liblocSDK8b.so new file mode 100644 index 0000000..ca234f1 Binary files /dev/null and b/src/map3demo/app/libs/x86/liblocSDK8b.so differ diff --git a/src/map3demo/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so b/src/map3demo/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so new file mode 100644 index 0000000..a1c0b4b Binary files /dev/null and b/src/map3demo/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/map3demo/app/libs/x86_64/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so b/src/map3demo/app/libs/x86_64/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so new file mode 100644 index 0000000..f22cd13 Binary files /dev/null and b/src/map3demo/app/libs/x86_64/libBaiduMapSDK_map_for_bikenavi_v7_5_3.so differ diff --git a/src/map3demo/app/libs/x86_64/libgnustl_shared.so b/src/map3demo/app/libs/x86_64/libgnustl_shared.so new file mode 100644 index 0000000..0149273 Binary files /dev/null and b/src/map3demo/app/libs/x86_64/libgnustl_shared.so differ diff --git a/src/map3demo/app/libs/x86_64/libindoor.so b/src/map3demo/app/libs/x86_64/libindoor.so new file mode 100644 index 0000000..80a00c6 Binary files /dev/null and b/src/map3demo/app/libs/x86_64/libindoor.so differ diff --git a/src/map3demo/app/libs/x86_64/liblocSDK8b.so b/src/map3demo/app/libs/x86_64/liblocSDK8b.so new file mode 100644 index 0000000..ff464c5 Binary files /dev/null and b/src/map3demo/app/libs/x86_64/liblocSDK8b.so differ diff --git a/src/map3demo/app/proguard-rules.pro b/src/map3demo/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/src/map3demo/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/src/map3demo/app/src/androidTest/java/com/example/map/ExampleInstrumentedTest.java b/src/map3demo/app/src/androidTest/java/com/example/map/ExampleInstrumentedTest.java new file mode 100644 index 0000000..794defd --- /dev/null +++ b/src/map3demo/app/src/androidTest/java/com/example/map/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.map; + +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.map", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/AndroidManifest.xml b/src/map3demo/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..359aeb4 --- /dev/null +++ b/src/map3demo/app/src/main/AndroidManifest.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map3demo/app/src/main/assets/BaiduBikeNavi_Resource_v7_5_4.png b/src/map3demo/app/src/main/assets/BaiduBikeNavi_Resource_v7_5_4.png new file mode 100644 index 0000000..ed5843e Binary files /dev/null and b/src/map3demo/app/src/main/assets/BaiduBikeNavi_Resource_v7_5_4.png differ diff --git a/src/map3demo/app/src/main/java/com/example/map/AddClasses.java b/src/map3demo/app/src/main/java/com/example/map/AddClasses.java new file mode 100644 index 0000000..93cdc4e --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/AddClasses.java @@ -0,0 +1,88 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.view.Window; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Spinner; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.ClassDBHelper; +import com.example.map.enity.Class_demo; + +@SuppressWarnings("rawtypes") +public class AddClasses extends AppCompatActivity implements View.OnClickListener{ + Button close_activity;//关闭按钮 + Button save_activity;//保存按钮 + Spinner selected_time;//选择上课时间 + Spinner selected_day;//选择哪天上课 + EditText subject;//科目 + EditText teacher;//老师名字 + private ClassDBHelper mHelper; + + public final String DB_NAME = "class.db"; + public final String TABLE_NAME = "class_table"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.activity_tianjiakebiao); + + save_activity=findViewById(R.id.save_activity); + selected_time=findViewById(R.id.selected_time); + selected_day=findViewById(R.id.selected_day); + subject=findViewById(R.id.subject); + teacher=findViewById(R.id.teacher); + //当点击dialog之外完成此activity + setFinishOnTouchOutside (true); + + //关闭按钮操作 + close_activity=(Button) findViewById(R.id.close_activity); + close_activity.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AddClasses.this.finish(); + } + }); + + findViewById(R.id.subject).setOnClickListener(this); + findViewById(R.id.teacher).setOnClickListener(this); + findViewById(R.id.save_activity).setOnClickListener(this); + } + + protected void onStart() { + super.onStart(); + // 获得数据库帮助器的实例 + mHelper = ClassDBHelper.getInstance(this); + // 打开数据库帮助器的读写连接 + mHelper.openWriteLink(); + mHelper.openReadLink(); + } + public void onClick(View v) { + String subject_=subject.getText().toString().trim(); + String teacher_=teacher.getText().toString().trim(); + String time = selected_time.getSelectedItem().toString(); + String day = selected_day.getSelectedItem().toString(); + Class_demo classes = null; + switch (v.getId()){ + + case R.id.close_activity: + Intent intent = new Intent(AddClasses.this, ClassTable.class);//跳转到注册界面 + startActivity(intent); + finish(); + break; + + case R.id.save_activity: + classes=new Class_demo(subject_,time,day,teacher_); + if (mHelper.insert(classes) > 0) { + Toast.makeText(this, "课表添加成功", Toast.LENGTH_SHORT).show(); + } + break; + } + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/BNaviDemoApplication.java b/src/map3demo/app/src/main/java/com/example/map/BNaviDemoApplication.java new file mode 100644 index 0000000..195b7c7 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/BNaviDemoApplication.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016 Baidu, Inc. All Rights Reserved. + */ +package com.example.map; + +import android.app.Application; + +import com.baidu.mapapi.SDKInitializer; + + +public class BNaviDemoApplication extends Application { + + @Override + public void onCreate() { + super.onCreate(); + /** + * 隐私政策统一接口:该接口必须在调用SDK初始化接口之前设置 + * 设为false不同意隐私政策:不支持发起检索、路线规划等数据请求, SDK抛出异常; + * 设为true同意隐私政策:支持发起检索、路线规划等数据请求 + */ + SDKInitializer.setAgreePrivacy(this, true); + + // 在SDK初始化时捕获抛出的异常 + try { + SDKInitializer.initialize(this); + } catch (Exception e) { + + } + + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/BNaviGuideActivity.java b/src/map3demo/app/src/main/java/com/example/map/BNaviGuideActivity.java new file mode 100644 index 0000000..ab16334 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/BNaviGuideActivity.java @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2016 Baidu, Inc. All Rights Reserved. + */ +package com.example.map; + +import android.app.Activity; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.util.Log; +import android.view.View; + +import com.baidu.mapapi.bikenavi.BikeNavigateHelper; +import com.baidu.mapapi.bikenavi.adapter.IBNaviStatusListener; +import com.baidu.mapapi.bikenavi.adapter.IBRouteGuidanceListener; +import com.baidu.mapapi.bikenavi.adapter.IBTTSPlayer; +import com.baidu.mapapi.bikenavi.model.BikeRouteDetailInfo; +import com.baidu.mapapi.bikenavi.model.IBRouteIconInfo; +import com.baidu.mapapi.bikenavi.params.BikeNaviLaunchParam; +import com.baidu.mapapi.walknavi.model.RouteGuideKind; + +public class BNaviGuideActivity extends Activity { + + private final static String TAG = BNaviGuideActivity.class.getSimpleName(); + + private BikeNavigateHelper mNaviHelper; + + BikeNaviLaunchParam param; + + @Override + protected void onDestroy() { + super.onDestroy(); + mNaviHelper.quit(); + } + + @Override + protected void onResume() { + super.onResume(); + mNaviHelper.resume(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mNaviHelper = BikeNavigateHelper.getInstance(); + + View view = mNaviHelper.onCreate(BNaviGuideActivity.this); + if (view != null) { + setContentView(view); + } + + mNaviHelper.setBikeNaviStatusListener(new IBNaviStatusListener() { + @Override + public void onNaviExit() { + Log.d(TAG, "onNaviExit"); + } + }); + + mNaviHelper.setTTsPlayer(new IBTTSPlayer() { + @Override + public int playTTSText(String s, boolean b) { + Log.d("tts", s); + return 0; + } + }); + + mNaviHelper.startBikeNavi(BNaviGuideActivity.this); + + mNaviHelper.setRouteGuidanceListener(this, new IBRouteGuidanceListener() { + @Override + public void onRouteGuideIconInfoUpdate(IBRouteIconInfo ibRouteIconInfo) { + + } + + @Override + public void onRouteGuideIconUpdate(Drawable drawable) { + + } + + @Override + public void onRouteGuideKind(RouteGuideKind routeGuideKind) { + + } + + @Override + public void onRoadGuideTextUpdate(CharSequence charSequence, CharSequence charSequence1) { + + } + + @Override + public void onRemainDistanceUpdate(CharSequence charSequence) { + + } + + @Override + public void onRemainTimeUpdate(CharSequence charSequence) { + + } + + @Override + public void onGpsStatusChange(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onRouteFarAway(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onRoutePlanYawing(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onReRouteComplete() { + + } + + @Override + public void onArriveDest() { + + } + + @Override + public void onVibrate() { + + } + + @Override + public void onGetRouteDetailInfo(BikeRouteDetailInfo bikeRouteDetailInfo) { + + } + }); + } + +} diff --git a/src/map3demo/app/src/main/java/com/example/map/BNaviMainActivity.java b/src/map3demo/app/src/main/java/com/example/map/BNaviMainActivity.java new file mode 100644 index 0000000..779b567 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/BNaviMainActivity.java @@ -0,0 +1,322 @@ +package com.example.map; + +import android.Manifest; +import android.app.Activity; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; + +import com.baidu.mapapi.bikenavi.BikeNavigateHelper; +import com.baidu.mapapi.bikenavi.adapter.IBEngineInitListener; +import com.baidu.mapapi.bikenavi.adapter.IBRoutePlanListener; +import com.baidu.mapapi.bikenavi.model.BikeRoutePlanError; +import com.baidu.mapapi.bikenavi.params.BikeNaviLaunchParam; +import com.baidu.mapapi.bikenavi.params.BikeRouteNodeInfo; +import com.baidu.mapapi.map.BaiduMap; +import com.baidu.mapapi.map.BitmapDescriptor; +import com.baidu.mapapi.map.BitmapDescriptorFactory; +import com.baidu.mapapi.map.MapStatus; +import com.baidu.mapapi.map.MapStatusUpdateFactory; +import com.baidu.mapapi.map.Marker; +import com.baidu.mapapi.map.MarkerOptions; +import com.baidu.mapapi.map.TextureMapView; +import com.baidu.mapapi.model.LatLng; +import com.baidu.mapapi.walknavi.WalkNavigateHelper; +import com.baidu.mapapi.walknavi.adapter.IWEngineInitListener; +import com.baidu.mapapi.walknavi.adapter.IWRoutePlanListener; +import com.baidu.mapapi.walknavi.model.WalkRoutePlanError; +import com.baidu.mapapi.walknavi.params.WalkNaviLaunchParam; +import com.baidu.mapapi.walknavi.params.WalkRouteNodeInfo; + +import java.util.ArrayList; + +public class BNaviMainActivity extends Activity { + + private final static String TAG = BNaviMainActivity.class.getSimpleName(); + + + private TextureMapView mMapView; + private BaiduMap mBaiduMap = null; + + /*导航起终点Marker,可拖动改变起终点的坐标*/ + private Marker mStartMarker; + private Marker mEndMarker; + + private LatLng startPt; + private LatLng endPt; + + private BikeNaviLaunchParam bikeParam; + private WalkNaviLaunchParam walkParam; + + private static boolean isPermissionRequested = false; + + private BitmapDescriptor bdStart = BitmapDescriptorFactory + .fromResource(R.drawable.icon_start); + private BitmapDescriptor bdEnd = BitmapDescriptorFactory + .fromResource(R.drawable.icon_end); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_guide_main); + requestPermission(); + mMapView = (TextureMapView)findViewById(R.id.mapview); + initMapStatus(); + + /*骑行导航入口*/ + Button bikeBtn = (Button) findViewById(R.id.btn_bikenavi); + bikeBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startBikeNavi(); + } + }); + + + + startPt = new LatLng(39.112193,117.359531); + endPt = new LatLng(39.110484,117.359181); + + /*构造导航起终点参数对象*/ + BikeRouteNodeInfo bikeStartNode = new BikeRouteNodeInfo(); + bikeStartNode.setLocation(startPt); + BikeRouteNodeInfo bikeEndNode = new BikeRouteNodeInfo(); + bikeEndNode.setLocation(endPt); + bikeParam = new BikeNaviLaunchParam().startNodeInfo(bikeStartNode).endNodeInfo(bikeEndNode); + + WalkRouteNodeInfo walkStartNode = new WalkRouteNodeInfo(); + walkStartNode.setLocation(startPt); + WalkRouteNodeInfo walkEndNode = new WalkRouteNodeInfo(); + walkEndNode.setLocation(endPt); + walkParam = new WalkNaviLaunchParam().startNodeInfo(walkStartNode).endNodeInfo(walkEndNode); + + /* 初始化起终点Marker */ + initOverlay(); + } + + /** + * 初始化地图状态 + */ + private void initMapStatus(){ + mBaiduMap = mMapView.getMap(); + MapStatus.Builder builder = new MapStatus.Builder(); + builder.target(new LatLng(39.112759,117.358732)).zoom(15); + mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); + } + + /** + * 初始化导航起终点Marker + */ + public void initOverlay() { + + MarkerOptions ooA = new MarkerOptions().position(startPt).icon(bdStart) + .zIndex(9).draggable(true); + + mStartMarker = (Marker) (mBaiduMap.addOverlay(ooA)); + mStartMarker.setDraggable(true); + MarkerOptions ooB = new MarkerOptions().position(endPt).icon(bdEnd) + .zIndex(5); + mEndMarker = (Marker) (mBaiduMap.addOverlay(ooB)); + mEndMarker.setDraggable(true); + + mBaiduMap.setOnMarkerDragListener(new BaiduMap.OnMarkerDragListener() { + public void onMarkerDrag(Marker marker) { + } + + public void onMarkerDragEnd(Marker marker) { + if(marker == mStartMarker){ + startPt = marker.getPosition(); + }else if(marker == mEndMarker){ + endPt = marker.getPosition(); + } + + BikeRouteNodeInfo bikeStartNode = new BikeRouteNodeInfo(); + bikeStartNode.setLocation(startPt); + BikeRouteNodeInfo bikeEndNode = new BikeRouteNodeInfo(); + bikeEndNode.setLocation(endPt); + bikeParam = new BikeNaviLaunchParam().startNodeInfo(bikeStartNode).endNodeInfo(bikeEndNode); + + WalkRouteNodeInfo walkStartNode = new WalkRouteNodeInfo(); + walkStartNode.setLocation(startPt); + WalkRouteNodeInfo walkEndNode = new WalkRouteNodeInfo(); + walkEndNode.setLocation(endPt); + walkParam = new WalkNaviLaunchParam().startNodeInfo(walkStartNode).endNodeInfo(walkEndNode); + + } + + public void onMarkerDragStart(Marker marker) { + } + }); + } + + /** + * 开始骑行导航 + */ + private void startBikeNavi() { + Log.d(TAG, "startBikeNavi"); + try { + BikeNavigateHelper.getInstance().initNaviEngine(this, new IBEngineInitListener() { + @Override + public void engineInitSuccess() { + Log.d(TAG, "BikeNavi engineInitSuccess"); + routePlanWithBikeParam(); + } + + @Override + public void engineInitFail() { + Log.d(TAG, "BikeNavi engineInitFail"); + BikeNavigateHelper.getInstance().unInitNaviEngine(); + } + }); + } catch (Exception e) { + Log.d(TAG, "startBikeNavi Exception"); + e.printStackTrace(); + } + } + + /** + * 开始步行导航 + */ + private void startWalkNavi() { + Log.d(TAG, "startWalkNavi"); + try { + WalkNavigateHelper.getInstance().initNaviEngine(this, new IWEngineInitListener() { + @Override + public void engineInitSuccess() { + Log.d(TAG, "WalkNavi engineInitSuccess"); + routePlanWithWalkParam(); + } + + @Override + public void engineInitFail() { + Log.d(TAG, "WalkNavi engineInitFail"); + WalkNavigateHelper.getInstance().unInitNaviEngine(); + } + }); + } catch (Exception e) { + Log.d(TAG, "startBikeNavi Exception"); + e.printStackTrace(); + } + } + + /** + * 发起骑行导航算路 + */ + private void routePlanWithBikeParam() { + BikeNavigateHelper.getInstance().routePlanWithRouteNode(bikeParam, new IBRoutePlanListener() { + @Override + public void onRoutePlanStart() { + Log.d(TAG, "BikeNavi onRoutePlanStart"); + } + + @Override + public void onRoutePlanSuccess() { + Log.d(TAG, "BikeNavi onRoutePlanSuccess"); + Intent intent = new Intent(); + intent.setClass(BNaviMainActivity.this, BNaviGuideActivity.class); + startActivity(intent); + } + + @Override + public void onRoutePlanFail(BikeRoutePlanError error) { + Log.d(TAG, "BikeNavi onRoutePlanFail"); + } + + }); + } + + /** + * 发起步行导航算路 + */ + private void routePlanWithWalkParam() { + WalkNavigateHelper.getInstance().routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { + @Override + public void onRoutePlanStart() { + Log.d(TAG, "WalkNavi onRoutePlanStart"); + } + + @Override + public void onRoutePlanSuccess() { + + Log.d(TAG, "onRoutePlanSuccess"); + + Intent intent = new Intent(); + intent.setClass(BNaviMainActivity.this, WNaviGuideActivity.class); + startActivity(intent); + + } + + @Override + public void onRoutePlanFail(WalkRoutePlanError error) { + Log.d(TAG, "WalkNavi onRoutePlanFail"); + } + + }); + } + + /** + * Android6.0之后需要动态申请权限 + */ + private void requestPermission() { + if (Build.VERSION.SDK_INT >= 23 && !isPermissionRequested) { + + isPermissionRequested = true; + + ArrayList permissionsList = new ArrayList<>(); + + String[] permissions = { + Manifest.permission.RECORD_AUDIO, + Manifest.permission.ACCESS_NETWORK_STATE, + Manifest.permission.INTERNET, + Manifest.permission.READ_PHONE_STATE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.MODIFY_AUDIO_SETTINGS, + Manifest.permission.WRITE_SETTINGS, + Manifest.permission.ACCESS_WIFI_STATE, + Manifest.permission.CHANGE_WIFI_STATE, + Manifest.permission.CHANGE_WIFI_MULTICAST_STATE + + + }; + + for (String perm : permissions) { + if (PackageManager.PERMISSION_GRANTED != checkSelfPermission(perm)) { + permissionsList.add(perm); + // 进入到这里代表没有权限. + } + } + + if (permissionsList.isEmpty()) { + return; + } else { + requestPermissions(permissionsList.toArray(new String[permissionsList.size()]), 0); + } + } + } + + protected void onPause() { + super.onPause(); + mMapView.onPause(); + } + + @Override + protected void onResume() { + super.onResume(); + mMapView.onResume(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mMapView.onDestroy(); + bdStart.recycle(); + bdEnd.recycle(); + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/ClassTable.java b/src/map3demo/app/src/main/java/com/example/map/ClassTable.java new file mode 100644 index 0000000..dd4a173 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/ClassTable.java @@ -0,0 +1,213 @@ +package com.example.map; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Color; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.View; +import android.widget.GridLayout; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.ClassDBHelper; +import com.example.map.enity.Class_demo; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ClassTable extends AppCompatActivity implements View.OnTouchListener { + + private static final String DB_NAME="class.db"; + private static final String TABLE_NAME="class_table"; + private static final int DB_VERSION=1; + private ClassDBHelper mHelper; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_class_table); + + ClassDBHelper dbHelper=new ClassDBHelper(this,DB_NAME,null,DB_VERSION); + + framework(); + applyDraw(dbHelper); + + } + protected void onStart() { + super.onStart(); + // 获得数据库帮助器的实例 + mHelper = ClassDBHelper.getInstance(this); + // 打开数据库帮助器的读写连接 + mHelper.openWriteLink(); + mHelper.openReadLink(); + } + public GridLayout LayoutColumn(int i) { + //di->周一 + GridLayout gridLayout = findViewById(R.id.d1); + switch (i) { + case 1: { + gridLayout = findViewById(R.id.d1); + break; + } + case 2: { + gridLayout = findViewById(R.id.d2); + break; + } + case 3: { + gridLayout = findViewById(R.id.d3); + break; + } + case 4: { + gridLayout = findViewById(R.id.d4); + break; + } + case 5: { + gridLayout = findViewById(R.id.d5); + break; + } + case 6: { + gridLayout = findViewById(R.id.d6); + break; + } + case 7: { + gridLayout = findViewById(R.id.d7); + break; + } + } + return gridLayout; + } + + public void framework() { + GridLayout gridLayout; + int id = 1; + for (int i = 1; i < 8; i++) { + gridLayout = LayoutColumn(i); + for (int j = 1; j < 10; j +=2) { + TextView textView1 = new TextView(this); + textView1.setId(id++); + textView1.setText(""); + textView1.setMaxLines(5); + textView1.setEllipsize(TextUtils.TruncateAt.END); + textView1.setBackgroundColor(Color.parseColor("#F0FFFF")); + textView1.setGravity(Gravity.CENTER); + GridLayout.LayoutParams params1 = new GridLayout.LayoutParams(); + params1.rowSpec = GridLayout.spec( j, 2,1); + params1.setMargins(5,10,5,10); + params1.width = GridLayout.LayoutParams.MATCH_PARENT; + params1.height = 0; + gridLayout.addView(textView1, params1); + } + } + } + + @SuppressLint("ClickableViewAccessibility") + public void applyDraw(ClassDBHelper DBHelper) { + List classes = query(DBHelper); + for (Class_demo aClass : classes) { + //第几节课 + int i = Integer.parseInt(aClass.c_time.charAt(0) + ""); +// int i=1; + //星期几 + int j = utils.getDay(aClass.getC_day()); + //获取此课程对应TextView的id + TextView Class = findViewById((j - 1) * 5 + ((i - 1)/2 + 1)); + + Date date = new Date(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE"); + if (aClass.getC_day().equals(simpleDateFormat.format(date).toString())) { + Class.setBackgroundColor(Color.rgb(28, 217, 204)); + } + //课程表信息映射出来 + int louceng=(int)(Math.random()*10+1); + int jiaoshihao=(int)(Math.random()*400+1); + String jiaoshi="S"+louceng+"-"+jiaoshihao; + String xinxi="课程:"+aClass.getC_subject()+'\n'+ "教师:"+aClass.getC_teacher()+'\n'; + Class.setText(xinxi); + //触碰此课程框触发 + Class.setOnTouchListener(ClassTable.this); + } + } + public List query(ClassDBHelper dbHelper) { + + List classes = new ArrayList<>(); + SQLiteDatabase db = dbHelper.getWritableDatabase(); + Cursor cursor1 = db.query(TABLE_NAME, null, null, null, null, null, null); +// cursor1.moveToFirst(); + while (cursor1.moveToNext()) { + Cursor cursor=db.query(TABLE_NAME,null,null,null,null,null,null); + @SuppressLint("Range") String subject=cursor1.getString(cursor.getColumnIndex("c_subject")); + @SuppressLint("Range") String time=cursor1.getString(cursor.getColumnIndex("c_time")); + @SuppressLint("Range") String day=cursor1.getString(cursor.getColumnIndex("c_day")); + @SuppressLint("Range") String teacher=cursor1.getString(cursor.getColumnIndex("c_teacher")); + classes.add(new Class_demo(subject,time,day,teacher)); + } + db.close(); + return classes; + } + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + MenuItem menuItem=menu.findItem(R.id.action_menu); + MenuItem close=menu.findItem(R.id.action_close); + MenuItem delete_class=menu.findItem(R.id.action_delete); + menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + Intent intent = new Intent(); + intent.setClass(ClassTable.this, AddClasses.class); + startActivity(intent); + return true; + } + }); + close.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + Intent intent = new Intent(); + intent.setClass(ClassTable.this, MainActivity.class); + startActivity(intent); + return true; + } + }); + + delete_class.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + Intent intent = new Intent(); + intent.setClass(ClassTable.this, DeleteClasses.class); + startActivity(intent); + return true; + } + }); + + return super.onCreateOptionsMenu(menu); + } + + /** + * Called when a touch event is dispatched to a view. This allows listeners to + * get a chance to respond before the target view. + * + * @param v The view the touch event has been dispatched to. + * @param event The MotionEvent object containing full information about + * the event. + * @return True if the listener has consumed the event, false otherwise. + */ + @Override + public boolean onTouch(View v, MotionEvent event) { + return false; + } + + /** + * Called when a view has been clicked. + * + * @param v The view that was clicked. + */ +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/DeleteClasses.java b/src/map3demo/app/src/main/java/com/example/map/DeleteClasses.java new file mode 100644 index 0000000..f545ac3 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/DeleteClasses.java @@ -0,0 +1,86 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.view.Window; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.ClassDBHelper; +import com.example.map.enity.Class_demo; + +public class DeleteClasses extends AppCompatActivity implements View.OnClickListener{ + Button close_activity;//关闭按钮 + Button delete_activity;//删除按钮 + // Spinner selected_time;//选择上课时间 +// Spinner selected_day;//选择哪天上课 + EditText subject;//科目 + EditText teacher;//老师名字 + private ClassDBHelper mHelper; + + public final String DB_NAME = "class.db"; + public final String TABLE_NAME = "class_table"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.deleteclass); + + delete_activity=findViewById(R.id.delete_activity); +// selected_time=findViewById(R.id.delete_selected_time); +// selected_day=findViewById(R.id.delete_selected_day); + subject=findViewById(R.id.delete_subject); + teacher=findViewById(R.id.delete_teacher); + //当点击dialog之外完成此activity + setFinishOnTouchOutside (true); + + //关闭按钮操作 + close_activity=(Button) findViewById(R.id.close_activity); + close_activity.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + DeleteClasses.this.finish(); + } + }); + + findViewById(R.id.delete_subject).setOnClickListener(this); + findViewById(R.id.delete_teacher).setOnClickListener(this); + findViewById(R.id.delete_activity).setOnClickListener(this); + } + + protected void onStart() { + super.onStart(); + // 获得数据库帮助器的实例 + mHelper = ClassDBHelper.getInstance(this); + // 打开数据库帮助器的读写连接 + mHelper.openWriteLink(); + mHelper.openReadLink(); + } + public void onClick(View v) { + String subject_=subject.getText().toString().trim(); + String teacher_=teacher.getText().toString().trim(); +// String time = selected_time.getSelectedItem().toString(); +// String day = selected_day.getSelectedItem().toString(); + Class_demo classes = null; + switch (v.getId()){ + + case R.id.close_activity: + Intent intent = new Intent(DeleteClasses.this, ClassTable.class);//跳转到注册界面 + startActivity(intent); + finish(); + break; + + case R.id.delete_activity: + classes=new Class_demo(subject_,teacher_); + if (mHelper.delete(classes) > 0) { + Toast.makeText(this, "课表删除成功", Toast.LENGTH_SHORT).show(); + } + break; + } + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/DemoApplication.java b/src/map3demo/app/src/main/java/com/example/map/DemoApplication.java new file mode 100644 index 0000000..95122bb --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/DemoApplication.java @@ -0,0 +1,30 @@ +package com.example.map; + +import android.app.Application; + +import com.baidu.mapapi.CoordType; +import com.baidu.mapapi.SDKInitializer; +import com.baidu.mapapi.common.BaiduMapSDKException; + + +public class DemoApplication extends Application { + @Override + public void onCreate() { + super.onCreate(); + //在使用SDK各组件之前初始化context信息,传入ApplicationContext + SDKInitializer.setAgreePrivacy(this, true); + try { + // 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext + SDKInitializer.initialize(this); + } catch (BaiduMapSDKException e) { + + } + //自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型. + //包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。 + SDKInitializer.setCoordType(CoordType.BD09LL); + + //开启地图的定位图层 +// mBaiduMap.setMyLocationEnabled(true); + } + +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/Detail.java b/src/map3demo/app/src/main/java/com/example/map/Detail.java new file mode 100644 index 0000000..7488ea6 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/Detail.java @@ -0,0 +1,42 @@ +package com.example.map; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Window; +import android.widget.TextView; + +public class Detail extends Activity { + + TextView time; + TextView clsNum; + TextView sub; + TextView teacher; + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.press); + + Intent intent = getIntent(); + + sub = findViewById(R.id.sub); + sub.setText(intent.getStringExtra("name")); + + time = findViewById(R.id.time); + time.setText(intent.getStringExtra("day")); + + clsNum = findViewById(R.id.clsNum); + clsNum.setText(intent.getStringExtra("time")); + + teacher = findViewById(R.id.teacher); + teacher.setText(intent.getStringExtra("teacher")); + + + setFinishOnTouchOutside(true); + + + } + +} diff --git a/src/map3demo/app/src/main/java/com/example/map/LogOut.java b/src/map3demo/app/src/main/java/com/example/map/LogOut.java new file mode 100644 index 0000000..3c1fe22 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/LogOut.java @@ -0,0 +1,88 @@ +package com.example.map; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.UserDBHelper; +import com.example.map.enity.User; + +public class LogOut extends AppCompatActivity implements View.OnClickListener{ + + private EditText username,userpassword; + private String userName; + private UserDBHelper mHelper; + private SharedPreferences.Editor editor; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_zhuxiao); + + initView();//初始化界面 + UserDBHelper userDBHelper = new UserDBHelper(this); + + SharedPreferences sp = getSharedPreferences("user_mes", MODE_PRIVATE); + editor = sp.edit(); + if(sp.getBoolean("flag",false)){ + String user_read = sp.getString("user",""); + String psw_read = sp.getString("psw",""); + username.setText(user_read); + userpassword.setText(psw_read); + } + } + private void initView() { + //初始化控件 + username = findViewById(R.id.zhuxiao_name); + userpassword = findViewById(R.id.zhuxiao_passwd); + Button btn_Login = findViewById(R.id.zhuxiao_queding); + Button tv_register = findViewById(R.id.zhuxiao_fanhui); + //设置点击事件监听器 + btn_Login.setOnClickListener(this); + tv_register.setOnClickListener(this); + } + + protected void onStart() { + super.onStart(); + // 获得数据库帮助器的实例 + mHelper = UserDBHelper.getInstance(this); + // 打开数据库帮助器的读写连接 + mHelper.openWriteLink(); + mHelper.openReadLink(); + } + + @Override + public void onClick(View v) { + String name=username.getText().toString().trim(); + String password_=userpassword.getText().toString().trim(); + User user=null; + switch (v.getId()){ + case R.id.zhuxiao_fanhui: + Intent intent=new Intent(LogOut.this, UserScreen.class); + startActivity(intent); + finish(); + break; + + case R.id.zhuxiao_queding: + user=new User(name,password_); + if(name.isEmpty()&&password_.isEmpty()){ + Toast.makeText(this,"请输入正确的用户名或密码",Toast.LENGTH_SHORT).show(); + } + else{ + if (mHelper.delete(user)>0){ + Toast.makeText(this, "课表删除成功", Toast.LENGTH_SHORT).show(); + Intent intent_=new Intent(LogOut.this,LoginScreen.class); + startActivity(intent_); + finish(); + } + } + + } + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/LoginScreen.java b/src/map3demo/app/src/main/java/com/example/map/LoginScreen.java new file mode 100644 index 0000000..54f80fb --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/LoginScreen.java @@ -0,0 +1,121 @@ +package com.example.map; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.UserDBHelper; +import com.example.map.enity.User; +import com.example.map.util.ToastUtil; + +import java.util.ArrayList; + +/** + * 此类 implements View.OnClickListener 之后, + * 就可以把onClick事件写到onCreate()方法之外 + * 这样,onCreate()方法中的代码就不会显得很冗余 + */ + +public class LoginScreen extends AppCompatActivity implements View.OnClickListener{ + +// private UserDBHelper userDBHelper; + private EditText username,userpassword; + private String userName; + private SharedPreferences.Editor editor; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login_screen);//屏幕显示的布局 + + getSupportActionBar().hide(); + + initView();//初始化界面 + UserDBHelper userDBHelper = new UserDBHelper(this); + + SharedPreferences sp = getSharedPreferences("user_mes", MODE_PRIVATE); + editor = sp.edit(); + if(sp.getBoolean("flag",false)){ + String user_read = sp.getString("user",""); + String psw_read = sp.getString("psw",""); + username.setText(user_read); + userpassword.setText(psw_read); + } + } + + private void initView() { + //初始化控件 + username = findViewById(R.id.user_name); + userpassword = findViewById(R.id.passwd); + Button btn_Login = findViewById(R.id.Login_button); + Button tv_register = findViewById(R.id.zhuce_button); + //设置点击事件监听器 + btn_Login.setOnClickListener(this); + tv_register.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + switch (v.getId()){ + case R.id.zhuce_button: //注册 + Intent intent = new Intent(LoginScreen.this, Register.class);//跳转到注册界面 + startActivity(intent); + finish(); + break; + + case R.id.Login_button: + String name = username.getText().toString().trim(); + String password = userpassword.getText().toString().trim(); + if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(password)) { + UserDBHelper userDBHelper = new UserDBHelper(this); + ArrayList data = userDBHelper.getAllData(); + boolean match = false; + for (int i = 0; i < data.size(); i++) { + User user = data.get(i); + if ((name.equals(user.getName()) && password.equals(user.getPassword()))) { + userName = user.getName(); + match = true; + break; + } else { + match = false; +// Toast.makeText(this, "密码错误", Toast.LENGTH_SHORT).show(); + } + } + if (match) { + ToastUtil.show(this,"登录成功"); + Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show(); + Runnable target; + //用线程启动 + Thread thread = new Thread(){ + @Override + public void run(){ + try { + sleep(2000);//2秒 模拟登录时间 + String user_name = userName; + Intent intent1 = new Intent(LoginScreen.this, MainActivity.class);//设置自己跳转到成功的界面 + + //intent1.putExtra("user_name",user_name); + startActivity(intent1); + finish(); + }catch (Exception e){ + e.printStackTrace(); + } + } + }; + thread.start();//打开线程 + } else { + Toast.makeText(this, "用户名或密码不正确,请重新输入", Toast.LENGTH_SHORT).show(); + } + } else { + Toast.makeText(this, "请输入你的用户名或密码", Toast.LENGTH_SHORT).show(); + } + break; + } + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/MainActivity.java b/src/map3demo/app/src/main/java/com/example/map/MainActivity.java new file mode 100644 index 0000000..8396004 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/MainActivity.java @@ -0,0 +1,765 @@ +package com.example.map; + +import android.Manifest; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import com.baidu.location.BDAbstractLocationListener; +import com.baidu.location.BDLocation; +import com.baidu.location.LocationClient; +import com.baidu.location.LocationClientOption; +import com.baidu.mapapi.SDKInitializer; +import com.baidu.mapapi.map.BaiduMap; +import com.baidu.mapapi.map.BitmapDescriptor; +import com.baidu.mapapi.map.BitmapDescriptorFactory; +import com.baidu.mapapi.map.InfoWindow; +import com.baidu.mapapi.map.MapStatusUpdate; +import com.baidu.mapapi.map.MapStatusUpdateFactory; +import com.baidu.mapapi.map.Marker; +import com.baidu.mapapi.map.MarkerOptions; +import com.baidu.mapapi.map.MyLocationData; +import com.baidu.mapapi.map.OverlayOptions; +import com.baidu.mapapi.map.TextureMapView; +import com.baidu.mapapi.model.LatLng; + +import java.util.ArrayList; +import java.util.List; + +public class MainActivity extends Activity implements View.OnClickListener { + + TextView locationInfo; + public LocationClient mLocationClient = null; + private MyLocationListener myListener = new MyLocationListener(); + + + //显示地图 + TextureMapView mMapView; + BaiduMap mBaiduMap = null; + + boolean isFirstLocate = true; + private InfoWindow infoWindow; + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //环境初始化 + SDKInitializer.initialize(getApplicationContext()); + + setContentView(R.layout.activity_main); + + //这个是显示经纬度信息 + //locationInfo = findViewById(R.id.locationInfo); + //添加弹窗 +// findViewById(R.id.show).setOnClickListener(this); + + LocationClient.setAgreePrivacy(true); + try { + mLocationClient = new LocationClient(getApplicationContext()); + mLocationClient.registerLocationListener(new MyLocationListener()); + + + mMapView = findViewById(R.id.bmapView); + mBaiduMap = mMapView.getMap(); + + mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); + + mBaiduMap.setMyLocationEnabled(true);//当前的定位 + + requestLocation(); + + //三个最基础的权限 + List PermissionList = new ArrayList(); + if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED){ + PermissionList.add(Manifest.permission.ACCESS_FINE_LOCATION); + } + if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_PHONE_STATE)!= PackageManager.PERMISSION_GRANTED){ + PermissionList.add(Manifest.permission.READ_PHONE_STATE); + } + if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED){ + PermissionList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); + } + if (!PermissionList.isEmpty()) { + String[] permissions = PermissionList.toArray(new String[PermissionList.size()]); + ActivityCompat.requestPermissions(MainActivity.this,permissions,1); + } else { + requestLocation(); + } + } catch (Exception e) { + e.printStackTrace(); + } + + //控件选择 + //按钮“我的” + Button button = findViewById(R.id.Myself); + button.setOnClickListener(new View.OnClickListener() { + @Override + //按钮点击后执行下面回调方法 + public void onClick(View v) { + Intent intent = new Intent(); + //setclass显示意图,直接指定来源和目的 + intent.setClass(getApplicationContext(), me.class);//跳转的目的地 + startActivity(intent); + } + }); + + button = findViewById(R.id.classtable); + button.setOnClickListener(new View.OnClickListener() { + @Override + //按钮点击后执行下面回调方法 + public void onClick(View v) { + Intent intent = new Intent(); + //setclass显示意图,直接指定来源和目的 + intent.setClass(getApplicationContext(), ClassTable.class);//跳转的目的地 + startActivity(intent); + } + }); + + button = findViewById(R.id.show); + button.setOnClickListener(new View.OnClickListener() { + @Override + //按钮点击后执行下面回调方法 + public void onClick(View v) { + Intent intent = new Intent(); + //setclass显示意图,直接指定来源和目的 + intent.setClass(getApplicationContext(), BNaviMainActivity.class);//跳转的目的地 + startActivity(intent); + } + }); + + + + +// //定义Maker坐标点--南苑 +// //以下是南苑的坐标点 +// //南1教学楼 +// LatLng point = new LatLng(39.112298,117.358615); +// Bundle mBundle = new Bundle();//这一行是后面的点击事件 +// +// //构建Marker图标 +// BitmapDescriptor bitmap = BitmapDescriptorFactory +// .fromResource(R.drawable.school); +// //构建MarkerOption,用于在地图上添加Marker +// OverlayOptions option = new MarkerOptions() +// .position(point) //必传参数 +// .icon(bitmap) //必传参数 +// .draggable(true) +// //设置平贴地图,在地图中双指下拉查看效果 +// .flat(true) +// .alpha(0.5f) +// //后面的点击事件 +// .extraInfo(mBundle); +// //在地图上添加Marker,并显示 +// mBaiduMap.addOverlay(option); + + +// mBaiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() { +// //marker被点击时回调的方法 +// //若响应点击事件,返回true,否则返回false +// //默认返回false +// @Override +// public boolean onMarkerClick(Marker marker) { +// Bundle extraInfo = marker.getExtraInfo(); //通过这个方法获取到,你前面塞的值 +// Toast.makeText(MainActivity.this, "南1教学楼", Toast.LENGTH_SHORT).show(); +// InfoWindow mInfoWindow = new InfoWindow(button, point, -47); +// mBaiduMap.showInfoWindow(mInfoWindow); +// return false; +// } +// }); + + + + //定义坐标 + List latLngList = new ArrayList<>(); + List optionsList = new ArrayList<>(); + mBaiduMap.clear();//先清除 地图上的覆盖物 + //定义Maker坐标点 + LatLng point = new LatLng(39.112298,117.358615); + //南院教学楼 + latLngList.add(new LatLng(39.112193,117.359531));//1 + latLngList.add(new LatLng(39.112759,117.358732));//2 + latLngList.add(new LatLng(39.111363,117.359266));//3 + latLngList.add(new LatLng(39.110474,117.359217));//4 + latLngList.add(new LatLng(39.108321,117.360066));//5 + latLngList.add(new LatLng(39.106142,117.363084));//空A + latLngList.add(new LatLng(39.106404,117.363194));//空B + latLngList.add(new LatLng(39.10696,117.363457));//空C + latLngList.add(new LatLng(39.10696,117.363457));//航海科技大厦 + latLngList.add(new LatLng(39.107646,117.362559));//电子信息与自动化学 + //北院教学楼 + latLngList.add(new LatLng(39.117437,117.35455));//北1 + latLngList.add(new LatLng(39.117755,117.353755));//北2 + latLngList.add(new LatLng(39.11786,117.354846));//北3 + latLngList.add(new LatLng(39.11672,117.356387));//北4 + latLngList.add(new LatLng(39.116557,117.355909));//北6 + latLngList.add(new LatLng(39.11724,117.356567));//北8 + latLngList.add(new LatLng(39.12175,117.356234));//北14 + latLngList.add(new LatLng(39.1228,117.358565));//北16 + latLngList.add(new LatLng(39.118786,117.36109));//北19 + latLngList.add(new LatLng(39.117056,117.361164));//北20 + latLngList.add(new LatLng(39.115893,117.361754));//北21 + latLngList.add(new LatLng(39.115432,117.361703));//北22 + latLngList.add(new LatLng(39.115987,117.360279));//北23 + latLngList.add(new LatLng(39.116167,117.35932));//北24 + latLngList.add(new LatLng(39.12252,117.35663));//北25 + //南院宿舍楼 + latLngList.add(new LatLng(39.109831,117.359846));//1 + latLngList.add(new LatLng(39.109505,117.359846));//2 + latLngList.add(new LatLng(39.109831,117.360394));//3 + latLngList.add(new LatLng(39.109505,117.360394));//4 + latLngList.add(new LatLng(39.109131,117.359846));//5 + latLngList.add(new LatLng(39.108795,117.359846));//6 + latLngList.add(new LatLng(39.109131,117.360394));//7 + latLngList.add(new LatLng(39.108795,117.360394));//8 + latLngList.add(new LatLng(39.109831,117.360977));//9 + latLngList.add(new LatLng(39.109505,117.360977));//10 + latLngList.add(new LatLng(39.109131,117.360977));//11 + latLngList.add(new LatLng(39.108795,117.360977));//12 + latLngList.add(new LatLng(39.109137,117.359046));//13 + latLngList.add(new LatLng(39.10885,117.359015));//14 + latLngList.add(new LatLng(39.109928,117.361656));//15 + latLngList.add(new LatLng(39.109548,117.361793));//16 + latLngList.add(new LatLng(39.109214,117.361681));//17 + latLngList.add(new LatLng(39.10923,117.362534));//18 + latLngList.add(new LatLng(39.108878,117.362538));//19 + latLngList.add(new LatLng(39.108294,117.358777));//20 + latLngList.add(new LatLng(39.108005,117.358797));//21 + latLngList.add(new LatLng(39.107442,117.358763));//22 + latLngList.add(new LatLng(39.107191,117.358739));//23 + //北院宿舍楼 + latLngList.add(new LatLng(39.11919,117.354523));//1 + latLngList.add(new LatLng(39.119435,117.354658));//2 + latLngList.add(new LatLng(39.119659,117.354842));//3 + latLngList.add(new LatLng(39.119953,117.354981));//4 + latLngList.add(new LatLng(39.120177,117.35512));//5 + latLngList.add(new LatLng(39.121296,117.355713));//6 + latLngList.add(new LatLng(39.121107,117.357555));//7 + latLngList.add(new LatLng(39.121286,117.357802));//8 + latLngList.add(new LatLng(39.121496,117.357968));//9 + latLngList.add(new LatLng(39.121814,117.358305));//10 + latLngList.add(new LatLng(39.120938,117.358655));//11 + latLngList.add(new LatLng(39.121318,117.358718));//12 + latLngList.add(new LatLng(39.11859,117.35524));//13 + latLngList.add(new LatLng(39.116535,117.357445));//14 + + latLngList.add(new LatLng(39.116575,117.357335));//17 + latLngList.add(new LatLng(39.116575,117.357335));//18 + latLngList.add(new LatLng(39.116575,117.357335));//19 + latLngList.add(new LatLng(39.116575,117.357335));//20 + latLngList.add(new LatLng(39.116575,117.357335));//21 + latLngList.add(new LatLng(39.116575,117.357335));//23 + + latLngList.add(new LatLng(39.118086,117.358226));//24 + latLngList.add(new LatLng(39.117663,117.357941));//25 + latLngList.add(new LatLng(39.11714,117.35775));//26 + latLngList.add(new LatLng(39.1169,117.357535));//27 + + //南院食堂 + latLngList.add(new LatLng(39.109673,117.359073));//1 + latLngList.add(new LatLng(39.108135,117.357461));//2 + latLngList.add(new LatLng(39.109613,117.357759));//3 + //北院食堂 + latLngList.add(new LatLng(39.117583,117.355635));//1 + latLngList.add(new LatLng(39.11834,117.357357));//2 + latLngList.add(new LatLng(39.119609,117.355716));//3 + latLngList.add(new LatLng(39.120747,117.358574));//5 + latLngList.add(new LatLng(39.119232,117.355929));//清真 + + + //构建MarkerOption,用于在地图上添加Marker + int north_school = 1;//北院教学楼 + int south_dormitory = 1;//南院宿舍楼 + int north_dormitory = 1;//北院宿舍楼 + int south_canteen = 1;//南院食堂 + int north_canteen = 1;//北院院食堂 + for (int i = 0; i < 75; i++) { + Bundle mBundle = new Bundle(); //用来传值 也可以识别点击的是哪一个marker + if ( i<10 ) { //南院教学楼 + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.school); + i = i+1; + mBundle.putString("title", "南" + i + "教学楼"); + i = i-1; + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } else if ( i<25 ){ //北院教学楼 + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.school); + mBundle.putString("title", "北" + north_school + "教学楼"); + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + north_school = north_school + 1; + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } else if ( i<48 ){ //南院宿舍楼 + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.dormitory); + mBundle.putString("title", "南" + south_dormitory + "宿舍楼"); + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + south_dormitory = south_dormitory + 1; + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } else if ( i < 73){ //北院宿舍楼 + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.dormitory); + mBundle.putString("title", "北" + north_dormitory + "宿舍楼"); + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + north_dormitory = north_dormitory + 1; + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } else if (i<76) { + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.canteen); + mBundle.putString("title", "南" + south_canteen + "食堂"); + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + south_canteen = south_canteen + 1; + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } else if (i<81) { + //构建Marker图标 + BitmapDescriptor bitmap = BitmapDescriptorFactory + .fromResource(R.drawable.canteen); + mBundle.putString("title", "北" + north_canteen + "食堂"); + mBundle.putDouble("lat", latLngList.get(i).latitude); + mBundle.putDouble("lng", latLngList.get(i).longitude); + north_canteen = north_canteen + 1; + + OverlayOptions option = new MarkerOptions() + .extraInfo(mBundle) //这里bundle 跟maker关联上 + // .title("lat="+latLngList.get(i).latitude+"---lng="+latLngList.get(i).longitude) //也可以用title,但是官方提示已经过时了 + .position(latLngList.get(i)) //设置经纬度 + .icon(bitmap);//设置marker图标 + optionsList.add(option); + } + + } + + //在地图上添加Marker,并显示 + // mBaiduMap.addOverlay(option); 添加一个marker使用这个 + mBaiduMap.addOverlays(optionsList); //添加marker list 的话,用这个 + mBaiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() { + @Override + public boolean onMarkerClick(Marker marker) { + Bundle extraInfo = marker.getExtraInfo(); //通过这个方法获取到,你前面塞的值 + String title = extraInfo.getString("title"); + double lat = extraInfo.getDouble("lat"); + double lng = extraInfo.getDouble("lng"); + Toast.makeText(MainActivity.this, title + " " + lat + " " + lng, Toast.LENGTH_SHORT).show(); + return false; + } + }); + + + + +// //南二教学楼 +// LatLng point_south_two_school = new LatLng(39.112193,117.359531); +// BitmapDescriptor bitmap_south_two_school = BitmapDescriptorFactory +// .fromResource(R.drawable.school); +// OverlayOptions option_south_two_school = new MarkerOptions() +// .position(point_south_two_school) +// .icon(bitmap_south_two_school) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_two_school); +// +// +// +// //南三教学楼 +// LatLng point_south_three_school = new LatLng(39.111363,117.359266); +// BitmapDescriptor bitmap_south_three_school = BitmapDescriptorFactory +// .fromResource(R.drawable.school); +// OverlayOptions option_south_three_school = new MarkerOptions() +// .position(point_south_three_school) +// .icon(bitmap_south_three_school) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_three_school); +// +// //南四教学楼 +// LatLng point_south_four_school = new LatLng(39.110474,117.359217); +// BitmapDescriptor bitmap_south_four_school = BitmapDescriptorFactory +// .fromResource(R.drawable.school); +// OverlayOptions option_south_four_school = new MarkerOptions() +// .position(point_south_four_school) +// .icon(bitmap_south_four_school) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_four_school); +// +// //南五教学楼 +// LatLng point_south_five_school = new LatLng(39.108553,117.360111); +// BitmapDescriptor bitmap_south_five_school = BitmapDescriptorFactory +// .fromResource(R.drawable.school); +// OverlayOptions option_south_five_school = new MarkerOptions() +// .position(point_south_five_school) +// .icon(bitmap_south_five_school) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_five_school); +// +// //南一宿舍 +// LatLng point_south_one_domitory = new LatLng(39.109831,117.359846); +// BitmapDescriptor bitmap_south_one_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_one_domitory = new MarkerOptions() +// .position(point_south_one_domitory) +// .icon(bitmap_south_one_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_one_domitory); +// +// //南二宿舍 +// LatLng point_south_two_domitory = new LatLng(39.109505,117.359846); +// BitmapDescriptor bitmap_south_two_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_two_domitory = new MarkerOptions() +// .position(point_south_two_domitory) +// .icon(bitmap_south_two_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_two_domitory); +// +// //南三宿舍 +// LatLng point_south_three_domitory = new LatLng(39.109831,117.360394); +// BitmapDescriptor bitmap_south_three_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_three_domitory = new MarkerOptions() +// .position(point_south_three_domitory) +// .icon(bitmap_south_three_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_three_domitory); +// +// //南四宿舍 +// LatLng point_south_four_domitory = new LatLng(39.109505,117.360394); +// BitmapDescriptor bitmap_south_four_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_four_domitory = new MarkerOptions() +// .position(point_south_four_domitory) +// .icon(bitmap_south_four_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_four_domitory); +// +// //南五宿舍 +// LatLng point_south_five_domitory = new LatLng(39.109131,117.359846); +// BitmapDescriptor bitmap_south_five_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_five_domitory = new MarkerOptions() +// .position(point_south_five_domitory) +// .icon(bitmap_south_five_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_five_domitory); +// +// //南六宿舍 +// LatLng point_south_six_domitory = new LatLng(39.108795,117.359846); +// BitmapDescriptor bitmap_south_six_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_six_domitory = new MarkerOptions() +// .position(point_south_six_domitory) +// .icon(bitmap_south_six_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_six_domitory); +// +// //南七宿舍 +// LatLng point_south_seven_domitory = new LatLng(39.109131,117.360394); +// BitmapDescriptor bitmap_south_seven_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_seven_domitory = new MarkerOptions() +// .position(point_south_seven_domitory) +// .icon(bitmap_south_seven_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_seven_domitory); +// +// //南八宿舍 +// LatLng point_south_eight_domitory = new LatLng(39.108795,117.360394); +// BitmapDescriptor bitmap_south_eight_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_eight_domitory = new MarkerOptions() +// .position(point_south_eight_domitory) +// .icon(bitmap_south_eight_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_eight_domitory); +// +// //南九宿舍 +// LatLng point_south_nine_domitory = new LatLng(39.109831,117.360977); +// BitmapDescriptor bitmap_south_nine_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_nine_domitory = new MarkerOptions() +// .position(point_south_nine_domitory) +// .icon(bitmap_south_nine_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_nine_domitory); +// +// //南十宿舍 +// LatLng point_south_ten_domitory = new LatLng(39.109505,117.360977); +// BitmapDescriptor bitmap_south_ten_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_ten_domitory = new MarkerOptions() +// .position(point_south_ten_domitory) +// .icon(bitmap_south_ten_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_ten_domitory); +// +// //南十一宿舍 +// LatLng point_south_eleven_domitory = new LatLng(39.109131,117.360977); +// BitmapDescriptor bitmap_south_eleven_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_eleven_domitory = new MarkerOptions() +// .position(point_south_eleven_domitory) +// .icon(bitmap_south_eleven_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_eleven_domitory); +// +// //南十二宿舍 +// LatLng point_south_twelve_domitory = new LatLng(39.108795,117.360977); +// BitmapDescriptor bitmap_south_twelve_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_twelve_domitory = new MarkerOptions() +// .position(point_south_twelve_domitory) +// .icon(bitmap_south_twelve_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_twelve_domitory); +// +// //南十三宿舍 +// LatLng point_south_thirteen_domitory = new LatLng(39.109134,117.359037); +// BitmapDescriptor bitmap_south_thirteen_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_thirteen_domitory = new MarkerOptions() +// .position(point_south_thirteen_domitory) +// .icon(bitmap_south_thirteen_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_thirteen_domitory); +// +// //南14宿舍 +// LatLng point_south_fourteen_domitory = new LatLng(39.108809,117.359037); +// BitmapDescriptor bitmap_south_fourteen_domitory = BitmapDescriptorFactory +// .fromResource(R.drawable.dormitory); +// OverlayOptions option_south_fourteen_domitory = new MarkerOptions() +// .position(point_south_fourteen_domitory) +// .icon(bitmap_south_fourteen_domitory) +// .draggable(true) +// .flat(true) +// .alpha(0.5f); +// mBaiduMap.addOverlay(option_south_fourteen_domitory); + + //南15宿舍 + LatLng point_south_fifteen_domitory = new LatLng(39.109131,117.359846); + BitmapDescriptor bitmap_south_fifteen_domitory = BitmapDescriptorFactory + .fromResource(R.drawable.dormitory); + OverlayOptions option_south_fifteen_domitory = new MarkerOptions() + .position(point_south_fifteen_domitory) + .icon(bitmap_south_fifteen_domitory) + .draggable(true) + .flat(true) + .alpha(0.5f); + mBaiduMap.addOverlay(option_south_fifteen_domitory); + } + + + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + switch (requestCode) { + case 1: + if (grantResults.length>0) { + for (int result:grantResults) { + if (result !=PackageManager.PERMISSION_GRANTED) { + Toast.makeText(this,"必须统一所有的权限才能使用本程序",Toast.LENGTH_SHORT).show(); + finish(); + return; + } + } + requestLocation(); + } else { + Toast.makeText(this,"发生未知错误",Toast.LENGTH_SHORT).show(); + finish(); + } + break; + case 2: + } + } + + private void requestLocation() { + initLocation();//对监听的地理位置的参数 + mLocationClient.start(); + } + + private void initLocation() { + //通过LocationClientOption设置LocationClient相关参数 + LocationClientOption option = new LocationClientOption(); + option.setOpenGps(true); // 打开gps + option.setCoorType("bd09ll"); // 设置坐标类型 + option.setScanSpan(1000); + option.setLocationMode(LocationClientOption.LocationMode.Battery_Saving);//设置的高精度模式 + option.setLocationNotify(true);//设置是否当GPS有效时按照1s/1次频率输出GPS结果 + option.setIsNeedAddress(true);//显示地理位置信息; + + //设置locationClientOption + mLocationClient.setLocOption(option); + } + + @Override + public void onPointerCaptureChanged(boolean hasCapture) { + super.onPointerCaptureChanged(hasCapture); + } + + + private class MyLocationListener extends BDAbstractLocationListener { + + @Override + public void onReceiveLocation(BDLocation location) { + navigateTo(location); + +// 这个是显示信息 +// StringBuilder currentPosition = new StringBuilder(); +// currentPosition.append("纬度:").append(location.getLongitude()).append("\n"); +// currentPosition.append("经度:").append(location.getLatitude()).append("\n"); +// currentPosition.append("国家:").append(location.getCountry()).append("\n"); +// currentPosition.append("省:").append(location.getProvince()).append("\n"); +// currentPosition.append("市:").append(location.getCity()).append("\n"); +// currentPosition.append("区:").append(location.getDistrict()).append("\n"); +// currentPosition.append("村镇:").append(location.getTown()).append("\n"); +// currentPosition.append("街道:").append(location.getStreet()).append("\n"); +// currentPosition.append("地址:").append(location.getAddrStr()).append("\n"); +// currentPosition.append("定位方式:"); +// if (location.getLocType()==BDLocation.TypeGpsLocation) { +// currentPosition.append("GPS"); +// } else if (location.getLocType()==BDLocation.TypeNetWorkLocation) { +// currentPosition.append("网络"); +// } +// locationInfo.setText(currentPosition); + } + } + + //缩放? + private void navigateTo(BDLocation location) { + if (isFirstLocate) { + LatLng ll = new LatLng(location.getLatitude(),location.getLongitude()); + MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll); + mBaiduMap.animateMapStatus(update);//更新 + update = MapStatusUpdateFactory.zoomTo(16f); + mBaiduMap.animateMapStatus(update); + isFirstLocate = false; + } + + MyLocationData.Builder locationBuilder = new MyLocationData.Builder(); + locationBuilder.longitude(location.getLongitude()); + locationBuilder.latitude(location.getLatitude()); + MyLocationData locationData = locationBuilder.build(); + mBaiduMap.setMyLocationData(locationData); + + } + + @Override + public void onClick(View view) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("展示"); + builder.setMessage("12345"); + builder.setPositiveButton("关闭", (dialogInterface, i) -> { + }); + AlertDialog dialog= builder.create(); + dialog.show(); + } + + //相应的生命周期 + @Override + protected void onDestroy() { + super.onDestroy(); + mMapView.onDestroy(); + mBaiduMap.setMyLocationEnabled(false); + mLocationClient.stop(); + } + + @Override + protected void onResume() { + super.onResume(); + //在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理 + mMapView.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理 + mMapView.onPause(); + } + + + + +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/MyLocationListener.java b/src/map3demo/app/src/main/java/com/example/map/MyLocationListener.java new file mode 100644 index 0000000..7f8559e --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/MyLocationListener.java @@ -0,0 +1,28 @@ +package com.example.map; + +import com.baidu.location.BDAbstractLocationListener; +import com.baidu.location.BDLocation; +import com.baidu.mapapi.map.BaiduMap; +import com.baidu.mapapi.map.MyLocationData; +import com.baidu.mapapi.map.TextureMapView; + + +//构造地图数据 +//我们通过继承抽象类BDAbstractListener并重写其onReceieveLocation方法来获取定位数据,并将其传给MapView +public class MyLocationListener extends BDAbstractLocationListener { + private TextureMapView mMapView = null; + private BaiduMap mBaiduMap; + + public void onReceiveLocation(BDLocation location) { + //mapView 销毁后不在处理新接收的位置 + if (location == null || mMapView == null){ + return; + } + MyLocationData locData = new MyLocationData.Builder() + .accuracy(location.getRadius()) + // 此处设置开发者获取到的方向信息,顺时针0-360 + .direction(location.getDirection()).latitude(location.getLatitude()) + .longitude(location.getLongitude()).build(); + mBaiduMap.setMyLocationData(locData); + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/Register.java b/src/map3demo/app/src/main/java/com/example/map/Register.java new file mode 100644 index 0000000..66a62d5 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/Register.java @@ -0,0 +1,78 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.database.UserDBHelper; +import com.example.map.enity.User; +import com.example.map.util.ToastUtil; + +public class Register extends AppCompatActivity implements View.OnClickListener{ + + private EditText et_user_name;//用户账号 + private EditText password;//用户密码 + private UserDBHelper mHelper; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + + et_user_name = findViewById(R.id.register_username); + password = findViewById(R.id.register_password); + //跳转事件 + Button button =findViewById(R.id.back_button); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),LoginScreen.class);//跳转的目的地 + startActivity(intent); + finish(); + } + }); + + //监听事件 + findViewById(R.id.register2_button).setOnClickListener(this); + findViewById(R.id.register_username).setOnClickListener(this); + findViewById(R.id.register_password).setOnClickListener(this); + } + + protected void onStart() { + super.onStart(); + // 获得数据库帮助器的实例 + mHelper = UserDBHelper.getInstance(this); + // 打开数据库帮助器的读写连接 + mHelper.openWriteLink(); + mHelper.openReadLink(); + } + + @Override + public void onClick(View v) { + String name=et_user_name.getText().toString().trim(); + String password_=password.getText().toString().trim(); + User user = null; + switch (v.getId()){ + case R.id.register2_button: + user=new User(name, password_); + if (mHelper.insert(user) > 0) { + ToastUtil.show(this, "注册成功"); + Intent intent=new Intent(Register.this,LoginScreen.class); + startActivity(intent); + finish(); + } + break; + } + } + +// protected void onStop() { +// super.onStop(); +// // 关闭数据库连接 +// mHelper.closeLink(); +// } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/UserScreen.java b/src/map3demo/app/src/main/java/com/example/map/UserScreen.java new file mode 100644 index 0000000..fdee67e --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/UserScreen.java @@ -0,0 +1,61 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +public class UserScreen extends AppCompatActivity implements View.OnClickListener{ + + private TextView tv_alert; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me); + //按钮点击后执行下面回调方法 + Button button=findViewById(R.id.map_);//跳转源按钮 + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),MainActivity.class);//跳转的目的地 + startActivity(intent); + } + }); + + Button button1=findViewById(R.id.zhuxiao); + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(), LogOut.class);//跳转的目的地 + startActivity(intent); + } + }); + //按钮点击后执行下面回调方法 + Button button_=findViewById(R.id.exit); + findViewById(R.id.exit).setOnClickListener(this); + + button_.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),LoginScreen.class);//跳转的目的地 + startActivity(intent); + } + }); + } + + /** + * Called when a view has been clicked. + * + * @param v The view that was clicked. + */ + @Override + public void onClick(View v) { + + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/WNaviGuideActivity.java b/src/map3demo/app/src/main/java/com/example/map/WNaviGuideActivity.java new file mode 100644 index 0000000..b29d74e --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/WNaviGuideActivity.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2017 Baidu, Inc. All Rights Reserved. + */ +package com.example.map; + +import android.app.Activity; +import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.os.Message; +import android.util.Log; +import android.view.View; +import android.widget.Toast; + +import com.baidu.mapapi.walknavi.WalkNavigateHelper; +import com.baidu.mapapi.walknavi.adapter.IWNaviStatusListener; +import com.baidu.mapapi.walknavi.adapter.IWRouteGuidanceListener; +import com.baidu.mapapi.walknavi.adapter.IWTTSPlayer; +import com.baidu.mapapi.walknavi.model.IWRouteIconInfo; +import com.baidu.mapapi.walknavi.model.RouteGuideKind; +import com.baidu.platform.comapi.walknavi.WalkNaviModeSwitchListener; +import com.baidu.platform.comapi.walknavi.widget.ArCameraView; + + +public class WNaviGuideActivity extends Activity { + + private final static String TAG = WNaviGuideActivity.class.getSimpleName(); + + private WalkNavigateHelper mNaviHelper; + + @Override + protected void onDestroy() { + super.onDestroy(); + mNaviHelper.quit(); + } + + @Override + protected void onResume() { + super.onResume(); + mNaviHelper.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + mNaviHelper.pause(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mNaviHelper = WalkNavigateHelper.getInstance(); + + try { + View view = mNaviHelper.onCreate(WNaviGuideActivity.this); + if (view != null) { + setContentView(view); + } + } catch (Exception e) { + e.printStackTrace(); + } + + mNaviHelper.setWalkNaviStatusListener(new IWNaviStatusListener() { + @Override + public void onWalkNaviModeChange(int mode, WalkNaviModeSwitchListener listener) { + Log.d(TAG, "onWalkNaviModeChange : " + mode); + mNaviHelper.switchWalkNaviMode(WNaviGuideActivity.this, mode, listener); + } + + @Override + public void onNaviExit() { + Log.d(TAG, "onNaviExit"); + } + }); + + mNaviHelper.setTTsPlayer(new IWTTSPlayer() { + @Override + public int playTTSText(final String s, boolean b) { + Log.d(TAG, "tts: " + s); + return 0; + } + }); + + boolean startResult = mNaviHelper.startWalkNavi(WNaviGuideActivity.this); + Log.e(TAG, "startWalkNavi result : " + startResult); + + mNaviHelper.setRouteGuidanceListener(this, new IWRouteGuidanceListener() { + @Override + public void onRouteGuideIconInfoUpdate(IWRouteIconInfo iwRouteIconInfo) { + + } + + @Override + public void onRouteGuideIconUpdate(Drawable drawable) { + + } + + @Override + public void onRouteGuideKind(RouteGuideKind routeGuideKind) { + + } + + @Override + public void onRoadGuideTextUpdate(CharSequence charSequence, CharSequence charSequence1) { + + } + + @Override + public void onRemainDistanceUpdate(CharSequence charSequence) { + + } + + @Override + public void onRemainTimeUpdate(CharSequence charSequence) { + + } + + @Override + public void onGpsStatusChange(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onRouteFarAway(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onRoutePlanYawing(CharSequence charSequence, Drawable drawable) { + + } + + @Override + public void onReRouteComplete() { + + } + + @Override + public void onArriveDest() { + + } + + @Override + public void onIndoorEnd(Message message) { + + } + + @Override + public void onFinalEnd(Message message) { + + } + + @Override + public void onVibrate() { + + } + }); + } + + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + if (requestCode == ArCameraView.WALK_AR_PERMISSION) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) { + Toast.makeText(WNaviGuideActivity.this, "没有相机权限,请打开后重试", Toast.LENGTH_SHORT).show(); + } else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + mNaviHelper.startCameraAndSetMapView(WNaviGuideActivity.this); + } + } + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/database/ClassDBHelper.java b/src/map3demo/app/src/main/java/com/example/map/database/ClassDBHelper.java new file mode 100644 index 0000000..cf2841e --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/database/ClassDBHelper.java @@ -0,0 +1,120 @@ +package com.example.map.database; + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +import androidx.annotation.Nullable; + +import com.example.map.enity.Class_demo; + +import java.util.ArrayList; + +public class ClassDBHelper extends SQLiteOpenHelper { + + private static final String DB_NAME="class.db"; + private static final String ClassTABLE_NAME="class_table"; + private static final int DB_VERSION=1; + private static ClassDBHelper mHelper = null; + private SQLiteDatabase mRDB=null;//用来读 + private SQLiteDatabase mWDB=null;//用来写 + public SQLiteDatabase db; + + //参数为上下文context,所谓上下文就是这个类所在包的路径 + public ClassDBHelper(Context context) { + super(context, DB_NAME, null, DB_VERSION); + db = getReadableDatabase(); + } + + + public ClassDBHelper(@Nullable Context context, + @Nullable String name, + @Nullable SQLiteDatabase.CursorFactory factory, + int version) { + + super(context, name, factory, version); + } + + //利用单例模式获取数据库帮助器的唯一实例 + public static ClassDBHelper getInstance(Context context){ + if(mHelper==null){ + mHelper=new ClassDBHelper(context); + } + return mHelper; + } + + //打开数据库的读连接 + public SQLiteDatabase openReadLink(){ + if (mRDB==null || !mRDB.isOpen()){ + mRDB= mHelper.getReadableDatabase(); + } + return mRDB; + } + + //打开数据库的写连接 + public SQLiteDatabase openWriteLink(){ + if (mWDB==null || !mWDB.isOpen()){ + mWDB= mHelper.getWritableDatabase(); + } + return mWDB; + } + + @Override + public void onCreate(SQLiteDatabase db) { + + String sql="CREATE TABLE IF NOT EXISTS "+ ClassTABLE_NAME + " (" + + "c_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+ + " c_subject VARCHAR NOT NULL,"+ + " c_time VARCHAR NOT NULL,"+ + " c_day VARCHAR NOT NULL,"+ + " c_teacher VARCHAR NOT NULL);"; + + ContentValues values=new ContentValues(); + values.put("c_subject","0"); + values.put("c_time","0"); + values.put("c_day","0"); + values.put("c_teacher","0"); + //插入id 1-36 个课程数据,以便添加课程 + for (int i = 1; i < 37; i++) { + values.put("c_id", i); + db.insert(ClassTABLE_NAME, "", values); + } + + db.execSQL(sql); + } + + public long insert(Class_demo classes){ + ContentValues values=new ContentValues(); + values.put("c_subject",classes.getC_subject()); + values.put("c_time",classes.getC_time()); + values.put("c_day",classes.getC_day()); + values.put("c_teacher",classes.getC_teacher()); + return mWDB.insert(ClassTABLE_NAME,null,values); + } + + public long delete(Class_demo classes){ + String subject=classes.getC_subject(); + String teacher=classes.getC_teacher(); + return mWDB.delete(ClassTABLE_NAME,"c_subject=? and c_teacher=?",new String[]{subject,teacher}); + } + public ArrayList getAllData(){ + ArrayList list = new ArrayList<>(); + @SuppressLint("Recycle") Cursor cursor = db.query(ClassTABLE_NAME,null,null,null,null,null,null); + while(cursor.moveToNext()){ + @SuppressLint("Range") String c_subject = cursor.getString(cursor.getColumnIndex("c_subject")); + @SuppressLint("Range") String c_time = cursor.getString(cursor.getColumnIndex("c_time")); + @SuppressLint("Range") String c_day = cursor.getString(cursor.getColumnIndex("c_day")); + @SuppressLint("Range") String c_teacher = cursor.getString(cursor.getColumnIndex("c_teacher")); + list.add(new Class_demo(c_subject,c_time,c_day,c_teacher)); + } + return list; + } + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } + +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/database/UserDBHelper.java b/src/map3demo/app/src/main/java/com/example/map/database/UserDBHelper.java new file mode 100644 index 0000000..ee93ee8 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/database/UserDBHelper.java @@ -0,0 +1,95 @@ +package com.example.map.database; + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +import com.example.map.enity.User; + +import java.util.ArrayList; + +public class UserDBHelper extends SQLiteOpenHelper { + + private static final String DB_NAME="user.db"; + private static final String TABLE_NAME="user_table"; + private static final int DB_VERSION=1; + private static UserDBHelper mHelper = null; + private SQLiteDatabase mRDB=null;//用来读 + private SQLiteDatabase mWDB=null;//用来写 + public SQLiteDatabase db; + + //参数为上下文context,所谓上下文就是这个类所在包的路径 + public UserDBHelper(Context context) { + super(context, DB_NAME, null, DB_VERSION); + db = getReadableDatabase(); + } + + //利用单例模式获取数据库帮助器的唯一实例 + public static UserDBHelper getInstance(Context context){ + if(mHelper==null){ + mHelper=new UserDBHelper(context); + } + return mHelper; + } + + //打开数据库的读连接 + public SQLiteDatabase openReadLink(){ + if (mRDB==null || !mRDB.isOpen()){ + mRDB= mHelper.getReadableDatabase(); + } + return mRDB; + } + //打开数据库的写连接 + public SQLiteDatabase openWriteLink(){ + if (mWDB==null || !mWDB.isOpen()){ + mWDB= mHelper.getWritableDatabase(); + } + return mWDB; + } + + + //创建数据库,执行建表语言 + @Override + public void onCreate(SQLiteDatabase db) { + String sql="CREATE TABLE IF NOT EXISTS "+ TABLE_NAME + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+ + " user_name VARCHAR NOT NULL,"+ + " password VARCHAR NOT NULL);"; + db.execSQL(sql); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } + + public long insert(User user){ + ContentValues values=new ContentValues(); + values.put("user_name",user.user_name); + values.put("password",user.password); + return mWDB.insert(TABLE_NAME,null,values); + } + + public long delete(User user){ + String name= user.getName(); + String passwd= user.getPassword(); + return mWDB.delete(TABLE_NAME,"user_name=? and password=?",new String[]{name,passwd}); + } + + //我们查询出来的内容,需要有个容器存放,以供使用,所以定义了一个ArrayList类的list + //这里使用游标Cursor + public ArrayList getAllData(){ + ArrayList list = new ArrayList(); + @SuppressLint("Recycle") Cursor cursor = db.query(TABLE_NAME,null,null,null,null,null,null); + while(cursor.moveToNext()){ + @SuppressLint("Range") String user_name = cursor.getString(cursor.getColumnIndex("user_name")); + @SuppressLint("Range") String password = cursor.getString(cursor.getColumnIndex("password")); + + list.add(new User(user_name,password)); + } + return list; + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/enity/Class_demo.java b/src/map3demo/app/src/main/java/com/example/map/enity/Class_demo.java new file mode 100644 index 0000000..8321683 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/enity/Class_demo.java @@ -0,0 +1,43 @@ +package com.example.map.enity; + +public class Class_demo { + + public String c_subject; + public String c_time; + public String c_day; + public String c_teacher; + + public Class_demo(String c_subject, String c_teacher) { + this.c_subject = c_subject; + this.c_teacher = c_teacher; + } + + public Class_demo(String c_subject, String c_time, String c_day, String c_teacher) { + this.c_subject = c_subject; + this.c_time = c_time; + this.c_day = c_day; + this.c_teacher = c_teacher; + } + + @Override + public String toString() { + return "Classes{" + + ", c_subject='" + c_subject + '\'' + + ", c_time='" + c_time + '\'' + + ", c_day='" + c_day + '\'' + + ", c_teacher='" + c_teacher + '\'' + + '}'; + } + public String getC_subject(){ + return c_subject; + } + public String getC_time(){ + return c_time; + } + public String getC_day(){ + return c_day; + } + public String getC_teacher(){ + return c_teacher; + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/enity/User.java b/src/map3demo/app/src/main/java/com/example/map/enity/User.java new file mode 100644 index 0000000..cc512a4 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/enity/User.java @@ -0,0 +1,30 @@ +package com.example.map.enity; + +public class User { + public String user_name; + public String password; + + public User(String user_name, String password) { + this.user_name = user_name; + this.password = password; + } + + public User(){ + } + + public String getName(){ + return user_name; + } + + public String getPassword(){ + return password; + } + + @Override + public String toString() { + return "User{" + + "user_name=" + user_name + + ", password=" + password + + '}'; + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/location/BDLocationListener.java b/src/map3demo/app/src/main/java/com/example/map/location/BDLocationListener.java new file mode 100644 index 0000000..b9ba376 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/location/BDLocationListener.java @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2016 Baidu, Inc. All Rights Reserved. + */ +package com.example.map.location; + +import android.location.Location; +import android.os.Bundle; + +/** + * @author by liuhongjian01 on 16/8/17. + */ +public interface BDLocationListener { + void onLocationChanged(Location location); + void onStatusChanged(String provider, int status, Bundle extras); + void onProviderEnabled(String provider); + void onProviderDisabled(String provider); +} diff --git a/src/map3demo/app/src/main/java/com/example/map/location/BDLocationManager.java b/src/map3demo/app/src/main/java/com/example/map/location/BDLocationManager.java new file mode 100644 index 0000000..ccfa783 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/location/BDLocationManager.java @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2016 Baidu, Inc. All Rights Reserved. + */ +package com.example.map.location; + +import android.content.Context; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; +import android.os.Bundle; + +import com.baidu.mapapi.JNIInitializer; + +/** + * @author by liuhongjian01 on 16/8/17. + */ +public class BDLocationManager { + + private LocationManager mSysLocManager; + private LocationListener mSysLocListener = new MLocationListener(); + private BDLocationListener listener; + + private static class Holder { + private static BDLocationManager INSTANCE = new BDLocationManager(); + } + + private BDLocationManager() { + initGPS(JNIInitializer.getCachedContext()); + + } + + public static BDLocationManager getInstance() { + return Holder.INSTANCE; + } + + public void addListener(BDLocationListener listener) { +// if (null != listener && !listeners.contains(listener)) { +// listeners.add(listener); +// } + this.listener = listener; + } + + public void removeListener() { +// if (null != listener && listeners.contains(listener)) { +// listeners.remove(listener); +// } + this.listener = null; + } + + private void initGPS(Context context) { + try { + if (mSysLocManager == null) { + /** 获取系统的定位服务管理类*/ + mSysLocManager = (LocationManager) context + .getSystemService(Context.LOCATION_SERVICE); + } + // mSysLocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mSysLocListener); + } catch (Exception e) { + } + } + + public void startLoc() { + mSysLocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mSysLocListener); + } + + public void stopLoc() { + mSysLocManager.removeUpdates(mSysLocListener); + } + + private class MLocationListener implements LocationListener{ + + @Override + public void onLocationChanged(Location location) { + if (null != listener) { + listener.onLocationChanged(location); + } + } + + @Override + public void onStatusChanged(String provider, int status, Bundle extras) { + if (null != listener) { + listener.onStatusChanged(provider, status, extras); + } + } + + @Override + public void onProviderEnabled(String provider) { + if (null != listener) { + listener.onProviderEnabled(provider); + } + } + + @Override + public void onProviderDisabled(String provider) { + if (null != listener) { + listener.onProviderDisabled(provider); + } + } + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/me.java b/src/map3demo/app/src/main/java/com/example/map/me.java new file mode 100644 index 0000000..19b2a08 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/me.java @@ -0,0 +1,69 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +public class me extends AppCompatActivity implements View.OnClickListener{ + + private TextView tv_alert; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me); + //按钮点击后执行下面回调方法 + Button button=findViewById(R.id.map_);//跳转源按钮 + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),MainActivity.class);//跳转的目的地 + startActivity(intent); + } + }); + + //按钮点击后执行下面回调方法 + Button button_; + //按钮点击后执行下面回调方法 + button_=findViewById(R.id.Myself); + findViewById(R.id.exit).setOnClickListener(this); + + button_.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),me.class);//跳转的目的地 + startActivity(intent); + } + }); + + //按钮点击后执行下面回调方法 + button_=findViewById(R.id.exit); + findViewById(R.id.exit).setOnClickListener(this); + + button_.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),sign_in_front.class);//跳转的目的地 + startActivity(intent); + } + }); + + + } + + /** + * Called when a view has been clicked. + * + * @param v The view that was clicked. + */ + @Override + public void onClick(View v) { + + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/sign_in_front.java b/src/map3demo/app/src/main/java/com/example/map/sign_in_front.java new file mode 100644 index 0000000..d46d6e1 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/sign_in_front.java @@ -0,0 +1,38 @@ +package com.example.map; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +import androidx.appcompat.app.AppCompatActivity; + +public class sign_in_front extends AppCompatActivity implements View.OnClickListener { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_sign_in_front); + Button button_=findViewById(R.id.sign); + + + //按钮点击后执行下面回调方法 + button_=findViewById(R.id.sign); + findViewById(R.id.sign).setOnClickListener(this); + + button_.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(); + intent.setClass(getApplicationContext(),LoginScreen.class);//跳转的目的地 + startActivity(intent); + } + }); + + } + + @Override + public void onClick(View view) { + + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/util/ClassTable.java b/src/map3demo/app/src/main/java/com/example/map/util/ClassTable.java new file mode 100644 index 0000000..78db632 --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/util/ClassTable.java @@ -0,0 +1,16 @@ +package com.example.map.util; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.map.R; + +public class ClassTable extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_class_table2); + } +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/java/com/example/map/util/ToastUtil.java b/src/map3demo/app/src/main/java/com/example/map/util/ToastUtil.java new file mode 100644 index 0000000..16858fd --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/util/ToastUtil.java @@ -0,0 +1,10 @@ +package com.example.map.util; + +import android.content.Context; +import android.widget.Toast; + +public class ToastUtil { + public static void show(Context ctx,String desc){ + Toast.makeText(ctx,desc,Toast.LENGTH_SHORT).show(); + } +} diff --git a/src/map3demo/app/src/main/java/com/example/map/utils.java b/src/map3demo/app/src/main/java/com/example/map/utils.java new file mode 100644 index 0000000..7baf0df --- /dev/null +++ b/src/map3demo/app/src/main/java/com/example/map/utils.java @@ -0,0 +1,40 @@ +package com.example.map; + +public class utils { + + public static int getDay(String day) { + int j = 0; + switch (day) { + case "星期一":{ + j = 1; + break; + } + case "星期二":{ + j = 2; + break; + } + case "星期三":{ + j = 3; + break; + } + case "星期四":{ + j = 4; + break; + } + case "星期五":{ + j = 5; + break; + } + case "星期六":{ + j = 6; + break; + } + case "星期日":{ + j = 7; + break; + } + } + return j; + } + +} \ No newline at end of file diff --git a/src/map3demo/app/src/main/res/drawable-v24/dormitory.png b/src/map3demo/app/src/main/res/drawable-v24/dormitory.png new file mode 100644 index 0000000..f18caf6 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable-v24/dormitory.png differ diff --git a/src/map3demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/map3demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/src/map3demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/map3demo/app/src/main/res/drawable-v24/school.png b/src/map3demo/app/src/main/res/drawable-v24/school.png new file mode 100644 index 0000000..333d332 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable-v24/school.png differ diff --git a/src/map3demo/app/src/main/res/drawable/btn_selector.xml b/src/map3demo/app/src/main/res/drawable/btn_selector.xml new file mode 100644 index 0000000..36064d6 --- /dev/null +++ b/src/map3demo/app/src/main/res/drawable/btn_selector.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map3demo/app/src/main/res/drawable/canteen.png b/src/map3demo/app/src/main/res/drawable/canteen.png new file mode 100644 index 0000000..245aac5 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/canteen.png differ diff --git a/src/map3demo/app/src/main/res/drawable/daohang.png b/src/map3demo/app/src/main/res/drawable/daohang.png new file mode 100644 index 0000000..688ef38 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/daohang.png differ diff --git a/src/map3demo/app/src/main/res/drawable/ic_launcher_background.xml b/src/map3demo/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/src/map3demo/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/map3demo/app/src/main/res/drawable/icon_end.png b/src/map3demo/app/src/main/res/drawable/icon_end.png new file mode 100644 index 0000000..2f288f4 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/icon_end.png differ diff --git a/src/map3demo/app/src/main/res/drawable/icon_start.png b/src/map3demo/app/src/main/res/drawable/icon_start.png new file mode 100644 index 0000000..ffc9a67 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/icon_start.png differ diff --git a/src/map3demo/app/src/main/res/drawable/map.jpeg b/src/map3demo/app/src/main/res/drawable/map.jpeg new file mode 100644 index 0000000..67eb03a Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/map.jpeg differ diff --git a/src/map3demo/app/src/main/res/drawable/select001.png b/src/map3demo/app/src/main/res/drawable/select001.png new file mode 100644 index 0000000..bbc68b0 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/select001.png differ diff --git a/src/map3demo/app/src/main/res/drawable/welcome.jpg b/src/map3demo/app/src/main/res/drawable/welcome.jpg new file mode 100644 index 0000000..e132e44 Binary files /dev/null and b/src/map3demo/app/src/main/res/drawable/welcome.jpg differ diff --git a/src/map3demo/app/src/main/res/layout/activity_class_table.xml b/src/map3demo/app/src/main/res/layout/activity_class_table.xml new file mode 100644 index 0000000..63847c8 --- /dev/null +++ b/src/map3demo/app/src/main/res/layout/activity_class_table.xml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/map3demo/app/src/main/res/layout/activity_class_table2.xml b/src/map3demo/app/src/main/res/layout/activity_class_table2.xml new file mode 100644 index 0000000..c57726d --- /dev/null +++ b/src/map3demo/app/src/main/res/layout/activity_class_table2.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/src/map3demo/app/src/main/res/layout/activity_guide_main.xml b/src/map3demo/app/src/main/res/layout/activity_guide_main.xml new file mode 100644 index 0000000..15a8193 --- /dev/null +++ b/src/map3demo/app/src/main/res/layout/activity_guide_main.xml @@ -0,0 +1,29 @@ + + + + + + + + +