伍洲行 3 years ago
parent 858e6ee843
commit b2324b17a8

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,15 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<<<<<<< HEAD
<mapping directory="$PROJECT_DIR$" vcs="Git" />
=======
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
>>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7
</component>
</project>

@ -1,64 +0,0 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.myapplication'
compileSdk 32
defaultConfig {
applicationId "com.example.myapplication"
minSdk 19
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// SOso
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
<<<<<<< HEAD
implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-AllNavi:7.4.0'
implementation files('libs/Msc.jar')
implementation files('libs\\android-support-v4.jar')
=======
implementation files('libs\\BaiduLBS_Android.jar')
implementation files('libs\\BaiduLBS_Android.jar')
implementation files('libs\\BaiduLBS_Android.jar')
implementation files('libs\\BaiduLBS_Android.jar')
implementation files('libs\\BaiduLBS_Android.jar')
implementation files('libs\\BaiduLBS_Android.jar')
>>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
implementation 'androidx.work:work-runtime:2.7.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.1.8'
}

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -1,15 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

@ -1,56 +0,0 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.myapplication'
compileSdk 32
defaultConfig {
applicationId "com.example.myapplication"
minSdk 19
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// SOso
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main{
jniLibs.srcDirs=['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.baidu.lbsyun:BaiduMapSDK_Map-AllNavi:7.4.0'
//implementation files('libs\\BaiduLBS_Android.jar')
//implementation files('libs\\BaiduLBS_Android.jar')
//implementation files('libs\\BaiduLBS_Android.jar')
// implementation files('libs\\BaiduLBS_Android.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

@ -1,39 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-dontoptimize
#-ignorewarnings
#-keeppackagenames com.baidu.**
#-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
#-dontwarn com.baidu.**
#-dontwarn com.baidu.navisdk.**
#-dontwarn com.baidu.navi.**
#-keep class com.baidu.** { *; }
#-keep interface com.baidu.** { *; }
#-keep class vi.com.gdi.** { *; }
#-dontwarn com.google.protobuf.**
#-keep class com.google.protobuf.** { *;}
#-keep interface com.google.protobuf.** { *;}

@ -1,26 +0,0 @@
package com.example.myapplication;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.myapplication", appContext.getPackageName());
}
}

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- 这个权限用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 这个权限用于访问系统接口提供的卫星定位信息 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 用于访问wifi网络信息wifi信息会用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 获取运营商信息,用于支持提供运营商信息相关的接口 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 这个权限用于获取wifi的获取权限wifi信息会用来进行网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 写入扩展存储,向扩展卡写入数据,用于写入离线定位数据 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 访问网络,网络定位需要上网 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" /> <!-- 获取摄像头权限用于AR步行导航 -->
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
android:name=".WNaviGuideActivity"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".itemfound"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MapActivity1"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote" />
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="pFUGlHMArXB22vUlCvWuElgEDX6fhQU7" />
<activity
android:name=".jiankang"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".yuyin"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".zhaoxun"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".yijiantong"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>

@ -1,117 +0,0 @@
package com.example.myapplication;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
/**
* Json
*/
public class JsonParser {
public static String parseIatResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
// 转写结果词,默认使用第一个结果
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
JSONObject obj = items.getJSONObject(0);
ret.append(obj.getString("w"));
// 如果需要多候选结果,解析数组其他字段
// for(int j = 0; j < items.length(); j++)
// {
// JSONObject obj = items.getJSONObject(j);
// ret.append(obj.getString("w"));
// }
}
} catch (Exception e) {
e.printStackTrace();
}
return ret.toString();
}
public static String parseGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for(int j = 0; j < items.length(); j++)
{
JSONObject obj = items.getJSONObject(j);
if(obj.getString("w").contains("nomatch"))
{
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("【置信度】" + obj.getInt("sc"));
ret.append("\n");
}
}
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseLocalGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for(int j = 0; j < items.length(); j++)
{
JSONObject obj = items.getJSONObject(j);
if(obj.getString("w").contains("nomatch"))
{
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("\n");
}
}
ret.append("【置信度】" + joResult.optInt("sc"));
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseTransResult(String json,String key) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
String errorCode = joResult.optString("ret");
if(!errorCode.equals("0")) {
return joResult.optString("errmsg");
}
JSONObject transResult = joResult.optJSONObject("trans_result");
ret.append(transResult.optString(key));
/*JSONArray words = joResult.getJSONArray("results");
for (int i = 0; i < words.length(); i++) {
JSONObject obj = words.getJSONObject(i);
ret.append(obj.getString(key));
}*/
} catch (Exception e) {
e.printStackTrace();
}
return ret.toString();
}
}

