This commit is contained in:
zhongchao
2021-11-05 22:59:09 +08:00
parent a4938ccd8c
commit 6c094debd8
96 changed files with 671 additions and 3266 deletions

84
.idea/misc.xml generated
View File

@@ -13,64 +13,62 @@
<map>
<entry key="../../../../../../layout/custom_preview.xml" value="0.390625" />
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
<entry key="OCH/mogo-och-bus/src/main/res/layout/item_och_bus_station.xml" value="0.3385416666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.24010416666666667" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="1.0" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.1734375" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.25833333333333336" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="1.0" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml" value="0.46307692307692305" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting_control.xml" value="0.3854166666666667" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_perspective_switch.xml" value="1.0" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="1.0" />
<entry key="modules/mogo-module-adas/src/main/res/drawable/module_adas_left_corner_bg.xml" value="0.22125" />
<entry key="modules/mogo-module-adas/src/main/res/layout/dialog_adas_dispatch_remind.xml" value="0.22658490296325878" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml" value="0.28125" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps_navigator.xml" value="0.27395833333333336" />
<entry key="modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml" value="0.28125" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_calling_user_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_fragment_team_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_view.xml" value="0.25" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_user_view.xml" value="0.46041666666666664" />
<entry key="modules/mogo-module-chat/src/main/res/layout/window_incomming_call_big.xml" value="0.5640625" />
<entry key="modules/mogo-module-extensions/src/main/res/layout-xhdpi-2000x1080/include_navi_info_panle.xml" value="0.3640625" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_item_v2x_live_video.xml" value="0.4401041666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_push_live_video.xml" value="0.4401041666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.375" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml" value="0.4401041666666667" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.34427083333333336" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/module_hmi_warning_v2x.xml" value="0.246875" />
<entry key="OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml" value="0.1010068539349746" />
<entry key="OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml" value="0.19479166666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" />
<entry key="modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml" value="0.273046875" />
<entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml" value="0.231875" />
<entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_incoming_bg.xml" value="0.231875" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_calling_user_view.xml" value="0.14839901477832512" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml" value="0.14839901477832512" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml" value="0.4675893879776822" />
<entry key="modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_user_view.xml" value="0.5252875333263728" />
<entry key="modules/mogo-module-chat/src/main/res/drawable/selector_btn_hangup.xml" value="0.231875" />
<entry key="modules/mogo-module-chat/src/main/res/drawable/selector_btn_scale_dialing.xml" value="0.199609375" />
<entry key="modules/mogo-module-chat/src/main/res/drawable/voice_answer_selector.xml" value="0.199609375" />
<entry key="modules/mogo-module-chat/src/main/res/layout/window_incomming_call_big.xml" value="0.14839901477832512" />
<entry key="modules/mogo-module-chat/src/main/res/layout/window_incomming_call_small.xml" value="0.1" />
<entry key="modules/mogo-module-extensions/src/main/res/drawable/module_mogo_autopilot_status_bg.xml" value="0.19479166666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_item_v2x_live_video.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_push_live_video.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_view_video_layout_normal.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/include_debug_panel.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_include_seeking_help_notice.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.8699541920928865" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance_no_map.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_map_layout_navi_info_panel.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-guide/src/main/res/layout/module_guide_fragment.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-guide/src/main/res/layout/module_guide_item_stage_five.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="1.0" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.3453125" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.25" />
<entry key="modules/mogo-module-left-panel/src/main/res/layout/module_left_panel_simple_speed.xml" value="0.3026041666666667" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="1.25" />
<entry key="modules/mogo-module-left-panel/src/main/res/layout/module_left_panel_simple_speed.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_left.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_right.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_top.xml" value="0.33" />
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml" value="0.3125" />
<entry key="modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml" value="0.1515625" />
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main_no_map.xml" value="0.33645833333333336" />
<entry key="modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml" value="0.17864583333333334" />
<entry key="modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml" value="0.315625" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch.xml" value="0.184" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch_affirm.xml" value="0.19166666666666668" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_map_marker_blue_info.xml" value="0.184" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_adas_left_corner_bg.xml" value="0.22125" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_affirm_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_cancel_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_timer_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_right_corner_bg.xml" value="0.22125" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.5546876453218006" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_crossroad_live_video.xml" value="0.12612612612612611" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_see_frontcar_live_video.xml" value="0.23020833333333332" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/view_video_layout_see_crossroad.xml" value="0.23020833333333332" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/view_video_layout_see_live.xml" value="0.23020833333333332" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_road_video_layout.xml" value="0.12708333333333333" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml" value="0.3854166666666667" />
<entry key="modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml" value="0.3338541666666667" />
<entry key="modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml" value="0.2838541666666667" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.Process;
import android.util.Log;
import com.alibaba.android.arouter.launcher.ARouter;
import com.auto.zhidao.logsdk.CrashSystem;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
@@ -32,6 +33,9 @@ import com.mogo.module.share.constant.ShareConstants;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.utils.ObuConfig;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
import com.mogo.test.crashreport.ITestCrashReportProvider;
import com.mogo.test.crashreport.upgrade.UpgradeReportProvider;
import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
import com.mogo.utils.ProcessUtils;
@@ -249,6 +253,22 @@ public class MogoApplication extends AbsMogoApplication {
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
// 关闭长链服务
apis.getSocketManagerApi(getApplicationContext()).destroy();
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
@Override
public void onConnectFailure() {
DebugConfig.setDownloadSnapshot(false);
}
@Override
public void onConnectSuccess() {
DebugConfig.setDownloadSnapshot(true);
}
@Override
public void onConnectLost() {
DebugConfig.setDownloadSnapshot(false);
}
});
// 开启Socket长链服务
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId());
}

View File

@@ -310,6 +310,26 @@ public class DebugConfig {
return sProductFlavor != null && sProductFlavor.startsWith("foch");
}
public static int sSelfCarSpeedYOffset = 20;
public static void setSelfCarSpeedYOffset(int sSelfCarSpeedYOffset) {
DebugConfig.sSelfCarSpeedYOffset = sSelfCarSpeedYOffset;
}
public static int getSelfCarSpeedYOffset() {
return sSelfCarSpeedYOffset;
}
private static boolean downloadSnapshot = false;
public static boolean isDownloadSnapshot() {
return downloadSnapshot;
}
public static void setDownloadSnapshot(boolean downloadSnapshot) {
DebugConfig.downloadSnapshot = downloadSnapshot;
}
// 环境状态
public static final int sLocation = 0;
public static final int sAdasRecognized = 1;

View File

