Merge branch 'dev2_aiSdk' into qa_och_taxi2
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -85,6 +85,7 @@
|
|||||||
<option value="$PROJECT_DIR$/tts/tts-base" />
|
<option value="$PROJECT_DIR$/tts/tts-base" />
|
||||||
<option value="$PROJECT_DIR$/tts/tts-di" />
|
<option value="$PROJECT_DIR$/tts/tts-di" />
|
||||||
<option value="$PROJECT_DIR$/tts/tts-noop" />
|
<option value="$PROJECT_DIR$/tts/tts-noop" />
|
||||||
|
<option value="$PROJECT_DIR$/tts/tts-pad" />
|
||||||
<option value="$PROJECT_DIR$/tts/tts-zhi" />
|
<option value="$PROJECT_DIR$/tts/tts-zhi" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
1
.idea/runConfigurations.xml
generated
1
.idea/runConfigurations.xml
generated
@@ -3,7 +3,6 @@
|
|||||||
<component name="RunConfigurationProducerService">
|
<component name="RunConfigurationProducerService">
|
||||||
<option name="ignoredProducers">
|
<option name="ignoredProducers">
|
||||||
<set>
|
<set>
|
||||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_operation_status_bg_width">145px</dimen>
|
<dimen name="module_mogo_och_operation_status_bg_width">140px</dimen>
|
||||||
<dimen name="module_mogo_och_operation_status_bg_height">145px</dimen>
|
<dimen name="module_mogo_och_operation_status_bg_height">140px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
|
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<dimen name="module_mogo_och_autopilot_status_text_size">44px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_size">44px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_m_l">224px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
|
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
|
||||||
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
|
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
<dimen name="module_mogo_och_autopilot_status_bg_width">300px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_bg_width">300px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_bg_height">100px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_bg_height">100px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_operation_status_bg_width">108px</dimen>
|
<dimen name="module_mogo_och_operation_status_bg_width">100px</dimen>
|
||||||
<dimen name="module_mogo_och_operation_status_bg_height">108px</dimen>
|
<dimen name="module_mogo_och_operation_status_bg_height">100px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_operation_status_padding">35px</dimen>
|
<dimen name="module_mogo_och_operation_status_padding">35px</dimen>
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<dimen name="module_mogo_och_autopilot_status_text_size">30px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_size">30px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
||||||
<dimen name="module_mogo_och_autopilot_status_text_m_l">188px</dimen>
|
<dimen name="module_mogo_och_autopilot_status_text_m_l">288px</dimen>
|
||||||
|
|
||||||
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
|
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
|
||||||
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
|
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ project.dependencies {
|
|||||||
d8xxImplementation rootProject.ext.dependencies.ttszhi
|
d8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||||
d80xImplementation rootProject.ext.dependencies.ttszhi
|
d80xImplementation rootProject.ext.dependencies.ttszhi
|
||||||
f8xxImplementation rootProject.ext.dependencies.ttszhi
|
f8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||||
fPadLenovoImplementation rootProject.ext.dependencies.ttszhi
|
fPadLenovoImplementation rootProject.ext.dependencies.ttspad
|
||||||
f80xImplementation rootProject.ext.dependencies.ttszhi
|
f80xImplementation rootProject.ext.dependencies.ttszhi
|
||||||
f8AmapImplementation rootProject.ext.dependencies.ttszhi
|
f8AmapImplementation rootProject.ext.dependencies.ttszhi
|
||||||
em4Implementation rootProject.ext.dependencies.ttszhi
|
em4Implementation rootProject.ext.dependencies.ttszhi
|
||||||
e8xxImplementation rootProject.ext.dependencies.ttszhi
|
e8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||||
fochtaxiImplementation rootProject.ext.dependencies.ttszhi
|
fochtaxiImplementation rootProject.ext.dependencies.ttszhi
|
||||||
fochbusImplementation rootProject.ext.dependencies.ttszhi
|
fochbusImplementation rootProject.ext.dependencies.ttszhi
|
||||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.ttszhi
|
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.ttspad
|
||||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.ttszhi
|
fPadLenovoOchBusImplementation rootProject.ext.dependencies.ttspad
|
||||||
phoneImplementation rootProject.ext.dependencies.ttszhi
|
phoneImplementation rootProject.ext.dependencies.ttszhi
|
||||||
} else {
|
} else {
|
||||||
bydautoImplementation project(':tts:tts-di')
|
bydautoImplementation project(':tts:tts-di')
|
||||||
@@ -27,15 +27,15 @@ project.dependencies {
|
|||||||
d8xxImplementation project(':tts:tts-zhi')
|
d8xxImplementation project(':tts:tts-zhi')
|
||||||
d80xImplementation project(':tts:tts-zhi')
|
d80xImplementation project(':tts:tts-zhi')
|
||||||
f8xxImplementation project(':tts:tts-zhi')
|
f8xxImplementation project(':tts:tts-zhi')
|
||||||
fPadLenovoImplementation project(':tts:tts-zhi')
|
fPadLenovoImplementation project(':tts:tts-pad')
|
||||||
f80xImplementation project(':tts:tts-zhi')
|
f80xImplementation project(':tts:tts-zhi')
|
||||||
f8AmapImplementation project(':tts:tts-zhi')
|
f8AmapImplementation project(':tts:tts-zhi')
|
||||||
em4Implementation project(':tts:tts-zhi')
|
em4Implementation project(':tts:tts-zhi')
|
||||||
e8xxImplementation project(':tts:tts-zhi')
|
e8xxImplementation project(':tts:tts-zhi')
|
||||||
fochtaxiImplementation project(':tts:tts-zhi')
|
fochtaxiImplementation project(':tts:tts-zhi')
|
||||||
fochbusImplementation project(':tts:tts-zhi')
|
fochbusImplementation project(':tts:tts-zhi')
|
||||||
fPadLenovoOchTaxiImplementation project(':tts:tts-zhi')
|
fPadLenovoOchTaxiImplementation project(':tts:tts-pad')
|
||||||
fPadLenovoOchBusImplementation project(':tts:tts-zhi')
|
fPadLenovoOchBusImplementation project(':tts:tts-pad')
|
||||||
phoneImplementation project(':tts:tts-zhi')
|
phoneImplementation project(':tts:tts-zhi')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ ext {
|
|||||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||||
compileSdkVersion : 28,
|
compileSdkVersion : 28,
|
||||||
buildToolsVersion : "29.0.2",
|
buildToolsVersion : "29.0.2",
|
||||||
minSdkVersion : 22,
|
minSdkVersion : 23,
|
||||||
targetSdkVersion : 23,
|
targetSdkVersion : 23,
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -216,6 +216,7 @@ ext {
|
|||||||
ttsbase : "com.mogo.tts:tts-base:${TTS_BASE_VERSION}",
|
ttsbase : "com.mogo.tts:tts-base:${TTS_BASE_VERSION}",
|
||||||
ttsdi : "com.mogo.tts:tts-di:${TTS_DI_VERSION}",
|
ttsdi : "com.mogo.tts:tts-di:${TTS_DI_VERSION}",
|
||||||
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
|
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
|
||||||
|
ttspad : "com.mogo.tts:tts-pad:${TTS_ZHI_VERSION}",
|
||||||
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
|
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
|
||||||
|
|
||||||
// mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
|
// mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ CRASHREPORT_UPGRADE_VERSION=2.0.12
|
|||||||
TTS_BASE_VERSION=2.0.12
|
TTS_BASE_VERSION=2.0.12
|
||||||
TTS_DI_VERSION=2.0.12
|
TTS_DI_VERSION=2.0.12
|
||||||
TTS_ZHI_VERSION=2.0.12
|
TTS_ZHI_VERSION=2.0.12
|
||||||
|
TTS_PAD_VERSION=2.0.12
|
||||||
TTS_NOOP_VERSION=2.0.12
|
TTS_NOOP_VERSION=2.0.12
|
||||||
# 自研地图
|
# 自研地图
|
||||||
MAP_CUSTOM_VERSION=2.0.12
|
MAP_CUSTOM_VERSION=2.0.12
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ dependencies {
|
|||||||
implementation project(':foudations:mogo-commons')
|
implementation project(':foudations:mogo-commons')
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.31'
|
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.33'
|
||||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,8 +91,12 @@ class MainService : Service() {
|
|||||||
CosUploadManagerImpl.getInstance(AbsMogoApplication.getApp().applicationContext)
|
CosUploadManagerImpl.getInstance(AbsMogoApplication.getApp().applicationContext)
|
||||||
.init(BuildConfig.APPLICATION_ID, 0)
|
.init(BuildConfig.APPLICATION_ID, 0)
|
||||||
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(this) as IMogoServiceApis
|
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(this) as IMogoServiceApis
|
||||||
speed = serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation.speed
|
if (serviceApis.mapServiceApi.getSingletonLocationClient(this) != null &&
|
||||||
Log.d(TAG, "onStartCommand speed = $speed")
|
serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation != null) {
|
||||||
|
speed = serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation.speed
|
||||||
|
Log.d(TAG, "onStartCommand speed = $speed")
|
||||||
|
}
|
||||||
|
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
params = intent.getParcelableExtra("params")
|
params = intent.getParcelableExtra("params")
|
||||||
params?.let {
|
params?.let {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.zhidao.mogo.module.main.independent">
|
package="com.zhidao.mogo.module.main.independent">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainIndependentActivity"
|
android:name=".MainIndependentActivity"
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
package com.zhidao.mogo.module.main.independent;
|
package com.zhidao.mogo.module.main.independent;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||||
import com.mogo.module.main.MainActivity;
|
import com.mogo.module.main.MainActivity;
|
||||||
@@ -20,6 +31,9 @@ import com.mogo.utils.UiThreadHandler;
|
|||||||
*/
|
*/
|
||||||
public class MainIndependentActivity extends MainActivity {
|
public class MainIndependentActivity extends MainActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isFirst = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||||
super.onCreate( savedInstanceState );
|
super.onCreate( savedInstanceState );
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
DebugConfig.setNeedRequestUserInfo(true);
|
DebugConfig.setNeedRequestUserInfo(true);
|
||||||
Log.d(TAG, "onCreate");
|
Log.d(TAG, "onCreate");
|
||||||
|
Log.d("liyz", "MainLauncherActivity onCreate ------->");
|
||||||
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
|
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
|||||||
|
|
||||||
// 进入vr模式,不可缩放地图
|
// 进入vr模式,不可缩放地图
|
||||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||||
UiThreadHandler.postDelayed(this::stepIntoVrMode, 3_000L );
|
UiThreadHandler.postDelayed(this::stepIntoVrMode, 3_500L );
|
||||||
}
|
}
|
||||||
|
|
||||||
mClickShareVoiceStrings =
|
mClickShareVoiceStrings =
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
|
|
||||||
<corners android:radius="60px" />
|
<corners android:radius="@dimen/module_switch_image_circle" />
|
||||||
|
|
||||||
<solid android:color="@color/module_switch_map_bg" />
|
<solid android:color="@color/module_switch_map_bg" />
|
||||||
|
|
||||||
|
|||||||
@@ -13,4 +13,5 @@
|
|||||||
<dimen name="module_switch_margin_left">22px</dimen>
|
<dimen name="module_switch_margin_left">22px</dimen>
|
||||||
<dimen name="module_switch_text_size">36px</dimen>
|
<dimen name="module_switch_text_size">36px</dimen>
|
||||||
<dimen name="module_switch_image">50px</dimen>
|
<dimen name="module_switch_image">50px</dimen>
|
||||||
|
<dimen name="module_switch_image_circle">60px</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -191,4 +191,11 @@
|
|||||||
<dimen name="module_ext_arcView_center_text_size">80px</dimen>
|
<dimen name="module_ext_arcView_center_text_size">80px</dimen>
|
||||||
<dimen name="module_ext_arcView_des_text_size">28px</dimen>
|
<dimen name="module_ext_arcView_des_text_size">28px</dimen>
|
||||||
|
|
||||||
|
<dimen name="module_switch_map">190px</dimen>
|
||||||
|
<dimen name="module_switch_map_height">76px</dimen>
|
||||||
|
<dimen name="module_switch_margin_left">16px</dimen>
|
||||||
|
<dimen name="module_switch_text_size">24px</dimen>
|
||||||
|
<dimen name="module_switch_image">35px</dimen>
|
||||||
|
<dimen name="module_switch_image_circle">38px</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -243,9 +243,12 @@
|
|||||||
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
|
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
|
||||||
<dimen name="module_video_window_width_content">400px</dimen>
|
<dimen name="module_video_window_width_content">400px</dimen>
|
||||||
<dimen name="module_video_window_height_content">300px</dimen>
|
<dimen name="module_video_window_height_content">300px</dimen>
|
||||||
<dimen name="module_switch_map">279px</dimen>
|
|
||||||
<dimen name="module_switch_map_height">119px</dimen>
|
<dimen name="module_switch_map">190px</dimen>
|
||||||
<dimen name="module_switch_margin_left">23px</dimen>
|
<dimen name="module_switch_map_height">76px</dimen>
|
||||||
<dimen name="module_switch_text_size">35px</dimen>
|
<dimen name="module_switch_margin_left">16px</dimen>
|
||||||
<dimen name="module_switch_image">50px</dimen>
|
<dimen name="module_switch_text_size">24px</dimen>
|
||||||
|
<dimen name="module_switch_image">35px</dimen>
|
||||||
|
<dimen name="module_switch_image_circle">38px</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.mogo.module.main;
|
package com.mogo.module.main;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@@ -42,6 +47,8 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.mogo.module.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
* @since 2019-12-23
|
* @since 2019-12-23
|
||||||
@@ -76,6 +83,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
|
|
||||||
protected ConstraintLayout clSpecialEffect;
|
protected ConstraintLayout clSpecialEffect;
|
||||||
|
|
||||||
|
private boolean isFirst = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
if (!DebugConfig.isMapBased()) {
|
if (!DebugConfig.isMapBased()) {
|
||||||
@@ -155,6 +164,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
NetworkUtils.listenNetStrength(this);
|
NetworkUtils.listenNetStrength(this);
|
||||||
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
|
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
|
||||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||||
|
|
||||||
|
mPresenter.checkPermission(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
@@ -426,4 +437,55 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == MOGO_PERMISSION_REQUEST_CODE) {
|
||||||
|
boolean isAllGranted = true;
|
||||||
|
// 判断是否所有的权限都已经授予了
|
||||||
|
for (int grant : grantResults) {
|
||||||
|
Log.d("liyz", "grant =" + grant);
|
||||||
|
if (grant != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
isAllGranted = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("liyz", "onRequestPermissionsResult isAllGranted = " + isAllGranted);
|
||||||
|
if (isAllGranted) {
|
||||||
|
isFirst = false;
|
||||||
|
} else {
|
||||||
|
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
|
||||||
|
if (!isFirst) {
|
||||||
|
openAppDetails();
|
||||||
|
isFirst = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开APP的详情设置
|
||||||
|
*/
|
||||||
|
private void openAppDetails() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
|
||||||
|
builder.setPositiveButton("手动授权", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("取消", null);
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package com.mogo.module.main;
|
package com.mogo.module.main;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
import com.mogo.commons.mvp.Presenter;
|
import com.mogo.commons.mvp.Presenter;
|
||||||
@@ -37,6 +43,8 @@ public class MainPresenter extends Presenter< MainView > {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final int MOGO_PERMISSION_REQUEST_CODE = 10000;
|
||||||
|
|
||||||
public MainPresenter( MainView view ) {
|
public MainPresenter( MainView view ) {
|
||||||
super( view );
|
super( view );
|
||||||
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
|
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
|
||||||
@@ -47,6 +55,46 @@ public class MainPresenter extends Presenter< MainView > {
|
|||||||
super.onCreate( owner );
|
super.onCreate( owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkPermission(Activity activity) {
|
||||||
|
boolean isAllGranted = checkPermissionAllGranted(
|
||||||
|
new String[]{
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (isAllGranted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求权限
|
||||||
|
*/
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
activity,
|
||||||
|
new String[]{
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
|
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
}, MOGO_PERMISSION_REQUEST_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否拥有指定的所有权限
|
||||||
|
*/
|
||||||
|
private boolean checkPermissionAllGranted(String[] permissions) {
|
||||||
|
for (String permission : permissions) {
|
||||||
|
if (ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// 只要有一个权限没有被授予, 则直接返回 false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 延时操作
|
* 延时操作
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -245,8 +245,11 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
|||||||
R.dimen.module_v2x_event_panel_btn_x
|
R.dimen.module_v2x_event_panel_btn_x
|
||||||
})
|
})
|
||||||
val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y)
|
val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y)
|
||||||
V2XServiceManager.getMogoEntranceButtonController()
|
|
||||||
.addBottomLayerView(mV2XEventPanelHistoryCountView, x, y)
|
if (V2XServiceManager.getMogoEntranceButtonController() != null) {
|
||||||
|
V2XServiceManager.getMogoEntranceButtonController()
|
||||||
|
.addBottomLayerView(mV2XEventPanelHistoryCountView, x, y)
|
||||||
|
}
|
||||||
mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
|
mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
|
||||||
View.GONE
|
View.GONE
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ include ':foudations:mogo-base-websocket-sdk'
|
|||||||
include ':tts:tts-base'
|
include ':tts:tts-base'
|
||||||
include ':tts:tts-di'
|
include ':tts:tts-di'
|
||||||
include ':tts:tts-zhi'
|
include ':tts:tts-zhi'
|
||||||
|
include ':tts:tts-pad'
|
||||||
include ':tts:tts-noop'
|
include ':tts:tts-noop'
|
||||||
include ':test:crashreport'
|
include ':test:crashreport'
|
||||||
include ':test:crashreport-bugly'
|
include ':test:crashreport-bugly'
|
||||||
|
|||||||
1
tts/tts-pad/.gitignore
vendored
Normal file
1
tts/tts-pad/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
54
tts/tts-pad/build.gradle
Normal file
54
tts/tts-pad/build.gradle
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.alibaba.arouter'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||||
|
versionCode Integer.valueOf(VERSION_CODE)
|
||||||
|
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
|
||||||
|
javaCompileOptions {
|
||||||
|
annotationProcessorOptions {
|
||||||
|
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
implementation rootProject.ext.dependencies.androidxappcompat
|
||||||
|
implementation rootProject.ext.dependencies.arouter
|
||||||
|
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||||
|
|
||||||
|
api rootProject.ext.dependencies.aiassist
|
||||||
|
api rootProject.ext.dependencies.aiassistReplace
|
||||||
|
|
||||||
|
if (Boolean.valueOf(RELEASE)) {
|
||||||
|
implementation rootProject.ext.dependencies.ttsbase
|
||||||
|
implementation rootProject.ext.dependencies.mogoutils
|
||||||
|
} else {
|
||||||
|
implementation project(":tts:tts-base")
|
||||||
|
implementation project(":foudations:mogo-utils")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||||
0
tts/tts-pad/consumer-rules.pro
Normal file
0
tts/tts-pad/consumer-rules.pro
Normal file
3
tts/tts-pad/gradle.properties
Normal file
3
tts/tts-pad/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
GROUP=com.mogo.tts
|
||||||
|
POM_ARTIFACT_ID=tts-pad
|
||||||
|
VERSION_CODE=1
|
||||||
21
tts/tts-pad/proguard-rules.pro
vendored
Normal file
21
tts/tts-pad/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
5
tts/tts-pad/src/main/AndroidManifest.xml
Normal file
5
tts/tts-pad/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.mogo.tts.pad">
|
||||||
|
|
||||||
|
/
|
||||||
|
</manifest>
|
||||||
480
tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java
Normal file
480
tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java
Normal file
@@ -0,0 +1,480 @@
|
|||||||
|
package com.mogo.tts.pad;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.tts.base.IMogoTTS;
|
||||||
|
import com.mogo.tts.base.IMogoTTSCallback;
|
||||||
|
import com.mogo.tts.base.MogoTTSConstants;
|
||||||
|
import com.mogo.tts.base.PreemptType;
|
||||||
|
import com.mogo.utils.AppUtils;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||||
|
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||||
|
import com.zhidao.voicesdk.MogoVoiceManagerImpl;
|
||||||
|
import com.zhidao.voicesdk.callback.OnConnStatusListener;
|
||||||
|
import com.zhidao.voicesdk.callback.OnTtsListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/10/12
|
||||||
|
* <p>
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Route( path = MogoTTSConstants.API_PATH )
|
||||||
|
class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||||
|
|
||||||
|
private static final String TAG = "ZhiTTS";
|
||||||
|
private String mLastQAndASpeakText;
|
||||||
|
|
||||||
|
private boolean mHasFlush = false;
|
||||||
|
private boolean mInitReady = false;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
Logger.d( TAG, "release" );
|
||||||
|
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
|
||||||
|
for ( String cmd : mCmdMap.keySet() ) {
|
||||||
|
try {
|
||||||
|
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mQAndAMap.clear();
|
||||||
|
mVoiceClient.release();
|
||||||
|
mSpeakVoiceMap.clear();
|
||||||
|
mCacheUnWakeupCommands.clear();
|
||||||
|
mContext = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VoiceClient mVoiceClient;
|
||||||
|
private MogoVoiceManager mogoVoiceManager;
|
||||||
|
// 免唤醒指令
|
||||||
|
private Map< String, List< IMogoTTSCallback > > mCmdMap = new HashMap<>();
|
||||||
|
// 问答指令
|
||||||
|
private Map< String, IMogoTTSCallback > mQAndAMap = new HashMap<>();
|
||||||
|
// 单独的语音播放
|
||||||
|
private Map< String, IMogoTTSCallback > mSpeakVoiceMap = new HashMap<>();
|
||||||
|
|
||||||
|
private Map< String, String[] > mCacheUnWakeupCommands = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
private void initFlushStatus() {
|
||||||
|
if ( !mHasFlush ) {
|
||||||
|
mHasFlush = isVoiceServiceReady( mContext );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化
|
||||||
|
*/
|
||||||
|
private void initSpeech( Context context ) {
|
||||||
|
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||||
|
mogoVoiceManager.init( context, new OnConnStatusListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
mInitReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否语音注册成功
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean hasFlush() {
|
||||||
|
return mHasFlush;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdSelected( String cmd ) {
|
||||||
|
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Logger.d( TAG, "received command: %s", cmd );
|
||||||
|
|
||||||
|
Iterator< IMogoTTSCallback > iterator = null;
|
||||||
|
try {
|
||||||
|
List< IMogoTTSCallback > cmdCallBacks = mCmdMap.get( cmd );
|
||||||
|
iterator = new ArrayList<>( cmdCallBacks ).iterator();
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
while ( iterator != null && iterator.hasNext() ) {
|
||||||
|
IMogoTTSCallback callBack = iterator.next();
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onCmdSelected( cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdAction( String speakText ) {
|
||||||
|
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||||
|
IMogoTTSCallback cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||||
|
if ( cmdCallBack != null ) {
|
||||||
|
cmdCallBack.onCmdAction( speakText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdCancel( String speakText ) {
|
||||||
|
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||||
|
IMogoTTSCallback cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||||
|
if ( cmdCallBack != null ) {
|
||||||
|
cmdCallBack.onCmdCancel( speakText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpeakEnd( String speakText ) {
|
||||||
|
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||||
|
mLastQAndASpeakText = speakText;
|
||||||
|
IMogoTTSCallback cmdCallBack = mQAndAMap.get( speakText );
|
||||||
|
if ( cmdCallBack != null ) {
|
||||||
|
cmdCallBack.onSpeakEnd( speakText );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IMogoTTSCallback callBack = mSpeakVoiceMap.remove( speakText );
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onSpeakEnd( speakText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpeakSelectTimeOut( String speakText ) {
|
||||||
|
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||||
|
if ( TextUtils.equals( speakText, mLastQAndASpeakText ) ) {
|
||||||
|
mLastQAndASpeakText = null;
|
||||||
|
}
|
||||||
|
IMogoTTSCallback cmdCallBack = mQAndAMap.remove( speakText );
|
||||||
|
if ( cmdCallBack != null ) {
|
||||||
|
cmdCallBack.onSpeakSelectTimeOut( speakText );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IMogoTTSCallback callBack = mSpeakVoiceMap.remove( speakText );
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onSpeakSelectTimeOut( speakText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音播报
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void speakTTSVoice( String text, IMogoTTSCallback callBack ) {
|
||||||
|
try {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mSpeakVoiceMap.put( text, callBack );
|
||||||
|
mVoiceClient.speakDefault( text );
|
||||||
|
}
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音播报
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public void speakTTSVoice( String text ) {
|
||||||
|
try {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mVoiceClient.speakDefault( text );
|
||||||
|
}
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音播报
|
||||||
|
*
|
||||||
|
* @param text 播报内容
|
||||||
|
* @param type 播报策略
|
||||||
|
*/
|
||||||
|
public void speakTTSVoice( String text, PreemptType type, IMogoTTSCallback callBack ) {
|
||||||
|
try {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mSpeakVoiceMap.put( text, callBack );
|
||||||
|
VoiceClient.PreemptType preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_NONE;
|
||||||
|
if ( type != null ) {
|
||||||
|
switch ( type ) {
|
||||||
|
case PREEMPT_TYPE_NEXT:
|
||||||
|
preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_NEXT;
|
||||||
|
break;
|
||||||
|
case PREEMPT_TYPE_FLUSH:
|
||||||
|
preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_FLUSH;
|
||||||
|
break;
|
||||||
|
case PREEMPT_TYPE_IMMEDIATELY:
|
||||||
|
preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY;
|
||||||
|
break;
|
||||||
|
case PREEMPT_TYPE_IMMEDIATELY_WITHOUT_CANCEL:
|
||||||
|
preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mVoiceClient.speakTypeText( text, preemptType );
|
||||||
|
}
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问答类型语音注册:默认确认和取消
|
||||||
|
*
|
||||||
|
* @param tts 播报内容
|
||||||
|
*/
|
||||||
|
public void speakQAndACmd( String tts, IMogoTTSCallback callBack ) {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mQAndAMap.put( tts, callBack );
|
||||||
|
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问答类型语音注册
|
||||||
|
*
|
||||||
|
* @param tts 播报内容
|
||||||
|
* @param okCmds 确认命令唤醒词
|
||||||
|
* @param cancelCmds 取消命令唤醒词
|
||||||
|
*/
|
||||||
|
public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoTTSCallback callBack ) {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mQAndAMap.put( tts, callBack );
|
||||||
|
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册免唤醒命令
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
* @param cmdWords
|
||||||
|
* @param callBack
|
||||||
|
*/
|
||||||
|
public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoTTSCallback callBack ) {
|
||||||
|
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||||
|
mCmdMap.put( cmd, new ArrayList<>() );
|
||||||
|
}
|
||||||
|
mCmdMap.get( cmd ).add( callBack );
|
||||||
|
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||||
|
mCacheUnWakeupCommands.remove( cmd );
|
||||||
|
}
|
||||||
|
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
|
||||||
|
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册免唤醒命令
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
* @param cmdWords
|
||||||
|
*/
|
||||||
|
private void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||||
|
initFlushStatus();
|
||||||
|
if ( mHasFlush ) {
|
||||||
|
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||||
|
mCacheUnWakeupCommands.remove( cmd );
|
||||||
|
}
|
||||||
|
Logger.i( TAG, "cache un wakeup command. %s", cmd );
|
||||||
|
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注销免唤醒命令
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
*/
|
||||||
|
public synchronized void unregisterUnWakeupCommand( String cmd ) {
|
||||||
|
mCmdMap.remove( cmd );
|
||||||
|
try {
|
||||||
|
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
mCacheUnWakeupCommands.remove( cmd );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注销免唤醒命令
|
||||||
|
*
|
||||||
|
* @param cmd
|
||||||
|
*/
|
||||||
|
public synchronized void unregisterUnWakeupCommand( String cmd, IMogoTTSCallback callBack ) {
|
||||||
|
if ( mCmdMap.containsKey( cmd ) ) {
|
||||||
|
List< IMogoTTSCallback > callBacks = mCmdMap.get( cmd );
|
||||||
|
if ( callBacks != null ) {
|
||||||
|
callBacks.remove( callBack );
|
||||||
|
}
|
||||||
|
if ( callBacks.isEmpty() ) {
|
||||||
|
mCmdMap.remove( cmd );
|
||||||
|
try {
|
||||||
|
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
mCacheUnWakeupCommands.remove( cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startAssistant( Context context ) {
|
||||||
|
startAssistant( context, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入
|
||||||
|
*/
|
||||||
|
public static void startAssistant( Context context, int status ) {
|
||||||
|
final Intent intent = new Intent();
|
||||||
|
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||||
|
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||||
|
intent.putExtra( "window_start_cancel", status );
|
||||||
|
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||||
|
Logger.d( TAG, "status = %d", status );
|
||||||
|
context.sendBroadcast( intent );
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void flush() {
|
||||||
|
if ( mCacheUnWakeupCommands.isEmpty() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mHasFlush = true;
|
||||||
|
Logger.d( TAG, "flush cache voice command when voice service ready." );
|
||||||
|
final Map< String, String[] > tmp = new HashMap<>( mCacheUnWakeupCommands );
|
||||||
|
for ( String cmd : tmp.keySet() ) {
|
||||||
|
registerUnWakeupCommand( cmd, tmp.get( cmd ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isVoiceServiceReady( Context context ) {
|
||||||
|
if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.zhidao.speech" ) )) {
|
||||||
|
return true;
|
||||||
|
} else if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.txz" ) )
|
||||||
|
&& AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.adapter" ) ) ) {
|
||||||
|
Logger.d( TAG, "txz is voiceServiceReady" );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void speakTTSAndDuck( String text ) {
|
||||||
|
speakTTSAndDuck( text, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void speakTTSAndDuck( String text, IMogoTTSCallback callBack ) {
|
||||||
|
try {
|
||||||
|
if ( mInitReady ) {
|
||||||
|
mSpeakVoiceMap.put( text, callBack );
|
||||||
|
mogoVoiceManager.toSpeak( text, -3, this );
|
||||||
|
}
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutUp( String ttsId, String text ) {
|
||||||
|
try {
|
||||||
|
mSpeakVoiceMap.remove( text );
|
||||||
|
mogoVoiceManager.shutUp( ttsId );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打断上一条正在播报的语音内容,仅在Speech上生效,TXZ为空实现
|
||||||
|
* 语音SDK生效版本从1.0.8.4版本起
|
||||||
|
*/
|
||||||
|
public void breakOffSpeak() {
|
||||||
|
mVoiceClient.breakOffSpeak();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearTTSCallback( String text ) {
|
||||||
|
try {
|
||||||
|
mSpeakVoiceMap.remove( text );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTtsStart( String ttsId, String text ) {
|
||||||
|
IMogoTTSCallback callBack = mSpeakVoiceMap.get( text );
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onTTSStart( ttsId, text );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTtsFinish( String ttsId, String text ) {
|
||||||
|
IMogoTTSCallback callBack = mSpeakVoiceMap.remove( text );
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onTTSEnd( ttsId, text );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTtsError( String ttsId, String text ) {
|
||||||
|
IMogoTTSCallback callBack = mSpeakVoiceMap.remove( text );
|
||||||
|
if ( callBack != null ) {
|
||||||
|
callBack.onTTSError( ttsId, text );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
if ( context != null ) {
|
||||||
|
mContext = context.getApplicationContext();
|
||||||
|
mVoiceClient = new VoiceClient( mContext );
|
||||||
|
mVoiceClient.setCallBack( this );
|
||||||
|
initFlushStatus();
|
||||||
|
initSpeech( context );
|
||||||
|
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAIAssist( Context context ) {
|
||||||
|
startAssistant( context, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startAIAssist( Context context, int status ) {
|
||||||
|
final Intent intent = new Intent();
|
||||||
|
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||||
|
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||||
|
intent.putExtra( "window_start_cancel", status );
|
||||||
|
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||||
|
Logger.d( TAG, "status = %d", status );
|
||||||
|
context.sendBroadcast( intent );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.mogo.tts.zhi">
|
package="com.mogo.tts.pad">
|
||||||
|
|
||||||
/
|
/
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.mogo.tts.zhi;
|
package com.mogo.tts.pad;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
Reference in New Issue
Block a user