final
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.
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 +0,0 @@
|
|||||||
/build
|
|
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.
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,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 +0,0 @@
|
|||||||
My Application
|
|
@ -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 +0,0 @@
|
|||||||
/build
|
|
@ -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>
|
|
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.
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,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,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,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,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…
Reference in new issue