diff --git a/src/MyApplication/.idea/vcs.xml b/src/MyApplication/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/src/MyApplication/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/MyApplication/app/build.gradle b/src/MyApplication/app/build.gradle index b377069..9dcddfa 100644 --- a/src/MyApplication/app/build.gradle +++ b/src/MyApplication/app/build.gradle @@ -8,12 +8,16 @@ android { defaultConfig { applicationId "com.example.myapplication" - minSdk 16 - targetSdk 32 + 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 { @@ -39,8 +43,13 @@ 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 files('libs\\Msc.jar') + implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-AllNavi:7.4.0' + implementation files('libs/Msc.jar') + implementation files('libs\\android-support-v4.jar') 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 index a659ead..591f5f4 100644 Binary files a/src/MyApplication/app/libs/BaiduLBS_Android.jar and b/src/MyApplication/app/libs/BaiduLBS_Android.jar differ diff --git a/src/MyApplication/app/libs/QWeather_Public_Android_V4.11.jar b/src/MyApplication/app/libs/QWeather_Public_Android_V4.11.jar deleted file mode 100644 index a6b25f9..0000000 Binary files a/src/MyApplication/app/libs/QWeather_Public_Android_V4.11.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 new file mode 100644 index 0000000..da1b8f7 Binary files /dev/null and b/src/MyApplication/app/libs/android-support-v4.jar 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 new file mode 100644 index 0000000..2935c4c Binary files /dev/null and b/src/MyApplication/app/libs/arm64-v8a/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so b/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so new file mode 100644 index 0000000..be99b75 Binary files /dev/null and b/src/MyApplication/app/libs/arm64-v8a/libgnustl_shared.so differ diff --git a/src/MyApplication/app/libs/arm64-v8a/libindoor.so b/src/MyApplication/app/libs/arm64-v8a/libindoor.so new file mode 100644 index 0000000..bfb6f75 Binary files /dev/null and b/src/MyApplication/app/libs/arm64-v8a/libindoor.so differ diff --git a/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so b/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so new file mode 100644 index 0000000..9bd868a Binary files /dev/null and b/src/MyApplication/app/libs/arm64-v8a/liblocSDK8b.so 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 new file mode 100644 index 0000000..9aab5e6 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi-v7a/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so b/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so new file mode 100644 index 0000000..96c22a2 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi-v7a/libgnustl_shared.so differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/libindoor.so b/src/MyApplication/app/libs/armeabi-v7a/libindoor.so new file mode 100644 index 0000000..b59be91 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi-v7a/libindoor.so differ diff --git a/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so b/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so new file mode 100644 index 0000000..aa90e76 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi-v7a/liblocSDK8b.so differ diff --git a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v6_3_0.so b/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v6_3_0.so deleted file mode 100644 index f1df914..0000000 Binary files a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v6_3_0.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 new file mode 100644 index 0000000..373e67f Binary files /dev/null and b/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_map_v6_3_0.so b/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_map_v6_3_0.so deleted file mode 100644 index b6fd27f..0000000 Binary files a/src/MyApplication/app/libs/armeabi/libBaiduMapSDK_map_v6_3_0.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 new file mode 100644 index 0000000..5cf6d20 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi/libgnustl_shared.so differ diff --git a/src/MyApplication/app/libs/armeabi/liblocSDK8a.so b/src/MyApplication/app/libs/armeabi/liblocSDK8a.so deleted file mode 100644 index 5286996..0000000 Binary files a/src/MyApplication/app/libs/armeabi/liblocSDK8a.so and /dev/null differ diff --git a/src/MyApplication/app/libs/armeabi/liblocSDK8b.so b/src/MyApplication/app/libs/armeabi/liblocSDK8b.so new file mode 100644 index 0000000..4083291 Binary files /dev/null and b/src/MyApplication/app/libs/armeabi/liblocSDK8b.so differ diff --git a/src/MyApplication/app/libs/readme.txt b/src/MyApplication/app/libs/readme.txt deleted file mode 100644 index 8a1d572..0000000 --- a/src/MyApplication/app/libs/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -1.使用demo测试时,需将res中除layout外资源拷贝到demo中assets相应的路径下; -2.使用带UI接口时,请将assets下文件拷贝到项目中; -3.文档说明请参考:http://doc.xfyun.cn/msc_android/; -4.在调用sdk时,请将res/layout下xml文件拷贝至工程的layout目录下,此文件为sdk内置ui所需,资源缺失会导致sdk部分功能无法使用; - -注: 1. 由于更新优化更新,本次(1138)的libmsc.so库需与本次Msc.jar相匹配,使用之前的Msc.jar包可能会导致出错。 - - -感谢您使用科大讯飞服务。 -官方网站:http://www.xfyun.cn/ diff --git a/src/MyApplication/app/libs/release.txt b/src/MyApplication/app/libs/release.txt deleted file mode 100644 index 8b8bfee..0000000 --- a/src/MyApplication/app/libs/release.txt +++ /dev/null @@ -1,908 +0,0 @@ -1.1140版本更新信息 - 1. SSL证书更新 -1.1139版本更新信息 - 1. 修复部分已知bug; - 2. 在线听写增加小语种听写功能; - 3. libmsc.so库中唤醒能力单独分出,需要唤醒能力时需加入libw_ivw.so -1.1138版本更新信息 - 1. 优化能量VAD,修复已知bug; - 2. 优化与服务端的网络交互; - 3. 由于更新优化更新,本次的libmsc.so库需与本次Msc.jar相匹配,不然可能出现异常。 -1.1137版本更新信息 - 1.新集成能量VAD,效率提升近60%(亮点); - 2.优化与服务端的网络交互,服务更稳定(亮点); - 3.修复部分已知bug; - 注: 1. 由于更新优化更新,本次的libmsc.so库需与本次Msc.jar相匹配,使用之前的Msc.jar包可能会导致出错。 - 2. 由于本次SDK中集成了最新的能量VAD,在线服务将支持arm、arm-v7、arm64-v8;离线唤醒支持armv7和arm64, - 离线命令词支持armv7。其中arm架构的libmsc.so仅支持在线能力。若在离线组合能力(离线唤醒+离线命令词)的SDK中, - 请选用armv7的libmsc.so。 --------------------------------------------------------------------- -1.1136版本更新信息 - 1.修复部分已知安全问题; - 2.修复部分已知bug; --------------------------------------------------------------------- -1.1135版本更新信息 - 1.解决speechdemo中合成文本设置失效问题; - 2.优化msc.jar 业务退出内存释放逻辑; --------------------------------------------------------------------- -1.1134版本更新信息 - 1.解决Android9.0 部分机型对org.apache.http 不兼容问题 - 2.优化demo代码,增加听写循环调用逻辑支持;增加合成实时音频流输出调用和说明; -MSC 5.0.41.1217 --------------------------------------------------------------------- -1.1133版本更新信息 - 1.大数据设备信息收集更新 -MSC 5.0.41.1217 - 1.增加离线听写能力 --------------------------------------------------------------------- -1.1132版本更新信息 - 1.增加大数据部分日志收集模块 -MSC 5.0.40.1214 - 1.增加唤醒闭环功能 --------------------------------------------------------------------- -1.1131版本更新信息 - 1.增加唤醒音量回调结果返回; - 2.demo中合成UI优化; -MSC 5.0.38.1199 - 1.增加opus编解码支持 --------------------------------------------------------------------- -1.1130版本更新信息 - -MSC 5.0.38.1195 - 1.更新唤醒引擎为60引擎; - 2.唤醒的门限值范围修改,为{0,3000},默认值为1450; --------------------------------------------------------------------- -1.1129版本更新信息 - 1.解决蓝牙播报漏字问题; - 2.解决8.1上合成漏字问题; - 3.解决speechDemo异常崩溃问题; - 4.优化speechDemo中UI; --------------------------------------------------------------------- -1.1128版本更新信息 - 1.合成业务,暂停和重新播放回调接口无返回问题修复; - 2.支持听写/识别/评测/声纹结果返回的字符编码配置; - 3.支持听写业务中sdk自带ui,是否显示错误码信息,默认显示,通过参数“view_tips_plain” 进行配置,例: - mIat.setParameter("view_tips_plain","false");此处即为设置错误码不显示。 - -MSC 5.0.37.1181 --------------------------------------------------------------------- -1.1127版本更新信息 - 1.语义模块统一采用aiui语义,后续不再继续提供msc语义; - 2.speechdemo关于声纹示例体验优化; - 3.解决Android8.1上合成文本音频出现乱码问题; - -MSC 5.0.36.1178 --------------------------------------------------------------------- -1.1126版本更新信息 - 1.合成语音播放,resumeSpeaking 接口增加audio 焦点获取; - 2.synthesizeToUri 接口部分参数设置失败问题修复; - 3.听写/合成 增加ico编码支持,"aue","ico"; - 4.修复MODE_WORLD_READABLE调用导致安全检测爆出的安全隐患 - -MSC 5.0.36.1178 更新信息 - 1.增加ico编解码支持 - 2.离线包增加aiui支持 -------------------------------------------------------------------- -1.1125版本更新信息 - 1.听写小窗口提供讯飞输入法下载链接,注意 替换iflytek下的xml资源; - 2.在线人脸/声纹可直接调用身份验证接口,speechdemo中包含在线人脸和声纹; - 3.评测demo中添加直接写入音频方式,详见demo中注释说明; - - -MSC 5.0.36.1176更新信息 - 1.解决Android 8.0上崩溃问题 --------------------------------------------------------------------- -1.1121版本更新信息 - 1.去除语记支持 - 2.更新底层库版本到5.0.35.1168 - -MSC 5.0.35.1168更新信息 - 1.Android 版本编译时增加 -fpic,修复Android 7.0以后Android 版本上出现的so加载崩溃问题; - 2.完善合成发音人列表 --------------------------------------------------------------------- -1.1120版本更新信息 - 1,事件回调:修正会话 SID 值正常,但返回为空的问题; - 2,AIMIC: 修正在唤醒会话结束偶现崩溃的问题; - 3,权限:修正没有 android.permission.ACCESS_NETWORK_STATE 时无法使用的问题; - 4,录音:加入录音时使用蓝牙的选项(SpeechConstant.BLUETOOTH); - 5,合成:修改合成进度中 spellinfo 的返回,以JSON格式,并增加音频长度信息(需设置 "audio_info" 参数为真); - 6,识别:增加在会话开始时,通过参数设置获取设备信息(SpeechConstant.DVC_INFO 参数需设置为真); - -已知问题: - 1,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果 EOS 值错误引起; - 2,合成:部份手机设备上,在蓝牙播放回调 onComplete 时,若马上开始录音,合成播放末尾漏字(安卓系统蓝牙播放延迟原因,暂不解决); --------------------------------------------------------------------- -1.1119版本更新信息 - 1,翻译:增加翻译示例和文档说明; - 2,合成:1) 增加淡入淡出参数 TTS_FADING(默认不启用);2) 加长音频结束播放时加播的空白音频,优化蓝牙合成播放末尾漏字问题; - 3,AIMIC: 修正偶现写音频失败问题;(自测通过) - -已知问题: - 1,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果EOS值错误引起; - 2,合成:厂商反馈蓝牙播放回调 onComplete 时,若马上开始录音,合成播放末尾漏字; --------------------------------------------------------------------- -1.1118版本更新信息 - 1,语义理解:增加 SCENE 语义情景参数; - 2,AIMIC:修正 27018 问题; - 3,DEMO:a) 语义理解DEMO,去掉不支持的语义说法提示,修正网址链接;b) 加入语义情景设置代码示例; - -已知问题: - 1,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果EOS值错误引起; ---------------------------------------------------------------------- -1.1116版本更新信息 - 1,语义理解:默认语义使用 3.0 版本; - 2,文档:新手指南文档,不能功能用同一个PDF文档;修改默认语义版本说明; - -已知问题: - 1,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果EOS值错误引起; ---------------------------------------------------------------------- -1.1116版本更新信息 - 1,语义理解:默认语义使用 3.0 版本; - 2,文档:新手指南文档,不能功能用同一个PDF文档;修改默认语义版本说明; - 3,DEMO:a) 语义理解DEMO,去掉不支持的语义说法提示,修正网址链接;b) 加入语义情景设置代码示例; - -已知问题: - 1,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果EOS值错误引起; ---------------------------------------------------------------------- -1.1116版本更新信息 - 1,语义理解:默认语义使用 3.0 版本; - 2,文档:新手指南文档,不能功能用同一个PDF文档;修改默认语义版本说明; - 3,AIMIC: a) 增加获取几麦和AIMIC版本的参数( aimic_on_channel, aimic_on_version ),增加设置 REAL BEAM 参数 ( aimic_on_real_beam ); - b) 修改清空缓存的处理,增加三个线程同步;减少缓存空间大小,减少由于缓存多时,唤醒结果返回与 CAE frame count 相差较大,使 CAE 不回调结果,而报 27019 的情况; - 4,DEMO: SpeechDemo, MscV5PlusDemo 修改语义报错时的提示,增加新版本重新配置语义的说明; - -MSC 5.2.0.1044 更新信息(AIMIC SDK): -1,将AIUI1042版本合并到AIMIC分支版本; - -已知问题: - 1,在构建版本时,3.0语义在正式域名上还不可用,仅能在测试域名上可用: server_url=http://60.166.12.151/onlytest.htm - 2,在构建版本时,新手指南说明的语义结果说明文档的超链接(http://aiui.xfyun.cn/info/protocol)里面还没放置文档; - 3,AIMIC:唤醒一定次数时,报 27019 问题,为唤醒引擎返回结果EOS值错误引起; ---------------------------------------------------------------------- -1.1115版本更新信息 - 1,资源目录:删除不要的 IVW 40 的资源;删除 1.0 版本的 ASR 资源,并把原 asr_two 文件夹改名 asr;IVW 50 资源区分中英目录; - 2,因 5.2.0.1040 没有更新最新的 模型VAD 代码,故 AIMIC 用的库为在 5.2.0.1040 基础上同步了最新模型VAD代码后的库; - -MSC 5.0.32.1156 更新信息(普通 SDK): -1、升级唤醒引擎:集成5.0.1016版本,取代之前的4.0BN引擎: - 1)支持中文唤醒,英文唤醒(中文,英文唤醒资源不同); - 2)支持windows,linux,Android平台; - 3)5.0引擎不兼容4.0,3.6引擎资源; - 4)资源头部格式变化; -2、针对唤醒资源头部授权信息的校验,添加可以不校验的逻辑:如果资源中有授权信息,则进行校验;如果没有,但是提供的msc库编译时添加了宏IFLY_SPEECH_PLUS_SUPPORT,则不进行校验,否则仍校验。 - -MSC 5.2.0.1040 更新信息(AIMIC SDK): -1、唤醒资源合并成一个文件,资源头格式变化; -2、唤醒多路由单独的宏控制: - 解决彭锐反馈的开了多路唤醒之后,aiui业务cpu占用高的问题;经过排查是因为开启多路唤醒,打开了宏PARALLEL_LINES_SUPPORT,影响了aiui业务;多路唤醒控制增加一个新的宏:IVW_PARALLEL_LINES_SUPPORT -3、针对唤醒资源头部授权信息的校验,添加可以不校验的逻辑:如果资源中有授权信息,则进行校验;如果没有,但是提供的msc库编译时添加了宏IFLY_SPEECH_PLUS_SUPPORT,则不进行校验,否则仍校验。 ---------------------------------------------------------------------- -1.1114版本更新信息 - 1,识别: a) 增加默认方言设置为 mandarin; - 2,合成: a) 修改淡出字节没有根据采样率调整,而使不同采样率下长短不一的问题; - b) 修正MSC和语记之间切换时,可能当前合成播放未停止的问题; - c) 在 ENGINE_TYPE 为 TYPE_DISTRIBUTED 时,默认进行网络检查; - - 3,唤醒: a) 唤醒在音频缓存超过两秒时,清空当前消息中的音频数据, 避免OOM问题; - 4,录音: a) 修改录音检查时长判断方式,仅在返回字节小于缓存时; sleep,避免可能不及时获取音频而缓存满丢失的问题; - 5,AIMIC: a) 增加线程优先级设置; - b) 修正在CPU占用较高时,由于 frame_count 错误而引起角度不对的问题; - 6,音频检测: a) 模型VAD,增加句子重设参数 RESET_SENTENCE; - b) 模型VAD,更新引擎和资源,修正端点状态返回延迟可能超过 250 ms 的问题; - 7,日志:a) 增加告警级别日志(目前仅在唤醒缓存不足时用到); - 8,文档:a) HTML文档,链接大部份在新窗口打开; - b) 修改默认ENGINE_MODE 值说明; - c) 增加分布式模式参数值 TYPE_DISTRIBUTED ; - d) 音频检测,增加短音频过滤说明;修改前端点, 后端点值域;修改 start 结果值、状态值说明;每次写入音频长度说明;暂不使用 start 和 end 值说明; - 9,音频文件保存: a) 修正没有关闭文件句柄的问题; - 10, Demo: a) 修正在线人脸 Demo 没有检查会话开始的错误,而一直等待的问题; - b) 音频检测 Demo 修改结果显示; - 11,错误码: AIMIC 错误码从26XXX,改成27XXX; - -已知问题: - 1,音频检测: a) 当每次写入的字节比较大,如500ms以上时,获取的 seg 值不正确; ---------------------------------------------------------------------- -1.1113版本更新信息 - 1,唤醒: 增加通过事件返回录音音频流,参考《MSC Reference Manual.html》关于 WakeuperListener 接口 onEvent 函数说明; - 2,合成:在暂停,恢复,停止时,增加淡入淡出的效果,优化播放体验; - 3,demo: 修正人脸DEMO由于服务返回结果为错误码,而导致崩溃的问题;修正在没有放置 libmsc.so 时DEMO因空指针引用而崩溃的问题 - 4,初始化: 去掉 Utility setParameter getParameter 时的单例判断,修正因此而导致获取参数和设置参数不生效的问题; - -已知问题: - 1,在合成离线使用语记模式(在线SDK默认离线功能使用语记),从在线(MSC模式)合成未播放完,马上使用离线(语记模式)合成时,上一次(在线合成)播放没有被取消,而是在当前合成(语记模式)播放完后,继续播放; - -MSC 5.0.30.1153 更新信息: - 1、将1152版本ssl内容同步回主版本:nameserver以及结构化日志scs支持ssl加密; - 2、离线授权auth支持ssl加密(业务短连接不计划支持,即使设置了ssl,如果走短连接,也不生效); - 3、去除日志中认证信息的打印; - 4、支持SHA204A硬件授权方案; - 5、解决唤醒可能出现的16005问题:论坛开发者反馈; - 6、代码优化:发往服务端参数部分,去除冗余逻辑; - 7、结构化日志里会添加进 几个字段,记录的是socket建立后的一些统计信息,用来辅助判断网络问题,只在Linux和Android平台下收集; - 8、增加情感发言人设置 ssb 中传入emot; - 9、修复离线合成自动读取发言人在android平台报错问题; - ---------------------------------------------------------------------- -1.1112版本更新信息 - 1,所有业务功能: 创建单例时,若 SpeechUtility.getUtility 为空,返回 null; - 2,注销: SpeechUtility destroy 时,先判断当前是否有会话进行,修正因会话进行中注销,而使SDK不可用的问题; - 3,DEMO: 听写 DEMO 提示中,去掉河南话; - 4,文档: a) VAD 检测功能加入未支持说明; b) 去掉 ISE_ENT,以 LANGUAGE 代替; - 5,IVW: 增加保存最近1分钟的音频(IVW_AUDIO_PATH); - 6,编译: 修改混淆配置,在Msc.pro 中,去掉唤醒相关的保留(减小在线 Msc.jar 大小);在MscV5luse.pro中,包含 Msc.pro 所有配置; - -MSC 5.0.29.1151 更新信息: - 1、合并张涛1049版本以及revision7804-7820功能点到主版本: - 1)增加JNI日志级别函数; 林国雄 - 2)修改JNI日志打印,把频繁打印的日志用INFO,重要日志用LOGCAT; 林国雄 - 3)结构化日志上传支持代理设置 MSPLogin中设置 proxy_host/proxy_ip, proxy_port; 张涛 - 4) ist, ise, 在线tts 的ssb请求中 增加 fac参数,用于强制 appid校验; 张涛 - 5)优化unique_id记录,改为首次解析lgi_params时记录unique_id,后续无需每次都解析lgi_params; 王逸群 - 6)评测,在线合成延迟登录ssb中带入auth_id 张涛 - 7)更新模型VAD引擎,增加置信度函数,增加 vad_reduce_flow 参数 张涛,林国雄 - 2、车载反馈偶尔获取不到结果问题修复; ---------------------------------------------------------------------- -1.1111版本更新信息 -1,asr: a) 删除没有使用到的 MscRecognizerAIMic.java 及其引用; - b) 修改前端点消除时的音频处理从独立的线程转回 MscHandler 线程中,并修改可能重复返回同一音频的问题; -2,文档:开放语义文档更新至语义官网上最新的版本; - -MSC 5.0.28.1150 更新信息: -1. 回退到1148的代码版本; -2. 基于1148代码上,解决sessinfo没有传入正确的sid的问题; ---------------------------------------------------------------------- -1.1110版本更新信息 - -1,ivw:a) 修正 SDK 设置的 IVW_NETVAL 覆盖外面设置值的问题; -2,aimic: a) 修正 aimic BUF_MODE没有设置到JNI的问题; - b) 增加无效结果错误码; - c) 减少原始音频的缓存大小; - d) 应用层不直接使用 aimic 的函数, 识别音频通过唤醒事件返回; - e) aimic.jar 合并到 msc.jar中,作为唤醒的一部分; - f) 增加当前缓存中留存数据大小的日志; - g) 修正在非持续唤醒时,因录音机重复开启时,状态值没有设置为0,而返回 26008 的问题; - h) 修正在 buf_mode=2 时,还会因原始音频缓存不够而返回 26014 错误的问题; - i) 修改调用 alsa 录音的方式,从直接引用,改为反射调用,编译时默认不带 alsa 的类; -3,日志: a) 调整日志级别,默认为 normal,只打印关键的会话日志,AUW等频繁打印的日志,只在 detail 或 all 级别时打印; -4,文档: a) 去掉 HTML 文档中 河南话; - b) 去掉 HTML 文档中 DOMAIN 的默认值说明; - c) PDF 文档中去掉Q群,网址改为论坛; -5,模型VAD: a) 增加置信度结果 confidence 和对应的 Native 函数(因 5.2.0.1032 libmsc.so 不带该 Native 函数,此版本 confidence 值全部为0); - b) 修改音量值范围,修正因引擎变化,音量值最大只到7的问题; -6,asr: a) 修改获取默BOS, EOS的方式; - b) 在消除前端点静音时,禁用 libmsc.so 中的VAD,直接使用模型VAD检测整个过程; - -aimic jni 更新信息: -1,增加禁止写入IVW音频的参数 ivw_auw_disable,用于测试,默认为 FALSE; -2,char 转 int 时,进行安全判断; -3,增加无效结果判断,返回 26019; -4,增加 ivw_sum_disable 参数,判断是否要启用 EOS 累计,适应 IVW 引擎的EOS值返回方式,默认为 FALSE; -5,增加 ivw_sum_by_engine 参数,判断是否已在引擎中累计 EOS 值 ,默认为 TRUE; -6,增加 唤醒结果全部转为 KEY=VALUE 方式,传给 CAE;且 frame_count 一直累计,传给 CAE 时不对1000求余; -7, libaimic.so 与 libaimicjni.so 合并为 libaimic.so; -8,增加线程等待,把原来的每一毫秒的SLEEP,改成直接等有数据再处理,减少空闲时线程对 CPU 的占用; -9,增加销毁线程前,判断上次的唤醒消息是否有回调完,避免因引用音频BUF而崩溃的问题; -10, 增加 ivw_auw_sync 参数,判断是否要把三个唤醒线程同步,默认为 TRUE; -11, 增加 AIMIC 未处理唤醒消息时的,返回错误 26018; - -msc 5.2.0.1032 更新信息: -1、升级唤醒引擎;集成5.0.1016版本;新增支持英文唤醒;资源分为common资源和唤醒词资源,common资源不加头,英文和中文不同的common资源;目前只支持windows和Android,不支持linux -2、唤醒闭环优化:上传逻辑优化;车载需求实现:通过参数控制每天上传(上传成功)的数据条数; -3、唤醒闭环优化功能可裁剪:IVWNET_NOT_SUPPORT=1 -4、QIVWGetResInfo内存泄漏修复; -5、离线授权在连接超时情况下报错16005问题修复; ---------------------------------------------------------------------- -1.1109版本更新信息 -1,使用 5.0.27.1146 构建 online, mfv, ifd 1109 版本; ---------------------------------------------------------------------- -1.1108版本更新信息 -1,合成:增加设置保存预合成音频文件名的参数; - -MSC更新信息 -5.0.27.1146 (不带 VAD 接口) -1、在所有在线业务的ssb请求参数段中添加unique_id字段。 -2、"语音云服务端通过nameserver下发ip,并新增标识字段""compel"",表示是否强制使用80端口。若没有强制使用80端口,则由msc自行选择合适的port建立连接(1028),传输数据。 -3、新增当网络类型切换,重新进行dns请求。 -4、现网ns版本协议号由1.2升级为1.3。 ---------------------------------------------------------------------- - -1.1107 版本更新信息 -1,录音:当录音时返回负值状态时,直接抛出异常; -2,JNI:添加AIUI相关的接口(仅 Native 定义); -3,有数数据采集:a) 包由 com.iflytek.thirdparty 移动到 com.iflytek.cloud.thirdparty; b) 捕获异常的 Exception 改为 Throwable; -4,AIMIC:a) 主版本与 AIMIC 分支合并; b) aimic 增加 ALSA JNI 日志控制; -5,使用 5.0.26.1144 版本库; - -MSC更新信息 -5.0.26.1144 -"基于1133版本维护AIMIC分支版本: -1、AIMIC多路唤醒优化:修改多路版唤醒会话对象维护方式(同识别,合成业务),去除业务全局锁,消除锁带来的性能消耗,多路版情况下QISRSessionBegin耗时优化尤为明显。(5.0.27.1134加入) -2、唤醒闭环优化:唤醒闭环优化:(5.0.27.1139加入) - 1)、上传逻辑优化; - 2)、通过参数控制每天上传(上传成功)的数据条数; - 3)、修改后的详细逻辑参见文档《唤醒闭环客户端唤醒词音频收集及上传.docx》以及《上传数据详细设计.vsd》 -3、唤醒闭环优化功能支持裁剪:通过宏IVWNET_NOT_SUPPORT裁剪;默认包含闭环优化,目前裁剪只支持windows,linux,android; - windows在msc_lua工程添加此宏;(5.0.27.1134加入) -4、修复QIVWGetResInfo接口的内存泄漏; - 通过MSPStrSplit函数解析后的数据内存未释放;(5.0.27.1134加入) -5、离线授权在连接超时情况下报错16005问题修复;(5.0.27.1135加入) -6、解决在线业务慢问题:dns解析问题,详细见5.0.27.1139版本修复说明。(5.0.27.1139加入)" -7、升级BN唤醒引擎运算量优化版本:4.0.1017 - ---------------------------------------------------------------------- -1.1106 版本更新信息 -1,配置项: a) Setting 中增加设置当前地区的函数 setLocale; b) 优化日志类的实现和设置方式,把 Setting 从日志类的分离出来; -2,闭环唤醒: a) 修正查询资源时,在更新资源后,没有使用新资源信息来查询的问题; -3,合成: a) 优化在获取MSC的合成信息有可能为负数时,重置为0; b) 增加返回进度的精度控制参数 tts_proc_scale ,默认值与原来不变(100); -4,人脸: a) 会话时,增加设置URL参数; -5,VAD:增加VAD检测DEMO,开放VAD功能; - -MSC更新信息 -5.0.27.1141 -1、将唤醒业务回退到1135版本;唤醒引擎回退到4.0.1007;(唤醒闭环部分除了修复若干问题,其他未做修改,与1139一致); -2、修复唤醒闭环上传模块若干bug: -3,开启闭环唤醒参数ivwnet_mode=1,上传失败情况下保存到本地,数据>2M时未丢弃数据; -4,断开网络执行用例,ivw_upload.log日志中显示数据上传失败,未将上传失败的数据保存至本地生成ivwnet.txt文件,直接丢弃数据; - -5.0.27.1143 -1、解决中文繁体以及英文windows操作系统下离线识别问题; -2、QIVWGetResInfo接口只对Android控件开放,若需要测试,需要修改msc_lua.def(windows)和msc.map(linux); -3、更新MetaVad代码; -4、解决断网时稳定性测试ISR会句柄数一直增加的问题 -5、重构sessinfo" -6、解决听写指定aud=raw时多过一次VAD的问题;VAD在 isr.lua中先配置并滤过一次; ---------------------------------------------------------------------- - -1.1105 版本更新信息 - -1,修正调用 destroy 时,崩溃的问题; -2,闭环唤醒:修正查询哪个资源更新时,原始资源目录不对的问题;在没有配置项时,默认进行资源查询; - -MSC 5.0.26.1140 修改: -基于1133版本维护车载唤醒分支版本: -1、升级唤醒引擎;集成5.0.1016版本;新增支持英文唤醒;资源分为common资源和唤醒词资源,common资源不加头,英文和中文不同的common资源;目前只支持windows和Android,不支持linux -2、唤醒闭环优化:上传逻辑优化;车载需求实现:通过参数控制每天上传(上传成功)的数据条数; -3、唤醒闭环优化功能可裁剪:IVWNET_NOT_SUPPORT=1 -4、QIVWGetResInfo内存泄漏修复; -5、离线授权在连接超时情况下报错16005问题修复; -6、车载反馈在线语义(听写)慢问题解决: ---------------------------------------------------------------------- -1.1104 for aimic 版本更新信息: -1,更新AIMIC库,不修改 NEW 传进来的 UserData,保证那参数是 NULL时,也能正常运行;在角度回调里,通过 param1 把 beam 回调给外面; -2,修改 AIMIC JNI,每路唤醒使用单独线程进行;音频和消息回调使用单独线程进行;唤醒音频直接在 JNI 处理,减少音频队列和唤醒结果回调的耗时;修正内存泄漏等; -3,更新 MSC 5.0.16.1133,减少唤醒写音频耗时,修正由于阻塞而使缓存用完报错的问题; -4,优化缓存的内存占用; -5,增加 AIMic Reference Manual.html, AlsaRecorder Reference Manual.html 文档; -6,增加 AIMicDemo; -7,src 目录新增 AimicTest 测试工具,以及AIMIC模块的源码:AIMicLibsrc,AIMIC_JNI; ---------------------------------------------------------------------- -1.1103 版本更新信息 - -1、语义理解:语义理解 ASR_UNDERSTAND 参数名,改为 ASR_SCH; -2、合成:回调合成到文件的打断错误时,增加是否在主线程判断,在主线程时可避免 在 onComplete 中开启新会话时,死循环而崩溃的问题;非主线程回调时,依然会出现此问题(目前需要应用来避免这种调用); -3、合成:增加 tts_min_audio_len 参数可设置合成最短的缓存时长;修改默认最短缓存音频时长,由原来20秒左右,改为60秒,以兼容在线合成在指定的符号下,返回音频长度与文本长度没有关系的合成情景; -4、唤醒:优化闭环查询和使用服务器资源,修改默认查询间隔为 24 小时;并在当前本地已下载网络资源,且 net_mode 为模式 2 时,网络资源比本地资源新时, 直接使用下载的资源,而不必每次要查询更新才能使用; -5、唤醒:在文档和DEMO中,去掉 net_mode 参数值中的 模式 2 说明,此模式只在高级用户中告知其使用; -6、编译:保留 VolumeUtil, FileDownloadListener 两个类; -7、logcat 日志:有数采集 和 MMLC 在获取 MSC 参数失败时的 ERROR 日志,改成 DEBUG 日志(不影响SDK使用,避免误导开发者); -8、JavaDoc:语法识别增加网页生成语法的使用说明;修改 JavaDoc 概览页作者字样,通过 JS 控制可替换成 灵犀云; -9、有数采集(灵犀云):修改有数采集逻辑,以兼容灵犀SDK分支的数据采集;(讯飞云版本SDK中,不进行有数采集) - -MSC 5.0.27.1139 修改: -升级唤醒引擎: -1、集成5.0.1016版本; -2、新增支持英文唤醒; -3、资源分为common资源和唤醒词资源,common资源不加头,英文和中文不同的common资源; -4、路径参数设置需要传入common资源和唤醒词资源路径,且common资源必须放在前面,例如:ivw_res_path =fo|res/ivw/IvwCommonRes.irf|0|0;fo|res/ivw/ivModel.xiaoainihao.irf.head|0|0 -已知问题: -1,在调用 SpeechRecognizer, SpeechSynthesizer, VoiceWakeuper 的 destory 销毁引擎时,底层库 MSC 概率性崩溃; ---------------------------------------------------------------------- -1.1102 版本更新信息 - -1、语记链接参数添加设备信息; - ---------------------------------------------------------------------- -1.1101 版本更新信息 - -1、语音合成修复合成空文本导致的异常问题; -2、SDK优化离线功能授权机制; -3、SDK优化在会话线程启动时增加异常抛出; -4、SDK优化编译指令,兼容AS最新版本编译; -5、录音机模块修复部分机型上无权限时获取数据不报错问题; -6、优化获取版本失败日志改为私有日志; -7、有界面识别对象音量回调增加非空判断; - ---------------------------------------------------------------------- - -1.1100 版本更新信息 - -1、语音识别新增模型VAD; -2、修复文本语义频繁调用卡死问题; -3、修改获取网络类型的参数的逻辑; - -注:关于平台1129唤醒支持注意事项 -1、1129版本能够加载3.6老资源,但不支持3.5老资源; -2、3.6老资源支持闭环优化,必须每个词都要设置唤醒门限值,否者未设置门限唤醒词唤醒会出问题,返回错误码16005; - ---------------------------------------------------------------------- -1.1099 版本更新信息 - -1、修复SpeechUtility创建异常问题; -2、身份验证鉴别功能新增海量鉴别功能; -3、优化文档及部分开放类注释说明; - ---------------------------------------------------------------------- - -1.1098 版本更新信息 - -1、MSC修复与第三方jar混淆冲突问题; -2、数据收集增加在createUtility进行收集; -3、数据收集修复应用列表上传时间设置无效; -4、数据收集修复开启统计无法关闭问题; -5、数据收集取消GET_TASKS权限判断; -6、语音合成修正频繁调用合成播放导致OOM问题; - ---------------------------------------------------------------------- -1.1097 版本更新信息 - -1、身份验证鉴别功能新增查询用户、退出组、删除组接口; -2、移除日志收集权限检查; -3、语音合成修改语速倍速方法,兼容5.5引擎; -4、修改20002超时错误提示; -5、优化消息优先级,去除min等级; - ---------------------------------------------------------------------- -1.1096 版本更新信息 - -1、离线合成引擎升级为aisound 6.0 pro; -2、离线识别引擎升级为aitalk two; -3、修复特殊设备调用系统API崩溃问题; -4、修复getVersion返回不正确问题; -5、优化唯一ID中mac地址为动态获取; - ---------------------------------------------------------------------- - -1.1093~1.1095 版本更新信息 - -1、新增应用列表及活跃应用收集功能; -2、新增鉴别错误码及错误码描述; - ---------------------------------------------------------------------- - -1.1092 版本更新信息 - -1、唤醒业务增加了推荐门限; -2、唤醒业务优化查询和下载内存问题; -3、评测业务修改startEvaluating返回值为int类型; -4、评测业务修改取消方法为cancel(); -5、声纹、评测、身份验证接口调用添加非空判断; - ---------------------------------------------------------------------- -1.1091 版本更新信息 - -1、增加鉴别功能; -2、优化唤醒业务,添加强制请求策略,不与缓存文件进行比较; -3、优化唤醒业务,查询和下载接口添加同步锁; -4、优化唤醒业务,startListening接口增加返回错误码; -5、修复评测和声纹业务内部读取文件数据,无法中断问题; - ---------------------------------------------------------------------- -1.1089 版本更新信息 - -1、优化离线人脸返回结果格式; -2、支持每个业务setParameter设置engineMode; -3、优化文档及部分开放类注释说明; -4、修改获取版本号的方法; - ---------------------------------------------------------------------- -1.1088 版本更新信息 - -1、开放唤醒持续优化功能,支持资源持续优化,提升唤醒效果; -2、修改唤醒业务开启默认不获取音频焦点; -3、优化离线人脸视频流接口,支持关键点信息参数控制; -4、优化命令词识别中是否传入语法判断条件; -5、有数数据收集、编解码及VAD模块同步至主版本; - ---------------------------------------------------------------------- -1.1087 版本更新信息 - -1、集成UniqueID模块,增加Manifest权限; -2、在线合成增加情感发音人小艾,SpeechConstant新增EMOT情感参数; -3、在线合成改为只走MSC,以解决语记在部分手机后台被限制网络权限的问题; -(小米MIUI设置->其他高级选项->电量和性能->神隐模式) - ---------------------------------------------------------------------- -1.1086 版本更新信息 - -1、使用最新离线人脸so文件,支持64位; -2、优化部分低端机器上,视频流检测不可用问题; -3、优化图片检测及视频流检测的返回结果; -4、修复图片检测判断条件,防止出现空指针; -5、优化身份验证参数传递,降低CPU使用率; -6、SpeechModuleAidl增加异常处理,防止启动崩溃; -7、优化异常日志输出,e.printStackTrace() 改为logE控制输出; -8、业务调度Handler增加捕获NATIVE引用的错误; - ---------------------------------------------------------------------- -1.1085 版本更新 - -1、使用msc版本1101版本测试so,增加闭环上传音频; -2、添加获取msc引擎版本方法(暂不开放); -3、开放对外文件下载类回调监听FileDownloadListener; -4、唤醒业务改为从SessionBegin启动引擎; -5、唤醒业务增加闭环优化网络模式ivw_net_mode参数; -6、唤醒业务增加请求闭环模型功能; -7、唤醒业务增加下载唤醒模型功能; - ---------------------------------------------------------------------- -1.1084 版本更新 - -1、修改错误码拼写错误; -2、在ResourceUtil添加唤醒资源路径; -3、增加身份验证传递网络类型; -4、增加获取引擎版本号接口。通过SpeechUtility.getParameter实现; -5、增加参数view_tips_plain,控制是否在UI中显示错误码; -6、解决ASR_NOMATCH_ERROR不生效的问题; -7、增加1.login传递基站信息; -8、增加本地授权错误码; -9、修正注释; ---------------------------------------------------------------------- -1.1083 版本更新 - -1.使用msc版本1109版本so,增加证书功能; -2.修正SpeakerVerifier类注释中有误的地方; -3.修正SpeakerVerifier类cancel函数带boolean参数的问题; - ---------------------------------------------------------------------- - -1.1082 版本更新 - -1、唤醒支持Ivw4.0引擎,使用msc版本1101; -2、接口方法注释信息,详细请见代码注释或者javaDoc; -3、修改音频数据音量计算方法; - ---------------------------------------------------------------------- -1.1081_release 版本更新 - -1、关闭动态修正ASR_DWA参数,修改Demo及相应说明修改; -2、完善v5版本对外接口方法注释信息,详细请见代码注释或者javaDoc; - ---------------------------------------------------------------------- -1.1081 版本更新 - -1、上传字段添加基站信息mmlc; -2、完善对外接口方法注释信息; -3、修改synthesizerToUri合成无音频时(空格、英文发音人合成中文等情况)抛出10118错误; - ---------------------------------------------------------------------- - -1.1080 版本更新 - -1、使用1101版本离线功能so库 -2、去除v5和v5+判断条件 -3、详细部分类的注释说明 - ---------------------------------------------------------------------- - -1.1079 版本更新信息 - -1.接口&参数调整: - 1、 新增SpeechUtility增加同步锁 - 2、 新增prot_ver=50的默认参数设置 - 3、 新增通过onEvent接口抛出音频数据 - 4、 新增通过onEvent接口抛出session id - 5、 修改onVolumeChange接口回调,增加buffer - 6、 修改声纹key值ISV_AUDIOPATH为ISV_AUDIO_PATH - 7、 修改缓存音频逻辑,详见TTS_BUFFER_TIME参数说明 - 8、 修改人脸、声纹用户id Key值,使用新Key值AUTH_ID参数 -2.功能优化: - 1、 修改性能日志模块 - 2、 新增load库的错误日志 - 3、 修改关于防止int数据溢出的代码 - 4、 修复userwords类无法插入空内容的缺陷 - 5、 修改constant.TEXT字段移到内部msckeys中 -3.语记相关: - 1、 修改语音+下载地址为语记新地址 - 2、 修改语音+action为语记的新action - ---------------------------------------------------------------------- - -1.1077 版本更新信息 - -1.联系人增加destroy接口 -2.支持保存音频wav格式 -3.将是否通知异常打断的参数名称由ASR_INTERRUPT_ERROR改为MFV_INTERRUPT_ERROR -4.修改部分注释及去除VerifierUtil中旋转方法,移动FaceRect类和绘图方法至demo -5.去掉对IdentityVerifier中MSC是否已经加载的判断 -6.人脸和融合验证错误码和描述 -7.混淆文件打开身份验证和工具类 - ---------------------------------------------------------------------- -1.1076 版本更新信息 - ---------------------------------------------------------------------- - -1.1075 版本更新信息 - -1.离线人脸测试稳定版本; -2.离线人脸检测支持图片和视频流; - ---------------------------------------------------------------------- - -1.1074 版本更新信息 - -1.离线人脸检测能力融合至msc; -2.离线人脸检测支持图片和视频流; -3.移除离线人脸关键点检测能力; - ---------------------------------------------------------------------- - -1.1073 版本更新信息 - -1.合成:Aisound合成音频无尾部静音导致读最后一个字很短,min基础上增加4KB的静音块。 -2.注释完善,官网链接修改。 -3.人脸:删除离线人脸JNI类,保留外部接口类,混淆离线人脸接口。 -4.语音+:避免客户端在使用语音功能的同时,语音服务被异常打断,造成mService为null的空指针错误 -5.优化: - 1、将listener置空,解决无法释放context的问题;2、修改onBeginOfSpeech回调,判断快速stop; - 2、修复int值计算溢出导致播放进度为负值问题 - 3、增加:SSB传递 msc.skin字段 -6.性能测试:唤醒、声纹、转写、识别、评测添加SessionBeginEnd字段 -7.lib_name 对外开放,建议预装软件修改名称 - ---------------------------------------------------------------------- - -1.1072 版本更新信息 - -1.在线听写增加结果动态修正功能; -2.修复SpeechUtility在子线程中创建崩溃的bug; -3.cancel前进行判断,避免打印errorlog; -4.新增检查语音+时错误码:20020,表示系统预装版本语音+; -5.优化参数注释; -6.删除获取通话记录的接口和观察者; - ---------------------------------------------------------------------- -1.1071 版本更新信息 - -1.修正由于读音频比当前播放块多引起CED比音频快的问题; -2.修改打包工具根据v5+/语音+来设置engine_mode; -3.增加唤醒注册功能(未完成); -4.评测新增两个字段,在Demo中解析; - ---------------------------------------------------------------------- -1.1070 版本更新信息 - -1.使用1089版本so库; -2.新手指南文档修改; -3.语音评测demo修改; -4.修复本地合成多客户端切换调用导致的应用崩溃问题; -5.修改msc_1088版本ced获取方式; -6.评测增加20秒网络超时,超时报20002; - ---------------------------------------------------------------------- - -1.1068 版本更新信息 - -1.使用1086版本so库; -2.增加语音评测接口; -3.增加人脸识别接口; -4.更换1086版ced获取接口; -5.合成UNICODE去除两个字节头部,解决ced不准问题; -6.删除地图区域参数area_key; - ---------------------------------------------------------------------- - -1.1067 v5+版本更新信息 - -1.使用1042版本so库; -2.增加体验包功能; ---------------------------------------------------------------------- - -1.1063 v5+版本更新信息 - -1.本地合成语速扩充到0-200; -2.初始化时对调用进程名称进行判断,解决由第三方库造成的子进程重复调用问题; -3.修复部分情况下无onEndOfSpeech回调的bug; -4.修复在个别手机上获取联系人出错的Bug; - - ---------------------------------------------------------------------- -1.1058 v5+版本更新信息 - -1.增加本地合成功能; - - ---------------------------------------------------------------------- -1.1057 v5+版本更新信息 - -1.增加本地命令词功能; -2.增加唤醒+本地命令词识别功能; - - ---------------------------------------------------------------------- -1.1048 v5+版本更新信息 - -1.使用v5+实现本地能力; -2.优化响应速度,节省用户流量; - - ---------------------------------------------------------------------- -1.1039版本更新信息 - -1.调整代码,优化接口调用耗时; -2.修复异常调用情况的错误码; -3.更新文档和demo; - ---------------------------------------------------------------------- - -1.1038版本更新信息 - -1.修复检测语音+安装bug; -2.文档更新; - ---------------------------------------------------------------------- - -1.1037版本更新信息 - -1.调整整体识别框架,提升识别效率; -2.提供云+端识别能力; -3.增加错误码提示文字; -4.文档更新; -5.demo重新编写完善; - ---------------------------------------------------------------------- - -1.1032版本更新信息 - -1.精简so库尺寸; -2.增加错误码; -3.修复上次识别立马开始下次识别可能报10132错误的问题 ---------------------------------------------------------------------- - -1.1031版本更新信息 - -1.修复TextUnderstander非主线程回调的问题; -2.增加合成语调参数; -3.默认发音人设置; -4.优化底层协议交互,提升响应时间; - ---------------------------------------------------------------------- - -1.1030版本更新信息 - -1.修复合成打断失败问题; -2.优化识别和合成效果; - ---------------------------------------------------------------------- -1.1029版本更新信息 - -1.增加错误码中文注释; -2.修复部分public字段被混淆的问题; -3.增加开放语义2.0协议文档和Demo; - ---------------------------------------------------------------------- -1.1028版本更新信息 - -1.进一步精简Jar尺寸至179K; -2.支持通过参数设置开放语义2.0协议; -3.修复内测版本功能及接口测试过程中发现的问题; -4.完善API手册和新手指南; - ---------------------------------------------------------------------- -1.1027版本更新信息 - -1.整合语音控件、讯飞语音+、跨平台语音+的错误码文件(ErrorCode),更新错误提示; -2.精简语音控件尺寸,由400K减至200K; -3.开放无UI的识别、合成接口,增加语音转语义SpeechUnderstander和文本转语义TextUnderstander接口; -4.传参接口修改为setParameter,公用参数通过SpeechConstant类读取,相关说明更新在JavaDoc中; -5.修改UI界面,使用新版简洁风格,摒弃“按钮”点击操作,通过“点触屏幕”完成相同功能; -6.修改识别、合成的引擎参数(使用language、domain等); -7.支持实时改变合成音频播放的StreamType(声音类型); -8.支持实时改变语音识别的AudioSource(声源); -9.提供外部写录音文件接口,同时支持保存识别、合成的音频; -10.修改回调接口,删除onEnd等接口,在JavaDoc和新手指南中增加相关说明; -11.优化底层协议代码,提供识别响应速度; -12.识别和语义返回原始结果,通过外部应用层进行解析(示例代码更新至MscDemo); - ---------------------------------------------------------------------- -1.1026版本更新信息 - -1.修复合成缓冲状态下不可以暂停的问题; -2.对Android4.4机型进行适配,优化相关代码兼容性; - ---------------------------------------------------------------------- -1.1026版本更新信息 - -1.初始化接口修改为SpeechUser#Login,转写、合成服务之前均需要调用; -2.优化客户端响应速度; -3.更新Demo和开发文档中初始化部分说明; - ---------------------------------------------------------------------- -1.1025.Lua版本更新信息 - -1.初始化接口修改为SpeechUser#Login,转写、合成服务之前均需要调用; -2.优化客户端响应速度; -3.更新Demo和开发文档中初始化部分说明; - ---------------------------------------------------------------------- -1.1025版本更新信息 - -1.优化识别接口封装,增加连接成功率; -2.SpeechListener类名修改为TextUnderstander; - ---------------------------------------------------------------------- -1.1024版本更新信息 - -1.优化个性化转写的成功率; - ---------------------------------------------------------------------- -1.1023版本更新信息 - -1.优化识别响应时间; -2.更新开发文档,修正部分错误描述; - ---------------------------------------------------------------------- -1.1022版本更新信息 - -1.优化客户端调度,提升识别的响应速度; -2.增加系统未安装浏览器情况下,点击"详细"的跳转提示; - ---------------------------------------------------------------------- -1.1021版本更新信息 - -1.优化数据上传接口,提升上传的成功率; - ---------------------------------------------------------------------- -1.1020版本更新信息 - -1.对网络进行优化,解决报20019网络繁忙的问题; - ---------------------------------------------------------------------- -1.1019版本更新信息 - -1.支持设置识别界面取消按钮的左右位置; - -2.支持参数控制音频播放方式和音频焦点的获取; - ---------------------------------------------------------------------- -1.1018版本更新信息 - -1、增加联系人ContactManager和用户词表UserWords的个性化接口; - -2、增加个性化接口的说明文档,并在Demo中添加相关示例代码; - -3、适配Android2.2版本以上的AudioFocus机制; - ---------------------------------------------------------------------- -1.1017版本更新信息 - -1、优化网络连接,解决长时间录音异常; - -2、解决部分机器抛出的内存不足错误; - ---------------------------------------------------------------------- -1.1016版本更新信息 - -1、解决TTS连续播放异常; - -2、更改默认皮肤; - -3、优化wap网络成功率; - -4、优化合成及识别流程,提高会话成功率。 - ---------------------------------------------------------------------- -1.1015版本更新信息 - -1、解决上一版本1.5系统出现的不兼容问题; - -2、支持Abnf语法文件上传,获得语法ID进行识别; - -3、解决TTS播放过程中,连续调用合成引起的问题。 - ---------------------------------------------------------------------- -1.1013版本更新信息 - -1、解决Android 4.0部分机型TTS合成颤音的问题; - -2、处理器支持 diff --git a/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v6_3_0.so b/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v6_3_0.so deleted file mode 100644 index 0a6412f..0000000 Binary files a/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v6_3_0.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 new file mode 100644 index 0000000..5554ff8 Binary files /dev/null and b/src/MyApplication/app/libs/x86/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/MyApplication/app/libs/x86/libBaiduMapSDK_map_v6_3_0.so b/src/MyApplication/app/libs/x86/libBaiduMapSDK_map_v6_3_0.so deleted file mode 100644 index c334a75..0000000 Binary files a/src/MyApplication/app/libs/x86/libBaiduMapSDK_map_v6_3_0.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 new file mode 100644 index 0000000..1eae31c Binary files /dev/null and b/src/MyApplication/app/libs/x86/libgnustl_shared.so differ diff --git a/src/MyApplication/app/libs/x86/liblocSDK8a.so b/src/MyApplication/app/libs/x86/liblocSDK8a.so deleted file mode 100644 index cc24465..0000000 Binary files a/src/MyApplication/app/libs/x86/liblocSDK8a.so and /dev/null differ diff --git a/src/MyApplication/app/libs/x86/liblocSDK8b.so b/src/MyApplication/app/libs/x86/liblocSDK8b.so new file mode 100644 index 0000000..ca234f1 Binary files /dev/null and b/src/MyApplication/app/libs/x86/liblocSDK8b.so differ diff --git a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v6_3_0.so b/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v6_3_0.so deleted file mode 100644 index 085e99b..0000000 Binary files a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v6_3_0.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 new file mode 100644 index 0000000..a1c0b4b Binary files /dev/null and b/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_base_v7_5_3.so differ diff --git a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_map_v6_3_0.so b/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_map_v6_3_0.so deleted file mode 100644 index fdf69bd..0000000 Binary files a/src/MyApplication/app/libs/x86_64/libBaiduMapSDK_map_v6_3_0.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 new file mode 100644 index 0000000..0149273 Binary files /dev/null and b/src/MyApplication/app/libs/x86_64/libgnustl_shared.so differ diff --git a/src/MyApplication/app/libs/x86_64/liblocSDK8a.so b/src/MyApplication/app/libs/x86_64/liblocSDK8a.so deleted file mode 100644 index b66eb9a..0000000 Binary files a/src/MyApplication/app/libs/x86_64/liblocSDK8a.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 new file mode 100644 index 0000000..ff464c5 Binary files /dev/null and b/src/MyApplication/app/libs/x86_64/liblocSDK8b.so differ diff --git a/src/MyApplication/app/src/main/AndroidManifest.xml b/src/MyApplication/app/src/main/AndroidManifest.xml index 62bb4a5..d1fcaed 100644 --- a/src/MyApplication/app/src/main/AndroidManifest.xml +++ b/src/MyApplication/app/src/main/AndroidManifest.xml @@ -10,14 +10,17 @@ + + + + + + + - - - - + + + + + + + + + + + + + + @@ -72,6 +106,10 @@ android:name="android.app.lib_name" android:value="" /> + + + + \ No newline at end of file diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/FucUtil.java b/src/MyApplication/app/src/main/java/com/example/myapplication/FucUtil.java deleted file mode 100644 index c161107..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/FucUtil.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.example.myapplication; - -import android.content.Context; - -import com.iflytek.cloud.ErrorCode; -import com.iflytek.cloud.SpeechConstant; -import com.iflytek.cloud.SpeechUtility; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; - -/** - * 功能性函数扩展类 - */ -public class FucUtil { - /** - * 读取asset目录下文件。 - * - * @return content - */ - public static String readFile(Context mContext, String file, String code) { - int len = 0; - byte[] buf = null; - String result = ""; - try { - InputStream in = mContext.getAssets().open(file); - len = in.available(); - buf = new byte[len]; - in.read(buf, 0, len); - - result = new String(buf, code); - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - /** - * 将字节缓冲区按照固定大小进行分割成数组 - * - * @param buffer 缓冲区 - * @param length 缓冲区大小 - * @param spsize 切割块大小 - * @return - */ - public static ArrayList splitBuffer(byte[] buffer, int length, int spsize) { - ArrayList array = new ArrayList(); - if (spsize <= 0 || length <= 0 || buffer == null || buffer.length < length) - return array; - int size = 0; - while (size < length) { - int left = length - size; - if (spsize < left) { - byte[] sdata = new byte[spsize]; - System.arraycopy(buffer, size, sdata, 0, spsize); - array.add(sdata); - size += spsize; - } else { - byte[] sdata = new byte[left]; - System.arraycopy(buffer, size, sdata, 0, left); - array.add(sdata); - size += left; - } - } - return array; - } - - /** - * 获取语记是否包含离线听写资源,如未包含跳转至资源下载页面 - * 1.PLUS_LOCAL_ALL: 本地所有资源 - * 2.PLUS_LOCAL_ASR: 本地识别资源 - * 3.PLUS_LOCAL_TTS: 本地合成资源 - */ - public static String checkLocalResource() { - String resource = SpeechUtility.getUtility().getParameter(SpeechConstant.PLUS_LOCAL_ASR); - try { - JSONObject result = new JSONObject(resource); - int ret = result.getInt(SpeechUtility.TAG_RESOURCE_RET); - switch (ret) { - case ErrorCode.SUCCESS: - JSONArray asrArray = result.getJSONObject("result").optJSONArray("asr"); - if (asrArray != null) { - int i = 0; - // 查询否包含离线听写资源 - for (; i < asrArray.length(); i++) { - if ("iat".equals(asrArray.getJSONObject(i).get(SpeechConstant.DOMAIN))) { - //asrArray中包含语言、方言字段,后续会增加支持方言的本地听写。 - //如:"accent": "mandarin","language": "zh_cn" - break; - } - } - if (i >= asrArray.length()) { - - SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR); - return "没有听写资源,跳转至资源下载页面"; - } - } else { - SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR); - return "没有听写资源,跳转至资源下载页面"; - } - break; - case ErrorCode.ERROR_VERSION_LOWER: - return "语记版本过低,请更新后使用本地功能"; - case ErrorCode.ERROR_INVALID_RESULT: - SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR); - return "获取结果出错,跳转至资源下载页面"; - case ErrorCode.ERROR_SYSTEM_PREINSTALL: - default: - break; - } - } catch (Exception e) { - SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR); - return "获取结果出错,跳转至资源下载页面"; - } - return ""; - } - - /** - * 读取asset目录下音频文件。 - * - * @return 二进制文件数据 - */ - public static byte[] readAudioFile(Context context, String filename) { - try { - InputStream ins = context.getAssets().open(filename); - byte[] data = new byte[ins.available()]; - - ins.read(data); - ins.close(); - - return data; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/IatSettings.java b/src/MyApplication/app/src/main/java/com/example/myapplication/IatSettings.java deleted file mode 100644 index d36d761..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/IatSettings.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.example.myapplication; - -import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceActivity; -import android.view.Window; - - -/** - * 听写设置界面 - */ -public class IatSettings extends PreferenceActivity implements OnPreferenceChangeListener { - - public static final String PREFER_NAME = "com.inflater.setting"; - - @SuppressWarnings("deprecation") - public void onCreate(Bundle savedInstanceState) { - requestWindowFeature(Window.FEATURE_NO_TITLE); - super.onCreate(savedInstanceState); - getPreferenceManager().setSharedPreferencesName(PREFER_NAME); - addPreferencesFromResource(R.xml.iat_setting); - - EditTextPreference mVadbosPreference = (EditTextPreference) findPreference("iat_vadbos_preference"); - mVadbosPreference.getEditText().addTextChangedListener(new SettingTextWatcher(IatSettings.this, mVadbosPreference, 0, 10000)); - - EditTextPreference mVadeosPreference = (EditTextPreference) findPreference("iat_vadeos_preference"); - mVadeosPreference.getEditText().addTextChangedListener(new SettingTextWatcher(IatSettings.this, mVadeosPreference, 0, 10000)); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - return true; - } -} diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java b/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java index 25f63fa..d161cb7 100644 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.java @@ -8,6 +8,10 @@ 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 { @@ -30,7 +34,7 @@ public class MainActivity extends AppCompatActivity { button_main_2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Intent intent2=new Intent(MainActivity.this,jiankang.class); + Intent intent2=new Intent(MainActivity.this, MainActivity1.class); startActivity(intent2); } diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java b/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java new file mode 100644 index 0000000..08bb720 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/MapActivity1.java @@ -0,0 +1,221 @@ +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/main/java/com/example/myapplication/SettingTextWatcher.java b/src/MyApplication/app/src/main/java/com/example/myapplication/SettingTextWatcher.java deleted file mode 100644 index 97eb410..0000000 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/SettingTextWatcher.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.example.myapplication; - -import android.content.Context; -import android.preference.EditTextPreference; -import android.text.Editable; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.widget.Toast; - -import java.util.regex.Pattern; - -/** - * 输入框输入范围控制 - */ -public class SettingTextWatcher implements TextWatcher { - private int editStart; - private int editCount; - private EditTextPreference mEditTextPreference; - int minValue;//最小值 - int maxValue;//最大值 - private Context mContext; - - public SettingTextWatcher(Context context, EditTextPreference e, int min, int max) { - mContext = context; - mEditTextPreference = e; - minValue = min; - maxValue = max; - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { -// Log.e("demo", "onTextChanged start:"+start+" count:"+count+" before:"+before); - editStart = start; - editCount = count; - } - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { -// Log.e("demo", "beforeTextChanged start:"+start+" count:"+count+" after:"+after); - } - - @Override - public void afterTextChanged(Editable s) { - if (TextUtils.isEmpty(s)) { - return; - } - String content = s.toString(); -// Log.e("demo", "content:"+content); - if (isNumeric(content)) { - int num = Integer.parseInt(content); - if (num > maxValue || num < minValue) { - s.delete(editStart, editStart + editCount); - mEditTextPreference.getEditText().setText(s); - Toast.makeText(mContext, "超出有效值范围", Toast.LENGTH_SHORT).show(); - } - } else { - s.delete(editStart, editStart + editCount); - mEditTextPreference.getEditText().setText(s); - Toast.makeText(mContext, "只能输入数字哦", Toast.LENGTH_SHORT).show(); - } - } - - /** - * 正则表达式-判断是否为数字 - */ - public static boolean isNumeric(String str) { - Pattern pattern = Pattern.compile("[0-9]*"); - return pattern.matcher(str).matches(); - } - -}; diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java b/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java new file mode 100644 index 0000000..7d561af --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java @@ -0,0 +1,231 @@ +package com.example.myapplication; +import android.annotation.SuppressLint; +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() { + @SuppressLint("HandlerLeak") + @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/main/java/com/example/myapplication/itemfound.java b/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java new file mode 100644 index 0000000..232730e --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/itemfound.java @@ -0,0 +1,224 @@ +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); + // 官网 + //构造WalkNaviLaunchParam + 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); + // 官网 + //构造WalkNaviLaunchParam + 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 new file mode 100644 index 0000000..95deb0b --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/DatabaseHelper.java @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..670e37f --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/FlickrFetcher.java @@ -0,0 +1,103 @@ +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数组 +//解析JSON数组,变成WeatherItem的数组形式 + +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获得的json转换成MarsItem + 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 new file mode 100644 index 0000000..8b9f5b7 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SettingActivity.java @@ -0,0 +1,132 @@ +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代表没有条目被选中 + 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代表没有条目被选中 + 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 new file mode 100644 index 0000000..e9478b3 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/SingleFragmentActivity.java @@ -0,0 +1,30 @@ +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 new file mode 100644 index 0000000..e98a864 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailActivity.java @@ -0,0 +1,34 @@ +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 new file mode 100644 index 0000000..9dc2b31 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherDetailFragment.java @@ -0,0 +1,133 @@ +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图标资源的id + 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 new file mode 100644 index 0000000..81c9a71 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherFragment.java @@ -0,0 +1,372 @@ +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 = "北京"; //记录当前的城市ID,如果有变化,需要刷新你页面 + 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(); + } + + /*回调函数,fragment调用activity的函数,这样点击列表后,方便出发事件,不应该用fragment执行其他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替activity进行处理 + setHasOptionsMenu(true); + + //创建数据库 + mDatabase = new DatabaseHelper(getActivity()).getWritableDatabase(); + + new FetchItemsTask().execute(); //异步执行,获取网站上的json内容 + } + + @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(); //异步执行,获取网站上的json内容 + return; + } + if(unit!=temp_unit){ //在重新启动页面的时候,如果地址改变了,需要刷新 + temp_unit = unit; + new FetchItemsTask().execute(); //异步执行,获取网站上的json内容 + 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图标资源的id + 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; + } + + // 异步从URL获取天气对象 + 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(); + + //实现今天天气部分的UI + 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部分的UI + setupAdapter(); + + //如果是ipad,就手动更新详情页面 + 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) { + //实例化mars_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 new file mode 100644 index 0000000..b6b33f9 --- /dev/null +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/weather/WeatherItem.java @@ -0,0 +1,78 @@ +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/java/com/example/myapplication/yuyin.java b/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java index 81d6db0..74f7ce4 100644 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/yuyin.java @@ -7,13 +7,16 @@ 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; @@ -55,6 +58,8 @@ public class yuyin extends AppCompatActivity implements View.OnClickListener { private TextView tvResult;//识别结果 private Button btnStart;//开始识别 private String resultType = "json";//结果内容数据格式 + private Button go; + private TextView tvResult1; @Override protected void onCreate(Bundle savedInstanceState) { @@ -62,7 +67,9 @@ public class yuyin extends AppCompatActivity implements View.OnClickListener { 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();//权限请求 @@ -112,6 +119,7 @@ public class yuyin extends AppCompatActivity implements View.OnClickListener { public void onResult(RecognizerResult results, boolean isLast) { printResult(results);//结果数据解析 + printButton(results); } @@ -150,6 +158,192 @@ public class yuyin extends AppCompatActivity implements View.OnClickListener { 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{ + + } + + + + + } /** diff --git a/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java b/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java index b6d7d46..9d19533 100644 --- a/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java +++ b/src/MyApplication/app/src/main/java/com/example/myapplication/zhaoxun.java @@ -2,7 +2,13 @@ package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; +import android.annotation.SuppressLint; +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 { @@ -10,5 +16,27 @@ public class zhaoxun extends AppCompatActivity { 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,"正在打开地图",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,"正在打开地图",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/main/jniLibs/libmsc.so b/src/MyApplication/app/src/main/jniLibs/libmsc.so deleted file mode 100644 index 06a3bdd..0000000 Binary files a/src/MyApplication/app/src/main/jniLibs/libmsc.so and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable-hdpi/icon.png b/src/MyApplication/app/src/main/res/drawable-hdpi/icon.png deleted file mode 100644 index cf0cb01..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable-hdpi/no_photo.png b/src/MyApplication/app/src/main/res/drawable-hdpi/no_photo.png deleted file mode 100644 index 05a0d2d..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable-hdpi/no_photo.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable-ldpi/icon.png b/src/MyApplication/app/src/main/res/drawable-ldpi/icon.png deleted file mode 100644 index d2dfdc6..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable-mdpi/icon.png b/src/MyApplication/app/src/main/res/drawable-mdpi/icon.png deleted file mode 100644 index 6a5697e..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/a100.png b/src/MyApplication/app/src/main/res/drawable/a100.png new file mode 100644 index 0000000..e435546 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a100.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a101.png b/src/MyApplication/app/src/main/res/drawable/a101.png new file mode 100644 index 0000000..43f4ab2 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a101.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a102.png b/src/MyApplication/app/src/main/res/drawable/a102.png new file mode 100644 index 0000000..b23965b Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a102.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a103.png b/src/MyApplication/app/src/main/res/drawable/a103.png new file mode 100644 index 0000000..9dcad7a Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a103.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a104.png b/src/MyApplication/app/src/main/res/drawable/a104.png new file mode 100644 index 0000000..86ff29f Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a104.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a150.png b/src/MyApplication/app/src/main/res/drawable/a150.png new file mode 100644 index 0000000..a3886f8 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a150.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a153.png b/src/MyApplication/app/src/main/res/drawable/a153.png new file mode 100644 index 0000000..cb94f14 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a153.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a154.png b/src/MyApplication/app/src/main/res/drawable/a154.png new file mode 100644 index 0000000..de89a6f Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a154.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a300.png b/src/MyApplication/app/src/main/res/drawable/a300.png new file mode 100644 index 0000000..977a857 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a300.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a301.png b/src/MyApplication/app/src/main/res/drawable/a301.png new file mode 100644 index 0000000..6384e67 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a301.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a302.png b/src/MyApplication/app/src/main/res/drawable/a302.png new file mode 100644 index 0000000..83f096d Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a302.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a303.png b/src/MyApplication/app/src/main/res/drawable/a303.png new file mode 100644 index 0000000..94c1d05 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a303.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a304.png b/src/MyApplication/app/src/main/res/drawable/a304.png new file mode 100644 index 0000000..3b3cc28 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a304.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a305.png b/src/MyApplication/app/src/main/res/drawable/a305.png new file mode 100644 index 0000000..6dd845a Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a305.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a306.png b/src/MyApplication/app/src/main/res/drawable/a306.png new file mode 100644 index 0000000..630ad92 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a306.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a307.png b/src/MyApplication/app/src/main/res/drawable/a307.png new file mode 100644 index 0000000..d76028c Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a307.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a308.png b/src/MyApplication/app/src/main/res/drawable/a308.png new file mode 100644 index 0000000..d218a85 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a308.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a309.png b/src/MyApplication/app/src/main/res/drawable/a309.png new file mode 100644 index 0000000..717e779 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a309.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a310.png b/src/MyApplication/app/src/main/res/drawable/a310.png new file mode 100644 index 0000000..e5004aa Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a310.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a311.png b/src/MyApplication/app/src/main/res/drawable/a311.png new file mode 100644 index 0000000..8d5f541 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a311.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a312.png b/src/MyApplication/app/src/main/res/drawable/a312.png new file mode 100644 index 0000000..0f74f47 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a312.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a313.png b/src/MyApplication/app/src/main/res/drawable/a313.png new file mode 100644 index 0000000..5429d60 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a313.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a314.png b/src/MyApplication/app/src/main/res/drawable/a314.png new file mode 100644 index 0000000..9feaa6b Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a314.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a315.png b/src/MyApplication/app/src/main/res/drawable/a315.png new file mode 100644 index 0000000..5b83793 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a315.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a316.png b/src/MyApplication/app/src/main/res/drawable/a316.png new file mode 100644 index 0000000..411aa73 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a316.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a317.png b/src/MyApplication/app/src/main/res/drawable/a317.png new file mode 100644 index 0000000..e2aeb2e Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a317.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a318.png b/src/MyApplication/app/src/main/res/drawable/a318.png new file mode 100644 index 0000000..b729b4a Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a318.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a350.png b/src/MyApplication/app/src/main/res/drawable/a350.png new file mode 100644 index 0000000..81dcaaa Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a350.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a351.png b/src/MyApplication/app/src/main/res/drawable/a351.png new file mode 100644 index 0000000..a3adce4 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a351.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a399.png b/src/MyApplication/app/src/main/res/drawable/a399.png new file mode 100644 index 0000000..a87be77 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a399.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a400.png b/src/MyApplication/app/src/main/res/drawable/a400.png new file mode 100644 index 0000000..b764670 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a400.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a401.png b/src/MyApplication/app/src/main/res/drawable/a401.png new file mode 100644 index 0000000..a4a619d Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a401.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a402.png b/src/MyApplication/app/src/main/res/drawable/a402.png new file mode 100644 index 0000000..d46ec85 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a402.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a403.png b/src/MyApplication/app/src/main/res/drawable/a403.png new file mode 100644 index 0000000..c33e15d Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a403.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a404.png b/src/MyApplication/app/src/main/res/drawable/a404.png new file mode 100644 index 0000000..4fcf44c Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a404.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a405.png b/src/MyApplication/app/src/main/res/drawable/a405.png new file mode 100644 index 0000000..c4e7471 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a405.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a406.png b/src/MyApplication/app/src/main/res/drawable/a406.png new file mode 100644 index 0000000..c0fc63b Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a406.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a407.png b/src/MyApplication/app/src/main/res/drawable/a407.png new file mode 100644 index 0000000..9ff95f2 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a407.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a408.png b/src/MyApplication/app/src/main/res/drawable/a408.png new file mode 100644 index 0000000..c006569 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a408.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a409.png b/src/MyApplication/app/src/main/res/drawable/a409.png new file mode 100644 index 0000000..5f9d6c2 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a409.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a410.png b/src/MyApplication/app/src/main/res/drawable/a410.png new file mode 100644 index 0000000..db28ffc Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a410.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a456.png b/src/MyApplication/app/src/main/res/drawable/a456.png new file mode 100644 index 0000000..20949c7 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a456.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a457.png b/src/MyApplication/app/src/main/res/drawable/a457.png new file mode 100644 index 0000000..334c3d1 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a457.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a499.png b/src/MyApplication/app/src/main/res/drawable/a499.png new file mode 100644 index 0000000..7f9ef59 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a499.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a500.png b/src/MyApplication/app/src/main/res/drawable/a500.png new file mode 100644 index 0000000..ea99407 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a500.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a501.png b/src/MyApplication/app/src/main/res/drawable/a501.png new file mode 100644 index 0000000..d9b1eca Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a501.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a502.png b/src/MyApplication/app/src/main/res/drawable/a502.png new file mode 100644 index 0000000..19d3a41 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a502.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a503.png b/src/MyApplication/app/src/main/res/drawable/a503.png new file mode 100644 index 0000000..406758f Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a503.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a504.png b/src/MyApplication/app/src/main/res/drawable/a504.png new file mode 100644 index 0000000..50af230 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a504.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a507.png b/src/MyApplication/app/src/main/res/drawable/a507.png new file mode 100644 index 0000000..9c0c5da Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a507.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a508.png b/src/MyApplication/app/src/main/res/drawable/a508.png new file mode 100644 index 0000000..f1c84a1 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a508.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a509.png b/src/MyApplication/app/src/main/res/drawable/a509.png new file mode 100644 index 0000000..5dbd197 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a509.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a510.png b/src/MyApplication/app/src/main/res/drawable/a510.png new file mode 100644 index 0000000..0fc21a0 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a510.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a511.png b/src/MyApplication/app/src/main/res/drawable/a511.png new file mode 100644 index 0000000..294da17 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a511.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a512.png b/src/MyApplication/app/src/main/res/drawable/a512.png new file mode 100644 index 0000000..e6a3b34 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a512.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a513.png b/src/MyApplication/app/src/main/res/drawable/a513.png new file mode 100644 index 0000000..a532a39 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a513.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a514.png b/src/MyApplication/app/src/main/res/drawable/a514.png new file mode 100644 index 0000000..acb49e3 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a514.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a515.png b/src/MyApplication/app/src/main/res/drawable/a515.png new file mode 100644 index 0000000..83b2de0 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a515.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a900.png b/src/MyApplication/app/src/main/res/drawable/a900.png new file mode 100644 index 0000000..d8b4c19 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a900.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a901.png b/src/MyApplication/app/src/main/res/drawable/a901.png new file mode 100644 index 0000000..bc28f5f Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a901.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/a999.png b/src/MyApplication/app/src/main/res/drawable/a999.png new file mode 100644 index 0000000..ff99a92 Binary files /dev/null and b/src/MyApplication/app/src/main/res/drawable/a999.png differ diff --git a/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml b/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml index 07d5da9..0d025f9 100644 --- a/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml +++ b/src/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml @@ -5,7 +5,7 @@ android:viewportWidth="108" android:viewportHeight="108"> - - - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/drawable/setting.png b/src/MyApplication/app/src/main/res/drawable/setting.png deleted file mode 100644 index 437bc51..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/setting.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/setting_p.png b/src/MyApplication/app/src/main/res/drawable/setting_p.png deleted file mode 100644 index 0da80e4..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/setting_p.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/drawable/user.png b/src/MyApplication/app/src/main/res/drawable/user.png deleted file mode 100644 index 6a5f7e2..0000000 Binary files a/src/MyApplication/app/src/main/res/drawable/user.png and /dev/null differ diff --git a/src/MyApplication/app/src/main/res/layout/activity_class1.xml b/src/MyApplication/app/src/main/res/layout/activity_class1.xml deleted file mode 100644 index 52be2bc..0000000 --- a/src/MyApplication/app/src/main/res/layout/activity_class1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/activity_detail.xml b/src/MyApplication/app/src/main/res/layout/activity_detail.xml new file mode 100644 index 0000000..8676b91 --- /dev/null +++ b/src/MyApplication/app/src/main/res/layout/activity_detail.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml b/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml new file mode 100644 index 0000000..71db188 --- /dev/null +++ b/src/MyApplication/app/src/main/res/layout/activity_itemfound.xml @@ -0,0 +1,34 @@ + + + + + + + android:textSize="30sp"> + + android:textSize="30sp"> + android:onClick="jump" + android:gravity="left" /> + - - - - - - + android:gravity="left" /> \ 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 new file mode 100644 index 0000000..704e179 --- /dev/null +++ b/src/MyApplication/app/src/main/res/layout/fragment_weather.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..2e4cfc4 --- /dev/null +++ b/src/MyApplication/app/src/main/res/layout/fragment_weather_detail.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/layout/phonedto.xml b/src/MyApplication/app/src/main/res/layout/phonedto.xml deleted file mode 100644 index 6b27af9..0000000 --- a/src/MyApplication/app/src/main/res/layout/phonedto.xml +++ /dev/null @@ -1,14 +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 new file mode 100644 index 0000000..0fc4779 --- /dev/null +++ b/src/MyApplication/app/src/main/res/layout/weather_item.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..4898217 --- /dev/null +++ b/src/MyApplication/app/src/main/res/menu/fragment_detail.xml @@ -0,0 +1,12 @@ + + + + + \ 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 new file mode 100644 index 0000000..5ba00eb --- /dev/null +++ b/src/MyApplication/app/src/main/res/menu/fragment_weather.xml @@ -0,0 +1,12 @@ + + + + + \ 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 new file mode 100644 index 0000000..376104c --- /dev/null +++ b/src/MyApplication/app/src/main/res/values-sw600dp/refs.xml @@ -0,0 +1,4 @@ + + + @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 index 7954437..35c327a 100644 --- a/src/MyApplication/app/src/main/res/values/arrays.xml +++ b/src/MyApplication/app/src/main/res/values/arrays.xml @@ -1,9 +1,11 @@ - - - - - - + + 摄氏度 + 华氏度 + + + sheshidu + huashidu + \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values/colors.xml b/src/MyApplication/app/src/main/res/values/colors.xml index f8c6127..6ffd33f 100644 --- a/src/MyApplication/app/src/main/res/values/colors.xml +++ b/src/MyApplication/app/src/main/res/values/colors.xml @@ -7,4 +7,8 @@ #FF018786 #FF000000 #FFFFFFFF + #FF6200EE + #FF6200EE + #D81B60 + #00BFFF \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/values/dimen.xml b/src/MyApplication/app/src/main/res/values/dimen.xml deleted file mode 100644 index 6d4270d..0000000 --- a/src/MyApplication/app/src/main/res/values/dimen.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 10dp - 5dp - 22sp - 18sp - - - 1dp - diff --git a/src/MyApplication/app/src/main/res/values/refs.xml b/src/MyApplication/app/src/main/res/values/refs.xml new file mode 100644 index 0000000..c8f80fe --- /dev/null +++ b/src/MyApplication/app/src/main/res/values/refs.xml @@ -0,0 +1,4 @@ + + + @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 index 850b258..5885930 100644 --- a/src/MyApplication/app/src/main/res/values/styles.xml +++ b/src/MyApplication/app/src/main/res/values/styles.xml @@ -1,18 +1,11 @@ - - - - \ No newline at end of file + diff --git a/src/MyApplication/app/src/main/res/xml/file_paths.xml b/src/MyApplication/app/src/main/res/xml/file_paths.xml deleted file mode 100644 index 0ad6df2..0000000 --- a/src/MyApplication/app/src/main/res/xml/file_paths.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/MyApplication/app/src/main/res/xml/iat_setting.xml b/src/MyApplication/app/src/main/res/xml/iat_setting.xml deleted file mode 100644 index a70fd18..0000000 --- a/src/MyApplication/app/src/main/res/xml/iat_setting.xml +++ /dev/null @@ -1,39 +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 new file mode 100644 index 0000000..394a6db --- /dev/null +++ b/src/MyApplication/app/src/main/res/xml/pref_setting.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file