diff --git a/libs/BaiduLBS_Android.jar b/libs/BaiduLBS_Android.jar deleted file mode 100644 index 591f5f4..0000000 Binary files a/libs/BaiduLBS_Android.jar and /dev/null differ diff --git a/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so b/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 2935c4c..0000000 Binary files a/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/libs/arm64-v8a/libgnustl_shared.so b/libs/arm64-v8a/libgnustl_shared.so deleted file mode 100644 index be99b75..0000000 Binary files a/libs/arm64-v8a/libgnustl_shared.so and /dev/null differ diff --git a/libs/arm64-v8a/libindoor.so b/libs/arm64-v8a/libindoor.so deleted file mode 100644 index bfb6f75..0000000 Binary files a/libs/arm64-v8a/libindoor.so and /dev/null differ diff --git a/libs/arm64-v8a/liblocSDK8b.so b/libs/arm64-v8a/liblocSDK8b.so deleted file mode 100644 index 9bd868a..0000000 Binary files a/libs/arm64-v8a/liblocSDK8b.so and /dev/null differ diff --git a/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so b/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 9aab5e6..0000000 Binary files a/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/libs/armeabi-v7a/libgnustl_shared.so b/libs/armeabi-v7a/libgnustl_shared.so deleted file mode 100644 index 96c22a2..0000000 Binary files a/libs/armeabi-v7a/libgnustl_shared.so and /dev/null differ diff --git a/libs/armeabi-v7a/libindoor.so b/libs/armeabi-v7a/libindoor.so deleted file mode 100644 index b59be91..0000000 Binary files a/libs/armeabi-v7a/libindoor.so and /dev/null differ diff --git a/libs/armeabi-v7a/liblocSDK8b.so b/libs/armeabi-v7a/liblocSDK8b.so deleted file mode 100644 index aa90e76..0000000 Binary files a/libs/armeabi-v7a/liblocSDK8b.so and /dev/null differ diff --git a/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so b/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 373e67f..0000000 Binary files a/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/libs/armeabi/libgnustl_shared.so b/libs/armeabi/libgnustl_shared.so deleted file mode 100644 index 5cf6d20..0000000 Binary files a/libs/armeabi/libgnustl_shared.so and /dev/null differ diff --git a/libs/armeabi/libindoor.so b/libs/armeabi/libindoor.so deleted file mode 100644 index a0879cf..0000000 Binary files a/libs/armeabi/libindoor.so and /dev/null differ diff --git a/libs/armeabi/liblocSDK8b.so b/libs/armeabi/liblocSDK8b.so deleted file mode 100644 index 4083291..0000000 Binary files a/libs/armeabi/liblocSDK8b.so and /dev/null differ diff --git a/libs/x86/libBaiduMapSDK_base_v7_5_3.so b/libs/x86/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 5554ff8..0000000 Binary files a/libs/x86/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/libs/x86/libgnustl_shared.so b/libs/x86/libgnustl_shared.so deleted file mode 100644 index 1eae31c..0000000 Binary files a/libs/x86/libgnustl_shared.so and /dev/null differ diff --git a/libs/x86/libindoor.so b/libs/x86/libindoor.so deleted file mode 100644 index 1de0a2c..0000000 Binary files a/libs/x86/libindoor.so and /dev/null differ diff --git a/libs/x86/liblocSDK8b.so b/libs/x86/liblocSDK8b.so deleted file mode 100644 index ca234f1..0000000 Binary files a/libs/x86/liblocSDK8b.so and /dev/null differ diff --git a/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so b/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index a1c0b4b..0000000 Binary files a/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/libs/x86_64/libgnustl_shared.so b/libs/x86_64/libgnustl_shared.so deleted file mode 100644 index 0149273..0000000 Binary files a/libs/x86_64/libgnustl_shared.so and /dev/null differ diff --git a/libs/x86_64/libindoor.so b/libs/x86_64/libindoor.so deleted file mode 100644 index 80a00c6..0000000 Binary files a/libs/x86_64/libindoor.so and /dev/null differ diff --git a/libs/x86_64/liblocSDK8b.so b/libs/x86_64/liblocSDK8b.so deleted file mode 100644 index ff464c5..0000000 Binary files a/libs/x86_64/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/.gitignore b/src/MyApplication/.gitignore deleted file mode 100644 index aa724b7..0000000 --- a/src/MyApplication/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.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/MyApplication/.idea/.gitignore b/src/MyApplication/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/src/MyApplication/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/src/MyApplication/.idea/compiler.xml b/src/MyApplication/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/src/MyApplication/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/MyApplication/.idea/gradle.xml b/src/MyApplication/.idea/gradle.xml deleted file mode 100644 index a2d7c21..0000000 --- a/src/MyApplication/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/.idea/misc.xml b/src/MyApplication/.idea/misc.xml deleted file mode 100644 index bdd9278..0000000 --- a/src/MyApplication/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/.idea/render.experimental.xml b/src/MyApplication/.idea/render.experimental.xml deleted file mode 100644 index 8ec256a..0000000 --- a/src/MyApplication/.idea/render.experimental.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/.idea/vcs.xml b/src/MyApplication/.idea/vcs.xml deleted file mode 100644 index f6446e1..0000000 --- a/src/MyApplication/.idea/vcs.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - -<<<<<<< HEAD - -======= - ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7 - - \ No newline at end of file diff --git a/src/MyApplication/app/.gitignore b/src/MyApplication/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/src/MyApplication/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/src/MyApplication/app/build.gradle b/src/MyApplication/app/build.gradle deleted file mode 100644 index d36f8e3..0000000 --- a/src/MyApplication/app/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - namespace 'com.example.myapplication' - compileSdk 32 - - defaultConfig { - applicationId "com.example.myapplication" - minSdk 19 - targetSdk 30 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - ndk { - // 设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so) - abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" - } - } - - 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.5.1' - implementation 'com.google.android.material:material:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' -<<<<<<< HEAD - implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-AllNavi:7.4.0' - implementation files('libs/Msc.jar') - implementation files('libs\\android-support-v4.jar') -======= - implementation files('libs\\BaiduLBS_Android.jar') - implementation files('libs\\BaiduLBS_Android.jar') - implementation files('libs\\BaiduLBS_Android.jar') - implementation files('libs\\BaiduLBS_Android.jar') - implementation files('libs\\BaiduLBS_Android.jar') - implementation files('libs\\BaiduLBS_Android.jar') ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7 - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - implementation 'androidx.work:work-runtime:2.7.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8' - -} \ No newline at end of file diff --git a/src/MyApplication/app/libs/BaiduLBS_Android.jar b/src/MyApplication/app/libs/BaiduLBS_Android.jar deleted file mode 100644 index 591f5f4..0000000 Binary files a/src/MyApplication/app/libs/BaiduLBS_Android.jar and /dev/null differ diff --git a/src/MyApplication/app/libs/Msc.jar b/src/MyApplication/app/libs/Msc.jar deleted file mode 100644 index fe502fb..0000000 Binary files a/src/MyApplication/app/libs/Msc.jar and /dev/null differ diff --git a/src/MyApplication/app/libs/android-support-v4.jar b/src/MyApplication/app/libs/android-support-v4.jar deleted file mode 100644 index da1b8f7..0000000 Binary files a/src/MyApplication/app/libs/android-support-v4.jar and /dev/null differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 2935c4c..0000000 Binary files a/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so b/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so deleted file mode 100644 index be99b75..0000000 Binary files a/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libindoor.so b/src/MyApplication/app/libs/arm64-v8a/libindoor.so deleted file mode 100644 index bfb6f75..0000000 Binary files a/src/MyApplication/app/libs/arm64-v8a/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so b/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so deleted file mode 100644 index 9bd868a..0000000 Binary files a/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libmsc.so b/src/MyApplication/app/libs/arm64-v8a/libmsc.so deleted file mode 100644 index aea6000..0000000 Binary files a/src/MyApplication/app/libs/arm64-v8a/libmsc.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 9aab5e6..0000000 Binary files a/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so b/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so deleted file mode 100644 index 96c22a2..0000000 Binary files a/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libindoor.so b/src/MyApplication/app/libs/armeabi-v7a/libindoor.so deleted file mode 100644 index b59be91..0000000 Binary files a/src/MyApplication/app/libs/armeabi-v7a/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so b/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so deleted file mode 100644 index aa90e76..0000000 Binary files a/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libmsc.so b/src/MyApplication/app/libs/armeabi-v7a/libmsc.so deleted file mode 100644 index 06a3bdd..0000000 Binary files a/src/MyApplication/app/libs/armeabi-v7a/libmsc.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 373e67f..0000000 Binary files a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi/libgnustl_shared.so b/src/MyApplication/app/libs/armeabi/libgnustl_shared.so deleted file mode 100644 index 5cf6d20..0000000 Binary files a/src/MyApplication/app/libs/armeabi/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi/libindoor.so b/src/MyApplication/app/libs/armeabi/libindoor.so deleted file mode 100644 index a0879cf..0000000 Binary files a/src/MyApplication/app/libs/armeabi/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi/liblocSDK8b.so b/src/MyApplication/app/libs/armeabi/liblocSDK8b.so deleted file mode 100644 index 4083291..0000000 Binary files a/src/MyApplication/app/libs/armeabi/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 5554ff8..0000000 Binary files a/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86/libgnustl_shared.so b/src/MyApplication/app/libs/x86/libgnustl_shared.so deleted file mode 100644 index 1eae31c..0000000 Binary files a/src/MyApplication/app/libs/x86/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86/libindoor.so b/src/MyApplication/app/libs/x86/libindoor.so deleted file mode 100644 index 1de0a2c..0000000 Binary files a/src/MyApplication/app/libs/x86/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86/liblocSDK8b.so b/src/MyApplication/app/libs/x86/liblocSDK8b.so deleted file mode 100644 index ca234f1..0000000 Binary files a/src/MyApplication/app/libs/x86/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index a1c0b4b..0000000 Binary files a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86_64/libgnustl_shared.so b/src/MyApplication/app/libs/x86_64/libgnustl_shared.so deleted file mode 100644 index 0149273..0000000 Binary files a/src/MyApplication/app/libs/x86_64/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86_64/libindoor.so b/src/MyApplication/app/libs/x86_64/libindoor.so deleted file mode 100644 index 80a00c6..0000000 Binary files a/src/MyApplication/app/libs/x86_64/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86_64/liblocSDK8b.so b/src/MyApplication/app/libs/x86_64/liblocSDK8b.so deleted file mode 100644 index ff464c5..0000000 Binary files a/src/MyApplication/app/libs/x86_64/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/proguard-rules.pro b/src/MyApplication/app/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/src/MyApplication/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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/MyApplication/app/src/MyApplication/.gitignore b/src/MyApplication/app/src/MyApplication/.gitignore deleted file mode 100644 index aa724b7..0000000 --- a/src/MyApplication/app/src/MyApplication/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.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/MyApplication/app/src/MyApplication/.idea/.gitignore b/src/MyApplication/app/src/MyApplication/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/src/MyApplication/app/src/MyApplication/.idea/.name b/src/MyApplication/app/src/MyApplication/.idea/.name deleted file mode 100644 index b3405b3..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -My Application \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/.idea/compiler.xml b/src/MyApplication/app/src/MyApplication/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/.idea/gradle.xml b/src/MyApplication/app/src/MyApplication/.idea/gradle.xml deleted file mode 100644 index a2d7c21..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/.idea/misc.xml b/src/MyApplication/app/src/MyApplication/.idea/misc.xml deleted file mode 100644 index bdd9278..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/.idea/render.experimental.xml b/src/MyApplication/app/src/MyApplication/.idea/render.experimental.xml deleted file mode 100644 index 8ec256a..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/render.experimental.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/.idea/vcs.xml b/src/MyApplication/app/src/MyApplication/.idea/vcs.xml deleted file mode 100644 index b2bdec2..0000000 --- a/src/MyApplication/app/src/MyApplication/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/.gitignore b/src/MyApplication/app/src/MyApplication/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/src/MyApplication/app/src/MyApplication/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/.idea/.gitignore b/src/MyApplication/app/src/MyApplication/app/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/src/MyApplication/app/src/MyApplication/app/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/src/MyApplication/app/src/MyApplication/app/.idea/gradle.xml b/src/MyApplication/app/src/MyApplication/app/.idea/gradle.xml deleted file mode 100644 index f22a539..0000000 --- a/src/MyApplication/app/src/MyApplication/app/.idea/gradle.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/.idea/misc.xml b/src/MyApplication/app/src/MyApplication/app/.idea/misc.xml deleted file mode 100644 index 6ff4d26..0000000 --- a/src/MyApplication/app/src/MyApplication/app/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/.idea/vcs.xml b/src/MyApplication/app/src/MyApplication/app/.idea/vcs.xml deleted file mode 100644 index c2365ab..0000000 --- a/src/MyApplication/app/src/MyApplication/app/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/build.gradle b/src/MyApplication/app/src/MyApplication/app/build.gradle deleted file mode 100644 index 8e64d7a..0000000 --- a/src/MyApplication/app/src/MyApplication/app/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - namespace 'com.example.myapplication' - compileSdk 32 - - defaultConfig { - applicationId "com.example.myapplication" - minSdk 19 - targetSdk 32 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - ndk { - // 璁剧疆鏀寔鐨凷O搴撴灦鏋勶紙寮鍙戣呭彲浠ユ牴鎹渶瑕侊紝閫夋嫨涓涓垨澶氫釜骞冲彴鐨剆o锛 - abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - sourceSets { - main{ - jniLibs.srcDirs=['libs'] - } - - - - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-AllNavi:7.4.0' - //implementation files('libs\\BaiduLBS_Android.jar') - //implementation files('libs\\BaiduLBS_Android.jar') - //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' -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/libs/BaiduLBS_Android.jar b/src/MyApplication/app/src/MyApplication/app/libs/BaiduLBS_Android.jar deleted file mode 100644 index 591f5f4..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/BaiduLBS_Android.jar and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 2935c4c..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so b/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so deleted file mode 100644 index be99b75..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libindoor.so b/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libindoor.so deleted file mode 100644 index bfb6f75..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so b/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so deleted file mode 100644 index 9bd868a..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 9aab5e6..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so deleted file mode 100644 index 96c22a2..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libindoor.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libindoor.so deleted file mode 100644 index b59be91..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so deleted file mode 100644 index aa90e76..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 373e67f..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libgnustl_shared.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libgnustl_shared.so deleted file mode 100644 index 5cf6d20..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libindoor.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libindoor.so deleted file mode 100644 index a0879cf..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/liblocSDK8b.so b/src/MyApplication/app/src/MyApplication/app/libs/armeabi/liblocSDK8b.so deleted file mode 100644 index 4083291..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/armeabi/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index 5554ff8..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86/libgnustl_shared.so b/src/MyApplication/app/src/MyApplication/app/libs/x86/libgnustl_shared.so deleted file mode 100644 index 1eae31c..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86/libindoor.so b/src/MyApplication/app/src/MyApplication/app/libs/x86/libindoor.so deleted file mode 100644 index 1de0a2c..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86/liblocSDK8b.so b/src/MyApplication/app/src/MyApplication/app/libs/x86/liblocSDK8b.so deleted file mode 100644 index ca234f1..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so b/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so deleted file mode 100644 index a1c0b4b..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libgnustl_shared.so b/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libgnustl_shared.so deleted file mode 100644 index 0149273..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libgnustl_shared.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libindoor.so b/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libindoor.so deleted file mode 100644 index 80a00c6..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/libindoor.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/liblocSDK8b.so b/src/MyApplication/app/src/MyApplication/app/libs/x86_64/liblocSDK8b.so deleted file mode 100644 index ff464c5..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/libs/x86_64/liblocSDK8b.so and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/proguard-rules.pro b/src/MyApplication/app/src/MyApplication/app/proguard-rules.pro deleted file mode 100644 index 25c3acd..0000000 --- a/src/MyApplication/app/src/MyApplication/app/proguard-rules.pro +++ /dev/null @@ -1,39 +0,0 @@ -# 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 - -#-dontoptimize -#-ignorewarnings -#-keeppackagenames com.baidu.** -#-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod - -#-dontwarn com.baidu.** -#-dontwarn com.baidu.navisdk.** -#-dontwarn com.baidu.navi.** - -#-keep class com.baidu.** { *; } -#-keep interface com.baidu.** { *; } - -#-keep class vi.com.gdi.** { *; } - -#-dontwarn com.google.protobuf.** -#-keep class com.google.protobuf.** { *;} -#-keep interface com.google.protobuf.** { *;} diff --git a/src/MyApplication/app/src/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.java b/src/MyApplication/app/src/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.java deleted file mode 100644 index 982ba51..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.myapplication; - -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.myapplication", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/AndroidManifest.xml b/src/MyApplication/app/src/MyApplication/app/src/main/AndroidManifest.xml deleted file mode 100644 index d7321f2..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/JsonParser.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/JsonParser.java deleted file mode 100644 index ac8babb..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/JsonParser.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.example.myapplication; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.json.JSONTokener; - -/** - * Json缁撴灉瑙f瀽绫 - */ -public class JsonParser { - - public static String parseIatResult(String json) { - StringBuffer ret = new StringBuffer(); - try { - JSONTokener tokener = new JSONTokener(json); - JSONObject joResult = new JSONObject(tokener); - - JSONArray words = joResult.getJSONArray("ws"); - for (int i = 0; i < words.length(); i++) { - // 杞啓缁撴灉璇嶏紝榛樿浣跨敤绗竴涓粨鏋 - JSONArray items = words.getJSONObject(i).getJSONArray("cw"); - JSONObject obj = items.getJSONObject(0); - ret.append(obj.getString("w")); -// 濡傛灉闇瑕佸鍊欓夌粨鏋滐紝瑙f瀽鏁扮粍鍏朵粬瀛楁 -// for(int j = 0; j < items.length(); j++) -// { -// JSONObject obj = items.getJSONObject(j); -// ret.append(obj.getString("w")); -// } - } - } catch (Exception e) { - e.printStackTrace(); - } - return ret.toString(); - } - - public static String parseGrammarResult(String json) { - StringBuffer ret = new StringBuffer(); - try { - JSONTokener tokener = new JSONTokener(json); - JSONObject joResult = new JSONObject(tokener); - - JSONArray words = joResult.getJSONArray("ws"); - for (int i = 0; i < words.length(); i++) { - JSONArray items = words.getJSONObject(i).getJSONArray("cw"); - for(int j = 0; j < items.length(); j++) - { - JSONObject obj = items.getJSONObject(j); - if(obj.getString("w").contains("nomatch")) - { - ret.append("娌℃湁鍖归厤缁撴灉."); - return ret.toString(); - } - ret.append("銆愮粨鏋溿" + obj.getString("w")); - ret.append("銆愮疆淇″害銆" + obj.getInt("sc")); - ret.append("\n"); - } - } - } catch (Exception e) { - e.printStackTrace(); - ret.append("娌℃湁鍖归厤缁撴灉."); - } - return ret.toString(); - } - - public static String parseLocalGrammarResult(String json) { - StringBuffer ret = new StringBuffer(); - try { - JSONTokener tokener = new JSONTokener(json); - JSONObject joResult = new JSONObject(tokener); - - JSONArray words = joResult.getJSONArray("ws"); - for (int i = 0; i < words.length(); i++) { - JSONArray items = words.getJSONObject(i).getJSONArray("cw"); - for(int j = 0; j < items.length(); j++) - { - JSONObject obj = items.getJSONObject(j); - if(obj.getString("w").contains("nomatch")) - { - ret.append("娌℃湁鍖归厤缁撴灉."); - return ret.toString(); - } - ret.append("銆愮粨鏋溿" + obj.getString("w")); - ret.append("\n"); - } - } - ret.append("銆愮疆淇″害銆" + joResult.optInt("sc")); - - } catch (Exception e) { - e.printStackTrace(); - ret.append("娌℃湁鍖归厤缁撴灉."); - } - return ret.toString(); - } - - public static String parseTransResult(String json,String key) { - StringBuffer ret = new StringBuffer(); - try { - JSONTokener tokener = new JSONTokener(json); - JSONObject joResult = new JSONObject(tokener); - String errorCode = joResult.optString("ret"); - if(!errorCode.equals("0")) { - return joResult.optString("errmsg"); - } - JSONObject transResult = joResult.optJSONObject("trans_result"); - ret.append(transResult.optString(key)); - /*JSONArray words = joResult.getJSONArray("results"); - for (int i = 0; i < words.length(); i++) { - JSONObject obj = words.getJSONObject(i); - ret.append(obj.getString(key)); - }*/ - } catch (Exception e) { - e.printStackTrace(); - } - return ret.toString(); - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java deleted file mode 100644 index d161cb7..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -import com.example.myapplication.weather.MainActivity1; -import com.example.myapplication.weather.SettingActivity; -import com.example.myapplication.weather.WeatherItem; - -public class MainActivity extends AppCompatActivity { - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - Button button_main_1=findViewById(R.id.button_main_1); - //鐐瑰嚮 - button_main_1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent1=new Intent(MainActivity.this,yijiantong.class); - startActivity(intent1); - - } - }); - //鐐瑰嚮 - Button button_main_2=findViewById(R.id.button_main_2); - button_main_2.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent2=new Intent(MainActivity.this, MainActivity1.class); - startActivity(intent2); - - } - }); - Button button_main_3=findViewById(R.id.button_main_3); - //鐐瑰嚮 - button_main_3.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Object packageContext; - Intent intent3=new Intent(MainActivity.this,zhaoxun.class); - startActivity(intent3); - - } - }); - Button button_main_4=findViewById(R.id.button_main_4); - //鐐瑰嚮 - button_main_4.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Object packageContext; - Intent intent1=new Intent(MainActivity.this,yuyin.class); - startActivity(intent1); - - } - }); - - - - - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java deleted file mode 100644 index 08bb720..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.example.myapplication; -import android.Manifest; -import android.app.Activity; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; - -import com.baidu.location.BDAbstractLocationListener; -import com.baidu.location.BDLocation; -import com.baidu.location.BDLocationListener; -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.MapStatus; -import com.baidu.mapapi.map.MapStatusUpdate; -import com.baidu.mapapi.map.MapStatusUpdateFactory; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.MyLocationConfiguration; -import com.baidu.mapapi.map.MyLocationData; -import com.baidu.mapapi.model.LatLng; -/* -public class MapActivity1 extends Activity { - private MapView mMapView = null; - private BaiduMap mBaiduMap; - private LocationClient mLocationClient; - private BitmapDescriptor mMarker; - private boolean ifFrist = true; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - SDKInitializer.initialize(getApplicationContext()); - setContentView(R.layout.activity_map1); - mMapView = findViewById(R.id.bmapview); - mBaiduMap = mMapView.getMap(); - mLocationClient = new LocationClient(this); - - MyLocationListener myLocationListener = new MyLocationListener(); - mLocationClient.registerLocationListener(myLocationListener); - - //瑕嗙洊鐗 鐢ㄤ簬鏄剧ず褰撳墠浣嶇疆 - mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk); - mBaiduMap.setMyLocationEnabled(true); - LocationClientOption option = new LocationClientOption(); - //鍙夛紝榛樿楂樼簿搴︼紝璁剧疆瀹氫綅妯″紡锛岄珮绮惧害锛屼綆鍔熻楋紝浠呰澶 - option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); - option.setOpenGps(true); // 鎵撳紑gps - option.setCoorType("bd09ll"); // 璁剧疆鍧愭爣绫诲瀷 - option.setScanSpan(1000); - option.setIsNeedAddress(true); - mLocationClient.setLocOption(option); - mLocationClient.start(); - } - - - public class MyLocationListener extends BDAbstractLocationListener { - @Override - public void onReceiveLocation(BDLocation location) { - //mapView 閿姣佸悗涓嶅湪澶勭悊鏂版帴鏀剁殑浣嶇疆 - if (location == null || mMapView == null){ - return; - } - MyLocationData locData = new MyLocationData.Builder() - .accuracy(location.getRadius()) - // 姝ゅ璁剧疆寮鍙戣呰幏鍙栧埌鐨勬柟鍚戜俊鎭紝椤烘椂閽0-360 - .latitude(location.getLatitude()) - .longitude(location.getLongitude()) - .direction(location.getDirection()) - .build(); - mBaiduMap.setMyLocationData(locData); - - MyLocationConfiguration configuration = new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, false, mMarker); - - mBaiduMap.setMyLocationConfiguration(configuration); - - if (ifFrist) { - LatLng ll = new LatLng(location.getLatitude(), location.getLongitude()); - MapStatus.Builder builder = new MapStatus.Builder(); - builder.target(ll); - builder.zoom(18.0f); - mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); - //鏀惧ぇ灞傜骇 - ifFrist = false; - } - - } - } - - @Override - protected void onResume() { - super.onResume(); - mMapView.onResume(); - } - @Override - protected void onPause() { - super.onPause(); - mMapView=findViewById(R.id.bmapview); - mMapView.onResume(); - } - @Override - protected void onDestroy() { - super.onDestroy(); - mLocationClient.stop(); - mMapView.onDestroy(); - } -} -*/ - -public class MapActivity1 extends AppCompatActivity { - private BitmapDescriptor mMarker; - LocationClient mLocationClient; //瀹氫綅瀹㈡埛绔 - MapView mapView; //Android Widget鍦板浘鎺т欢 - BaiduMap baiduMap; - boolean isFirstLocate = true; - - TextView tv_Lat; //绾害 - TextView tv_Lon; //缁忓害 - TextView tv_Add; //鍦板潃 - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - //濡傛灉娌℃湁瀹氫綅鏉冮檺锛屽姩鎬佽姹傜敤鎴峰厑璁镐娇鐢ㄨ鏉冮檺 - if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1); - }else { - requestLocation(); - } - } - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - // super.onRequestPermissionsResult(requestCode, permissions, grantResults); - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - switch (requestCode) { - case 1: - if (grantResults[0] != PackageManager.PERMISSION_GRANTED) { - Toast.makeText(this, "娌℃湁瀹氫綅鏉冮檺锛", Toast.LENGTH_LONG).show(); - finish(); - } else { - requestLocation(); - } - } - } - private void requestLocation() { - initLocation(); - mLocationClient.start(); - } - private void initLocation() { //鍒濆鍖 - mLocationClient = new LocationClient(getApplicationContext()); - mLocationClient.registerLocationListener(new MyLocationListener()); - SDKInitializer.initialize(getApplicationContext()); - setContentView(R.layout.activity_map1); - // mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk); - mapView = findViewById(R.id.bmapview); - baiduMap = mapView.getMap(); - tv_Lat = findViewById(R.id.tv_Lat); - tv_Lon = findViewById(R.id.tv_Lon); - tv_Add = findViewById(R.id.tv_Add); - - LocationClientOption option = new LocationClientOption(); - //璁剧疆鎵弿鏃堕棿闂撮殧 - option.setScanSpan(1000); - //璁剧疆瀹氫綅妯″紡锛屼笁閫変竴 - option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); - - //璁剧疆闇瑕佸湴鍧淇℃伅 - option.setIsNeedAddress(true); - //淇濆瓨瀹氫綅鍙傛暟 - mLocationClient.setLocOption(option); - } - //鍐呴儴绫伙紝鐧惧害浣嶇疆鐩戝惉鍣 - private class MyLocationListener implements BDLocationListener { - @Override - public void onReceiveLocation(BDLocation bdLocation) { - tv_Lat.setText(bdLocation.getLatitude()+""); - tv_Lon.setText(bdLocation.getLongitude()+""); - tv_Add.setText(bdLocation.getAddrStr()); - if(bdLocation.getLocType()==BDLocation.TypeGpsLocation || bdLocation.getLocType()==BDLocation.TypeNetWorkLocation){ - navigateTo(bdLocation); - } - } - MyLocationConfiguration configuration = new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, false, mMarker); -// - // baiduMap.setMyLocationConfiguration(configuration); - } - private void navigateTo(BDLocation bdLocation) { - if(isFirstLocate){ - LatLng ll = new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude()); - MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll); - baiduMap.animateMapStatus(update); - - isFirstLocate = false; - } - } - @Override - protected void onResume() { - super.onResume(); - mapView.onResume(); - } - @Override - protected void onPause() { - super.onPause(); - mapView=findViewById(R.id.bmapview); - mapView.onResume(); - } - @Override - protected void onDestroy() { - super.onDestroy(); - mLocationClient.stop(); - mapView.onDestroy(); - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/SpeechApplication.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/SpeechApplication.java deleted file mode 100644 index a808003..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/SpeechApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.myapplication; - -import android.app.Application; - -import com.iflytek.cloud.SpeechUtility; - -public class SpeechApplication extends Application { - - @Override - public void onCreate() { - - // 5ef048e1 涓哄湪寮鏀惧钩鍙版敞鍐岀殑APPID 娉ㄦ剰娌℃湁绌烘牸锛岀洿鎺ユ浛鎹㈠嵆鍙 - SpeechUtility.createUtility(SpeechApplication.this, "appid=6d0c39e4"); - - super.onCreate(); - } -} - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java deleted file mode 100644 index 71598f6..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java +++ /dev/null @@ -1,237 +0,0 @@ -package com.example.myapplication; -<<<<<<< HEAD:src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java -import android.annotation.SuppressLint; -======= ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java -import android.app.Activity; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.os.Handler; -import android.os.Message; -import android.util.Log; -import android.view.View; -import android.widget.Toast; - -import androidx.annotation.NonNull; - -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.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; - - private boolean isPreSPEAKtotal = true; - private String orient = ""; - - @Override - protected void onDestroy() { - super.onDestroy(); - mNaviHelper.quit(); - } - - @Override - protected void onResume() { - super.onResume(); - mNaviHelper.resume(); - } - - @Override - protected void onPause() { - super.onPause(); - mNaviHelper.pause(); - } - - - Handler handler = new Handler() { -<<<<<<< HEAD:src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java - @SuppressLint("HandlerLeak") -======= ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - if (msg.what == 0x001) { - ChangeState(); - handler.sendEmptyMessageDelayed(0x001, 45000); - } - if (msg.what == 0x002) { - handler.sendEmptyMessageDelayed(0x002, 30000); - } - if (msg.what == 0x003) { - - startActivity(new Intent(WNaviGuideActivity.this, MainActivity.class)); - } - } - }; - - private void ChangeState() { - isPreSPEAKtotal = true; - } - - @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("======", "onWalkNaviModeChange : " + mode); - mNaviHelper.switchWalkNaviMode(WNaviGuideActivity.this, mode, listener); - } - - /* @Description: 杩欎釜鏄湪閫鍑哄鑸椂鑷姩璋冪敤鐨勬柟娉曪紝鍦ㄨ繖閲岃鎶婂璞¤繘琛岄噴鏀撅紝閬垮厤绌哄璞$殑浜х敓 - * @Author: LiY ue - */ - @Override - public void onNaviExit() { - Log.d("======", "onNaviExit"); - handler.removeMessages(0x001); - handler.removeMessages(0x002); - handler.removeMessages(0x003); - } - }); - - - 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 onRouteGuideIconUpdate(Drawable icon) { - - } - - @Override - public void onRouteGuideKind(RouteGuideKind routeGuideKind) { - Log.d("======", "onRouteGuideKind: " + routeGuideKind); - if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_UTurn) - - if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Back || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Front){ - Log.d("========", "onRouteGuideKind: aaaaaa"); - } - - } - - /** - * @Description: 璇卞淇℃伅 - */ - @Override - public void onRoadGuideTextUpdate(CharSequence charSequence, CharSequence - charSequence1) { - Log.d(TAG, "onRoadGuideTextUpdate charSequence=: " + charSequence + " charSequence1 = : " + - charSequence1); - orient = charSequence.toString() + charSequence1.toString(); - - } - - - @Override - public void onRemainDistanceUpdate(CharSequence charSequence) { - Log.d(TAG, "onRemainDistanceUpdate: charSequence = :" + charSequence); - if (isPreSPEAKtotal) { - } - } - - - @Override - public void onRemainTimeUpdate(CharSequence charSequence) { - Log.d(TAG, "onRemainTimeUpdate: charSequence = :" + charSequence); - if (isPreSPEAKtotal) { - isPreSPEAKtotal = false; - } - } - - - @Override - public void onGpsStatusChange(CharSequence charSequence, Drawable drawable) { - Log.d(TAG, "onGpsStatusChange: charSequence = :" + charSequence); - - } - - - @Override - public void onRouteFarAway(CharSequence charSequence, Drawable drawable) { - Log.d(TAG, "onRouteFarAway: charSequence = :" + charSequence); - } - - - @Override - public void onRoutePlanYawing(CharSequence charSequence, Drawable drawable) { - Log.d(TAG, "onRoutePlanYawing: charSequence = :" + charSequence); - - } - - - @Override - public void onReRouteComplete() { - } - - @Override - public void onArriveDest() { - handler.sendEmptyMessageDelayed(0x003, 6000); - } - - @Override - public void onIndoorEnd(Message msg) { - - } - - @Override - public void onFinalEnd(Message msg) { - - } - - @Override - public void onVibrate() { - - } - }); - handler.sendEmptyMessage(0x001); - handler.sendEmptyMessage(0x002); - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull 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/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java deleted file mode 100644 index 232730e..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; - -import com.baidu.mapapi.bikenavi.BikeNavigateHelper; -import com.baidu.mapapi.walknavi.adapter.IWRoutePlanListener; -import com.baidu.mapapi.walknavi.model.WalkRoutePlanError; -import com.baidu.mapapi.walknavi.params.*; -import com.baidu.mapapi.CoordType; -import com.baidu.mapapi.SDKInitializer; -import com.baidu.mapapi.model.LatLng; -import java.util.ArrayList; -import java.util.List; - -import android.widget.ImageButton; -import android.widget.TextView; -import android.annotation.SuppressLint; -import android.os.Bundle; -import com.baidu.baidunavis.BaiduNaviParams; -import com.baidu.mapapi.SDKInitializer; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.walknavi.WalkNavigateHelper; -import com.baidu.mapapi.walknavi.adapter.IWEngineInitListener; -import com.baidu.mapapi.walknavi.params.WalkNaviLaunchParam; - -public class itemfound extends AppCompatActivity { - private WalkNavigateHelper helper = null; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - //initPermissions(); // 鍒濆鍖栨潈闄 - setContentView(R.layout.activity_itemfound); // 濉厖瑙嗗浘 - - // 鐐瑰嚮鎸夐挳寮濮嬪鑸 - Button imageButton = findViewById(R.id.button_item_keys); - imageButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // 鍒濆鍖栨琛屽鑸 - startBikeNavi(); - } - }); - Button imageButtonwallet = findViewById(R.id.button_item_wallet); - imageButtonwallet.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // 鍒濆鍖栨琛屽鑸 - startBikeNavi(); - } - }); - } - // 鍒濆鍖栨潈闄 - /* - private void initPermissions() { - if (Build.VERSION.SDK_INT >= 23) { - ArrayList permissionsList = new ArrayList<>(); - String[] permissions = { - Manifest.permission.ACCESS_NETWORK_STATE, - Manifest.permission.INTERNET, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - }; - - for (String perm : permissions) { - if (PackageManager.PERMISSION_GRANTED != checkSelfPermission(perm)) { - permissionsList.add(perm); - // 杩涘叆鍒拌繖閲屼唬琛ㄦ病鏈夋潈闄. - } - if (!permissionsList.isEmpty()) { - String[] strings = new String[permissionsList.size()]; - requestPermissions(permissionsList.toArray(strings), 0); - } - } - - } - }*/ - private void startBikeNavi() { - //Log.d("=========", "startBikeNavi"); - try { - helper = WalkNavigateHelper.getInstance(); - helper.initNaviEngine(this, new IWEngineInitListener() { - @Override - public void engineInitSuccess() { - // Log.d("=========", "BikeNavi engineInitSuccess寮曟搸鍒濆鍖栨垚鍔"); - startWebNavi(); - } - - @Override - public void engineInitFail() { - // Log.d("=========", "BikeNavi engineInitFail"); - BikeNavigateHelper.getInstance().unInitNaviEngine(); - } - }); - } catch (Exception e) { - // Log.d("=========", "startBikeNavi Exception"); - e.printStackTrace(); - } - } - private void startWebNavi() { - //璧风粓鐐逛綅缃 - LatLng walkStartNode = new LatLng(39.110132, 117.358512); - LatLng walkEndNode = new LatLng(39.111348, 117.358940); - - WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); - startNode.setLocation(walkStartNode); - WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); - endNode.setLocation(walkEndNode); - // 瀹樼綉 - //鏋勯燱alkNaviLaunchParam - WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); - //鑾峰彇WalkNavigateHelper瀹炰緥 //鍙戣捣绠楄矾 - helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { - @Override - public void onRoutePlanStart() { - // Log.d("=======", "WalkNavi onRoutePlanStart寮濮嬫琛屽鑸"); - } - - @Override - public void onRoutePlanSuccess() { - // Log.d("========", "onRoutePlanSuccess绠楄矾鎴愬姛"); - Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); - // intent.setClass(getContext(), WNaviGuideActivity.class); - startActivity(intent); - } - - @Override - public void onRoutePlanFail(WalkRoutePlanError error) { -// Log.d("Walk", "WalkNavi onRoutePlanFail"); - } - - }); - } - - -/* - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_itemfound); - Button find_wallet=findViewById(R.id.button_item_wallet); - Button find_keys=findViewById(R.id.button_item_keys); - find_wallet.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - double locationX; - double locationy; - //BaiduMapNavigation - - - } - }); - find_keys.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - //NaviParaOption para=new Navi(); - - } - }); - }*/ private void startBikeNavi1() { - //Log.d("=========", "startBikeNavi"); - try { - helper = WalkNavigateHelper.getInstance(); - helper.initNaviEngine(this, new IWEngineInitListener() { - @Override - public void engineInitSuccess() { - // Log.d("=========", "BikeNavi engineInitSuccess寮曟搸鍒濆鍖栨垚鍔"); - startWebNavi1(); - } - - @Override - public void engineInitFail() { - // Log.d("=========", "BikeNavi engineInitFail"); - BikeNavigateHelper.getInstance().unInitNaviEngine(); - } - }); - } catch (Exception e) { - // Log.d("=========", "startBikeNavi Exception"); - e.printStackTrace(); - } -} - private void startWebNavi1() { - //璧风粓鐐逛綅缃 - LatLng walkStartNode = new LatLng(39.110132, 117.358512); - LatLng walkEndNode = new LatLng(39.112286, 117.359619); - - WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); - startNode.setLocation(walkStartNode); - WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); - endNode.setLocation(walkEndNode); - // 瀹樼綉 - //鏋勯燱alkNaviLaunchParam - WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); - //鑾峰彇WalkNavigateHelper瀹炰緥 //鍙戣捣绠楄矾 - helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { - @Override - public void onRoutePlanStart() { - // Log.d("=======", "WalkNavi onRoutePlanStart寮濮嬫琛屽鑸"); - } - - @Override - public void onRoutePlanSuccess() { - // Log.d("========", "onRoutePlanSuccess绠楄矾鎴愬姛"); - Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); - // intent.setClass(getContext(), WNaviGuideActivity.class); - startActivity(intent); - } - - @Override - public void onRoutePlanFail(WalkRoutePlanError error) { -// Log.d("Walk", "WalkNavi onRoutePlanFail"); - } - - }); - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/jiankang.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/jiankang.java deleted file mode 100644 index f2fef3c..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/jiankang.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; - -import android.os.Bundle; - -public class jiankang extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_jiankang); - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java deleted file mode 100644 index 95deb0b..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -public class DatabaseHelper extends SQLiteOpenHelper { - private static final int VERSION = 1; - private static final String NAME = "weather"; - - public DatabaseHelper(Context context){ - super(context,NAME,null,VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL("create table weather (_id INTEGER PRIMARY KEY AUTOINCREMENT,date text,max_temp text,min_temp text,text text,humidity text,pressure text,wind text,icon text)"); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java deleted file mode 100644 index 670e37f..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.example.myapplication.weather; - -import android.util.Log; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -//鑾峰彇鏁版嵁鐨勪簩杩涘埗鏁扮粍/瀛楃涓插舰寮 -//鑾峰彇JSON鏁扮粍 -//瑙f瀽JSON鏁扮粍锛屽彉鎴怶eatherItem鐨勬暟缁勫舰寮 - -public class FlickrFetcher { - public static final String TAG = "FlickrFetcher"; - - public byte[] getUrlBytes(String urlSpec) throws Exception{ - URL url = new URL(urlSpec); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); -// connection.setInstanceFollowRedirects(false); //璺熻釜閲嶅畾鍚 -// String redirect = connection.getHeaderField("Location"); -// if (redirect != null){ -// connection = (HttpURLConnection)new URL(redirect).openConnection(); -// } - - try{ - ByteArrayOutputStream out = new ByteArrayOutputStream(); - InputStream in = connection.getInputStream(); - - if(connection.getResponseCode() != HttpURLConnection.HTTP_OK){ - throw new IOException(connection.getResponseMessage() + " :with "+urlSpec); - } - - int bytesRead = 0; - byte[] buffer = new byte[1024]; - while((bytesRead = in.read(buffer)) > 0){ - out.write(buffer,0,bytesRead); - } - out.close(); - return out.toByteArray(); - }finally { - connection.disconnect(); - } - } - - public String getUrlString(String urlSpec)throws Exception{ - return new String(getUrlBytes(urlSpec)); - } - - public List fetchItems(String urlSpec){ - List items = new ArrayList<>(); - try{ - String jsonString = getUrlString(urlSpec); - Log.i(TAG,"result: "+jsonString); - JSONObject jsonBody = new JSONObject(jsonString); - parseItems(items,jsonBody); - }catch (Exception e){ - Log.i(TAG,"Failed!"+e); - } - return items; - } - - public JSONObject fetchCity(String urlSpec){ - String locationID = ""; - JSONObject jsonObject = null; - try{ - String jsonString = getUrlString(urlSpec); - Log.i(TAG,"result: "+jsonString); - JSONObject jsonBody = new JSONObject(jsonString); - JSONArray locationJsonArray = jsonBody.getJSONArray("location"); - jsonObject = locationJsonArray.getJSONObject(0); -// locationID = locationJsonArray.getJSONObject(0).getString("id"); -// String lat = locationJsonArray.getJSONObject(0).getString("lat"); -// String lon = locationJsonArray.getJSONObject(0).getString("lon"); - }catch (Exception e){ - Log.i(TAG,"Failed!"+e); - } - return jsonObject; - } - - private void parseItems(List items,JSONObject jsonBody) throws Exception{ //灏嗕粠url鑾峰緱鐨刯son杞崲鎴怣arsItem - JSONArray weatherJsonArray = jsonBody.getJSONArray("daily"); - for(int i=0;i= Build.VERSION_CODES.O) { - NotificationChannel channel = new NotificationChannel("to-do" - , "寰呭姙娑堟伅", - NotificationManager.IMPORTANCE_HIGH); - channel.enableVibration(true); - channel.setVibrationPattern(new long[]{500}); - notificationManager.createNotificationChannel(channel); - builder.setChannelId("to-do"); - notification = builder.build(); - } else { - notification = builder.build(); - } - - notificationManager.notify(0,notification); - System.out.println(notification); - } - - public static void setServiceAlarm(Context context,boolean isOn){ - Intent i = NotificationService.newIntent(context); - PendingIntent pi = PendingIntent.getService(context,0,i,0); - - AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - - if(isOn){ - alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), - NOTIFICATION_INTERVAL,pi); - }else{ - alarmManager.cancel(pi); - pi.cancel(); - } - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java deleted file mode 100644 index 8b9f5b7..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.DialogInterface; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.View; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; - -import com.example.myapplication.R; - -public class SettingActivity extends AppCompatActivity { - private EditText location; - private TextView unit_text; - private TextView send_text; - private LinearLayout page; - private LinearLayout unit; - private LinearLayout send; - private String city; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_setting); - - location = (EditText) findViewById(R.id.location); - unit = (LinearLayout)findViewById(R.id.unit); - page = (LinearLayout)findViewById(R.id.page); - unit_text = (TextView)findViewById(R.id.unit_text); - send = (LinearLayout)findViewById(R.id.send); - send_text = (TextView)findViewById(R.id.send_text); - - SharedPreferences pref = getSharedPreferences("setting",MODE_PRIVATE); - location.setText(pref.getString("city","鍖椾含")); - unit_text.setText(pref.getString("unit","鎽勬皬搴")); - send_text.setText(pref.getString("send","鏄")); - - page.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - location.clearFocus(); - } - }); - - location.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - city = s.toString(); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("city",city); - editor.commit(); - } - - @Override - public void afterTextChanged(Editable s) { - - } - }); - - unit.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - click(); - } - }); - - send.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - click2(); - } - }); - } - - //鐐瑰嚮鎸夐挳寮瑰嚭涓涓崟閫夊璇濇 - public void click() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("璇烽夋嫨娓╁害鍗曚綅"); - final String items[] = {"鎽勬皬搴","鍗庢皬搴"}; - -//-1浠h〃娌℃湁鏉$洰琚変腑 - builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - //1.鎶婇変腑鐨勬潯鐩彇鍑烘潵 - String item = items[which]; - Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); - unit_text.setText(item.toString()); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("unit",item.toString()); - editor.commit(); - //2.鐒跺悗鎶婂璇濇鍏抽棴 - dialog.dismiss(); - } - }); -//涓鏍疯show - builder.show(); - } - - public void click2() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("璇烽夋嫨鏄惁寮鍚氱煡"); - final String items[] = {"鏄","鍚"}; - -//-1浠h〃娌℃湁鏉$洰琚変腑 - builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - //1.鎶婇変腑鐨勬潯鐩彇鍑烘潵 - String item = items[which]; - Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); - send_text.setText(item.toString()); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("send",item.toString()); - editor.commit(); - //2.鐒跺悗鎶婂璇濇鍏抽棴 - dialog.dismiss(); - } - }); -//涓鏍疯show - builder.show(); - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java deleted file mode 100644 index e9478b3..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.example.myapplication.weather; - -import android.os.Bundle; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; - -public abstract class SingleFragmentActivity extends AppCompatActivity { - protected abstract Fragment createFragment(); - protected abstract int getLayoutId(); - protected abstract int getFragmentId(); - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(getLayoutId()); - - FragmentManager fm = getSupportFragmentManager(); - Fragment fragment = fm.findFragmentById(getFragmentId()); - - if(fragment == null){ - fragment = createFragment(); - fm.beginTransaction(). - add(getFragmentId(),fragment) - .commit(); - } - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java deleted file mode 100644 index e98a864..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.content.Intent; - -import androidx.fragment.app.Fragment; - -import com.example.myapplication.R; - -public class WeatherDetailActivity extends SingleFragmentActivity{ - public static final String EXTRA_WEATHER_ITEM = "com.example.weather.weatherItem"; - - @Override - protected Fragment createFragment() { - WeatherItem weatherItem = (WeatherItem)getIntent().getSerializableExtra(EXTRA_WEATHER_ITEM); - return WeatherDetailFragment.newInstance(weatherItem); - } - - @Override - protected int getLayoutId() { - return R.layout.activity_detail; - } - - @Override - protected int getFragmentId() { - return R.id.detail_container; - } - - public static Intent newIntent(Context packageContext, WeatherItem weatherItem){ - Intent intent = new Intent(packageContext,WeatherDetailActivity.class); - intent.putExtra(EXTRA_WEATHER_ITEM,weatherItem); - return intent; - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java deleted file mode 100644 index 9dc2b31..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.content.Intent; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; - -import com.example.myapplication.R; - -public class WeatherDetailFragment extends Fragment { - private WeatherItem mWeatherItem; //鐢ㄦ潵璁剧疆UI - - private TextView mDeatilDate; - private TextView mDetailMaxTemp; - private TextView mDetailMinTemp; - private ImageView mDetialIcon; - private TextView mDetailDesc; - private TextView mDetailHumidity; - private TextView mDetailPressure; - private TextView mDetailWind; - - private static final String TAG = "WeatherDetailFragment"; - private static final String ARG_ITEM = "args_item"; - private String unit_text = "掳"; - - public static WeatherDetailFragment newInstance(WeatherItem weatherItem) { - Bundle args = new Bundle(); - args.putSerializable(ARG_ITEM,weatherItem); - WeatherDetailFragment fragment = new WeatherDetailFragment(); - fragment.setArguments(args); - return fragment; - } - - //鑾峰彇drawable鍥炬爣璧勬簮鐨刬d - public int getIconId(Context mContext, String icon){ - int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; - if(i>0){ - Log.i(TAG,"Success to get drawable resoure"); - }else{ - Log.i(TAG,"Fail to get drawable resoure"); - } - return i; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - mWeatherItem = (WeatherItem) getArguments().getSerializable(ARG_ITEM); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_weather_detail,container,false); - if(getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).getString("unit","鎽勬皬搴")=="鍗庢皬搴"){ - unit_text = "鈩"; - } - - mDeatilDate = (TextView) v.findViewById(R.id.detail_date); - mDetailMaxTemp = (TextView) v.findViewById(R.id.detail_max_temp); - mDetailMinTemp = (TextView) v.findViewById(R.id.detail_min_temp); - mDetialIcon = (ImageView) v.findViewById(R.id.detail_icon); - mDetailHumidity = (TextView) v.findViewById(R.id.detail_humidity); - mDetailPressure = (TextView) v.findViewById(R.id.detail_pressure); - mDetailWind = (TextView) v.findViewById(R.id.detail_wind); - mDetailDesc = (TextView) v.findViewById(R.id.detail_desc); - - mDeatilDate.setText(mWeatherItem.getData()); - mDetailMaxTemp.setText(mWeatherItem.getMax_temp()+unit_text); - mDetailMinTemp.setText(mWeatherItem.getMin_temp()+unit_text); - String icon = "a"+mWeatherItem.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mDetialIcon.setImageDrawable(drawable); - mDetailHumidity.setText("Humidity: "+mWeatherItem.getHumidity()+" %"); - mDetailPressure.setText("Pressure: "+mWeatherItem.getPressure()+" hPa"); - mDetailWind.setText("Wind: "+mWeatherItem.getWind()+" km/h SE"); - mDetailDesc.setText(mWeatherItem.getText()); - - return v; - } - - public String createMessage(){ - String message = ""; - message += "浠婂ぉ鐨勫ぉ姘旂姸鍐典负锛"+mWeatherItem.getText(); - message += " 浠婂ぉ鐨勬渶楂樻俯搴︽槸锛 "+mWeatherItem.getMax_temp(); - message += " 浠婂ぉ鐨勬渶浣庢俯搴︽槸锛 "+mWeatherItem.getMin_temp(); - message += " 浠婂ぉ鐨勬箍搴︿负锛 "+mWeatherItem.getHumidity(); - message += " 浠婂ぉ鐨勯閫熶负锛"+mWeatherItem.getWind(); - message += " 浠婂ぉ鐨勬皵鍘嬩负锛"+mWeatherItem.getPressure(); - message += " 甯屾湜鎮ㄦ嫢鏈夌編濂界殑涓澶!"; - return message; - } - - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - if(getActivity().findViewById(R.id.fragment_container)==null){ //鏄墜鏈烘ā寮 - inflater.inflate(R.menu.fragment_detail,menu); - } - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - switch (item.getItemId()){ - case R.id.menu_setting: - Intent intent = new Intent(getActivity(),SettingActivity.class); - startActivity(intent); - return true; - case R.id.menu_share: - Intent i = new Intent(Intent.ACTION_SEND); - i.setType("text/plain"); - i.putExtra(Intent.EXTRA_TEXT,createMessage()); - startActivity(i); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java deleted file mode 100644 index 81c9a71..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.example.myapplication.weather; - -import android.app.Activity; -import android.content.ContentValues; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.graphics.drawable.Drawable; -import android.net.ConnectivityManager; -import android.net.Uri; -import android.os.AsyncTask; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.example.myapplication.R; - -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - -public class WeatherFragment extends Fragment { - private static final String TAG="WeatherFragment"; - private RecyclerView mWeatherRecyclerView; - //浠婃棩澶╂皵鏉垮潡 - private TextView mTodayTime; - private TextView mTodayMaxTemp; - private TextView mTodayMinTemp; - private ImageView mTodayIcon; - private TextView mTodayIconDesc; - - private String location = "鍖椾含"; //璁板綍褰撳墠鐨勫煄甯侷D锛屽鏋滄湁鍙樺寲锛岄渶瑕佸埛鏂颁綘椤甸潰 - private String temp_unit = "鎽勬皬搴"; - private String unit_text = "掳"; - private List mItems = new ArrayList<>(); //涓冨ぉ鐨勫ぉ姘旇鎯呭璞 - - private Callbacks mCallbacks; - - private SQLiteDatabase mDatabase; - - public static WeatherFragment newInstance(){ - return new WeatherFragment(); - } - - /*鍥炶皟鍑芥暟锛宖ragment璋冪敤activity鐨勫嚱鏁帮紝杩欐牱鐐瑰嚮鍒楄〃鍚庯紝鏂逛究鍑哄彂浜嬩欢锛屼笉搴旇鐢╢ragment鎵ц鍏朵粬fragment鐨勭粏鑺*/ - public interface Callbacks{ - void onWeatherSelected(WeatherItem weatherItem); - } - - public static Intent newIntent(Context context){ - Intent i = new Intent(context, MainActivity1.class); - return i; - } - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - mCallbacks = (Callbacks)activity; - } - - @Override - public void onDetach() { - super.onDetach(); - mCallbacks = null; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); - setRetainInstance(true); - - //璁剧疆鍏朵粬閫夐」锛岃manager鐭ラ亾fragment鏇縜ctivity杩涜澶勭悊 - setHasOptionsMenu(true); - - //鍒涘缓鏁版嵁搴 - mDatabase = new DatabaseHelper(getActivity()).getWritableDatabase(); - - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_weather,container,false); - - mWeatherRecyclerView = (RecyclerView) v.findViewById(R.id.fragment_weather_recycler_view); - mWeatherRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); - - //缁戝畾浠婃棩澶╂皵妯″潡 - mTodayTime = (TextView)v.findViewById(R.id.today_time); - mTodayMaxTemp = (TextView)v.findViewById(R.id.today_max_temp); - mTodayMinTemp = (TextView)v.findViewById(R.id.today_min_temp); - mTodayIcon = (ImageView)v.findViewById(R.id.today_icon); - mTodayIconDesc = (TextView)v.findViewById(R.id.today_icon_desc); - return v; - } - - @Override - public void onResume() { - super.onResume(); - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - String city = pref.getString("city","鍖椾含"); - String unit = pref.getString("unit","鎽勬皬搴"); - String send = pref.getString("send","鏄"); - if(city!=location){ //鍦ㄩ噸鏂板惎鍔ㄩ〉闈㈢殑鏃跺欙紝濡傛灉鍦板潃鏀瑰彉浜嗭紝闇瑕佸埛鏂 - location = city; - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - return; - } - if(unit!=temp_unit){ //鍦ㄩ噸鏂板惎鍔ㄩ〉闈㈢殑鏃跺欙紝濡傛灉鍦板潃鏀瑰彉浜嗭紝闇瑕佸埛鏂 - temp_unit = unit; - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - return; - } - if (send=="鏄"){ - //寮鍚悗鍙版湇鍔★紝鍚姩瀹氭椂鍣紝鍙戦侀氱煡娑堟伅 - NotificationService.setServiceAlarm(getActivity(),true); - }else{ - NotificationService.setServiceAlarm(getActivity(),false); - } - } - - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.fragment_weather,menu); - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - switch (item.getItemId()){ - case R.id.menu_setting: - Intent intent = new Intent(getActivity(),SettingActivity.class); - startActivity(intent); - return true; - case R.id.menu_map: - //璋冪敤鑵捐鍦板浘 - Intent intent_txmap = new Intent(); - System.out.println("lat is :"+pref.getString("lat","39.90498")); - System.out.println("lon is :"+pref.getString("lon","116.40528")); - intent_txmap.setData(Uri.parse("qqmap://map/geocoder?coord="+ - pref.getString("lat","39.90498")+ - "," +pref.getString("lon","116.40528")+ - "&referer=BJWBZ-EXJ3U-IUGV4-4A74J-754OJ-KXFVX")); - startActivity(intent_txmap); - } - return super.onOptionsItemSelected(item); - } - - //鑾峰彇drawable鍥炬爣璧勬簮鐨刬d - public int getIconId(Context mContext, String icon){ - int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; - if(i>0){ - //Log.i(TAG,"Success to get drawable resoure"); - }else{ - Log.i(TAG,"Fail to get drawable resoure"); - } - return i; - } - - // 寮傛浠嶶RL鑾峰彇澶╂皵瀵硅薄 - private class FetchItemsTask extends AsyncTask> { - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - String city = pref.getString("city","鍖椾含"); - String unit = pref.getString("unit","鎽勬皬搴"); - String city_url = "https://geoapi.qweather.com/v2/city/lookup?location="+city+"&key=6b01a87a7f3347a19c7b6b84f2ba35e3"; - - @Override - protected List doInBackground(Void... voids) { - List weatherItems = new ArrayList<>(); - unit_text = "掳"; - if(unit=="鍗庢皬搴"){ - unit_text = "鈩"; - } - - System.out.println("network is :"+isNetworkConnected(getActivity().getApplicationContext())); - //濡傛灉娌℃湁缃戠粶杩炴帴锛屼粠鏁版嵁搴撹幏鍙栦俊鎭 - if(!isNetworkConnected(getActivity().getApplicationContext())){ - Cursor cursor = mDatabase.query ("weather",null,null,null,null,null,null); - cursor.moveToFirst(); - for(int i=0;i weatherItems) { - mItems = weatherItems; - - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting", Context.MODE_PRIVATE).edit(); - - //瀹炵幇浠婂ぉ澶╂皵閮ㄥ垎鐨刄I - WeatherItem item = mItems.get(0); - mTodayTime.setText("Today,"+location); - mTodayMaxTemp.setText(item.getMax_temp()+unit_text); - editor.putString("max_temp",item.getMax_temp()); - mTodayMinTemp.setText(item.getMin_temp()+unit_text); - editor.putString("min_temp",item.getMin_temp()); - mTodayIconDesc.setText(item.getText()); - editor.putString("text",item.getText()); - String icon = "a"+item.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mTodayIcon.setImageDrawable(drawable); - - editor.commit(); - - //瀹炵幇recyclerview閮ㄥ垎鐨刄I - setupAdapter(); - - //濡傛灉鏄痠pad锛屽氨鎵嬪姩鏇存柊璇︽儏椤甸潰 - if(getActivity().findViewById(R.id.detail_container)!=null){ - mCallbacks.onWeatherSelected(item); - } - } - } - - public class WeatherHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ - private WeatherItem mWeatherItem; - private TextView mItemMaxWeather; - private TextView mItemMinWeather; - private ImageView mItemIcon; - private TextView mItemDate; - private TextView mItemDesc; - - public void setDay(String day){ - mItemDate.setText(day); - } - - public WeatherHolder(View itemView){ - super(itemView); - itemView.setOnClickListener(this); - mItemMaxWeather = (TextView) itemView.findViewById(R.id.item_max_weather); - mItemMinWeather = (TextView) itemView.findViewById(R.id.item_min_weather); - mItemIcon = (ImageView) itemView.findViewById(R.id.item_icon); - mItemDate = (TextView) itemView.findViewById(R.id.item_date); - mItemDesc = (TextView) itemView.findViewById(R.id.item_desc); - } - - public void bindWeatherItem(WeatherItem weatherItem){ - mWeatherItem = weatherItem; - mItemMaxWeather.setText(weatherItem.getMax_temp()+unit_text); - mItemMinWeather.setText(weatherItem.getMin_temp()+unit_text); - String icon = "a"+weatherItem.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mItemIcon.setImageDrawable(drawable); - mItemDate.setText(weatherItem.getData()); - mItemDesc.setText(weatherItem.getText()); - } - - //鐐瑰嚮鍒楄〃锛岃烦杞埌璇︽儏椤甸潰 - @Override - public void onClick(View v) { - Log.i(TAG,"click"); - mCallbacks.onWeatherSelected(mWeatherItem); - } - } - - private class WeatherAdaper extends RecyclerView.Adapter{ - private List mWeatherList = new ArrayList<>(); - - public WeatherAdaper(List items){ - mWeatherList = items; - } - - @Override - public int getItemCount() { - return mWeatherList.size(); - } - - @Override - public WeatherHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - //瀹炰緥鍖杕ars_item甯冨眬 - LayoutInflater inflater = LayoutInflater.from(getActivity()); - View view = inflater.inflate(R.layout.weather_item,parent,false); - return new WeatherHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull WeatherHolder holder, int position) { - WeatherItem weatherItem = mWeatherList.get(position); - holder.bindWeatherItem(weatherItem); - if(position==0){ - holder.setDay("Today"); - } - if(position==1){ - holder.setDay("Tomorrow"); - } - } - } - - private void setupAdapter(){ - if(isAdded()){ - mWeatherRecyclerView.setAdapter(new WeatherAdaper(mItems)); - } - } - - //鍒ゆ柇缃戠粶鏄惁杩炴帴 - public boolean isNetworkConnected(Context context) { - ConnectivityManager cm = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); - boolean isNetworkAvailable = cm.getActiveNetwork() != null; - boolean isNetworkConnected = isNetworkAvailable && cm.getActiveNetworkInfo().isConnected(); - return isNetworkConnected; - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java deleted file mode 100644 index b6b33f9..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.example.myapplication.weather; - -import java.io.Serializable; - -public class WeatherItem implements Serializable { - private String data; //澶╂皵鏃ユ湡 - private String max_temp; //鏈楂樻俯搴 - private String min_temp; //鏈浣庢俯搴 - private String text; //澶╂皵鎻忚堪 - private String humidity; //閫傚害 - private String pressure; //姘斿帇 - private String wind; //椋庡姏 - private String icon; //鍥炬爣 - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public String getMax_temp() { - return max_temp; - } - - public void setMax_temp(String max_temp) { - this.max_temp = max_temp; - } - - public String getMin_temp() { - return min_temp; - } - - public void setMin_temp(String min_temp) { - this.min_temp = min_temp; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String getHumidity() { - return humidity; - } - - public void setHumidity(String humidity) { - this.humidity = humidity; - } - - public String getPressure() { - return pressure; - } - - public void setPressure(String pressure) { - this.pressure = pressure; - } - - public String getWind() { - return wind; - } - - public void setWind(String wind) { - this.wind = wind; - } -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yijiantong.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yijiantong.java deleted file mode 100644 index 0241c47..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yijiantong.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.provider.ContactsContract; -import android.view.View; -import android.widget.Button; - -public class yijiantong extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_yijiantong); - if (shouldAskPermissions()) { - askPermissions(); - } - - - Button button1 = findViewById(R.id.button1); - //鐐瑰嚮 - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000067&chInfo=ch_desktop&url=https%3A%2F%2F68687564.h5app.alipay.com%2Fwww%2Findex.html"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - - Button button2 = findViewById(R.id.button2); - //鐐瑰嚮 - button2.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=2021002170600786"); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(intent); - - } - }); - Button button3 = findViewById(R.id.button3); - //鐐瑰嚮 - button3.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=2021001123608001"); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(intent); - - } - }); - Button button4 = findViewById(R.id.button4); - //鐐瑰嚮 - button4.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=10000007"); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - startActivity(intent); - - } - }); - - - Button button5 = findViewById(R.id.button5); - //鐐瑰嚮 - button5.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri1 = Uri.parse("alipayqr://platformapi/startapp?saId=20000056"); - Intent intent1 = new Intent(Intent.ACTION_VIEW, uri1); - startActivity(intent1); - - } - }); - Button button6 = findViewById(R.id.button6); - //鐐瑰嚮 - button6.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri2 = Uri.parse("alipayqr://platformapi/startapp?saId=20000123"); - Intent intent2 = new Intent(Intent.ACTION_VIEW, uri2); - startActivity(intent2); - - } - }); - Button button7 = findViewById(R.id.button8); - //鐐瑰嚮 - button7.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent addIntent = new Intent(Intent.ACTION_INSERT, Uri.withAppendedPath(Uri.parse("content://com.android.contacts"), "contacts")); - addIntent.setType("vnd.android.cursor.dir/person"); - addIntent.setType("vnd.android.cursor.dir/contact"); - addIntent.setType("vnd.android.cursor.dir/raw_contact"); - boolean number = false; - addIntent.putExtra(ContactsContract.Intents.Insert.NAME, number); - - boolean numberForNewConstant = false; - addIntent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, numberForNewConstant); - startActivity(addIntent); - - } - }); - Button button8 = findViewById(R.id.button7); - //鐐瑰嚮 - button8.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - //璋冪敤绯荤粺鏂规硶鎷ㄦ墦鐢佃瘽 - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_CALL); - intent.setData(Uri.parse("tel:" + "15607989193")); - startActivity(intent); - } - }); - - - - } - - private boolean askPermissions() { - return (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1); - } - - private boolean shouldAskPermissions() { - String[] permissions = { - "android.permission.CALL_PHONE" - }; - int requestCode = 200; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - requestPermissions(permissions, requestCode); - } - return true; - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java deleted file mode 100644 index d34e570..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java +++ /dev/null @@ -1,450 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; - -import android.Manifest; -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.os.Environment; -import android.os.Handler; -import android.os.Message; -import android.provider.ContactsContract; -import android.util.Log; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; -import android.widget.Toast; - -import com.iflytek.cloud.ErrorCode; -import com.iflytek.cloud.InitListener; -import com.iflytek.cloud.RecognizerListener; -import com.iflytek.cloud.RecognizerResult; -import com.iflytek.cloud.SpeechConstant; -import com.iflytek.cloud.SpeechError; -import com.iflytek.cloud.SpeechRecognizer; -import com.iflytek.cloud.ui.RecognizerDialog; -import com.iflytek.cloud.ui.RecognizerDialogListener; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; - -public class yuyin extends AppCompatActivity implements View.OnClickListener { - - private static final String TAG = "MainActivity"; - - private SpeechRecognizer mIat;// 语音听写对象 - private RecognizerDialog mIatDialog;// 语音听写UI - - // 用HashMap存储听写结果 - private HashMap mIatResults = new LinkedHashMap(); - - private SharedPreferences mSharedPreferences;//缓存 - - private String mEngineType = SpeechConstant.TYPE_CLOUD;// 引擎类型 - private String language = "zh_cn";//识别语言 - - private TextView tvResult;//识别结果 - private Button btnStart;//开始识别 - private String resultType = "json";//结果内容数据格式 - private Button go; - private TextView tvResult1; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_yuyin); - tvResult = findViewById(R.id.tv_result); - btnStart = findViewById(R.id.btn_start); - go=findViewById(R.id.go); - btnStart.setOnClickListener(this); - tvResult1=findViewById(R.id.tv_result1); - - initPermission();//权限请求 - - - // 使用SpeechRecognizer对象,可根据回调消息自定义界面; - mIat = SpeechRecognizer.createRecognizer(yuyin.this, mInitListener); - // 使用UI听写功能,请根据sdk文件目录下的notice.txt,放置布局文件和图片资源 - mIatDialog = new RecognizerDialog(yuyin.this, mInitListener); - mSharedPreferences = getSharedPreferences("ASR", - Activity.MODE_PRIVATE); - } - - @Override - public void onClick(View v) { - if( null == mIat ){ - // 创建单例失败,与 21001 错误为同样原因,参考 http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=9688 - showMsg( "创建对象失败,请确认 libmsc.so 放置正确,且有调用 createUtility 进行初始化" ); - return; - } - - mIatResults.clear();//清除数据 - setParam(); // 设置参数 - mIatDialog.setListener(mRecognizerDialogListener);//设置监听 - mIatDialog.show();// 显示对话框 - } - - - /** - * 初始化监听器。 - */ - private InitListener mInitListener = new InitListener() { - - @Override - public void onInit(int code) { - Log.d(TAG, "SpeechRecognizer init() code = " + code); - if (code != ErrorCode.SUCCESS) { - showMsg("初始化失败,错误码:" + code + ",请点击网址https://www.xfyun.cn/document/error-code查询解决方案"); - } - } - }; - - - /** - * 听写UI监听器 - */ - private RecognizerDialogListener mRecognizerDialogListener = new RecognizerDialogListener() { - public void onResult(RecognizerResult results, boolean isLast) { - - printResult(results);//结果数据解析 - printButton(results); - - } - - /** - * 识别回调错误. - */ - public void onError(SpeechError error) { - showMsg(error.getPlainDescription(true)); - } - - }; - - /** - * 数据解析 - * - * @param results - */ - private void printResult(RecognizerResult results) { - String text = JsonParser.parseIatResult(results.getResultString()); - - String sn = null; - // 读取json结果中的sn字段 - try { - JSONObject resultJson = new JSONObject(results.getResultString()); - sn = resultJson.optString("sn"); - } catch (JSONException e) { - e.printStackTrace(); - } - - mIatResults.put(sn, text); - - StringBuffer resultBuffer = new StringBuffer(); - for (String key : mIatResults.keySet()) { - resultBuffer.append(mIatResults.get(key)); - } - - tvResult.setText(resultBuffer.toString());//听写结果显示 - - } - private void printButton(RecognizerResult results) { - String text = JsonParser.parseIatResult(results.getResultString()); - - String sn = null; - // 读取json结果中的sn字段 - try { - JSONObject resultJson = new JSONObject(results.getResultString()); - sn = resultJson.optString("sn"); - } catch (JSONException e) { - e.printStackTrace(); - } - - mIatResults.put(sn, text); - - StringBuffer resultBuffer = new StringBuffer(); - for (String key : mIatResults.keySet()) { - resultBuffer.append(mIatResults.get(key)); - } - if(resultBuffer.toString().equals("健康。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000067&chInfo=ch_desktop&url=https%3A%2F%2F68687564.h5app.alipay.com%2Fwww%2Findex.html"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("行程。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=2021002170600786"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("核酸检测。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=2021001123608001"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("扫码付款。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=10000007"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("付款码。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000056"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("收款码。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000123"); - Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); - startActivity(intent10); - - } - }); - } - else if(resultBuffer.toString().equals("设置常用联系人。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent addIntent = new Intent(Intent.ACTION_INSERT, Uri.withAppendedPath(Uri.parse("content://com.android.contacts"), "contacts")); - addIntent.setType("vnd.android.cursor.dir/person"); - addIntent.setType("vnd.android.cursor.dir/contact"); - addIntent.setType("vnd.android.cursor.dir/raw_contact"); - boolean number = false; - addIntent.putExtra(ContactsContract.Intents.Insert.NAME, number); - - boolean numberForNewConstant = false; - addIntent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, numberForNewConstant); - startActivity(addIntent); - - } - }); - } - else if(resultBuffer.toString().equals("呼叫。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_CALL); - intent.setData(Uri.parse("tel:" + "15607989193")); - startActivity(intent); - - } - }); - } - else if(resultBuffer.toString().equals("一键通。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent1=new Intent(yuyin.this,yijiantong.class); - startActivity(intent1);; - - } - }); - } - else if(resultBuffer.toString().equals("找寻。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent1=new Intent(yuyin.this,zhaoxun.class); - startActivity(intent1);; - - } - }); - } - else if(resultBuffer.toString().equals("健康。")){ - Button button1 = findViewById(R.id.go); - tvResult1.setText(resultBuffer.toString()); - - button1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Intent intent1=new Intent(yuyin.this,jiankang.class); - startActivity(intent1);; - - } - }); - } - else{ - - } - - - - - - } - - /** - * 参数设置 - * - * @return - */ - public void setParam() { - // 清空参数 - mIat.setParameter(SpeechConstant.PARAMS, null); - // 设置听写引擎 - mIat.setParameter(SpeechConstant.ENGINE_TYPE, mEngineType); - // 设置返回结果格式 - mIat.setParameter(SpeechConstant.RESULT_TYPE, resultType); - - if (language.equals("zh_cn")) { - String lag = mSharedPreferences.getString("iat_language_preference", - "mandarin"); - Log.e(TAG, "language:" + language);// 设置语言 - mIat.setParameter(SpeechConstant.LANGUAGE, "zh_cn"); - // 设置语言区域 - mIat.setParameter(SpeechConstant.ACCENT, lag); - } else { - - mIat.setParameter(SpeechConstant.LANGUAGE, language); - } - Log.e(TAG, "last language:" + mIat.getParameter(SpeechConstant.LANGUAGE)); - - //此处用于设置dialog中不显示错误码信息 - //mIat.setParameter("view_tips_plain","false"); - - // 设置语音前端点:静音超时时间,即用户多长时间不说话则当做超时处理 - mIat.setParameter(SpeechConstant.VAD_BOS, mSharedPreferences.getString("iat_vadbos_preference", "4000")); - - // 设置语音后端点:后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音 - mIat.setParameter(SpeechConstant.VAD_EOS, mSharedPreferences.getString("iat_vadeos_preference", "1000")); - - // 设置标点符号,设置为"0"返回结果无标点,设置为"1"返回结果有标点 - mIat.setParameter(SpeechConstant.ASR_PTT, mSharedPreferences.getString("iat_punc_preference", "1")); - - // 设置音频保存路径,保存音频格式支持pcm、wav,设置路径为sd卡请注意WRITE_EXTERNAL_STORAGE权限 - mIat.setParameter(SpeechConstant.AUDIO_FORMAT, "wav"); - mIat.setParameter(SpeechConstant.ASR_AUDIO_PATH, Environment.getExternalStorageDirectory() + "/msc/iat.wav"); - } - - /** - * 提示消息 - * @param msg - */ - private void showMsg(String msg) { - Toast.makeText(yuyin.this, msg, Toast.LENGTH_SHORT).show(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - - if (null != mIat) { - // 退出时释放连接 - mIat.cancel(); - mIat.destroy(); - } - } - - - /** - * android 6.0 以上需要动态申请权限 - */ - private void initPermission() { - String permissions[] = {Manifest.permission.RECORD_AUDIO, - Manifest.permission.ACCESS_NETWORK_STATE, - Manifest.permission.INTERNET, - Manifest.permission.WRITE_EXTERNAL_STORAGE - }; - - ArrayList toApplyList = new ArrayList(); - - for (String perm : permissions) { - if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this, perm)) { - toApplyList.add(perm); - } - } - String tmpList[] = new String[toApplyList.size()]; - if (!toApplyList.isEmpty()) { - ActivityCompat.requestPermissions(this, toApplyList.toArray(tmpList), 123); - } - - } - - /** - * 权限申请回调,可以作进一步处理 - * - * @param requestCode - * @param permissions - * @param grantResults - */ - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - // 此处为android 6.0以上动态授权的回调,用户自行实现。 - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } - - -} diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java b/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java deleted file mode 100644 index 9853f8c..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.Toast; - -public class zhaoxun extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_zhaoxun); - Button buttonitem=findViewById(R.id.myitem); - Button buttonmap=findViewById(R.id.map); - buttonitem.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - /* Toast.makeText(zhaoxun.this,"姝e湪鎵撳紑鍦板浘",Toast.LENGTH_SHORT).show(); - Intent intent=new Intent(zhaoxun.this,MapActivity1.class); - startActivity(intent);*/ - Intent intent=new Intent(zhaoxun.this,itemfound.class); - startActivity(intent); - } - }); - buttonmap.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - Toast.makeText(zhaoxun.this,"姝e湪鎵撳紑鍦板浘",Toast.LENGTH_SHORT).show(); - Intent intent=new Intent(zhaoxun.this,MapActivity1.class); - startActivity(intent); - - } - }); - - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_detail.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_detail.xml deleted file mode 100644 index 8676b91..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_detail.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml deleted file mode 100644 index a0c89ed..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml - - ->>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml - - - - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_jiankang.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_jiankang.xml deleted file mode 100644 index 8226952..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_jiankang.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 24e19db..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main1.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main1.xml deleted file mode 100644 index dc30be7..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_main1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_map1.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_map1.xml deleted file mode 100644 index e939697..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_map1.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_setting.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_setting.xml deleted file mode 100644 index 5447e4d..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_setting.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_twopane.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_twopane.xml deleted file mode 100644 index 4396ba4..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_twopane.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_wnavi_guide.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_wnavi_guide.xml deleted file mode 100644 index cc26e01..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_wnavi_guide.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yijiantong.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yijiantong.xml deleted file mode 100644 index 36c211a..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yijiantong.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yuyin.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yuyin.xml deleted file mode 100644 index 4316595..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/activity_yuyin.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather.xml deleted file mode 100644 index 704e179..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml deleted file mode 100644 index 2e4cfc4..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/weather_item.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/weather_item.xml deleted file mode 100644 index 0fc4779..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/layout/weather_item.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cf..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cf..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/src/MyApplication/app/src/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values-night/themes.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values-night/themes.xml deleted file mode 100644 index 0cd3ba5..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/arrays.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/arrays.xml deleted file mode 100644 index 35c327a..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/arrays.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 鎽勬皬搴 - 鍗庢皬搴 - - - sheshidu - huashidu - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/colors.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/colors.xml deleted file mode 100644 index 6ffd33f..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - #FF6200EE - #FF6200EE - #D81B60 - #00BFFF - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/refs.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/refs.xml deleted file mode 100644 index c8f80fe..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/refs.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @layout/activity_main1 - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/strings.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/strings.xml deleted file mode 100644 index 3de1a39..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - My Application - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/styles.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/themes.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/values/themes.xml deleted file mode 100644 index 274275d..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/backup_rules.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/backup_rules.xml deleted file mode 100644 index fa0f996..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/backup_rules.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/data_extraction_rules.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/data_extraction_rules.xml deleted file mode 100644 index 9ee9997..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/data_extraction_rules.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/pref_setting.xml b/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/pref_setting.xml deleted file mode 100644 index 394a6db..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/main/res/xml/pref_setting.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.java b/src/MyApplication/app/src/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.java deleted file mode 100644 index bf43ee5..0000000 --- a/src/MyApplication/app/src/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.myapplication; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/build.gradle b/src/MyApplication/app/src/MyApplication/build.gradle deleted file mode 100644 index 90f9008..0000000 --- a/src/MyApplication/app/src/MyApplication/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '7.3.0' apply false - id 'com.android.library' version '7.3.0' apply false -} \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/gradle.properties b/src/MyApplication/app/src/MyApplication/gradle.properties deleted file mode 100644 index d6b8937..0000000 --- a/src/MyApplication/app/src/MyApplication/gradle.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -android.enableJetifier=true -# Enables namespacing of each library's R class so that its R class includes only the -# resources declared in the library itself and none from the library's dependencies, -# thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true -# ???gradle.properties????????? -#???????????????????androidX??????? \ No newline at end of file diff --git a/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.jar b/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c..0000000 Binary files a/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.properties b/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a4646a3..0000000 --- a/src/MyApplication/app/src/MyApplication/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Oct 03 10:56:04 CST 2022 -distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip -distributionPath=wrapper/dists -zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME diff --git a/src/MyApplication/app/src/MyApplication/gradlew b/src/MyApplication/app/src/MyApplication/gradlew deleted file mode 100644 index 4f906e0..0000000 --- a/src/MyApplication/app/src/MyApplication/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/src/MyApplication/app/src/MyApplication/gradlew.bat b/src/MyApplication/app/src/MyApplication/gradlew.bat deleted file mode 100644 index 107acd3..0000000 --- a/src/MyApplication/app/src/MyApplication/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/src/MyApplication/app/src/MyApplication/settings.gradle b/src/MyApplication/app/src/MyApplication/settings.gradle deleted file mode 100644 index f727bcc..0000000 --- a/src/MyApplication/app/src/MyApplication/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} -rootProject.name = "My Application" -include ':app' diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java b/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java deleted file mode 100644 index 232730e..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.example.myapplication; - -import androidx.appcompat.app.AppCompatActivity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; - -import com.baidu.mapapi.bikenavi.BikeNavigateHelper; -import com.baidu.mapapi.walknavi.adapter.IWRoutePlanListener; -import com.baidu.mapapi.walknavi.model.WalkRoutePlanError; -import com.baidu.mapapi.walknavi.params.*; -import com.baidu.mapapi.CoordType; -import com.baidu.mapapi.SDKInitializer; -import com.baidu.mapapi.model.LatLng; -import java.util.ArrayList; -import java.util.List; - -import android.widget.ImageButton; -import android.widget.TextView; -import android.annotation.SuppressLint; -import android.os.Bundle; -import com.baidu.baidunavis.BaiduNaviParams; -import com.baidu.mapapi.SDKInitializer; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.walknavi.WalkNavigateHelper; -import com.baidu.mapapi.walknavi.adapter.IWEngineInitListener; -import com.baidu.mapapi.walknavi.params.WalkNaviLaunchParam; - -public class itemfound extends AppCompatActivity { - private WalkNavigateHelper helper = null; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - //initPermissions(); // 鍒濆鍖栨潈闄 - setContentView(R.layout.activity_itemfound); // 濉厖瑙嗗浘 - - // 鐐瑰嚮鎸夐挳寮濮嬪鑸 - Button imageButton = findViewById(R.id.button_item_keys); - imageButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // 鍒濆鍖栨琛屽鑸 - startBikeNavi(); - } - }); - Button imageButtonwallet = findViewById(R.id.button_item_wallet); - imageButtonwallet.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - // 鍒濆鍖栨琛屽鑸 - startBikeNavi(); - } - }); - } - // 鍒濆鍖栨潈闄 - /* - private void initPermissions() { - if (Build.VERSION.SDK_INT >= 23) { - ArrayList permissionsList = new ArrayList<>(); - String[] permissions = { - Manifest.permission.ACCESS_NETWORK_STATE, - Manifest.permission.INTERNET, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - }; - - for (String perm : permissions) { - if (PackageManager.PERMISSION_GRANTED != checkSelfPermission(perm)) { - permissionsList.add(perm); - // 杩涘叆鍒拌繖閲屼唬琛ㄦ病鏈夋潈闄. - } - if (!permissionsList.isEmpty()) { - String[] strings = new String[permissionsList.size()]; - requestPermissions(permissionsList.toArray(strings), 0); - } - } - - } - }*/ - private void startBikeNavi() { - //Log.d("=========", "startBikeNavi"); - try { - helper = WalkNavigateHelper.getInstance(); - helper.initNaviEngine(this, new IWEngineInitListener() { - @Override - public void engineInitSuccess() { - // Log.d("=========", "BikeNavi engineInitSuccess寮曟搸鍒濆鍖栨垚鍔"); - startWebNavi(); - } - - @Override - public void engineInitFail() { - // Log.d("=========", "BikeNavi engineInitFail"); - BikeNavigateHelper.getInstance().unInitNaviEngine(); - } - }); - } catch (Exception e) { - // Log.d("=========", "startBikeNavi Exception"); - e.printStackTrace(); - } - } - private void startWebNavi() { - //璧风粓鐐逛綅缃 - LatLng walkStartNode = new LatLng(39.110132, 117.358512); - LatLng walkEndNode = new LatLng(39.111348, 117.358940); - - WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); - startNode.setLocation(walkStartNode); - WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); - endNode.setLocation(walkEndNode); - // 瀹樼綉 - //鏋勯燱alkNaviLaunchParam - WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); - //鑾峰彇WalkNavigateHelper瀹炰緥 //鍙戣捣绠楄矾 - helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { - @Override - public void onRoutePlanStart() { - // Log.d("=======", "WalkNavi onRoutePlanStart寮濮嬫琛屽鑸"); - } - - @Override - public void onRoutePlanSuccess() { - // Log.d("========", "onRoutePlanSuccess绠楄矾鎴愬姛"); - Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); - // intent.setClass(getContext(), WNaviGuideActivity.class); - startActivity(intent); - } - - @Override - public void onRoutePlanFail(WalkRoutePlanError error) { -// Log.d("Walk", "WalkNavi onRoutePlanFail"); - } - - }); - } - - -/* - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_itemfound); - Button find_wallet=findViewById(R.id.button_item_wallet); - Button find_keys=findViewById(R.id.button_item_keys); - find_wallet.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - double locationX; - double locationy; - //BaiduMapNavigation - - - } - }); - find_keys.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) {//Intent - //NaviParaOption para=new Navi(); - - } - }); - }*/ private void startBikeNavi1() { - //Log.d("=========", "startBikeNavi"); - try { - helper = WalkNavigateHelper.getInstance(); - helper.initNaviEngine(this, new IWEngineInitListener() { - @Override - public void engineInitSuccess() { - // Log.d("=========", "BikeNavi engineInitSuccess寮曟搸鍒濆鍖栨垚鍔"); - startWebNavi1(); - } - - @Override - public void engineInitFail() { - // Log.d("=========", "BikeNavi engineInitFail"); - BikeNavigateHelper.getInstance().unInitNaviEngine(); - } - }); - } catch (Exception e) { - // Log.d("=========", "startBikeNavi Exception"); - e.printStackTrace(); - } -} - private void startWebNavi1() { - //璧风粓鐐逛綅缃 - LatLng walkStartNode = new LatLng(39.110132, 117.358512); - LatLng walkEndNode = new LatLng(39.112286, 117.359619); - - WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); - startNode.setLocation(walkStartNode); - WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); - endNode.setLocation(walkEndNode); - // 瀹樼綉 - //鏋勯燱alkNaviLaunchParam - WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); - //鑾峰彇WalkNavigateHelper瀹炰緥 //鍙戣捣绠楄矾 - helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { - @Override - public void onRoutePlanStart() { - // Log.d("=======", "WalkNavi onRoutePlanStart寮濮嬫琛屽鑸"); - } - - @Override - public void onRoutePlanSuccess() { - // Log.d("========", "onRoutePlanSuccess绠楄矾鎴愬姛"); - Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); - // intent.setClass(getContext(), WNaviGuideActivity.class); - startActivity(intent); - } - - @Override - public void onRoutePlanFail(WalkRoutePlanError error) { -// Log.d("Walk", "WalkNavi onRoutePlanFail"); - } - - }); - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java deleted file mode 100644 index 95deb0b..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -public class DatabaseHelper extends SQLiteOpenHelper { - private static final int VERSION = 1; - private static final String NAME = "weather"; - - public DatabaseHelper(Context context){ - super(context,NAME,null,VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL("create table weather (_id INTEGER PRIMARY KEY AUTOINCREMENT,date text,max_temp text,min_temp text,text text,humidity text,pressure text,wind text,icon text)"); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - - } -} \ No newline at end of file diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java deleted file mode 100644 index 670e37f..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.example.myapplication.weather; - -import android.util.Log; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -//鑾峰彇鏁版嵁鐨勪簩杩涘埗鏁扮粍/瀛楃涓插舰寮 -//鑾峰彇JSON鏁扮粍 -//瑙f瀽JSON鏁扮粍锛屽彉鎴怶eatherItem鐨勬暟缁勫舰寮 - -public class FlickrFetcher { - public static final String TAG = "FlickrFetcher"; - - public byte[] getUrlBytes(String urlSpec) throws Exception{ - URL url = new URL(urlSpec); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); -// connection.setInstanceFollowRedirects(false); //璺熻釜閲嶅畾鍚 -// String redirect = connection.getHeaderField("Location"); -// if (redirect != null){ -// connection = (HttpURLConnection)new URL(redirect).openConnection(); -// } - - try{ - ByteArrayOutputStream out = new ByteArrayOutputStream(); - InputStream in = connection.getInputStream(); - - if(connection.getResponseCode() != HttpURLConnection.HTTP_OK){ - throw new IOException(connection.getResponseMessage() + " :with "+urlSpec); - } - - int bytesRead = 0; - byte[] buffer = new byte[1024]; - while((bytesRead = in.read(buffer)) > 0){ - out.write(buffer,0,bytesRead); - } - out.close(); - return out.toByteArray(); - }finally { - connection.disconnect(); - } - } - - public String getUrlString(String urlSpec)throws Exception{ - return new String(getUrlBytes(urlSpec)); - } - - public List fetchItems(String urlSpec){ - List items = new ArrayList<>(); - try{ - String jsonString = getUrlString(urlSpec); - Log.i(TAG,"result: "+jsonString); - JSONObject jsonBody = new JSONObject(jsonString); - parseItems(items,jsonBody); - }catch (Exception e){ - Log.i(TAG,"Failed!"+e); - } - return items; - } - - public JSONObject fetchCity(String urlSpec){ - String locationID = ""; - JSONObject jsonObject = null; - try{ - String jsonString = getUrlString(urlSpec); - Log.i(TAG,"result: "+jsonString); - JSONObject jsonBody = new JSONObject(jsonString); - JSONArray locationJsonArray = jsonBody.getJSONArray("location"); - jsonObject = locationJsonArray.getJSONObject(0); -// locationID = locationJsonArray.getJSONObject(0).getString("id"); -// String lat = locationJsonArray.getJSONObject(0).getString("lat"); -// String lon = locationJsonArray.getJSONObject(0).getString("lon"); - }catch (Exception e){ - Log.i(TAG,"Failed!"+e); - } - return jsonObject; - } - - private void parseItems(List items,JSONObject jsonBody) throws Exception{ //灏嗕粠url鑾峰緱鐨刯son杞崲鎴怣arsItem - JSONArray weatherJsonArray = jsonBody.getJSONArray("daily"); - for(int i=0;i= Build.VERSION_CODES.O) { - NotificationChannel channel = new NotificationChannel("to-do" - , "寰呭姙娑堟伅", - NotificationManager.IMPORTANCE_HIGH); - channel.enableVibration(true); - channel.setVibrationPattern(new long[]{500}); - notificationManager.createNotificationChannel(channel); - builder.setChannelId("to-do"); - notification = builder.build(); - } else { - notification = builder.build(); - } - - notificationManager.notify(0,notification); - System.out.println(notification); - } - - public static void setServiceAlarm(Context context,boolean isOn){ - Intent i = NotificationService.newIntent(context); - PendingIntent pi = PendingIntent.getService(context,0,i,0); - - AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - - if(isOn){ - alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), - NOTIFICATION_INTERVAL,pi); - }else{ - alarmManager.cancel(pi); - pi.cancel(); - } - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java deleted file mode 100644 index 8b9f5b7..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.DialogInterface; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.View; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; - -import com.example.myapplication.R; - -public class SettingActivity extends AppCompatActivity { - private EditText location; - private TextView unit_text; - private TextView send_text; - private LinearLayout page; - private LinearLayout unit; - private LinearLayout send; - private String city; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_setting); - - location = (EditText) findViewById(R.id.location); - unit = (LinearLayout)findViewById(R.id.unit); - page = (LinearLayout)findViewById(R.id.page); - unit_text = (TextView)findViewById(R.id.unit_text); - send = (LinearLayout)findViewById(R.id.send); - send_text = (TextView)findViewById(R.id.send_text); - - SharedPreferences pref = getSharedPreferences("setting",MODE_PRIVATE); - location.setText(pref.getString("city","鍖椾含")); - unit_text.setText(pref.getString("unit","鎽勬皬搴")); - send_text.setText(pref.getString("send","鏄")); - - page.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - location.clearFocus(); - } - }); - - location.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - city = s.toString(); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("city",city); - editor.commit(); - } - - @Override - public void afterTextChanged(Editable s) { - - } - }); - - unit.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - click(); - } - }); - - send.setOnClickListener(new View.OnClickListener(){ - public void onClick(View v){ - click2(); - } - }); - } - - //鐐瑰嚮鎸夐挳寮瑰嚭涓涓崟閫夊璇濇 - public void click() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("璇烽夋嫨娓╁害鍗曚綅"); - final String items[] = {"鎽勬皬搴","鍗庢皬搴"}; - -//-1浠h〃娌℃湁鏉$洰琚変腑 - builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - //1.鎶婇変腑鐨勬潯鐩彇鍑烘潵 - String item = items[which]; - Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); - unit_text.setText(item.toString()); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("unit",item.toString()); - editor.commit(); - //2.鐒跺悗鎶婂璇濇鍏抽棴 - dialog.dismiss(); - } - }); -//涓鏍疯show - builder.show(); - } - - public void click2() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("璇烽夋嫨鏄惁寮鍚氱煡"); - final String items[] = {"鏄","鍚"}; - -//-1浠h〃娌℃湁鏉$洰琚変腑 - builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - //1.鎶婇変腑鐨勬潯鐩彇鍑烘潵 - String item = items[which]; - Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); - send_text.setText(item.toString()); - SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); - editor.putString("send",item.toString()); - editor.commit(); - //2.鐒跺悗鎶婂璇濇鍏抽棴 - dialog.dismiss(); - } - }); -//涓鏍疯show - builder.show(); - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java deleted file mode 100644 index e9478b3..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.example.myapplication.weather; - -import android.os.Bundle; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; - -public abstract class SingleFragmentActivity extends AppCompatActivity { - protected abstract Fragment createFragment(); - protected abstract int getLayoutId(); - protected abstract int getFragmentId(); - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(getLayoutId()); - - FragmentManager fm = getSupportFragmentManager(); - Fragment fragment = fm.findFragmentById(getFragmentId()); - - if(fragment == null){ - fragment = createFragment(); - fm.beginTransaction(). - add(getFragmentId(),fragment) - .commit(); - } - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java deleted file mode 100644 index e98a864..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.content.Intent; - -import androidx.fragment.app.Fragment; - -import com.example.myapplication.R; - -public class WeatherDetailActivity extends SingleFragmentActivity{ - public static final String EXTRA_WEATHER_ITEM = "com.example.weather.weatherItem"; - - @Override - protected Fragment createFragment() { - WeatherItem weatherItem = (WeatherItem)getIntent().getSerializableExtra(EXTRA_WEATHER_ITEM); - return WeatherDetailFragment.newInstance(weatherItem); - } - - @Override - protected int getLayoutId() { - return R.layout.activity_detail; - } - - @Override - protected int getFragmentId() { - return R.id.detail_container; - } - - public static Intent newIntent(Context packageContext, WeatherItem weatherItem){ - Intent intent = new Intent(packageContext,WeatherDetailActivity.class); - intent.putExtra(EXTRA_WEATHER_ITEM,weatherItem); - return intent; - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java deleted file mode 100644 index 9dc2b31..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.example.myapplication.weather; - -import android.content.Context; -import android.content.Intent; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; - -import com.example.myapplication.R; - -public class WeatherDetailFragment extends Fragment { - private WeatherItem mWeatherItem; //鐢ㄦ潵璁剧疆UI - - private TextView mDeatilDate; - private TextView mDetailMaxTemp; - private TextView mDetailMinTemp; - private ImageView mDetialIcon; - private TextView mDetailDesc; - private TextView mDetailHumidity; - private TextView mDetailPressure; - private TextView mDetailWind; - - private static final String TAG = "WeatherDetailFragment"; - private static final String ARG_ITEM = "args_item"; - private String unit_text = "掳"; - - public static WeatherDetailFragment newInstance(WeatherItem weatherItem) { - Bundle args = new Bundle(); - args.putSerializable(ARG_ITEM,weatherItem); - WeatherDetailFragment fragment = new WeatherDetailFragment(); - fragment.setArguments(args); - return fragment; - } - - //鑾峰彇drawable鍥炬爣璧勬簮鐨刬d - public int getIconId(Context mContext, String icon){ - int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; - if(i>0){ - Log.i(TAG,"Success to get drawable resoure"); - }else{ - Log.i(TAG,"Fail to get drawable resoure"); - } - return i; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - mWeatherItem = (WeatherItem) getArguments().getSerializable(ARG_ITEM); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_weather_detail,container,false); - if(getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).getString("unit","鎽勬皬搴")=="鍗庢皬搴"){ - unit_text = "鈩"; - } - - mDeatilDate = (TextView) v.findViewById(R.id.detail_date); - mDetailMaxTemp = (TextView) v.findViewById(R.id.detail_max_temp); - mDetailMinTemp = (TextView) v.findViewById(R.id.detail_min_temp); - mDetialIcon = (ImageView) v.findViewById(R.id.detail_icon); - mDetailHumidity = (TextView) v.findViewById(R.id.detail_humidity); - mDetailPressure = (TextView) v.findViewById(R.id.detail_pressure); - mDetailWind = (TextView) v.findViewById(R.id.detail_wind); - mDetailDesc = (TextView) v.findViewById(R.id.detail_desc); - - mDeatilDate.setText(mWeatherItem.getData()); - mDetailMaxTemp.setText(mWeatherItem.getMax_temp()+unit_text); - mDetailMinTemp.setText(mWeatherItem.getMin_temp()+unit_text); - String icon = "a"+mWeatherItem.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mDetialIcon.setImageDrawable(drawable); - mDetailHumidity.setText("Humidity: "+mWeatherItem.getHumidity()+" %"); - mDetailPressure.setText("Pressure: "+mWeatherItem.getPressure()+" hPa"); - mDetailWind.setText("Wind: "+mWeatherItem.getWind()+" km/h SE"); - mDetailDesc.setText(mWeatherItem.getText()); - - return v; - } - - public String createMessage(){ - String message = ""; - message += "浠婂ぉ鐨勫ぉ姘旂姸鍐典负锛"+mWeatherItem.getText(); - message += " 浠婂ぉ鐨勬渶楂樻俯搴︽槸锛 "+mWeatherItem.getMax_temp(); - message += " 浠婂ぉ鐨勬渶浣庢俯搴︽槸锛 "+mWeatherItem.getMin_temp(); - message += " 浠婂ぉ鐨勬箍搴︿负锛 "+mWeatherItem.getHumidity(); - message += " 浠婂ぉ鐨勯閫熶负锛"+mWeatherItem.getWind(); - message += " 浠婂ぉ鐨勬皵鍘嬩负锛"+mWeatherItem.getPressure(); - message += " 甯屾湜鎮ㄦ嫢鏈夌編濂界殑涓澶!"; - return message; - } - - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - if(getActivity().findViewById(R.id.fragment_container)==null){ //鏄墜鏈烘ā寮 - inflater.inflate(R.menu.fragment_detail,menu); - } - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - switch (item.getItemId()){ - case R.id.menu_setting: - Intent intent = new Intent(getActivity(),SettingActivity.class); - startActivity(intent); - return true; - case R.id.menu_share: - Intent i = new Intent(Intent.ACTION_SEND); - i.setType("text/plain"); - i.putExtra(Intent.EXTRA_TEXT,createMessage()); - startActivity(i); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java deleted file mode 100644 index 81c9a71..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.example.myapplication.weather; - -import android.app.Activity; -import android.content.ContentValues; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.graphics.drawable.Drawable; -import android.net.ConnectivityManager; -import android.net.Uri; -import android.os.AsyncTask; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.example.myapplication.R; - -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - -public class WeatherFragment extends Fragment { - private static final String TAG="WeatherFragment"; - private RecyclerView mWeatherRecyclerView; - //浠婃棩澶╂皵鏉垮潡 - private TextView mTodayTime; - private TextView mTodayMaxTemp; - private TextView mTodayMinTemp; - private ImageView mTodayIcon; - private TextView mTodayIconDesc; - - private String location = "鍖椾含"; //璁板綍褰撳墠鐨勫煄甯侷D锛屽鏋滄湁鍙樺寲锛岄渶瑕佸埛鏂颁綘椤甸潰 - private String temp_unit = "鎽勬皬搴"; - private String unit_text = "掳"; - private List mItems = new ArrayList<>(); //涓冨ぉ鐨勫ぉ姘旇鎯呭璞 - - private Callbacks mCallbacks; - - private SQLiteDatabase mDatabase; - - public static WeatherFragment newInstance(){ - return new WeatherFragment(); - } - - /*鍥炶皟鍑芥暟锛宖ragment璋冪敤activity鐨勫嚱鏁帮紝杩欐牱鐐瑰嚮鍒楄〃鍚庯紝鏂逛究鍑哄彂浜嬩欢锛屼笉搴旇鐢╢ragment鎵ц鍏朵粬fragment鐨勭粏鑺*/ - public interface Callbacks{ - void onWeatherSelected(WeatherItem weatherItem); - } - - public static Intent newIntent(Context context){ - Intent i = new Intent(context, MainActivity1.class); - return i; - } - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - mCallbacks = (Callbacks)activity; - } - - @Override - public void onDetach() { - super.onDetach(); - mCallbacks = null; - } - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); - setRetainInstance(true); - - //璁剧疆鍏朵粬閫夐」锛岃manager鐭ラ亾fragment鏇縜ctivity杩涜澶勭悊 - setHasOptionsMenu(true); - - //鍒涘缓鏁版嵁搴 - mDatabase = new DatabaseHelper(getActivity()).getWritableDatabase(); - - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_weather,container,false); - - mWeatherRecyclerView = (RecyclerView) v.findViewById(R.id.fragment_weather_recycler_view); - mWeatherRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); - - //缁戝畾浠婃棩澶╂皵妯″潡 - mTodayTime = (TextView)v.findViewById(R.id.today_time); - mTodayMaxTemp = (TextView)v.findViewById(R.id.today_max_temp); - mTodayMinTemp = (TextView)v.findViewById(R.id.today_min_temp); - mTodayIcon = (ImageView)v.findViewById(R.id.today_icon); - mTodayIconDesc = (TextView)v.findViewById(R.id.today_icon_desc); - return v; - } - - @Override - public void onResume() { - super.onResume(); - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - String city = pref.getString("city","鍖椾含"); - String unit = pref.getString("unit","鎽勬皬搴"); - String send = pref.getString("send","鏄"); - if(city!=location){ //鍦ㄩ噸鏂板惎鍔ㄩ〉闈㈢殑鏃跺欙紝濡傛灉鍦板潃鏀瑰彉浜嗭紝闇瑕佸埛鏂 - location = city; - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - return; - } - if(unit!=temp_unit){ //鍦ㄩ噸鏂板惎鍔ㄩ〉闈㈢殑鏃跺欙紝濡傛灉鍦板潃鏀瑰彉浜嗭紝闇瑕佸埛鏂 - temp_unit = unit; - new FetchItemsTask().execute(); //寮傛鎵ц锛岃幏鍙栫綉绔欎笂鐨刯son鍐呭 - return; - } - if (send=="鏄"){ - //寮鍚悗鍙版湇鍔★紝鍚姩瀹氭椂鍣紝鍙戦侀氱煡娑堟伅 - NotificationService.setServiceAlarm(getActivity(),true); - }else{ - NotificationService.setServiceAlarm(getActivity(),false); - } - } - - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.fragment_weather,menu); - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - switch (item.getItemId()){ - case R.id.menu_setting: - Intent intent = new Intent(getActivity(),SettingActivity.class); - startActivity(intent); - return true; - case R.id.menu_map: - //璋冪敤鑵捐鍦板浘 - Intent intent_txmap = new Intent(); - System.out.println("lat is :"+pref.getString("lat","39.90498")); - System.out.println("lon is :"+pref.getString("lon","116.40528")); - intent_txmap.setData(Uri.parse("qqmap://map/geocoder?coord="+ - pref.getString("lat","39.90498")+ - "," +pref.getString("lon","116.40528")+ - "&referer=BJWBZ-EXJ3U-IUGV4-4A74J-754OJ-KXFVX")); - startActivity(intent_txmap); - } - return super.onOptionsItemSelected(item); - } - - //鑾峰彇drawable鍥炬爣璧勬簮鐨刬d - public int getIconId(Context mContext, String icon){ - int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; - if(i>0){ - //Log.i(TAG,"Success to get drawable resoure"); - }else{ - Log.i(TAG,"Fail to get drawable resoure"); - } - return i; - } - - // 寮傛浠嶶RL鑾峰彇澶╂皵瀵硅薄 - private class FetchItemsTask extends AsyncTask> { - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); - SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); - String city = pref.getString("city","鍖椾含"); - String unit = pref.getString("unit","鎽勬皬搴"); - String city_url = "https://geoapi.qweather.com/v2/city/lookup?location="+city+"&key=6b01a87a7f3347a19c7b6b84f2ba35e3"; - - @Override - protected List doInBackground(Void... voids) { - List weatherItems = new ArrayList<>(); - unit_text = "掳"; - if(unit=="鍗庢皬搴"){ - unit_text = "鈩"; - } - - System.out.println("network is :"+isNetworkConnected(getActivity().getApplicationContext())); - //濡傛灉娌℃湁缃戠粶杩炴帴锛屼粠鏁版嵁搴撹幏鍙栦俊鎭 - if(!isNetworkConnected(getActivity().getApplicationContext())){ - Cursor cursor = mDatabase.query ("weather",null,null,null,null,null,null); - cursor.moveToFirst(); - for(int i=0;i weatherItems) { - mItems = weatherItems; - - SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting", Context.MODE_PRIVATE).edit(); - - //瀹炵幇浠婂ぉ澶╂皵閮ㄥ垎鐨刄I - WeatherItem item = mItems.get(0); - mTodayTime.setText("Today,"+location); - mTodayMaxTemp.setText(item.getMax_temp()+unit_text); - editor.putString("max_temp",item.getMax_temp()); - mTodayMinTemp.setText(item.getMin_temp()+unit_text); - editor.putString("min_temp",item.getMin_temp()); - mTodayIconDesc.setText(item.getText()); - editor.putString("text",item.getText()); - String icon = "a"+item.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mTodayIcon.setImageDrawable(drawable); - - editor.commit(); - - //瀹炵幇recyclerview閮ㄥ垎鐨刄I - setupAdapter(); - - //濡傛灉鏄痠pad锛屽氨鎵嬪姩鏇存柊璇︽儏椤甸潰 - if(getActivity().findViewById(R.id.detail_container)!=null){ - mCallbacks.onWeatherSelected(item); - } - } - } - - public class WeatherHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ - private WeatherItem mWeatherItem; - private TextView mItemMaxWeather; - private TextView mItemMinWeather; - private ImageView mItemIcon; - private TextView mItemDate; - private TextView mItemDesc; - - public void setDay(String day){ - mItemDate.setText(day); - } - - public WeatherHolder(View itemView){ - super(itemView); - itemView.setOnClickListener(this); - mItemMaxWeather = (TextView) itemView.findViewById(R.id.item_max_weather); - mItemMinWeather = (TextView) itemView.findViewById(R.id.item_min_weather); - mItemIcon = (ImageView) itemView.findViewById(R.id.item_icon); - mItemDate = (TextView) itemView.findViewById(R.id.item_date); - mItemDesc = (TextView) itemView.findViewById(R.id.item_desc); - } - - public void bindWeatherItem(WeatherItem weatherItem){ - mWeatherItem = weatherItem; - mItemMaxWeather.setText(weatherItem.getMax_temp()+unit_text); - mItemMinWeather.setText(weatherItem.getMin_temp()+unit_text); - String icon = "a"+weatherItem.getIcon(); - int id = getIconId(getContext(),icon); - Drawable drawable = getResources().getDrawable(id); - mItemIcon.setImageDrawable(drawable); - mItemDate.setText(weatherItem.getData()); - mItemDesc.setText(weatherItem.getText()); - } - - //鐐瑰嚮鍒楄〃锛岃烦杞埌璇︽儏椤甸潰 - @Override - public void onClick(View v) { - Log.i(TAG,"click"); - mCallbacks.onWeatherSelected(mWeatherItem); - } - } - - private class WeatherAdaper extends RecyclerView.Adapter{ - private List mWeatherList = new ArrayList<>(); - - public WeatherAdaper(List items){ - mWeatherList = items; - } - - @Override - public int getItemCount() { - return mWeatherList.size(); - } - - @Override - public WeatherHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - //瀹炰緥鍖杕ars_item甯冨眬 - LayoutInflater inflater = LayoutInflater.from(getActivity()); - View view = inflater.inflate(R.layout.weather_item,parent,false); - return new WeatherHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull WeatherHolder holder, int position) { - WeatherItem weatherItem = mWeatherList.get(position); - holder.bindWeatherItem(weatherItem); - if(position==0){ - holder.setDay("Today"); - } - if(position==1){ - holder.setDay("Tomorrow"); - } - } - } - - private void setupAdapter(){ - if(isAdded()){ - mWeatherRecyclerView.setAdapter(new WeatherAdaper(mItems)); - } - } - - //鍒ゆ柇缃戠粶鏄惁杩炴帴 - public boolean isNetworkConnected(Context context) { - ConnectivityManager cm = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); - boolean isNetworkAvailable = cm.getActiveNetwork() != null; - boolean isNetworkConnected = isNetworkAvailable && cm.getActiveNetworkInfo().isConnected(); - return isNetworkConnected; - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java deleted file mode 100644 index b6b33f9..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.example.myapplication.weather; - -import java.io.Serializable; - -public class WeatherItem implements Serializable { - private String data; //澶╂皵鏃ユ湡 - private String max_temp; //鏈楂樻俯搴 - private String min_temp; //鏈浣庢俯搴 - private String text; //澶╂皵鎻忚堪 - private String humidity; //閫傚害 - private String pressure; //姘斿帇 - private String wind; //椋庡姏 - private String icon; //鍥炬爣 - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public String getMax_temp() { - return max_temp; - } - - public void setMax_temp(String max_temp) { - this.max_temp = max_temp; - } - - public String getMin_temp() { - return min_temp; - } - - public void setMin_temp(String min_temp) { - this.min_temp = min_temp; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String getHumidity() { - return humidity; - } - - public void setHumidity(String humidity) { - this.humidity = humidity; - } - - public String getPressure() { - return pressure; - } - - public void setPressure(String pressure) { - this.pressure = pressure; - } - - public String getWind() { - return wind; - } - - public void setWind(String wind) { - this.wind = wind; - } -} diff --git a/src/MyApplication/app/src/main/res/drawable/a100.png b/src/MyApplication/app/src/main/res/drawable/a100.png deleted file mode 100644 index e435546..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a100.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a101.png b/src/MyApplication/app/src/main/res/drawable/a101.png deleted file mode 100644 index 43f4ab2..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a101.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a102.png b/src/MyApplication/app/src/main/res/drawable/a102.png deleted file mode 100644 index b23965b..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a102.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a103.png b/src/MyApplication/app/src/main/res/drawable/a103.png deleted file mode 100644 index 9dcad7a..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a103.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a104.png b/src/MyApplication/app/src/main/res/drawable/a104.png deleted file mode 100644 index 86ff29f..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a104.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a150.png b/src/MyApplication/app/src/main/res/drawable/a150.png deleted file mode 100644 index a3886f8..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a150.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a153.png b/src/MyApplication/app/src/main/res/drawable/a153.png deleted file mode 100644 index cb94f14..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a153.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a154.png b/src/MyApplication/app/src/main/res/drawable/a154.png deleted file mode 100644 index de89a6f..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a154.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a300.png b/src/MyApplication/app/src/main/res/drawable/a300.png deleted file mode 100644 index 977a857..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a300.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a301.png b/src/MyApplication/app/src/main/res/drawable/a301.png deleted file mode 100644 index 6384e67..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a301.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a302.png b/src/MyApplication/app/src/main/res/drawable/a302.png deleted file mode 100644 index 83f096d..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a302.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a303.png b/src/MyApplication/app/src/main/res/drawable/a303.png deleted file mode 100644 index 94c1d05..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a303.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a304.png b/src/MyApplication/app/src/main/res/drawable/a304.png deleted file mode 100644 index 3b3cc28..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a304.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a305.png b/src/MyApplication/app/src/main/res/drawable/a305.png deleted file mode 100644 index 6dd845a..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a305.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a306.png b/src/MyApplication/app/src/main/res/drawable/a306.png deleted file mode 100644 index 630ad92..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a306.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a307.png b/src/MyApplication/app/src/main/res/drawable/a307.png deleted file mode 100644 index d76028c..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a307.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a308.png b/src/MyApplication/app/src/main/res/drawable/a308.png deleted file mode 100644 index d218a85..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a308.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a309.png b/src/MyApplication/app/src/main/res/drawable/a309.png deleted file mode 100644 index 717e779..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a309.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a310.png b/src/MyApplication/app/src/main/res/drawable/a310.png deleted file mode 100644 index e5004aa..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a310.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a311.png b/src/MyApplication/app/src/main/res/drawable/a311.png deleted file mode 100644 index 8d5f541..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a311.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a312.png b/src/MyApplication/app/src/main/res/drawable/a312.png deleted file mode 100644 index 0f74f47..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a312.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a313.png b/src/MyApplication/app/src/main/res/drawable/a313.png deleted file mode 100644 index 5429d60..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a313.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a314.png b/src/MyApplication/app/src/main/res/drawable/a314.png deleted file mode 100644 index 9feaa6b..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a314.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a315.png b/src/MyApplication/app/src/main/res/drawable/a315.png deleted file mode 100644 index 5b83793..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a315.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a316.png b/src/MyApplication/app/src/main/res/drawable/a316.png deleted file mode 100644 index 411aa73..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a316.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a317.png b/src/MyApplication/app/src/main/res/drawable/a317.png deleted file mode 100644 index e2aeb2e..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a317.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a318.png b/src/MyApplication/app/src/main/res/drawable/a318.png deleted file mode 100644 index b729b4a..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a318.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a350.png b/src/MyApplication/app/src/main/res/drawable/a350.png deleted file mode 100644 index 81dcaaa..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a350.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a351.png b/src/MyApplication/app/src/main/res/drawable/a351.png deleted file mode 100644 index a3adce4..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a351.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a399.png b/src/MyApplication/app/src/main/res/drawable/a399.png deleted file mode 100644 index a87be77..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a399.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a400.png b/src/MyApplication/app/src/main/res/drawable/a400.png deleted file mode 100644 index b764670..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a400.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a401.png b/src/MyApplication/app/src/main/res/drawable/a401.png deleted file mode 100644 index a4a619d..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a401.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a402.png b/src/MyApplication/app/src/main/res/drawable/a402.png deleted file mode 100644 index d46ec85..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a402.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a403.png b/src/MyApplication/app/src/main/res/drawable/a403.png deleted file mode 100644 index c33e15d..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a403.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a404.png b/src/MyApplication/app/src/main/res/drawable/a404.png deleted file mode 100644 index 4fcf44c..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a404.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a405.png b/src/MyApplication/app/src/main/res/drawable/a405.png deleted file mode 100644 index c4e7471..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a405.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a406.png b/src/MyApplication/app/src/main/res/drawable/a406.png deleted file mode 100644 index c0fc63b..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a406.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a407.png b/src/MyApplication/app/src/main/res/drawable/a407.png deleted file mode 100644 index 9ff95f2..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a407.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a408.png b/src/MyApplication/app/src/main/res/drawable/a408.png deleted file mode 100644 index c006569..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a408.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a409.png b/src/MyApplication/app/src/main/res/drawable/a409.png deleted file mode 100644 index 5f9d6c2..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a409.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a410.png b/src/MyApplication/app/src/main/res/drawable/a410.png deleted file mode 100644 index db28ffc..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a410.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a456.png b/src/MyApplication/app/src/main/res/drawable/a456.png deleted file mode 100644 index 20949c7..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a456.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a457.png b/src/MyApplication/app/src/main/res/drawable/a457.png deleted file mode 100644 index 334c3d1..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a457.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a499.png b/src/MyApplication/app/src/main/res/drawable/a499.png deleted file mode 100644 index 7f9ef59..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a499.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a500.png b/src/MyApplication/app/src/main/res/drawable/a500.png deleted file mode 100644 index ea99407..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a500.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a501.png b/src/MyApplication/app/src/main/res/drawable/a501.png deleted file mode 100644 index d9b1eca..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a501.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a502.png b/src/MyApplication/app/src/main/res/drawable/a502.png deleted file mode 100644 index 19d3a41..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a502.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a503.png b/src/MyApplication/app/src/main/res/drawable/a503.png deleted file mode 100644 index 406758f..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a503.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a504.png b/src/MyApplication/app/src/main/res/drawable/a504.png deleted file mode 100644 index 50af230..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a504.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a507.png b/src/MyApplication/app/src/main/res/drawable/a507.png deleted file mode 100644 index 9c0c5da..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a507.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a508.png b/src/MyApplication/app/src/main/res/drawable/a508.png deleted file mode 100644 index f1c84a1..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a508.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a509.png b/src/MyApplication/app/src/main/res/drawable/a509.png deleted file mode 100644 index 5dbd197..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a509.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a510.png b/src/MyApplication/app/src/main/res/drawable/a510.png deleted file mode 100644 index 0fc21a0..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a510.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a511.png b/src/MyApplication/app/src/main/res/drawable/a511.png deleted file mode 100644 index 294da17..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a511.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a512.png b/src/MyApplication/app/src/main/res/drawable/a512.png deleted file mode 100644 index e6a3b34..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a512.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a513.png b/src/MyApplication/app/src/main/res/drawable/a513.png deleted file mode 100644 index a532a39..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a513.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a514.png b/src/MyApplication/app/src/main/res/drawable/a514.png deleted file mode 100644 index acb49e3..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a514.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a515.png b/src/MyApplication/app/src/main/res/drawable/a515.png deleted file mode 100644 index 83b2de0..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a515.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a900.png b/src/MyApplication/app/src/main/res/drawable/a900.png deleted file mode 100644 index d8b4c19..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a900.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a901.png b/src/MyApplication/app/src/main/res/drawable/a901.png deleted file mode 100644 index bc28f5f..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a901.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a999.png b/src/MyApplication/app/src/main/res/drawable/a999.png deleted file mode 100644 index ff99a92..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/a999.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/layout/activity_detail.xml b/src/MyApplication/app/src/main/res/layout/activity_detail.xml deleted file mode 100644 index 8676b91..0000000 --- a/src/MyApplication/app/src/main/res/layout/activity_detail.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/activity_main1.xml b/src/MyApplication/app/src/main/res/layout/activity_main1.xml deleted file mode 100644 index dc30be7..0000000 --- a/src/MyApplication/app/src/main/res/layout/activity_main1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/activity_setting.xml b/src/MyApplication/app/src/main/res/layout/activity_setting.xml deleted file mode 100644 index 5447e4d..0000000 --- a/src/MyApplication/app/src/main/res/layout/activity_setting.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/activity_twopane.xml b/src/MyApplication/app/src/main/res/layout/activity_twopane.xml deleted file mode 100644 index 4396ba4..0000000 --- a/src/MyApplication/app/src/main/res/layout/activity_twopane.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/fragment_weather.xml b/src/MyApplication/app/src/main/res/layout/fragment_weather.xml deleted file mode 100644 index 704e179..0000000 --- a/src/MyApplication/app/src/main/res/layout/fragment_weather.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml b/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml deleted file mode 100644 index 2e4cfc4..0000000 --- a/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/weather_item.xml b/src/MyApplication/app/src/main/res/layout/weather_item.xml deleted file mode 100644 index 0fc4779..0000000 --- a/src/MyApplication/app/src/main/res/layout/weather_item.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/menu/fragment_detail.xml b/src/MyApplication/app/src/main/res/menu/fragment_detail.xml deleted file mode 100644 index 4898217..0000000 --- a/src/MyApplication/app/src/main/res/menu/fragment_detail.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/menu/fragment_weather.xml b/src/MyApplication/app/src/main/res/menu/fragment_weather.xml deleted file mode 100644 index 5ba00eb..0000000 --- a/src/MyApplication/app/src/main/res/menu/fragment_weather.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values-sw600dp/refs.xml b/src/MyApplication/app/src/main/res/values-sw600dp/refs.xml deleted file mode 100644 index 376104c..0000000 --- a/src/MyApplication/app/src/main/res/values-sw600dp/refs.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @layout/activity_twopane - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values/arrays.xml b/src/MyApplication/app/src/main/res/values/arrays.xml deleted file mode 100644 index 35c327a..0000000 --- a/src/MyApplication/app/src/main/res/values/arrays.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 鎽勬皬搴 - 鍗庢皬搴 - - - sheshidu - huashidu - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values/refs.xml b/src/MyApplication/app/src/main/res/values/refs.xml deleted file mode 100644 index c8f80fe..0000000 --- a/src/MyApplication/app/src/main/res/values/refs.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @layout/activity_main1 - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values/styles.xml b/src/MyApplication/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930..0000000 --- a/src/MyApplication/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/src/MyApplication/app/src/main/res/xml/pref_setting.xml b/src/MyApplication/app/src/main/res/xml/pref_setting.xml deleted file mode 100644 index 394a6db..0000000 --- a/src/MyApplication/app/src/main/res/xml/pref_setting.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/MyApplication/build.gradle b/src/MyApplication/build.gradle deleted file mode 100644 index d87351c..0000000 --- a/src/MyApplication/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -android{ -plugins { - id 'com.android.application' version '7.3.0' apply true - id 'com.android.library' version '7.3.0' apply true -} -sourceSets{ - main{ - jniLibs.srcDir 'libs' - jni.srcDirs = [] //disable automatic ndk-build - } -} -buildTypes { - release { - minifyEnabled true - shrinkResources true - proguardFiles getDefaultProguardFile( - 'proguard-android-optimize.txt'), - 'proguard-rules.pro' - } -} -sourceSets{ - main{ - jniLibs.srcDirs=['libs'] - } -} -dependencies { - compile fileTree(dir: 'libs' , include: ['*.jar']) - androidTestCompile ('com.android.support.test.espresso: espresso-core: 2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - compile 'com.android.support: appcompat-v7:25.1.0' - testCompile 'junit: junit: 4.12' -} -} \ No newline at end of file diff --git a/src/MyApplication/gradle.properties b/src/MyApplication/gradle.properties deleted file mode 100644 index 3e927b1..0000000 --- a/src/MyApplication/gradle.properties +++ /dev/null @@ -1,21 +0,0 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -# Enables namespacing of each library's R class so that its R class includes only the -# resources declared in the library itself and none from the library's dependencies, -# thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file diff --git a/src/MyApplication/gradle/wrapper/gradle-wrapper.jar b/src/MyApplication/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c..0000000 Binary files a/src/MyApplication/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/src/MyApplication/gradle/wrapper/gradle-wrapper.properties b/src/MyApplication/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a4646a3..0000000 --- a/src/MyApplication/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Oct 03 10:56:04 CST 2022 -distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip -distributionPath=wrapper/dists -zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME diff --git a/src/MyApplication/gradlew b/src/MyApplication/gradlew deleted file mode 100644 index 4f906e0..0000000 --- a/src/MyApplication/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/src/MyApplication/gradlew.bat b/src/MyApplication/gradlew.bat deleted file mode 100644 index 107acd3..0000000 --- a/src/MyApplication/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/src/MyApplication/settings.gradle b/src/MyApplication/settings.gradle deleted file mode 100644 index f727bcc..0000000 --- a/src/MyApplication/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} -rootProject.name = "My Application" -include ':app'