@ -1,69 +0,0 @@
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.myapplication.weather.MainActivity1;
import com.example.myapplication.weather.SettingActivity;
import com.example.myapplication.weather.WeatherItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button_main_1=findViewById(R.id.button_main_1);
//点击
button_main_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent1=new Intent(MainActivity.this,yijiantong.class);
startActivity(intent1);
}
});
//点击
Button button_main_2=findViewById(R.id.button_main_2);
button_main_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent2=new Intent(MainActivity.this, MainActivity1.class);
startActivity(intent2);
}
});
Button button_main_3=findViewById(R.id.button_main_3);
//点击
button_main_3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Object packageContext;
Intent intent3=new Intent(MainActivity.this,zhaoxun.class);
startActivity(intent3);
}
});
Button button_main_4=findViewById(R.id.button_main_4);
//点击
button_main_4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Object packageContext;
Intent intent1=new Intent(MainActivity.this,yuyin.class);
startActivity(intent1);
}
});
}
}

@ -1,221 +0,0 @@
package com.example.myapplication;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationConfiguration;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
/*
public class MapActivity1 extends Activity {
private MapView mMapView = null;
private BaiduMap mBaiduMap;
private LocationClient mLocationClient;
private BitmapDescriptor mMarker;
private boolean ifFrist = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_map1);
mMapView = findViewById(R.id.bmapview);
mBaiduMap = mMapView.getMap();
mLocationClient = new LocationClient(this);
MyLocationListener myLocationListener = new MyLocationListener();
mLocationClient.registerLocationListener(myLocationListener);
//覆盖物 用于显示当前位置
mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk);
mBaiduMap.setMyLocationEnabled(true);
LocationClientOption option = new LocationClientOption();
//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
option.setIsNeedAddress(true);
mLocationClient.setLocOption(option);
mLocationClient.start();
}
public class MyLocationListener extends BDAbstractLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
//mapView 销毁后不在处理新接收的位置
if (location == null || mMapView == null){
return;
}
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息顺时针0-360
.latitude(location.getLatitude())
.longitude(location.getLongitude())
.direction(location.getDirection())
.build();
mBaiduMap.setMyLocationData(locData);
MyLocationConfiguration configuration = new MyLocationConfiguration(
MyLocationConfiguration.LocationMode.NORMAL, false, mMarker);
mBaiduMap.setMyLocationConfiguration(configuration);
if (ifFrist) {
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll);
builder.zoom(18.0f);
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
//放大层级
ifFrist = false;
}
}
}
@Override
protected void onResume() {
super.onResume();
mMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
mMapView=findViewById(R.id.bmapview);
mMapView.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
mLocationClient.stop();
mMapView.onDestroy();
}
}
*/
public class MapActivity1 extends AppCompatActivity {
private BitmapDescriptor mMarker;
LocationClient mLocationClient; //定位客户端
MapView mapView; //Android Widget地图控件
BaiduMap baiduMap;
boolean isFirstLocate = true;
TextView tv_Lat; //纬度
TextView tv_Lon; //经度
TextView tv_Add; //地址
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//如果没有定位权限,动态请求用户允许使用该权限
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
}else {
requestLocation();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1:
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "没有定位权限!", Toast.LENGTH_LONG).show();
finish();
} else {
requestLocation();
}
}
}
private void requestLocation() {
initLocation();
mLocationClient.start();
}
private void initLocation() { //初始化
mLocationClient = new LocationClient(getApplicationContext());
mLocationClient.registerLocationListener(new MyLocationListener());
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_map1);
// mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk);
mapView = findViewById(R.id.bmapview);
baiduMap = mapView.getMap();
tv_Lat = findViewById(R.id.tv_Lat);
tv_Lon = findViewById(R.id.tv_Lon);
tv_Add = findViewById(R.id.tv_Add);
LocationClientOption option = new LocationClientOption();
//设置扫描时间间隔
option.setScanSpan(1000);
//设置定位模式,三选一
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
//设置需要地址信息
option.setIsNeedAddress(true);
//保存定位参数
mLocationClient.setLocOption(option);
}
//内部类,百度位置监听器
private class MyLocationListener implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation bdLocation) {
tv_Lat.setText(bdLocation.getLatitude()+"");
tv_Lon.setText(bdLocation.getLongitude()+"");
tv_Add.setText(bdLocation.getAddrStr());
if(bdLocation.getLocType()==BDLocation.TypeGpsLocation || bdLocation.getLocType()==BDLocation.TypeNetWorkLocation){
navigateTo(bdLocation);
}
}
MyLocationConfiguration configuration = new MyLocationConfiguration(
MyLocationConfiguration.LocationMode.NORMAL, false, mMarker);
//
// baiduMap.setMyLocationConfiguration(configuration);
}
private void navigateTo(BDLocation bdLocation) {
if(isFirstLocate){
LatLng ll = new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude());
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll);
baiduMap.animateMapStatus(update);
isFirstLocate = false;
}
}
@Override
protected void onResume() {
super.onResume();
mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
mapView=findViewById(R.id.bmapview);
mapView.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
mLocationClient.stop();
mapView.onDestroy();
}
}