@@ -1,2 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.carchatting" />
package="com.mogo.module.carchatting" >
<application>
<!--这里是为了测试增加的广播-->
<receiver android:name=".biz.Test">
<intent-filter>
<action android:name="com.callchat" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -7,7 +7,9 @@ import com.google.gson.Gson
import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM
import com.mogo.chat.model.bean.TeammateInfo
import com.mogo.chat.service.IMService
import com.mogo.chat.util.UserInfoHelper
import com.mogo.chat.util.UserInfoHelper.currentCallType
import com.mogo.chat.util.log
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS
import com.mogo.module.carchatting.R
@@ -30,7 +32,7 @@ import com.mogo.utils.logger.Logger
import com.zhidao.carchattingprovider.MogoDriverInfo
class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCommandListener,
IVoiceIntentListener {
IVoiceIntentListener {
companion object {
const val TAG: String = "CallChatCenter"
@@ -87,14 +89,14 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
this.serviceApi = mogoService
}
serviceApi?.statusManagerApi?.registerStatusChangedListener(
MODULE_NAME,
StatusDescriptor.MAIN_PAGE_RESUME,
statusChangedListener
MODULE_NAME,
StatusDescriptor.MAIN_PAGE_RESUME,
statusChangedListener
)
serviceApi?.statusManagerApi?.registerStatusChangedListener(
MODULE_NAME,
StatusDescriptor.VR_MODE,
statusChangedListener
MODULE_NAME,
StatusDescriptor.VR_MODE,
statusChangedListener
)
}
@@ -105,7 +107,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
if (status) {
VoiceUtil.registerAll(context!!, this, this)
syncInitStatus()
Logger.i(TAG, "MAIN_PAGE_RESUME callType: $currentCallType , status : ${callChatManager.isCalling()}")
Logger.i(
TAG,
"MAIN_PAGE_RESUME callType: $currentCallType , status : ${callChatManager.isCalling()}"
)
if (currentCallType == CALL_TYPE_VEHICLE_TEAM && callChatManager.isCalling()) {
callWindowShowCallBack()
callingWindowManager.showVehicleTeamView()
@@ -122,7 +127,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
}
}
StatusDescriptor.VR_MODE -> {
Logger.i(TAG, "VR_MODE callType: $currentCallType , status : ${callChatManager.isCalling()}")
Logger.i(
TAG,
"VR_MODE callType: $currentCallType , status : ${callChatManager.isCalling()}"
)
updateCallingWindowInVRMode()
}
else -> {
@@ -217,8 +225,8 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
private fun match(matchType: Int, from: Int = 1) {
LogUtil.i(TAG, "startMatch")
AnalyticsUtil.track(
INVOKE_TRACK_MATCH_SHOW,
mutableMapOf("matchatype" to matchType, "source" to 2, "from" to from)
INVOKE_TRACK_MATCH_SHOW,
mutableMapOf("matchatype" to matchType, "source" to 2, "from" to from)
)
callChatManager.match()
}
@@ -234,8 +242,8 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
LogUtil.i(TAG, "CARD_MATCH_FAILED matchFailed")
val type = if (isTTS) 1 else 2
AnalyticsUtil.track(
INVOKE_TRACK_MATCH_FAIL_CLOSE_CLICK,
hashMapOf("type" to type)
INVOKE_TRACK_MATCH_FAIL_CLOSE_CLICK,
hashMapOf("type" to type)
)
cancelMatchToDefault(isTTS)
}
@@ -244,19 +252,24 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
private fun showVehicleTeamFragment() {
LogUtil.i(TAG, "showVehicleTeamFragment")
activity?.supportFragmentManager
?.beginTransaction()
?.replace(containerId!!, VehicleTeamFragment.newInstance(), VehicleTeamFragment::class.simpleName)
?.commitNowAllowingStateLoss()
?.beginTransaction()
?.replace(
containerId!!,
VehicleTeamFragment.newInstance(),
VehicleTeamFragment::class.simpleName
)
?.commitNowAllowingStateLoss()
}
fun closeVehicleTeamFragment() {
activity?.let {
it.supportFragmentManager.let { fragmentManager ->
fragmentManager.findFragmentByTag(VehicleTeamFragment::class.simpleName)?.let { fragment ->
fragmentManager.beginTransaction()
fragmentManager.findFragmentByTag(VehicleTeamFragment::class.simpleName)
?.let { fragment ->
fragmentManager.beginTransaction()
.remove(fragment)
.commitNowAllowingStateLoss()
}
}
}
}
}
@@ -390,6 +403,20 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
refreshViewByType()
}
override fun answerCall() {
Logger.d(TAG, "answerCall")
taskMainLaunch {
callingWindowManager.hideIncomingView()
}
}
override fun answerCallError(errorMsg: String) {
Logger.d(TAG, "answerCallError")
taskMainLaunch {
TipToast.shortTip(errorMsg)
}
}
override fun call(userInfo: UserInfo?) {
Logger.d(TAG, "call===userInfo: $userInfo")
if (userInfo != null) {
@@ -450,7 +477,7 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
private fun resetCallingView() {
showCallWindowFromDefault = false
hideLauncherCallingView()
mapViewManager.resetMarkerStatus()
mapViewManager.resetMarkerStatus(serviceApi)
}
override fun callInvokeError(msg: String) {
@@ -458,6 +485,25 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
resetCallingView()
}
/**
* 收到来电消息
* 1.如果当前已经打来电话,再次接收到,则拒绝
* 2.如果当前正在打电话中,则拒绝
*/
override fun showIncomingCall(userInfo: UserInfo) {
if (callChatManager.isCalling() || callingWindowManager.isIncomingWindowShow()) {
log(TAG, "已在通话进程中,准备拒绝他 ---> ")
refuseCall(userInfo.sn)
} else {
log(TAG, "有人打来电话,准备显示 ---> ${UserInfoHelper.currentRoomId}")
callingWindowManager.showIncomingView({
callChatManager.answerInvoke(userInfo.sn)
}, {
refuseCall(userInfo.sn)
})
}
}
override fun match(userInfo: UserInfo) {
Logger.d(TAG, "match===userInfo: $userInfo")
currentUserInfo = userInfo
@@ -465,7 +511,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
}
override fun matchInvokeResult(invokeResult: Boolean, userInfo: UserInfo?, errorMsg: String) {
Logger.d(TAG, "matchInvokeResult===$invokeResult, msg: $errorMsg, callStatus: ${callChatManager.getStatusName()}")
Logger.d(
TAG,
"matchInvokeResult===$invokeResult, msg: $errorMsg, callStatus: ${callChatManager.getStatusName()}"
)
if (invokeResult) {
// 开始匹配成功
currentUserInfo = userInfo
@@ -526,7 +575,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
*/
override fun vehicleTeamMemberChange(teamMember: List<TeammateInfo>?) {
try {
Logger.d(TAG, "vehicleTeamMemberChange:" + teamMember?.size + ":" + teamMember.toString())
Logger.d(
TAG,
"vehicleTeamMemberChange:" + teamMember?.size + ":" + teamMember.toString()
)
this.teamMember = teamMember
callingWindowManager.updateVehicleTeamHeadView(teamMember)
mapViewManager.updateTeamMarker(context!!, teamMember)
@@ -600,11 +652,11 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
teamInvitationWindowManager.hideTeamInvitationView()
AnalyticsUtil.track(INVOKE_TRACK_CHATTING)
mapViewManager.showLocationOnMap(
context!!,
serviceApi,
currentUserInfo?.lat?.toDouble(),
currentUserInfo?.lon?.toDouble(),
currentUserInfo?.userHead
context!!,
serviceApi,
currentUserInfo?.lat?.toDouble(),
currentUserInfo?.lon?.toDouble(),
currentUserInfo?.userHead
)
refreshViewByType()
}
@@ -625,7 +677,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
* 邀请加入车队
*/
fun inviteJoinVehicleTeam(sn: String) {
Logger.i(TAG, "isCalling():" + callChatManager.isCalling() + ",currentCallType:" + currentCallType)
Logger.i(
TAG,
"isCalling():" + callChatManager.isCalling() + ",currentCallType:" + currentCallType
)
if (callChatManager.isCalling() && currentCallType != CALL_TYPE_VEHICLE_TEAM) {
toast(R.string.module_car_chat_in_call)
return
@@ -654,7 +709,10 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
}
private fun onPause() {
Logger.i(TAG, "onPause currentCallType : $currentCallType , status: ${callChatManager.isCalling()}")
Logger.i(
TAG,
"onPause currentCallType : $currentCallType , status: ${callChatManager.isCalling()}"
)
userWindowManager.hideUserView()
callWindowHideCallBack()
if (currentCallType == CALL_TYPE_VEHICLE_TEAM && callChatManager.isCalling()) {
@@ -668,14 +726,14 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
fun onDestroy() {
serviceApi?.statusManagerApi?.unregisterStatusChangedListener(
MODULE_NAME,
StatusDescriptor.MAIN_PAGE_RESUME,
statusChangedListener
MODULE_NAME,
StatusDescriptor.MAIN_PAGE_RESUME,
statusChangedListener
)
serviceApi?.statusManagerApi?.unregisterStatusChangedListener(
MODULE_NAME,
StatusDescriptor.VR_MODE,
statusChangedListener
MODULE_NAME,
StatusDescriptor.VR_MODE,
statusChangedListener
)
teamInvitationWindowManager.onDestroy()
flag = null

View File

@@ -8,7 +8,9 @@ import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
import com.mogo.chat.constant.CALL_TYPE_MATCHING
import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM
import com.mogo.chat.constant.CALL_TYPE_VOICE
import com.mogo.chat.model.bean.Message
import com.mogo.chat.model.bean.TeammateInfo
import com.mogo.chat.model.bean.toSns
import com.mogo.chat.util.CallTimer.Companion.callTimer
import com.mogo.chat.util.UserInfoHelper.currentCallType
import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo
@@ -18,6 +20,7 @@ import com.mogo.module.carchatting.bean.EnthusiasmIndex
import com.mogo.module.carchatting.bean.Result
import com.mogo.module.carchatting.bean.UserInfo
import com.mogo.module.carchatting.bean.toUserInfo
import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
import com.mogo.module.carchatting.net.Repository
import com.mogo.module.carchatting.net.request
import com.mogo.utils.logger.Logger
@@ -27,7 +30,6 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
companion object {
const val TAG: String = "CallChatManager"
const val METHOD_FLAG = "CAR_CALL_TO_DEFAULT"
}
@@ -47,6 +49,16 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
iBizCallBack?.invokeCallData(toUserInfo(tmpSenderInfo))
}
override fun receiverCalling(message: Message) {
super.receiverCalling(message)
iBizCallBack?.showIncomingCall(toUserInfo(message.toSns()))
}
override fun refuseMatchToShowCalling(message: Message) {
super.refuseMatchToShowCalling(message)
iBizCallBack?.showIncomingCall(toUserInfo(message.toSns()))
}
override fun receiverCallingAgree() {
super.receiverCallingAgree()
iBizCallBack?.call(toUserInfo(tmpSenderInfo))
@@ -142,6 +154,11 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
})
}
fun answerInvoke(sn: String) {
Logger.i(TAG, "answerInvoke")
IMCallManager.answer(sn, this)
}
fun callToSomeone(sn: String) {
Logger.i(TAG, "callToSomeone")
IMCallManager.call(METHOD_FLAG, sn, this)
@@ -204,9 +221,9 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
}
fun getEnthusiasmIndex(
sn: String,
onSuccess: (EnthusiasmIndex) -> Unit,
onError: (String) -> Unit
sn: String,
onSuccess: (EnthusiasmIndex) -> Unit,
onError: (String) -> Unit
) {
request<BaseResponse<Result>> {
loader {
@@ -238,7 +255,7 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
override fun invokeCallData(invokeData: String) {
super.invokeCallData(invokeData)
if (!invokeData.isBlank()) {
if (invokeData.isNotBlank()) {
val userInfo = Gson().fromJson(invokeData, UserInfo::class.java)
iBizCallBack?.invokeCallData(userInfo)
} else {
@@ -246,10 +263,22 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
}
}
override fun answer() {
super.answer()
Logger.i(TAG, "answer")
iBizCallBack?.answerCall()
}
override fun answerCallError(errorMsg: String) {
super.answerCallError(errorMsg)
Logger.i(TAG, "answerCallError errorMsg : $errorMsg")
iBizCallBack?.answerCallError(errorMsg)
}
override fun call(data: String) {
super.call(data)
Logger.i(TAG, "call data: $data")
if (!data.isBlank()) {
if (data.isNotBlank()) {
val userInfo = Gson().fromJson(data, UserInfo::class.java)
iBizCallBack?.call(userInfo)
} else {
@@ -271,7 +300,11 @@ class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse {
override fun matchInvokeResult(invokeResult: Boolean, msg: String) {
super.matchInvokeResult(invokeResult, msg)
if (invokeResult) {
iBizCallBack?.matchInvokeResult(invokeResult, Gson().fromJson(msg, UserInfo::class.java), msg)
iBizCallBack?.matchInvokeResult(
invokeResult,
Gson().fromJson(msg, UserInfo::class.java),
msg
)
} else {
iBizCallBack?.matchInvokeResult(invokeResult, null, msg)
}

View File

@@ -9,12 +9,18 @@ interface IBizCallChat {
fun callTypeInit()
fun answerCall()
fun answerCallError(errorMsg: String)
fun call(userInfo: UserInfo?)
fun invokeCallData(userInfo: UserInfo?)
fun callInvokeError(msg: String)
fun showIncomingCall(userInfo: UserInfo)
fun match(userInfo: UserInfo)
fun matchInvokeResult(invokeResult: Boolean, userInfo: UserInfo?, errorMsg: String)

View File

@@ -1,6 +1,7 @@
package com.mogo.module.carchatting.biz
import com.google.gson.Gson
import com.mogo.chat.callcenter.CallController
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
import com.mogo.chat.callcenter.IMType
import com.mogo.chat.callcenter.SocketClientFactory
@@ -8,6 +9,7 @@ import com.mogo.chat.callcenter.isInit
import com.mogo.chat.common.gme.GMEApi
import com.mogo.chat.constant.OFFLINE_STATUS
import com.mogo.chat.constant.ONLINE_STATUS
import com.mogo.chat.model.control.ChatController
import com.mogo.chat.service.ChatServiceHandler
import com.mogo.chat.service.InvokeDataProxy
import com.mogo.chat.util.UserInfoHelper
@@ -15,6 +17,7 @@ import com.mogo.chat.util.UserInfoHelper.currentCallType
import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo
import com.mogo.chat.util.log
import com.mogo.module.carchatting.card.CallChatConstant.Companion.PARAM_SN
import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
import com.zhidao.carchattingprovider.ICallProviderResponse
import com.zhidao.carchattingprovider.ICallResponse
import kotlinx.coroutines.Dispatchers
@@ -24,17 +27,30 @@ import kotlinx.coroutines.launch
class IMCallManager private constructor() {
companion object {
const val TAG = "IMCallManager"
fun canCall(flag: String, response: ICallProviderResponse) {
log(TAG, "是否能拨打电话 flag --->: $flag")
response.canCall(callTypeManager.callStatus.isInit() && SocketClientFactory.socketClient.isOpen)
}
fun answer(sn: String, response: ICallResponse) {
ChatServiceHandler.answer(sn, UserInfoHelper.currentRoomId, {
log(TAG, "接听电话成功 ---> ")
response.answer()
ChatController.enterRoom(UserInfoHelper.currentRoomId)
CallController.callController.callingReceiver()
}, {
val errorMsg =
if (it.message != null) it.message else "answer call is error ,please try again"
response.answerCallError(errorMsg!!)
log(TAG, " answer call is error ,please try again")
})
}
fun call(
flag: String,
snReceiver: String,
response: ICallResponse
flag: String,
snReceiver: String,
response: ICallResponse
) {
log(TAG, "拨打电话 sn --->: $snReceiver , flag: $flag")
if (callTypeManager.callStatus.isInit() && SocketClientFactory.socketClient.isOpen) {
@@ -45,15 +61,17 @@ class IMCallManager private constructor() {
response.callInvokeError(exception.message!!)
})
} else {
log(TAG, "拨打电话出现异常 能否拨打 :${callTypeManager.callStatus.isInit()} " +
"长连状态:${SocketClientFactory.socketClient.isOpen}")
log(
TAG, "拨打电话出现异常 能否拨打 :${callTypeManager.callStatus.isInit()} " +
"长连状态:${SocketClientFactory.socketClient.isOpen}"
)
response.error("call: 正在通话中,请稍后再试")
}
}
fun match(
flag: String,
response: ICallResponse
flag: String,
response: ICallResponse
) {
log(TAG, "开始匹配 ---> flag: $flag ")
ChatServiceHandler.startMatch(flag, {
@@ -101,9 +119,9 @@ class IMCallManager private constructor() {
}
fun hangUp(
flag: String,
snReceiver: String,
response: ICallResponse
flag: String,
snReceiver: String,
response: ICallResponse
) {
log(TAG, "挂断电话 ---> flag: $flag , snReceiver : $snReceiver")
ChatServiceHandler.hangUp(snReceiver, {
@@ -114,9 +132,11 @@ class IMCallManager private constructor() {
})
}
fun refuseCall(flag: String,
snSender: String,
response: ICallResponse) {
fun refuseCall(
flag: String,
snSender: String,
response: ICallResponse
) {
log(TAG, "拒绝电话 / 取消打电话 ---> flag: $flag")
ChatServiceHandler.refuseCall(snSender, {
response.refuse(true, currentCallType)
@@ -164,9 +184,9 @@ class IMCallManager private constructor() {
}
fun invisibleUser(
flag: String,
visible: Boolean,
response: ICallResponse
flag: String,
visible: Boolean,
response: ICallResponse
) {
log(TAG, "用户隐身 ---> flag: $flag , visible : $visible")
val status: Int = if (visible) {
@@ -182,9 +202,9 @@ class IMCallManager private constructor() {
}
fun isOnLine(
flag: String,
sn: String,
response: ICallResponse
flag: String,
sn: String,
response: ICallResponse
) {
log(TAG, "车机是否在线 ---> flag: $flag , sn : $sn")
ChatServiceHandler.isOnLine(sn, { onLine: Boolean ->
@@ -195,9 +215,9 @@ class IMCallManager private constructor() {
}
fun getUserInfoForCall(
flag: String,
sn: String?,
response: ICallResponse
flag: String,
sn: String?,
response: ICallResponse
) {
val tmpSn = sn ?: ""
log(TAG, "获取用户信息 ---> flag: $flag , sn : $sn")

View File

@@ -0,0 +1,13 @@
package com.mogo.module.carchatting.biz
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.module.carchatting.bean.UserInfo
class Test:BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
CallChatCenter.callChatCenter.showIncomingCall(UserInfo("123",123,"","","","","","","",""))
}
}

View File

@@ -26,5 +26,7 @@ class CallChatConstant {
const val PARAM_MUTE = "PARAM_MUTE"
const val PARAM_VISIBLE = "PARAM_VISIBLE"
const val PARAM_END_TYPE = "PARAM_END_TYPE"
const val TAG = "CALL_CHATTING"
}
}

View File

@@ -1,105 +0,0 @@
package com.mogo.module.carchatting.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.module.carchatting.R;
import com.mogo.module.common.utils.CarSeries;
import java.util.ArrayList;
public
/*
* @author congtaowang
* @since 2020/12/1
*
* 描述
*/
class CallUserView {
private CallUserView(){
}
private static ArrayList<Bitmap> sBitmaps;
public synchronized static ArrayList<Bitmap> inflateCallingBitmap(Context context) {
if (!CarSeries.isF8xxSeries()) {
return null;
}
if (sBitmaps != null && !sBitmaps.isEmpty()) {
return sBitmaps;
}
sBitmaps = new ArrayList<>();
for (int i = 0; i < calling.length; i++) {
sBitmaps.add(inflateView(context, i));
}
return sBitmaps;
}
private static final int[] calling = {
R.mipmap.module_callchat_green_cycle_00020,
// R.mipmap.module_callchat_green_cycle_00021,
// R.mipmap.module_callchat_green_cycle_00022,
R.mipmap.module_callchat_green_cycle_00023,
// R.mipmap.module_callchat_green_cycle_00024,
// R.mipmap.module_callchat_green_cycle_00025,
R.mipmap.module_callchat_green_cycle_00026,
// R.mipmap.module_callchat_green_cycle_00027,
// R.mipmap.module_callchat_green_cycle_00028,
R.mipmap.module_callchat_green_cycle_00029,
// R.mipmap.module_callchat_green_cycle_00030,
// R.mipmap.module_callchat_green_cycle_00031,
R.mipmap.module_callchat_green_cycle_00032,
// R.mipmap.module_callchat_green_cycle_00033,
// R.mipmap.module_callchat_green_cycle_00034,
R.mipmap.module_callchat_green_cycle_00035,
// R.mipmap.module_callchat_green_cycle_00036,
// R.mipmap.module_callchat_green_cycle_00037,
R.mipmap.module_callchat_green_cycle_00038,
// R.mipmap.module_callchat_green_cycle_00039,
// R.mipmap.module_callchat_green_cycle_00040,
R.mipmap.module_callchat_green_cycle_00041,
// R.mipmap.module_callchat_green_cycle_00042,
// R.mipmap.module_callchat_green_cycle_00043,
R.mipmap.module_callchat_green_cycle_00044,
// R.mipmap.module_callchat_green_cycle_00045,
// R.mipmap.module_callchat_green_cycle_00046,
R.mipmap.module_callchat_green_cycle_00047,
R.mipmap.module_callchat_green_cycle_00048
};
public static Bitmap inflateView(Context context, int index) {
View view = LayoutInflater.from(context).inflate(R.layout.module_car_chatting_calling_user_view, null);
view.setBackgroundResource(calling[index]);
return fromView(view);
}
private static Bitmap fromView(View view) {
view.setDrawingCacheEnabled(true);
processChildView(view);
view.destroyDrawingCache();
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
Bitmap bitmap;
return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
}
private static void processChildView(View view) {
if (!(view instanceof ViewGroup)) {
if (view instanceof TextView) {
((TextView) view).setHorizontallyScrolling(false);
}
} else {
for (int var1 = 0; var1 < ((ViewGroup) view).getChildCount(); ++var1) {
processChildView(((ViewGroup) view).getChildAt(var1));
}
}
}
}

View File

@@ -2,7 +2,10 @@ package com.mogo.module.carchatting.view
import android.annotation.SuppressLint
import android.content.Context
import android.media.AudioManager
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
@@ -10,9 +13,12 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.bumptech.glide.request.RequestOptions
import com.mogo.chat.constant.TAG
import com.mogo.chat.model.bean.TeammateInfo
import com.mogo.chat.util.MediaController
import com.mogo.chat.util.log
import com.mogo.chat.voice.IMVoiceClient
import com.mogo.chat.voice.IVoiceIntentListener
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_BYD
import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE
import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.UserInfo
import com.mogo.module.carchatting.biz.CallChatCenter
@@ -24,8 +30,9 @@ import com.mogo.utils.glide.GlideApp
import com.mogo.utils.glide.GlideRoundedCornersTransform
import com.mogo.utils.logger.Logger
import de.hdodenhof.circleimageview.CircleImageView
import kotlin.let as let
class CallingWindowManager private constructor() {
class CallingWindowManager private constructor() : IVoiceIntentListener {
companion object {
@@ -39,12 +46,19 @@ class CallingWindowManager private constructor() {
@Volatile
private var isLauncherCallingViewShown = false
@Volatile
private var isLauncherIncomingViewShown = false
private var launcherIncomingView: View? = null
private var launcherCallingView: View? = null
private var matchView: ConstraintLayout? = null
private var matchingView: ConstraintLayout? = null
private var callingView: ConstraintLayout? = null
private var callIncomingAnswer: ImageView? = null
private var callIncomingRefuse: ImageView? = null
private var cancelMatch: TextView? = null
private var callingHead: ImageView? = null
private var callingNickName: TextView? = null
@@ -68,14 +82,18 @@ class CallingWindowManager private constructor() {
private var showVehicleTeamView: (() -> Unit)? = null
private var quitVehicleTeam: (() -> Unit)? = null
private var moveToCenter: (() -> Unit)? = null
private var agreeIncomingBack: (() -> Unit)? = null
private var hangUpIncomingBack: (() -> Unit)? = null
@SuppressLint("InflateParams")
fun init(context: Context, serviceApi: IMogoServiceApis,
match: () -> Unit,
cancelMatch: () -> Unit,
showVehicleTeamView: () -> Unit,
quitVehicleTeam: () -> Unit,
moveToCenter: () -> Unit) {
fun init(
context: Context, serviceApi: IMogoServiceApis,
match: () -> Unit,
cancelMatch: () -> Unit,
showVehicleTeamView: () -> Unit,
quitVehicleTeam: () -> Unit,
moveToCenter: () -> Unit
) {
Logger.d(CallChatCenter.TAG, "CallingWindowManager init --->")
this.mContext = context
this.serviceApi = serviceApi
@@ -84,11 +102,7 @@ class CallingWindowManager private constructor() {
this.showVehicleTeamView = showVehicleTeamView
this.quitVehicleTeam = quitVehicleTeam
this.moveToCenter = moveToCenter
if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_BYD) {
Logger.d(CallChatCenter.TAG, "CallingWindowManager 展示匹配 addLeftFeatureView--->")
initView()
serviceApi.entranceButtonController?.addLeftFeatureView(launcherCallingView)
}
hideIncomingView()
}
private fun initView() {
@@ -119,8 +133,6 @@ class CallingWindowManager private constructor() {
matchView?.visibility = View.VISIBLE
}
matchView?.setOnClickListener {
match?.invoke()
matchView?.visibility = View.GONE
@@ -147,11 +159,15 @@ class CallingWindowManager private constructor() {
if (isLauncherCallingViewShown) {
return
}
if (DebugConfig.getCarMachineType() != CAR_MACHINE_TYPE_BYD) {
serviceApi?.windowManagerApi?.addView(launcherCallingView, vrModeHelper.getCallingWindowLayoutPosition(mContext!!), true)
} else {
serviceApi?.entranceButtonController?.addLeftFeatureView(launcherCallingView)
}
serviceApi?.windowManagerApi?.addView(
launcherCallingView,
vrModeHelper.getCallingWindowLayoutPosition(mContext!!),
true
)
}
fun isIncomingWindowShow(): Boolean {
return isLauncherIncomingViewShown
}
fun isCallingWindowShow(): Boolean {
@@ -184,9 +200,66 @@ class CallingWindowManager private constructor() {
}
}
fun showIncomingView(
agreeIncomingBack: () -> Unit,
hangUpIncomingBack: () -> Unit
) {
Logger.d(
CallChatCenter.TAG,
"展示Launcher来电浮窗 showIncomingView===$isLauncherCallingViewShown"
)
this.agreeIncomingBack = agreeIncomingBack
this.hangUpIncomingBack = hangUpIncomingBack
if (!isLauncherCallingViewShown) {
IMVoiceClient.speakAndRegisterCall({ _ ->
if (isLauncherCallingViewShown) {
log(TAG, "speakAndRegisterCall")
releaseAudioAndVoice()
}
}, {
log(TAG, "playFinish")
playAudioCall()
registerIntentInComingCall()
})
if (launcherIncomingView == null) {
launcherIncomingView = LayoutInflater.from(mContext)
.inflate(R.layout.module_car_chatting_launcher_incoming_hawk_eye_view, null)
launcherIncomingView?.setOnClickListener { }
launcherIncomingView?.let { view ->
callIncomingAnswer = view.findViewById(R.id.module_carchatting_incoming_answer)
callIncomingRefuse = view.findViewById(R.id.module_carchatting_incoming_hangUp)
callIncomingAnswer?.setOnClickListener {
releaseAudioAndVoice()
agreeIncomingBack.invoke()
}
callIncomingRefuse?.setOnClickListener {
releaseAudioAndVoice()
hangUpIncomingBack.invoke()
}
}
}
if (isLauncherIncomingViewShown) {
return
}
val params = FrameLayout.LayoutParams(
mContext!!.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_width)
.toInt(),
mContext!!.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_height)
.toInt()
)
val x = mContext!!.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_x)
val y = mContext!!.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_y)
params.leftMargin = x.toInt()
params.topMargin = y.toInt()
serviceApi?.windowManagerApi?.addView(launcherIncomingView, params, true)
isLauncherIncomingViewShown = true
Logger.d(CallChatCenter.TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown")
}
}
fun showCallingView(
currentUserInfo: UserInfo?,
hangUpCallBack: () -> Unit
currentUserInfo: UserInfo?,
hangUpCallBack: () -> Unit
) {
Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown")
if (!isLauncherCallingViewShown) {
@@ -194,15 +267,18 @@ class CallingWindowManager private constructor() {
refreshCallWindowData(currentUserInfo)
}
} else {
Logger.d(CallChatCenter.TAG, "刷新Launcher浮窗数据 showCallingView===currentUserInfo :$currentUserInfo")
Logger.d(
CallChatCenter.TAG,
"刷新Launcher浮窗数据 showCallingView===currentUserInfo :$currentUserInfo"
)
refreshCallWindowData(currentUserInfo)
}
}
@SuppressLint("InflateParams")
private inline fun addCallWindowView(
crossinline hangUpCallBack: () -> Unit,
refreshData: (() -> Unit)
crossinline hangUpCallBack: () -> Unit,
refreshData: (() -> Unit)
) {
if (launcherCallingView == null) {
initView()
@@ -218,30 +294,51 @@ class CallingWindowManager private constructor() {
showCallingWindow()
refreshData.invoke()
isLauncherCallingViewShown = true
Logger.d(CallChatCenter.TAG, "添加浮窗成功 showCallingView===$isLauncherCallingViewShown")
Logger.d(CallChatCenter.TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown")
}
private fun refreshCallWindowData(currentUserInfo: UserInfo?) {
mContext?.let {
if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
GlideApp.with(it).load(currentUserInfo?.userHead)
.apply(RequestOptions.bitmapTransform(
GlideRoundedCornersTransform(20f, GlideRoundedCornersTransform.CornerType.LEFT)))
.placeholder(R.mipmap.module_carchatting_hawk_eye_default_head_img).into(callingHead!!)
.apply(
RequestOptions.bitmapTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.LEFT
)
)
)
.placeholder(R.mipmap.module_carchatting_hawk_eye_default_head_img)
.into(callingHead!!)
} else {
val options: RequestOptions =
RequestOptions()
.placeholder(R.mipmap.module_carchatting_default_head_img)
.error(R.mipmap.module_carchatting_default_head_img)
RequestOptions()
.placeholder(R.mipmap.module_carchatting_default_head_img)
.error(R.mipmap.module_carchatting_default_head_img)
GlideApp.with(it).asBitmap().load(currentUserInfo?.userHead)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(SkinAbleBitmapTarget(callingHead, options))
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(SkinAbleBitmapTarget(callingHead, options))
}
}
// callingNickName?.text = currentUserInfo?.userName ?: "蘑菇车主"
callingNickName?.text = "云平台" //todo 需要产品后面更改逻辑,避免写死造成困扰
}
fun hideIncomingView() {
if (!isLauncherIncomingViewShown) {
return
}
Logger.d(CallChatCenter.TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown")
releaseAudioAndVoice()
if (isLauncherIncomingViewShown) {
isLauncherIncomingViewShown = false
}
launcherIncomingView?.let {
serviceApi?.windowManagerApi?.removeView(it)
}
}
fun hideCallingView() {
Logger.d(CallChatCenter.TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown")
if (isLauncherCallingViewShown) {
@@ -259,9 +356,7 @@ class CallingWindowManager private constructor() {
}
private fun removeView() {
if (DebugConfig.getCarMachineType() != CAR_MACHINE_TYPE_BYD) {
serviceApi?.windowManagerApi?.removeView(launcherCallingView)
}
serviceApi?.windowManagerApi?.removeView(launcherCallingView)
}
fun updateTimer(timeStr: String) {
@@ -270,7 +365,10 @@ class CallingWindowManager private constructor() {
}
fun showVehicleTeamView() {
Logger.d(CallChatCenter.TAG, "showVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown")
Logger.d(
CallChatCenter.TAG,
"showVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
)
if (!isLauncherCallingViewShown) {
if (launcherCallingView == null) {
initView()
@@ -287,7 +385,10 @@ class CallingWindowManager private constructor() {
}
fun hideVehicleTeamView() {
Logger.d(CallChatCenter.TAG, "hideVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown")
Logger.d(
CallChatCenter.TAG,
"hideVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
)
callingView?.visibility = View.GONE
matchingView?.visibility = View.GONE
moduleCarchattingTeamRlView?.visibility = View.GONE
@@ -321,70 +422,90 @@ class CallingWindowManager private constructor() {
2 -> {
moduleCarchattingCivHead0?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[0].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead0!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead0!!)
moduleCarchattingCivHead1?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[1].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead1!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead1!!)
moduleCarchattingCivHead2?.visibility = View.GONE
moduleCarchattingCivHead3?.visibility = View.GONE
moduleCarchattingCivHead4?.visibility = View.GONE
val layoutParams: ConstraintLayout.LayoutParams = moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val layoutParams: ConstraintLayout.LayoutParams =
moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
layoutParams.bottomMargin = 0
moduleCarchattingTeamLlHead?.layoutParams = layoutParams
}
3 -> {
moduleCarchattingCivHead0?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[0].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead0!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead0!!)
moduleCarchattingCivHead1?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[1].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead1!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead1!!)
moduleCarchattingCivHead2?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[2].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead2!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead2!!)
moduleCarchattingCivHead3?.visibility = View.GONE
moduleCarchattingCivHead4?.visibility = View.GONE
val layoutParams: ConstraintLayout.LayoutParams = moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val layoutParams: ConstraintLayout.LayoutParams =
moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
layoutParams.bottomMargin = 0
moduleCarchattingTeamLlHead?.layoutParams = layoutParams
}
4 -> {
moduleCarchattingCivHead0?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[0].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead0!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead0!!)
moduleCarchattingCivHead1?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[1].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead1!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead1!!)
moduleCarchattingCivHead2?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[2].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead2!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead2!!)
moduleCarchattingCivHead3?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[3].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead3!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead3!!)
moduleCarchattingCivHead4?.visibility = View.INVISIBLE
val layoutParams: ConstraintLayout.LayoutParams = moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val margin = mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin)
val layoutParams: ConstraintLayout.LayoutParams =
moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val margin =
mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin)
layoutParams.bottomMargin = margin.toInt()
moduleCarchattingTeamLlHead?.layoutParams = layoutParams
}
else -> {
moduleCarchattingCivHead0?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[0].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead0!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead0!!)
moduleCarchattingCivHead1?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[1].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead1!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead1!!)
moduleCarchattingCivHead2?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[2].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead2!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead2!!)
moduleCarchattingCivHead3?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[3].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead3!!)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead3!!)
moduleCarchattingCivHead4?.visibility = View.VISIBLE
GlideApp.with(mContext!!).load(teamMember[4].headImgUrl)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop().into(moduleCarchattingCivHead4!!)
val layoutParams: ConstraintLayout.LayoutParams = moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val margin = mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin)
.placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop()
.into(moduleCarchattingCivHead4!!)
val layoutParams: ConstraintLayout.LayoutParams =
moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams
val margin =
mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin)
layoutParams.bottomMargin = margin.toInt()
moduleCarchattingTeamLlHead?.layoutParams = layoutParams
}
@@ -407,4 +528,37 @@ class CallingWindowManager private constructor() {
}
launcherCallingView = null
}
private fun releaseAudioAndVoice() {
stopAudioCall()
unRegisterVoice()
}
private fun playAudioCall() {
MediaController.startPlay(mContext!!, R.raw.call, true, AudioManager.STREAM_RING)
}
private fun stopAudioCall() {
log(TAG, "停止播放来电铃声======")
MediaController.release()
}
private fun registerIntentInComingCall() {
IMVoiceClient.registerIntentInComingCall(this)
}
private fun unRegisterVoice() {
IMVoiceClient.releaseSpeakAndRegisterCallback()
IMVoiceClient.unRegisterIntentInComingCall(this)
}
override fun onVoiceAnswerCall() {
releaseAudioAndVoice()
agreeIncomingBack?.invoke()
}
override fun onVoiceRefuseCall() {
releaseAudioAndVoice()
hangUpIncomingBack?.invoke()
}
}

View File

@@ -3,15 +3,12 @@ package com.mogo.module.carchatting.view
import android.content.Context
import android.graphics.Rect
import android.graphics.drawable.BitmapDrawable
import android.widget.ImageView
import com.mogo.chat.model.bean.TeammateInfo
import com.mogo.chat.provider.ServiceApi
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.map.marker.MogoMarkerOptions
import com.mogo.module.carchatting.R
import com.mogo.module.common.ModuleNames
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.entity.MarkerLocation
import com.mogo.module.common.entity.MarkerShowEntity
import com.mogo.service.IMogoServiceApis
@@ -51,11 +48,11 @@ class MapViewManager private constructor() {
}
fun showLocationOnMap(
context: Context,
serviceApi: IMogoServiceApis?,
lat: Double?,
lon: Double?,
userHead: String?
context: Context,
serviceApi: IMogoServiceApis?,
lat: Double?,
lon: Double?,
userHead: String?
) {
if (!hasMarked) {
hasMarked = true
@@ -65,23 +62,23 @@ class MapViewManager private constructor() {
private fun showLocation(
context: Context,
serviceApi: IMogoServiceApis?,
lat: Double?,
lon: Double?,
userHead: String?
context: Context,
serviceApi: IMogoServiceApis?,
lat: Double?,
lon: Double?,
userHead: String?
) {
//延时一分钟后获取大而全数据
serviceApi?.statusManagerApi?.setUserInteractionStatus(
CallChattingProviderConstant.CAR_CALL_PROVIDER,
true,
true
CallChattingProviderConstant.CAR_CALL_PROVIDER,
true,
true
)
//清除地图上所有Marker
serviceApi?.mapServiceApi?.getMarkerManager(context)?.removeMarkers()
//获取需要打点的经纬度
val userLoc =
serviceApi?.mapServiceApi?.getSingletonLocationClient(context)?.lastKnowLocation
serviceApi?.mapServiceApi?.getSingletonLocationClient(context)?.lastKnowLocation
val latlonList = mutableListOf<MogoLatLng>()
var currentLatLng: MogoLatLng? = null
userLoc?.let {
@@ -91,31 +88,31 @@ class MapViewManager private constructor() {
//打点传入type为在线车辆 并缩小地图区域
getMarkerEntity(context, lat, lon, userHead) { _: String, options: MogoMarkerOptions ->
val mapMarker =
serviceApi?.mapServiceApi?.getMarkerManager(context)?.addMarker(CALLING, options)
serviceApi?.mapServiceApi?.getMarkerManager(context)?.addMarker(CALLING, options)
mapMarker?.setClickable(false)
}
val mapUIController = serviceApi?.mapServiceApi?.mapUIController
mapUIController?.showBounds(
CallChattingProviderConstant.CAR_CALL_PROVIDER,
currentLatLng,
latlonList,
Rect(
context.resources.getDimension(R.dimen.dp_736).toInt(),
context.resources.getDimension(R.dimen.dp_198).toInt(),
context.resources.getDimension(R.dimen.dp_59).toInt(),
context.resources.getDimension(R.dimen.dp_59).toInt()
),
true
CallChattingProviderConstant.CAR_CALL_PROVIDER,
currentLatLng,
latlonList,
Rect(
context.resources.getDimension(R.dimen.dp_736).toInt(),
context.resources.getDimension(R.dimen.dp_198).toInt(),
context.resources.getDimension(R.dimen.dp_59).toInt(),
context.resources.getDimension(R.dimen.dp_59).toInt()
),
true
)
}
@Suppress("DEPRECATION")
private fun getMarkerEntity(
context: Context,
lat: Double?,
lon: Double?,
userHead: String?,
callBack: (markerType: String, options: MogoMarkerOptions) -> Unit
context: Context,
lat: Double?,
lon: Double?,
userHead: String?,
callBack: (markerType: String, options: MogoMarkerOptions) -> Unit
) {
val markerEntity = MarkerShowEntity()
val markerLoc = MarkerLocation()
@@ -129,16 +126,17 @@ class MapViewManager private constructor() {
markerLocation = markerLoc
}
val options = MogoMarkerOptions()
.`object`(markerEntity)
.icon((context.resources.getDrawable(R.mipmap.module_carchatting_caller) as BitmapDrawable).bitmap)
.latitude(markerEntity.markerLocation.lat)
.longitude(markerEntity.markerLocation.lon)
.`object`(markerEntity)
.icon((context.resources.getDrawable(R.mipmap.module_carchatting_caller) as BitmapDrawable).bitmap)
.latitude(markerEntity.markerLocation.lat)
.longitude(markerEntity.markerLocation.lon)
callBack.invoke(markerEntity.markerType, options)
}
fun resetMarkerStatus() {
fun resetMarkerStatus(serviceApi: IMogoServiceApis?) {
Logger.d(TAG, "resetMarkerStatus")
hasMarked = false
ServiceApi.mapService()?.getMarkerManager(AbsMogoApplication.getApp().applicationContext)?.removeMarkers(CALLING)
serviceApi?.mapServiceApi?.getMarkerManager(AbsMogoApplication.getApp().applicationContext)
?.removeMarkers(CALLING)
}
}

View File

@@ -1,29 +0,0 @@
package com.mogo.module.carchatting.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
public
/**
* @author congtaowang
* @since 2020/12/1
*
* 描述
*/
class UnSupportSkinFrameLayout extends FrameLayout {
public UnSupportSkinFrameLayout( Context context ) {
this( context, null );
}
public UnSupportSkinFrameLayout( Context context, @Nullable AttributeSet attrs ) {
this( context, attrs, 0 );
}
public UnSupportSkinFrameLayout( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
}

View File

@@ -1,29 +0,0 @@
package com.mogo.module.carchatting.view;
import android.content.Context;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
public
/**
* @author congtaowang
* @since 2020/12/1
*
* 描述
*/
class UnSupportSkinImageView extends AppCompatImageView {
public UnSupportSkinImageView( Context context ) {
this( context, null );
}
public UnSupportSkinImageView( Context context, @Nullable AttributeSet attrs ) {
this( context, attrs, 0 );
}
public UnSupportSkinImageView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.carchatting.view.UnSupportSkinFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/module_callchat_green_cycle_00020">
<com.mogo.module.carchatting.view.UnSupportSkinImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/module_callchat_online_car" />
</com.mogo.module.carchatting.view.UnSupportSkinFrameLayout>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/module_call_chat_state_incoming_hawk_eye_width"
android:layout_height="@dimen/module_call_chat_state_incoming_hawk_eye_height"
android:background="@drawable/module_carchatting_vr_calling_bg"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_carchatting_rl_incoming_view"
android:layout_width="@dimen/module_call_chat_state_incoming_hawk_eye_width"
android:layout_height="@dimen/module_call_chat_state_incoming_hawk_eye_height"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/module_carchatting_call_head"
android:layout_width="@dimen/module_call_chat_incoming_aisdk_tag_width"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:src="@drawable/module_carchatting_aicloud_incoming"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/module_carchatting_incoming_answer"
android:layout_width="@dimen/module_call_chat_hawk_eye_incoming_circle_btn_size"
android:layout_height="@dimen/module_call_chat_hawk_eye_incoming_circle_btn_size"
android:layout_marginEnd="@dimen/module_call_chat_calling_iv_hawk_eye_margin_left_right"
android:layout_marginRight="@dimen/module_call_chat_state_incoming_hawk_eye_call_margin_right"
android:clickable="true"
android:scaleType="centerInside"
android:src="@mipmap/module_callchatting_launcher_incoming_answer"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/module_carchatting_incoming_hangUp"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/module_carchatting_incoming_hangUp"
android:layout_width="@dimen/module_call_chat_hawk_eye_incoming_circle_btn_size"
android:layout_height="@dimen/module_call_chat_hawk_eye_incoming_circle_btn_size"
android:layout_marginEnd="@dimen/module_call_chat_calling_iv_hawk_eye_margin_left_right"
android:clickable="true"
android:scaleType="centerInside"
android:src="@mipmap/module_callchatting_launcher_incoming_hangup"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/module_carchatting_call_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_call_chat_state_incoming_hawk_eye_margin_left"
android:layout_marginBottom="@dimen/module_call_chat_calling_text_hawk_eye_margin_top_bottom"
android:text="请求语音通话..."
android:textColor="@color/module_carchatting_hawk_eye_status_color"
android:textSize="@dimen/module_call_chat_calling_text_hawk_eye_time_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/module_carchatting_call_head" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_call_chat_calling_text_hawk_eye_margin_top_bottom"
android:text="云平台"
android:textColor="@android:color/white"
android:textSize="@dimen/module_call_chat_calling_text_hawk_eye_name_size"
app:layout_constraintStart_toStartOf="@+id/module_carchatting_call_time"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -4,11 +4,16 @@
<dimen name="module_call_chat_state_location_hawk_eye_y">1160px</dimen>
<dimen name="module_call_chat_state_hawk_eye_width">460px</dimen>
<dimen name="module_call_chat_state_hawk_eye_height">144px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_width">560px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_height">142px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_margin_left">20px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_call_margin_right">30px</dimen>
<dimen name="module_call_chat_calling_bg_radius">30px</dimen>
<dimen name="module_call_chat_matching_textsize">28px</dimen>
<dimen name="module_call_chat_matching_text_size">24px</dimen>
<dimen name="module_call_chat_calling_iv_hawk_eye_width_height">144px</dimen>
<dimen name="module_call_chat_hawk_eye_circle_btn_size">88px</dimen>
<dimen name="module_call_chat_hawk_eye_incoming_circle_btn_size">86px</dimen>
<dimen name="module_call_chat_calling_iv_hawk_eye_margin_left_right">20px</dimen>
<dimen name="module_call_chat_calling_text_hawk_eye_margin_top_bottom">26px</dimen>
<dimen name="module_call_chat_calling_text_hawk_eye_time_size">24px</dimen>
@@ -20,4 +25,5 @@
<dimen name="module_call_chat_team_info_text_size">24px</dimen>
<dimen name="module_call_chat_team_chatting_margin_top">27px</dimen>
<dimen name="module_call_chat_team_chatting_text_size">34px</dimen>
<dimen name="module_call_chat_incoming_aisdk_tag_width">139px</dimen>
</resources>

View File

@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<dimen name="module_call_chat_state_incoming_hawk_eye_width">560px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_height">142px</dimen>
<dimen name="module_call_chat_incoming_aisdk_tag_width">139px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_margin_left">20px</dimen>
<dimen name="module_call_chat_state_incoming_hawk_eye_call_margin_right">30px</dimen>
<dimen name="module_call_chat_hawk_eye_incoming_circle_btn_size">86px</dimen>
<dimen name="module_call_chat_state_location_y">467px</dimen>
<dimen name="module_call_chat_state_location_x">573px</dimen>
<dimen name="module_call_chat_state_width">338px</dimen>

View File

@@ -1,10 +1,22 @@
package com.zhidao.carchattingprovider;
import androidx.annotation.NonNull;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface ICallChatResponse extends ICallProviderResponse {
@Override
default void answer() {
}
@Override
default void answerCallError(@NonNull String errorMsg) {
}
@Override
default void canCall(boolean canCall) {

View File

@@ -3,6 +3,14 @@ package com.zhidao.carchattingprovider
interface ICallProviderResponse : ICallResponse {
override fun answer() {
super.answer()
}
override fun answerCallError(errorMsg: String) {
super.answerCallError(errorMsg)
}
override fun hangUp(hangUp: Boolean, type: Int) {
super.hangUp(hangUp, type)
}

View File

@@ -2,6 +2,12 @@ package com.zhidao.carchattingprovider
interface ICallResponse {
fun answer(){
}
fun answerCallError(errorMsg: String){
}
fun hangUp(hangUp: Boolean, type: Int) {
}

View File

@@ -74,7 +74,6 @@ dependencies {
compileOnly rootProject.ext.dependencies.aspectj
implementation rootProject.ext.dependencies.circleimageview
implementation rootProject.ext.dependencies.strategy
implementation rootProject.ext.dependencies.mogowebsocket

View File

@@ -11,7 +11,6 @@
-keep class com.mogo.chat.util.AnalyticsUtilKt{*;}
-keep class com.mogo.chat.util.LogUtil{*;}
-keep class com.mogo.chat.voice.*{*;}
-keep class com.mogo.chat.window.IWindowCallActionListener{*;}
#公司SDK
-keep class com.zhidao.auto.micstrategy.*{*;}

View File

@@ -1,30 +0,0 @@
package com.mogo.chat.aspect
import org.aspectj.lang.ProceedingJoinPoint
import org.aspectj.lang.annotation.Around
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Pointcut
import java.util.concurrent.TimeUnit
@Aspect
class ExceptionAspectj : BaseAspectj() {
@Pointcut("execution(* com.tencent.sharp.jni.TraeAudioManager\$2.run(..))")
fun gmeTrack() {
}
@Around("gmeTrack()")
fun logExecute(joinPoint: ProceedingJoinPoint) {
try {
enterMethod(joinPoint)
val startNanos = System.nanoTime()
val result = joinPoint.proceed()
val stopNanos = System.nanoTime()
val lengthMill = TimeUnit.NANOSECONDS.toMillis(stopNanos - startNanos)
exitMethod(joinPoint, result, lengthMill)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -1,14 +0,0 @@
package com.mogo.chat.aspect;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target({TYPE, METHOD, CONSTRUCTOR})
@Retention(RUNTIME)
public @interface PushMsg {
}

View File

@@ -1,63 +0,0 @@
package com.mogo.chat.aspect
import android.util.Log
import android.view.View
import com.mogo.chat.constant.PUSH_MSG_AGREE_ENTER
import com.mogo.chat.constant.PUSH_MSG_HANG_UP
import com.mogo.chat.model.bean.Message
import com.mogo.chat.util.isDoubleClick
import com.mogo.chat.util.sp.recordCallTime
import com.mogo.chat.util.trackHangUp
import org.aspectj.lang.JoinPoint
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Before
import org.aspectj.lang.annotation.Pointcut
@Aspect
class TrackAspectj {
companion object {
const val TAG = "TrackAspectj"
}
@Pointcut("execution(* android.view.View.OnClickListener.onClick(..))")
fun trackOnClick() {
}
@Before("trackOnClick()")
fun trackClick(joinPoint: JoinPoint) {
val view = joinPoint.args[0] as View
if (isDoubleClick(view.id)) {
Log.i("trackClick", "重复点击,已过滤")
return
}
}
@Pointcut("within(@com.mogo.chat.aspect.PushMsg *)")
fun withinPushClass() {
}
@Pointcut("execution(!synthetic * *(..))&& withinPushClass()")
fun methodInsidePushType() {
}
@Pointcut("execution(@com.mogo.chat.aspect.PushMsg * *(..))|| methodInsidePushType()")
fun pushMethod() {
}
@Before("pushMethod()")
fun trackPushMsg(joinPoint: JoinPoint) {
val msg = joinPoint.args[0] as Message
when (msg.status) {
PUSH_MSG_AGREE_ENTER -> {
recordCallTime()
}
PUSH_MSG_HANG_UP -> {
trackHangUp(msg.type)
}
}
}
}

View File

@@ -6,12 +6,12 @@ class HttpConstants {
companion object {
const val DEV_BASE_URL_OWNER = "http://dzt-show.zhidaohulian.com/"
const val DEV_CONFIG_URL = "http://dzt-test.zhidaohulian.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/"
private const val DEV_BASE_URL_OWNER = "http://dzt-show.zhidaohulian.com/"
private const val DEV_CONFIG_URL = "http://dzt-test.zhidaohulian.com/"
private const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/"
const val SOCKET_SERVER = "ws://62.234.196.121:4001/ws"
const val DEV_SOCKET_SERVER = "ws://dzt-test.zhidaohulian.com/ws"
private const val SOCKET_SERVER = "ws://62.234.196.121:4001/ws"
private const val DEV_SOCKET_SERVER = "ws://dzt-test.zhidaohulian.com/ws"
fun getBaseUrl(): String {
return when (getNetMode()) {

View File

@@ -1,7 +0,0 @@
package com.mogo.chat.constant
enum class RequestCode {
MATCH_ACTIVITY,
PERSONAL_CENTER_ACTIVITY
}

View File

@@ -1,9 +0,0 @@
package com.mogo.chat.constant
enum class ResultCode {
MATCH_CANCEL,
MATCH_ENTRY_ROOM,
MATCH_FAIL,
PERSONAL_CENTER_CALL
}

View File

@@ -3,21 +3,11 @@ package com.mogo.chat.provider
import com.mogo.commons.AbsMogoApplication
import com.mogo.map.location.IMogoLocationClient
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.map.IMogoMapService
import com.mogo.service.statusmanager.IMogoStatusManager
class ServiceApi {
companion object {
fun mapService(): IMogoMapService?{
return MogoApisHandler.getInstance().apis.mapServiceApi
}
fun statusManager(): IMogoStatusManager? {
return MogoApisHandler.getInstance().apis.statusManagerApi
}
fun locationClient(): IMogoLocationClient? {
return MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(AbsMogoApplication.getApp().applicationContext)
}

View File

@@ -16,18 +16,11 @@ import com.mogo.chat.constant.HttpConstants
import com.mogo.chat.constant.SOCKET_HAND_SHAKE
import com.mogo.chat.constant.SOCKET_HEART_BEAT
import com.mogo.chat.constant.TAG
import com.mogo.chat.model.bean.Message
import com.mogo.chat.model.bean.Sns
import com.mogo.chat.model.bean.SocketMsg
import com.mogo.chat.model.bean.toSns
import com.mogo.chat.model.control.ChatController
import com.mogo.chat.util.UserInfoHelper.currentRoomId
import com.mogo.chat.util.audio.AudioFocusUtil
import com.mogo.chat.util.log
import com.mogo.chat.util.sp.getRoomId
import com.mogo.chat.util.trackAppEnter
import com.mogo.chat.window.CallingWindowManager
import com.mogo.chat.window.IWindowCallActionListener
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.websocket.ISocketMsgCallBack
import com.mogo.websocket.ISocketMsgSetting
@@ -36,7 +29,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
class IMService : Service(), ICallMessage, IWindowCallActionListener {
class IMService : Service(), ICallMessage {
companion object {
@@ -45,8 +38,6 @@ class IMService : Service(), ICallMessage, IWindowCallActionListener {
}
}
private lateinit var callingWindowManager: CallingWindowManager
override fun onBind(intent: Intent): IBinder? {
return null
}
@@ -72,7 +63,6 @@ class IMService : Service(), ICallMessage, IWindowCallActionListener {
ChatController.getUserInfo()
callController.addCallBack(this.javaClass.simpleName, this)
callingWindowManager = CallingWindowManager(this, this)
// 注册状态回调,用来处理音频焦点
callTypeManager.addCallTypeChangedListener(object : ICallTypeChangedListener {
override fun onCallTypeChanged(callType: IMType) {
@@ -101,7 +91,8 @@ class IMService : Service(), ICallMessage, IWindowCallActionListener {
override fun getHeartBeatMsg(): String {
log(TAG, "getHeartBeatMsg")
val socketMsg = SocketMsg(SOCKET_HEART_BEAT, MoGoAiCloudClientConfig.getInstance().sn, getRoomId())
val socketMsg =
SocketMsg(SOCKET_HEART_BEAT, MoGoAiCloudClientConfig.getInstance().sn, getRoomId())
return Gson().toJson(socketMsg)
}
}
@@ -133,57 +124,6 @@ class IMService : Service(), ICallMessage, IWindowCallActionListener {
}
}
override fun initStatus() {
super.initStatus()
callingWindowManager.hideIncomingCall()
}
/**
* 浮窗点击接听电话
*/
override fun windowAnswerCall(userReceiver: Sns) {
trackAppEnter("7")
ChatServiceHandler.answer(userReceiver.sn, currentRoomId, {
log(TAG, "接听电话成功 ---> ")
callingWindowManager.hideIncomingCall()
ChatController.enterRoom(currentRoomId)
callController.callingReceiver()
}, {
log(TAG, "IMService answer call is error ,please try again")
})
}
/**
* 浮窗显示拒绝接听电话
*/
override fun windowRefuseCall(sns: Sns) {
ChatServiceHandler.refuseCall(sns.sn, {}, {})
callingWindowManager.hideIncomingCall()
}
/**
* 收到来电消息
* 1.如果当前已经进房,则拒绝
* 2.如果当前已经收到邀请信息,则拒绝
* 3.如果当前正在打电话中,则拒绝
*/
override fun receiverCalling(message: Message) {
super.receiverCalling(message)
if (callingWindowManager.isWindowShow) {
log(TAG, "已在通话进程中,准备拒绝他 ---> ")
ChatServiceHandler.refuseCall(message.snSender, {}, {}, message.roomId)
} else {
log(TAG, "有人打来电话,准备显示 ---> $currentRoomId")
callingWindowManager.showIncomingCall(message.toSns())
}
}
override fun refuseMatchToShowCalling(message: Message) {
super.refuseMatchToShowCalling(message)
callingWindowManager.showIncomingCall(message.toSns())
}
override fun onTrimMemory(level: Int) {
super.onTrimMemory(level)
log(TAG, "onTrimMemory ---> ")

View File

@@ -43,21 +43,7 @@ private fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf(
trackRouter!!.track(eventType, data)
}
@DebugLog
fun trackAppEnter(type: String, context: Context = AbsMogoApplication.getApp().applicationContext) {
trackNormalEvent(
TRACK_APP_ENTER,
mutableMapOf(
"from" to type,
"appname" to context.getString(R.string.app_name),
"appversion" to context.packageManager.getPackageInfo(
context.packageName,
0
).versionName
)
)
}
//todo
@DebugLog
fun trackCall(callType: Int, type: Int) {
//记录开始语音、直播时间

View File

@@ -2,10 +2,7 @@
package com.mogo.chat.util.sp
import com.mogo.chat.aspect.DebugLog
const val TEMPORARY_FILE_NAME = "temporary_im_data"
const val CONFIG_FILE_NAME = "configs_im_data"
const val FILE_NAME = "settings_im_data"
const val PARAM_ROOM_ID = "PARAM_ROOM_ID"
@@ -14,20 +11,7 @@ const val PARAM_NEW_FOCUS = "PARAM_NEW_FOCUS"
const val PARAM_VOICE_TYPE = "PARAM_VOICE_TYPE"
const val PARAM_CALL_TIME = "PARAM_CALL_TIME"
const val PARAM_INIT_TIP = "PARAM_INIT_TIP"
const val PARAM_CAR_ONLINE_STATUS = "PARAM_CAR_ONLINE_STATUS"
const val PARAM_GUIDE_SHOW_STATUS = "PARAM_GUIDE_SHOW_STATUS"
const val PARAM_CONFIG_EXPIRY_TIME = "PARAM_CONFIG_EXPIRY_TIME"
const val PARAM_CONFIG_COUNT_DOWN_TIME = "PARAM_CONFIG_COUNT_DOWN_TIME"
const val PARAM_CONFIG_VOICE_CONTENT = "PARAM_CONFIG_VOICE_CONTENT"
const val PARAM_CONFIG_IMAGE_IS_SAVED = "PARAM_CONFIG_IMAGE_IS_SAVED"
const val PARAM_CONFIG_TOPIC_GUIDE = "PARAM_CONFIG_TOPIC_GUIDE"
const val PARAM_CONFIG_FOCUS_NOTICE_TIMES = "PARAM_CONFIG_FOCUS_NOTICE_TIMES"
const val PARAM_CONFIG_OWN_NICK_NAME = "PARAM_CONFIG_OWN_NICK_NAME"
const val PARAM_CONFIG_OWN_HEAD_IMG = "PARAM_CONFIG_OWN_HEAD_IMG"
fun saveRoomId(roomId: Int) {
getCommitSP(TEMPORARY_FILE_NAME) {
@@ -86,15 +70,6 @@ fun getCarOnLineStatus(): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_CAR_ONLINE_STATUS, true)
}
fun initTip(initType: Int) {
getApplySp(FILE_NAME) {
putBoolean(PARAM_INIT_TIP + initType, true)
}
}
fun getInitStatus(initType: Int): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_INIT_TIP + initType, false)
}
fun recordCallTime() {
getApplySp(FILE_NAME) {
@@ -111,77 +86,3 @@ fun getTalkTime(): Long {
}
}
fun guideHasShown() {
getApplySp(FILE_NAME) {
putBoolean(PARAM_GUIDE_SHOW_STATUS, true).apply()
}
}
fun getGuideShowStatus(): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_GUIDE_SHOW_STATUS, false)
}
/**********************************************配置Data*****************************************************/
fun setExpiryTime(expiryTime: Long) {
getApplySp(CONFIG_FILE_NAME) {
putLong(PARAM_CONFIG_EXPIRY_TIME, expiryTime)
}
}
fun isExpiryTime(requestTime: Long): Boolean {
return getSP(CONFIG_FILE_NAME).getLong(PARAM_CONFIG_EXPIRY_TIME, 0) != requestTime
}
fun setCountDownTime(countDownTime: Int) {
getApplySp(CONFIG_FILE_NAME) {
putInt(PARAM_CONFIG_COUNT_DOWN_TIME, countDownTime)
}
}
fun getCountDownTime(): Int {
return getSP(CONFIG_FILE_NAME).getInt(PARAM_CONFIG_COUNT_DOWN_TIME, 0)
}
fun setConfigVoiceContent(voiceContent: String) {
getApplySp(CONFIG_FILE_NAME) {
putString(PARAM_CONFIG_VOICE_CONTENT, voiceContent)
}
}
fun getConfigVoiceContent(): String {
return getSP(CONFIG_FILE_NAME).getString(PARAM_CONFIG_VOICE_CONTENT, "")!!
}
fun setImageSaveStatus(saveStatus: Boolean) {
getApplySp(CONFIG_FILE_NAME) {
putBoolean(PARAM_CONFIG_IMAGE_IS_SAVED, saveStatus)
}
}
fun getImageSaveStatus(): Boolean {
return getSP(CONFIG_FILE_NAME).getBoolean(PARAM_CONFIG_IMAGE_IS_SAVED, false)
}
fun setFocusNoticeTimes(times: Int) {
getApplySp(CONFIG_FILE_NAME) {
putInt(PARAM_CONFIG_FOCUS_NOTICE_TIMES, times)
}
}
fun getFocusNoticeTimes(): Int {
return getSP(CONFIG_FILE_NAME).getInt(PARAM_CONFIG_FOCUS_NOTICE_TIMES, 0)
}
@DebugLog
fun setTopicGuideContent(content: String) {
getApplySp(CONFIG_FILE_NAME) {
putString(PARAM_CONFIG_TOPIC_GUIDE, content)
}
}
fun getTopicGuideContent(): Array<String> {
val content = getSP(CONFIG_FILE_NAME).getString(PARAM_CONFIG_TOPIC_GUIDE, "")
return if (content.isNullOrEmpty()) emptyArray() else content.split("/").toTypedArray()
}

View File

@@ -1,252 +0,0 @@
package com.mogo.chat.window
import android.content.Context
import android.graphics.PixelFormat
import android.media.AudioManager
import android.os.Build
import android.os.Handler
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.view.WindowManager.LayoutParams
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import com.mogo.chat.R
import com.mogo.chat.constant.TAG
import com.mogo.chat.model.bean.Sns
import com.mogo.chat.util.MediaController
import com.mogo.chat.util.log
import com.mogo.chat.voice.IMVoiceClient
import com.mogo.chat.voice.IVoiceIntentListener
import com.mogo.utils.WindowUtils
import com.mogo.utils.glide.GlideApp
/**
* 来电界面管理
*/
class CallingWindowManager(
val context: Context,
private val callActionListener: IWindowCallActionListener
) : IVoiceIntentListener {
companion object {
const val MSG_DIALING_TIME_OUT = 1001
const val DEFAULT_MAX_DIALING_TIME = 30 * 1000L
}
private var windowManager: WindowManager? = null
var isWindowShow = false
private var isShowBig = false
private var bodyView: View? = null
private var layoutParams: LayoutParams = LayoutParams()
private lateinit var userInfo: Sns
private lateinit var btnScale: ImageButton
private lateinit var ivHeadImg: ImageView
private lateinit var tvNickName: TextView
private lateinit var tvBigAnswer: TextView
private lateinit var tvBigCancel: TextView
private lateinit var ibSmallAnswer: ImageButton
private lateinit var ibSmallCancel: ImageButton
private val handler = Handler(context.mainLooper) {
log(TAG, "times up ,ready to refuse call ")
when (it.what) {
MSG_DIALING_TIME_OUT -> callActionListener.windowRefuseCall(userInfo)
}
true
}
fun showIncomingCall(userInfo: Sns) {
if (!isWindowShow) {
log(TAG, "显示来电浮窗======")
broadCastVoicePrompt()
handler.sendEmptyMessageDelayed(MSG_DIALING_TIME_OUT, DEFAULT_MAX_DIALING_TIME)
isWindowShow = true
this.userInfo = userInfo
windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = LayoutParams.TYPE_APPLICATION_OVERLAY
} else {
layoutParams.type = LayoutParams.TYPE_PHONE
}
layoutParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE
layoutParams.gravity = Gravity.START or Gravity.TOP
layoutParams.format = PixelFormat.RGBA_8888
exchangeToBig()
}
}
private fun exchangeToBig() {
windowManager?.let {
if (bodyView != null) {
// 如果bodyView不为空需要先清除掉然后重新添加因为如果不为空则说明是从小界面切换回大界面而不是初始化展示大界面
it.removeView(bodyView)
}
bodyView =
LayoutInflater.from(context).inflate(R.layout.window_incomming_call_big, null)
layoutParams.width = LayoutParams.MATCH_PARENT
layoutParams.height = LayoutParams.MATCH_PARENT
layoutParams.x = 0
layoutParams.y = 0
initBigView()
it.addView(bodyView, layoutParams)
isShowBig = true
}
}
private fun initBigView() {
bodyView?.let {
btnScale = it.findViewById(R.id.btnScale)
ivHeadImg = it.findViewById(R.id.ivHead)
tvNickName = it.findViewById(R.id.tvUserName)
tvBigAnswer = it.findViewById(R.id.tvBigAnswer)
tvBigCancel = it.findViewById(R.id.tvBigCancel)
it.setOnClickListener(null)
GlideApp.with(context).load(userInfo.headImgUrl)
.placeholder(R.mipmap.icon_avator_big).circleCrop()
.into(ivHeadImg)
// tvNickName.text = userInfo.nickName
tvNickName.text = "云平台" //todo 需要产品后面更改逻辑,避免写死造成困扰
btnScale.setOnClickListener {
exchangeToSmall()
}
tvBigAnswer.setOnClickListener {
// 接听电话
clickDialingCall(true)
}
tvBigCancel.setOnClickListener {
// 拒绝接听电话
clickDialingCall(false)
}
}
}
private fun exchangeToSmall() {
windowManager?.let {
it.removeViewImmediate(bodyView)
bodyView =
LayoutInflater.from(context).inflate(R.layout.window_incomming_call_small, null)
val sWidth = WindowUtils.getScreenWidth(context)
val sHeight = WindowUtils.getScreenHeight(context)
val x =
sWidth - context.resources.getDimension(R.dimen.dp_580) - context.resources.getDimension(
R.dimen.dp_310
)
val y =
sHeight - context.resources.getDimension(R.dimen.dp_120) - context.resources.getDimension(
R.dimen.dp_60
) - WindowUtils.getStatusBarHeight(context)
layoutParams.width = context.resources.getDimension(R.dimen.dp_768).toInt()
layoutParams.height = context.resources.getDimension(R.dimen.dp_212).toInt()
layoutParams.gravity = Gravity.START or Gravity.TOP
layoutParams.x = x.toInt()
layoutParams.y = y.toInt()
initSmallView()
it.addView(bodyView, layoutParams)
isShowBig = false
}
}
private fun initSmallView() {
bodyView?.let {
tvNickName = it.findViewById(R.id.tvSmallUserName)
ibSmallAnswer = it.findViewById(R.id.ibSmallAnswer)
ibSmallCancel = it.findViewById(R.id.ibSmallCancel)
tvNickName.text = userInfo.nickName
it.setOnClickListener {
exchangeToBig()
}
ibSmallAnswer.setOnClickListener {
// 接听电话
callActionListener.windowAnswerCall(userInfo)
}
ibSmallCancel.setOnClickListener {
// 拒绝接听电话
callActionListener.windowRefuseCall(userInfo)
}
}
}
fun hideIncomingCall() {
log(TAG,"hideIncomingCall")
if (isWindowShow && windowManager != null) {
handler.removeMessages(MSG_DIALING_TIME_OUT)
log(TAG,"removeView : windowManager")
windowManager!!.removeView(bodyView)
windowManager = null
bodyView = null
isWindowShow = false
}
releaseAudioAndVoice()
}
/**
* 来电语音播报,现在只有语音来电,暂时不报别的
*/
private fun broadCastVoicePrompt() {
IMVoiceClient.speakAndRegisterCall({ agree ->
if (isWindowShow) {
log(TAG, "speakAndRegisterCall")
clickDialingCall(agree)
}
}, {
log(TAG, "playFinish")
playAudioCall()
registerIntentInComingCall()
})
}
private fun clickDialingCall(agree: Boolean) {
if (agree) {
callActionListener.windowAnswerCall(userInfo)
} else {
callActionListener.windowRefuseCall(userInfo)
}
releaseAudioAndVoice()
}
override fun onVoiceAnswerCall() {
callActionListener.windowAnswerCall(userInfo)
releaseAudioAndVoice()
}
override fun onVoiceRefuseCall() {
callActionListener.windowRefuseCall(userInfo)
releaseAudioAndVoice()
}
private fun releaseAudioAndVoice() {
stopAudioCall()
unRegisterVoice()
}
private fun playAudioCall() {
log(TAG, "播放来电铃声=====$isWindowShow")
if (isWindowShow) {
MediaController.startPlay(context, R.raw.call, true, AudioManager.STREAM_RING)
}
}
private fun stopAudioCall() {
log(TAG, "停止播放来电铃声======")
MediaController.release()
}
private fun registerIntentInComingCall() {
IMVoiceClient.registerIntentInComingCall(this)
}
private fun unRegisterVoice() {
IMVoiceClient.releaseSpeakAndRegisterCallback()
IMVoiceClient.unRegisterIntentInComingCall(this)
}
}

View File

@@ -1,19 +0,0 @@
package com.mogo.chat.window
import com.mogo.chat.model.bean.Sns
/**
* 浮窗通话状态通知
*/
interface IWindowCallActionListener {
/**
* 浮窗点击接听电话
*/
fun windowAnswerCall(userReceiver: Sns)
/**
* 浮窗显示拒绝接听电话
*/
fun windowRefuseCall(sns: Sns)
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/hangup_press" android:state_pressed="true" />
<item android:drawable="@mipmap/hangup_normal" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/scale_dialing_press" android:state_pressed="true" />
<item android:drawable="@mipmap/scale_dialing_normal" />
</selector>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/answer_press" android:state_pressed="true" />
<item android:drawable="@mipmap/answer_normal" />
</selector>

View File

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clBigDialing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/dialing_big_bg"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toBottomOf="@+id/mapView"
app:layout_constraintEnd_toEndOf="@+id/mapView"
app:layout_constraintStart_toStartOf="@+id/flLeft"
app:layout_constraintTop_toTopOf="@+id/mapView">
<ImageButton
android:id="@+id/btnScale"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_70"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginTop="@dimen/dp_50"
android:background="@drawable/selector_btn_scale_dialing"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/ivHead"
android:layout_width="@dimen/dp_264"
android:layout_height="@dimen/dp_264"
android:layout_marginTop="@dimen/dp_126"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_19"
android:ellipsize="end"
android:maxEms="10"
android:maxLines="1"
android:textColor="#fff"
android:textSize="@dimen/dp_57"
app:layout_constraintEnd_toEndOf="@+id/ivHead"
app:layout_constraintStart_toStartOf="@+id/ivHead"
app:layout_constraintTop_toBottomOf="@+id/ivHead" />
<TextView
android:id="@+id/tvDialingNotice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_38"
android:text="邀请你语音通话..."
android:textColor="#fff"
android:textSize="@dimen/dp_42"
app:layout_constraintEnd_toEndOf="@+id/tvUserName"
app:layout_constraintStart_toStartOf="@+id/tvUserName"
app:layout_constraintTop_toBottomOf="@+id/tvUserName" />
<TextView
android:id="@+id/tvBigAnswer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/voice_answer_selector"
android:drawablePadding="10px"
android:gravity="center"
android:text="接听"
android:textColor="#fff"
android:textSize="@dimen/dp_38"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tvBigCancel"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvDialingNotice" />
<TextView
android:id="@+id/tvBigCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/selector_btn_hangup"
android:drawablePadding="10px"
android:gravity="center"
android:text="拒绝"
android:textColor="#fff"
android:textSize="@dimen/dp_38"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/tvBigAnswer"
app:layout_constraintTop_toBottomOf="@+id/tvDialingNotice" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clSmallDialing"
android:layout_width="@dimen/dp_840"
android:layout_height="@dimen/dp_232"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="@mipmap/main_small_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/ibSmallAnswer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_36"
android:background="@drawable/voice_answer_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/ibSmallCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_36"
android:background="@drawable/selector_btn_hangup"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvSmallUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxEms="6"
android:maxLines="1"
android:textColor="#fff"
android:textSize="@dimen/dp_56"
app:layout_constraintBottom_toTopOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="邀请你语音通话..."
android:textColor="#7fffffff"
android:textSize="@dimen/dp_36"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tvSmallUserName"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="@+id/tvSmallUserName"
app:layout_constraintTop_toBottomOf="@+id/tvSmallUserName" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">CarChatting</string>
</resources>

View File

@@ -154,25 +154,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
// msg.sendToTarget();
}
});
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi(context)
.registerLifecycleListener(10020, new IMogoLifecycleListener() {
@Override
public void onConnectFailure() {
DebugConfig.setStatus(DebugConfig.sDownloadLink, false);
}
@Override
public void onConnectSuccess() {
DebugConfig.setStatus(DebugConfig.sDownloadLink, true);
}
@Override
public void onConnectLost() {
DebugConfig.setStatus(DebugConfig.sDownloadLink, false);
}
});
}

View File

@@ -93,7 +93,7 @@ public class EnvStatusManager {
if (i == 3) {
stringBuilder.append(DebugConfig.getAutoPilotStatus()).append("\n");
} else if (i == 4) {
stringBuilder.append("true".equals(DebugConfig.getStatus(i, false)) ? "正常" : "异常").append("\n");
stringBuilder.append(DebugConfig.isDownloadSnapshot() ? "正常" : "异常").append("\n");
} else if (i == 5 || i == 6) {
stringBuilder.append(DebugConfig.getStatusData(i)).append("\n");
} else if (i == 7) {