@ -1,18 +0,0 @@
package com.example.myapplication;
import android.app.Application;
import com.iflytek.cloud.SpeechUtility;
public class SpeechApplication extends Application {
@Override
public void onCreate() {
// 5ef048e1 为在开放平台注册的APPID 注意没有空格,直接替换即可
SpeechUtility.createUtility(SpeechApplication.this, "appid=6d0c39e4");
super.onCreate();
}
}

@ -1,237 +0,0 @@
package com.example.myapplication;
<<<<<<< HEAD:src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java
import android.annotation.SuppressLint;
=======
>>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.baidu.mapapi.walknavi.WalkNavigateHelper;
import com.baidu.mapapi.walknavi.adapter.IWNaviStatusListener;
import com.baidu.mapapi.walknavi.adapter.IWRouteGuidanceListener;
import com.baidu.mapapi.walknavi.adapter.IWTTSPlayer;
import com.baidu.mapapi.walknavi.model.RouteGuideKind;
import com.baidu.platform.comapi.walknavi.WalkNaviModeSwitchListener;
import com.baidu.platform.comapi.walknavi.widget.ArCameraView;
public class WNaviGuideActivity extends Activity {
private final static String TAG = WNaviGuideActivity.class.getSimpleName();
private WalkNavigateHelper mNaviHelper;
private boolean isPreSPEAKtotal = true;
private String orient = "";
@Override
protected void onDestroy() {
super.onDestroy();
mNaviHelper.quit();
}
@Override
protected void onResume() {
super.onResume();
mNaviHelper.resume();
}
@Override
protected void onPause() {
super.onPause();
mNaviHelper.pause();
}
Handler handler = new Handler() {
<<<<<<< HEAD:src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java
@SuppressLint("HandlerLeak")
=======
>>>>>>> dc8dfd73a8a58508fec99a79684ba5574328c7e7:src/MyApplication/app/src/MyApplication/app/src/main/java/com/example/myapplication/WNaviGuideActivity.java
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0x001) {
ChangeState();
handler.sendEmptyMessageDelayed(0x001, 45000);
}
if (msg.what == 0x002) {
handler.sendEmptyMessageDelayed(0x002, 30000);
}
if (msg.what == 0x003) {
startActivity(new Intent(WNaviGuideActivity.this, MainActivity.class));
}
}
};
private void ChangeState() {
isPreSPEAKtotal = true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mNaviHelper = WalkNavigateHelper.getInstance();
try {
View view = mNaviHelper.onCreate(WNaviGuideActivity.this);
if (view != null) {
setContentView(view);
}
} catch (Exception e) {
e.printStackTrace();
}
//设置步行导航状态监听
mNaviHelper.setWalkNaviStatusListener(new IWNaviStatusListener() {
@Override
public void onWalkNaviModeChange(int mode, WalkNaviModeSwitchListener listener) {
Log.d("======", "onWalkNaviModeChange : " + mode);
mNaviHelper.switchWalkNaviMode(WNaviGuideActivity.this, mode, listener);
}
/* @Description: 退
* @Author: LiY ue
*/
@Override
public void onNaviExit() {
Log.d("======", "onNaviExit");
handler.removeMessages(0x001);
handler.removeMessages(0x002);
handler.removeMessages(0x003);
}
});
mNaviHelper.setTTsPlayer(new IWTTSPlayer() {
@Override
public int playTTSText(final String s, boolean b) {
Log.d(TAG, "tts: " + s);
return 0;
}
});
boolean startResult = mNaviHelper.startWalkNavi(WNaviGuideActivity.this);
Log.e(TAG, "startWalkNavi result : " + startResult);
//设置路线指引监听
mNaviHelper.setRouteGuidanceListener(this, new
IWRouteGuidanceListener() {
@Override
public void onRouteGuideIconUpdate(Drawable icon) {
}
@Override
public void onRouteGuideKind(RouteGuideKind routeGuideKind) {
Log.d("======", "onRouteGuideKind: " + routeGuideKind);
if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_UTurn)
if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Back || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Front){
Log.d("========", "onRouteGuideKind: aaaaaa");
}
}
/**
* @Description:
*/
@Override
public void onRoadGuideTextUpdate(CharSequence charSequence, CharSequence
charSequence1) {
Log.d(TAG, "onRoadGuideTextUpdate charSequence=: " + charSequence + " charSequence1 = : " +
charSequence1);
orient = charSequence.toString() + charSequence1.toString();
}
@Override
public void onRemainDistanceUpdate(CharSequence charSequence) {
Log.d(TAG, "onRemainDistanceUpdate: charSequence = :" + charSequence);
if (isPreSPEAKtotal) {
}
}
@Override
public void onRemainTimeUpdate(CharSequence charSequence) {
Log.d(TAG, "onRemainTimeUpdate: charSequence = :" + charSequence);
if (isPreSPEAKtotal) {
isPreSPEAKtotal = false;
}
}
@Override
public void onGpsStatusChange(CharSequence charSequence, Drawable drawable) {
Log.d(TAG, "onGpsStatusChange: charSequence = :" + charSequence);
}
@Override
public void onRouteFarAway(CharSequence charSequence, Drawable drawable) {
Log.d(TAG, "onRouteFarAway: charSequence = :" + charSequence);
}
@Override
public void onRoutePlanYawing(CharSequence charSequence, Drawable drawable) {
Log.d(TAG, "onRoutePlanYawing: charSequence = :" + charSequence);
}
@Override
public void onReRouteComplete() {
}
@Override
public void onArriveDest() {
handler.sendEmptyMessageDelayed(0x003, 6000);
}
@Override
public void onIndoorEnd(Message msg) {
}
@Override
public void onFinalEnd(Message msg) {
}
@Override
public void onVibrate() {
}
});
handler.sendEmptyMessage(0x001);
handler.sendEmptyMessage(0x002);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == ArCameraView.WALK_AR_PERMISSION) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) {
Toast.makeText(WNaviGuideActivity.this, "没有相机权限,请打开后重试", Toast.LENGTH_SHORT).show();
} else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mNaviHelper.startCameraAndSetMapView(WNaviGuideActivity.this);
}
}
}
}

@ -1,224 +0,0 @@
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.baidu.mapapi.bikenavi.BikeNavigateHelper;
import com.baidu.mapapi.walknavi.adapter.IWRoutePlanListener;
import com.baidu.mapapi.walknavi.model.WalkRoutePlanError;
import com.baidu.mapapi.walknavi.params.*;
import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.model.LatLng;
import java.util.ArrayList;
import java.util.List;
import android.widget.ImageButton;
import android.widget.TextView;
import android.annotation.SuppressLint;
import android.os.Bundle;
import com.baidu.baidunavis.BaiduNaviParams;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.walknavi.WalkNavigateHelper;
import com.baidu.mapapi.walknavi.adapter.IWEngineInitListener;
import com.baidu.mapapi.walknavi.params.WalkNaviLaunchParam;
public class itemfound extends AppCompatActivity {
private WalkNavigateHelper helper = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//initPermissions(); // 初始化权限
setContentView(R.layout.activity_itemfound); // 填充视图
// 点击按钮开始导航
Button imageButton = findViewById(R.id.button_item_keys);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 初始化步行导航
startBikeNavi();
}
});
Button imageButtonwallet = findViewById(R.id.button_item_wallet);
imageButtonwallet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 初始化步行导航
startBikeNavi();
}
});
}
// 初始化权限
/*
private void initPermissions() {
if (Build.VERSION.SDK_INT >= 23) {
ArrayList<String> 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");
}
});
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save