From 0ef4820e09de19361f8a5c0dcb60b9950ad40616 Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 10 Dec 2020 13:43:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[=E4=BA=8B=E4=BB=B6=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=B7=A6=E4=BE=A7=E5=9C=86=E8=A7=92=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/adapter/V2XShareEventAdapter.java | 2 +- .../v2x/adapter/holder/V2XRoadEventVH.java | 12 ++++++-- .../mogo/module/v2x/utils/EventTypeUtils.java | 30 +++++++++++++++++++ .../res/layout/item_v2x_event_detail_vr.xml | 1 - .../res/layout/item_v2x_fault_help_vr.xml | 1 + 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java index 6828c691cf..665b08f9f5 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java @@ -107,7 +107,7 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter { private static final String TAG = "V2XRoadEventVH"; + private Context mContext; private MogoImageView ivEventImg; private MogoImageView ivReportHead; private ImageView ivEventPlay; @@ -144,6 +151,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false) : LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false) ); + mContext = viewGroup.getContext(); init(itemView); // 设置视图状态监听 itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @@ -206,8 +214,8 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { imgUrl = mNoveltyInfo.getItems().get(0).getUrl(); } if (!TextUtils.isEmpty(imgUrl)) { - V2XServiceManager.getImageLoader() - .displayImage(imgUrl, ivEventImg); + Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform( + new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg); } if (url.contains(".mp4")) { ivEventImg.setOnClickListener(v -> { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java index 5df0729f44..bb1d51fefc 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java @@ -121,6 +121,36 @@ public class EventTypeUtils { return strBg; } + /* + * VR模式下道路类型影响到分享列表 (VR模式暂时没有事件面板,所以可以删除此方法,公用上边的getPoiTypeBg) + * */ + public static int getPoiTypeBgForShareItem(String poiType) { + int strBg; + switch (poiType) { + case V2XPoiTypeEnum.FOURS_PARKING: // 停车场 + case V2XPoiTypeEnum.GAS_STATION: // 加油站 + strBg = R.drawable.bg_v2x_event_type_blue; + break; + case V2XPoiTypeEnum.FOURS_BLOCK_UP: // 拥堵 + case V2XPoiTypeEnum.FOURS_LIVING: // 实时路况 + case V2XPoiTypeEnum.FOURS_NEALY: // 身边 + strBg = R.drawable.bg_v2x_event_type_orange; + break; + case V2XPoiTypeEnum.TRAFFIC_CHECK:// 交通检查 + case V2XPoiTypeEnum.ROAD_CLOSED:// 封路 + case V2XPoiTypeEnum.FOURS_ROAD_WORK:// 施工 + case V2XPoiTypeEnum.FOURS_PONDING:// 积水 + case V2XPoiTypeEnum.FOURS_FOG: // 浓雾 + case V2XPoiTypeEnum.FOURS_ICE: // 结冰 + case V2XPoiTypeEnum.FOURS_ACCIDENT: // 事故 + strBg = R.drawable.bg_v2x_event_type_read; + break; + default: + strBg = R.drawable.bg_v2x_event_type_read; + break; + } + return strBg; + } /** * 判断是否是道路预警事件 diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index 2e753f40fc..79822a5547 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -16,7 +16,6 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:miv_bottomLeftRadius="@dimen/dp_20" app:miv_failureHolder="@drawable/v2x_icon_live_logo" app:miv_overlayImageId="@drawable/v2x_icon_live_logo" app:miv_placeHolder="@drawable/v2x_icon_live_logo" diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml index ed01bd0d88..f11eb95ea2 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml @@ -107,6 +107,7 @@ android:layout_width="@dimen/module_v2x_event_button_size_vr" android:layout_height="@dimen/module_v2x_event_button_size_vr" android:src="@drawable/selector_nav_btn" + android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> From e59b89164ac6e82671d02548a120ea276c5e5438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 10 Dec 2020 14:13:49 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=B0=8F?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 + .../com/mogo/launcher/MogoApplication.java | 4 ++ config.gradle | 1 + gradle.properties | 1 + modules/mogo-module-smp/build.gradle | 51 ++++++++++++++----- modules/mogo-module-smp/gradle.properties | 3 ++ .../small/map/IMogoSmallMapProvider.java | 12 +++++ .../module/small/map/SmallMapService.java | 8 +++ .../mogo/module/small/map/SmallMapView.java | 8 +++ .../module/small/map/SmallMapViewHandler.java | 8 +++ .../module/small/map/SmallVisionProvider.java | 46 +++++++++++++++++ 11 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 modules/mogo-module-smp/gradle.properties create mode 100644 modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/IMogoSmallMapProvider.java create mode 100644 modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java create mode 100644 modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java create mode 100644 modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapViewHandler.java create mode 100644 modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java diff --git a/app/build.gradle b/app/build.gradle index 31b58785e9..c64a06899f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -435,6 +435,7 @@ dependencies { implementation rootProject.ext.dependencies.guideshow implementation rootProject.ext.dependencies.moduleextensions implementation rootProject.ext.dependencies.modulemap + implementation rootProject.ext.dependencies.moduleSmallMap } else { implementation project(':foudations:mogo-commons') implementation project(':foudations:mogo-base-websocket-sdk') @@ -451,6 +452,7 @@ dependencies { implementation project(':modules:mogo-module-monitor') implementation project(':modules:mogo-module-extensions') implementation project(':modules:mogo-module-map') + implementation project(':modules:mogo-module-smp') } apply from: "./functions/perform.gradle" diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 46338739f7..9fb370170f 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -22,6 +22,7 @@ import com.mogo.module.main.service.MogoMainService; import com.mogo.module.push.base.PushUIConstants; import com.mogo.module.service.ServiceConst; import com.mogo.module.share.constant.ShareConstants; +import com.mogo.module.small.map.IMogoSmallMapProvider; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.utils.ObuConfig; import com.mogo.service.IMogoServiceApis; @@ -99,6 +100,9 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning" ) ); // MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) ); + // 小地图模块 + MogoModulePaths.addModule( new MogoModule( IMogoSmallMapProvider.path, "IMogoSmallMapProvider" ) ); + MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) ); if ( !DebugConfig.isLauncher() ) { diff --git a/config.gradle b/config.gradle index 690687840b..9d98d9bb95 100644 --- a/config.gradle +++ b/config.gradle @@ -111,6 +111,7 @@ ext { guideshow : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDESHOW_VERSION}", // V2X moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}", + moduleSmallMap : "com.mogo.module:module-small-map:${MOGO_MODULES_SMALL_MAP}", modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}", modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}", // push diff --git a/gradle.properties b/gradle.properties index 24262a25ef..62574eec69 100644 --- a/gradle.properties +++ b/gradle.properties @@ -130,6 +130,7 @@ TTS_NOOP_VERSION=2.0.7 # 自研地图 MAP_CUSTOM_VERSION=1.2.1.9 MOGO_MODULES_MVISION_VERSION=1.0.0 +MOGO_MODULES_SMALL_MAP=1.0.0 # httpdns HTTPDNS_TENCENT_VERSION = 1.0.0 HTTPDNS_BASE_VERSION = 1.0.0 diff --git a/modules/mogo-module-smp/build.gradle b/modules/mogo-module-smp/build.gradle index f5abda057a..e3a46f8dd8 100644 --- a/modules/mogo-module-smp/build.gradle +++ b/modules/mogo-module-smp/build.gradle @@ -1,19 +1,23 @@ -plugins { - id 'com.android.library' -} +apply plugin: 'com.android.library' +apply plugin: 'com.alibaba.arouter' android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" - + compileSdkVersion rootProject.ext.android.compileSdkVersion + // buildToolsVersion rootProject.ext.android.buildToolsVersion defaultConfig { - minSdkVersion 19 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" + minSdkVersion rootProject.ext.android.minSdkVersion + targetSdkVersion rootProject.ext.android.targetSdkVersion + versionCode Integer.valueOf(VERSION_CODE) + versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") + + javaCompileOptions { + annotationProcessorOptions { + arguments = [AROUTER_MODULE_NAME: project.getName()] + } + } testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" + consumerProguardFiles 'consumer-rules.pro' } buildTypes { @@ -22,6 +26,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -30,7 +35,25 @@ android { dependencies { - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.2.1' + implementation rootProject.ext.dependencies.androidxappcompat + implementation rootProject.ext.dependencies.androidxconstraintlayout + implementation rootProject.ext.dependencies.arouter + annotationProcessor rootProject.ext.dependencies.aroutercompiler + if (Boolean.valueOf(RELEASE)) { + api rootProject.ext.dependencies.mogomap + api rootProject.ext.dependencies.mogomapapi + api rootProject.ext.dependencies.mogoutils + api rootProject.ext.dependencies.mogocommons + api rootProject.ext.dependencies.mogoserviceapi + implementation rootProject.ext.dependencies.modulecommon + } else { + api project(":libraries:mogo-map") + api project(":libraries:mogo-map-api") + api project(":foudations:mogo-utils") + api project(":foudations:mogo-commons") + api project(':services:mogo-service-api') + implementation project(':modules:mogo-module-common') + } +} -} \ No newline at end of file +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/modules/mogo-module-smp/gradle.properties b/modules/mogo-module-smp/gradle.properties new file mode 100644 index 0000000000..61d3012ece --- /dev/null +++ b/modules/mogo-module-smp/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.module +POM_ARTIFACT_ID=module-small-map +VERSION_CODE=1 diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/IMogoSmallMapProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/IMogoSmallMapProvider.java new file mode 100644 index 0000000000..cb8cb65fe0 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/IMogoSmallMapProvider.java @@ -0,0 +1,12 @@ +package com.mogo.module.small.map; + +import com.mogo.service.module.IMogoModuleProvider; + +/** + * @author donghongyu + * @date 12/10/20 1:36 PM + */ +public interface IMogoSmallMapProvider extends IMogoModuleProvider { + String path = "/small_map/api"; + +} diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java new file mode 100644 index 0000000000..9b67f23665 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java @@ -0,0 +1,8 @@ +package com.mogo.module.small.map; + +/** + * @author donghongyu + * @date 12/10/20 1:35 PM + */ +public class SmallMapService { +} diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java new file mode 100644 index 0000000000..0ab902870b --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java @@ -0,0 +1,8 @@ +package com.mogo.module.small.map; + +/** + * @author donghongyu + * @date 12/10/20 1:35 PM + */ +public class SmallMapView { +} diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapViewHandler.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapViewHandler.java new file mode 100644 index 0000000000..93e841b09a --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapViewHandler.java @@ -0,0 +1,8 @@ +package com.mogo.module.small.map; + +/** + * @author donghongyu + * @date 12/10/20 1:35 PM + */ +public class SmallMapViewHandler { +} diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java new file mode 100644 index 0000000000..90969b6462 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java @@ -0,0 +1,46 @@ +package com.mogo.module.small.map; + +import android.content.Context; +import android.os.Bundle; +import android.util.Log; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; + +import com.alibaba.android.arouter.facade.annotation.Route; + +/** + * @author donghongyu + * @date 12/10/20 1:34 PM + */ +@Route(path = IMogoSmallMapProvider.path) +public class SmallVisionProvider implements IMogoSmallMapProvider { + private static final String TAG = "SmallVisionProvider"; + + @Override + public Fragment createFragment(Context context, Bundle data) { + return null; + } + + @Override + public View createView(Context context) { + return null; + } + + @NonNull + @Override + public String getModuleName() { + return null; + } + + @Override + public int getType() { + return 0; + } + + @Override + public void init(Context context) { + Log.d(TAG, "小地图模块初始化……"); + } +} From 1d4fcc3a6e23f54daec5697ab41011381ac05640 Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 10 Dec 2020 16:04:34 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=8E=A5=E6=94=B6=E6=B1=82=E5=8A=A9?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E5=A4=B4=E5=83=8F=E5=B7=A6=E4=BE=A7=E5=9C=86?= =?UTF-8?q?=E8=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/adapter/holder/V2XOtherSeekHelpVH.java | 15 +++++++++++++-- .../module/v2x/adapter/holder/V2XRoadEventVH.java | 9 +++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java index 977334632f..e866a3038a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java @@ -1,5 +1,6 @@ package com.mogo.module.v2x.adapter.holder; +import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; import android.view.LayoutInflater; @@ -8,6 +9,8 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; import com.mogo.commons.debug.DebugConfig; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.MarkerExploreWay; @@ -25,6 +28,7 @@ import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; import com.mogo.module.v2x.voice.V2XVoiceConstants; import com.mogo.module.v2x.voice.V2XVoiceManager; import com.mogo.service.imageloader.MogoImageView; +import com.mogo.utils.glide.GlideRoundedCornersTransform; import java.text.SimpleDateFormat; import java.util.Date; @@ -44,6 +48,7 @@ import static com.mogo.module.v2x.V2XConst.VR_MODE; */ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder { + private Context mContext; private MogoImageView ivHead; private TextView tvName; private TextView tvDistance; @@ -73,6 +78,7 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder { public V2XOtherSeekHelpVH(ViewGroup viewGroup) { super(LayoutInflater.from(viewGroup.getContext()) .inflate(VR_MODE ? R.layout.item_v2x_fault_help_vr : R.layout.item_v2x_fault_help, viewGroup, false)); + mContext = viewGroup.getContext(); ivHead = itemView.findViewById(R.id.ivFaultHelpHead); tvName = itemView.findViewById(R.id.tvFaultHelpName); tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance); @@ -179,8 +185,13 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder { } try { if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) { - V2XServiceManager.getImageLoader() - .displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead); + if (VR_MODE) { + Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform( + new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead); + } else { + V2XServiceManager.getImageLoader() + .displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead); + } } tvName.setText(mV2XPushMessageEntity.getDisplayName()); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index 10fcb421db..c159852853 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -214,8 +214,13 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { imgUrl = mNoveltyInfo.getItems().get(0).getUrl(); } if (!TextUtils.isEmpty(imgUrl)) { - Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform( - new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg); + if (VR_MODE) { + Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform( + new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg); + } else { + V2XServiceManager.getImageLoader() + .displayImage(imgUrl, ivEventImg); + } } if (url.contains(".mp4")) { ivEventImg.setOnClickListener(v -> { From bd28bd10162fec9128c6c72122f22228d30afe67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 10 Dec 2020 16:21:17 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=B0=8F?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/AndroidManifest.xml | 6 ++ .../module/small/map/SmallMapService.java | 73 ++++++++++++++++++- .../mogo/module/small/map/SmallMapView.java | 41 ++++++++++- .../module/small/map/SmallVisionProvider.java | 14 +++- 4 files changed, 129 insertions(+), 5 deletions(-) diff --git a/modules/mogo-module-smp/src/main/AndroidManifest.xml b/modules/mogo-module-smp/src/main/AndroidManifest.xml index 3f004d131a..649a2f531a 100644 --- a/modules/mogo-module-smp/src/main/AndroidManifest.xml +++ b/modules/mogo-module-smp/src/main/AndroidManifest.xml @@ -2,4 +2,10 @@ + + + \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java index 9b67f23665..686397704f 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java @@ -1,8 +1,79 @@ package com.mogo.module.small.map; +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; +import android.os.RemoteException; + +import androidx.annotation.Nullable; + +import com.mogo.module.common.entity.MogoSnapshotSetData; +import com.mogo.module.common.machinevision.IMachineVisionInterface; +import com.mogo.module.common.wm.WindowManagerView; +import com.mogo.utils.logger.Logger; + /** * @author donghongyu * @date 12/10/20 1:35 PM */ -public class SmallMapService { +public class SmallMapService extends Service { + private static final String TAG = "MachineVisionMapService"; + private IBinder mBinder; + private WindowManagerView mMachineVisionMapViewManager; + private SmallMapView mMapView; + + + @Nullable + @Override + public IBinder onBind(Intent intent) { + mBinder = new SmallMapServiceBinder(); + addMachineVisionMapView(); + Logger.d(TAG, "onBind"); + return mBinder; + } + + @Override + public void onRebind(Intent intent) { + super.onRebind(intent); + addMachineVisionMapView(); + Logger.d(TAG, "onRebind"); + } + + @Override + public boolean onUnbind(Intent intent) { + + return true; + } + + @Override + public void onDestroy() { + super.onDestroy(); + + } + + private void addMachineVisionMapView() { + + } + + + /** + * 小地图与大地图之间进程通讯 + */ + public class SmallMapServiceBinder extends IMachineVisionInterface.Stub { + + @Override + public void postData(MogoSnapshotSetData data) throws RemoteException { + + } + + @Override + public void hideViewIfExist() throws RemoteException { + + } + + @Override + public void showViewIfExist() throws RemoteException { + + } + } } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java index 0ab902870b..c746db0896 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java @@ -1,8 +1,47 @@ package com.mogo.module.small.map; +import android.content.Context; +import android.util.AttributeSet; +import android.util.Log; + +import androidx.annotation.Nullable; + +import com.mogo.map.MogoBaseMapView; + /** * @author donghongyu * @date 12/10/20 1:35 PM */ -public class SmallMapView { +public class SmallMapView extends MogoBaseMapView { + private final String TAG = "SmallMapView"; + + public SmallMapView(Context context) { + this(context, null); + } + + public SmallMapView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } + + public SmallMapView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void addDleMaps() { + Log.d(TAG, "addDleMaps……"); + + } + + @Override + public void display2DMap(boolean invokeCreateAuto, boolean invokeResumeAuto) { + Log.d(TAG, "display2DMap……"); + + } + + @Override + public void displayVRMap(boolean invokeCreateAuto, boolean invokeResumeAuto) { + Log.d(TAG, "displayVRMap……"); + + } } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java index 90969b6462..d6ee7e537b 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.service.module.ModuleType; /** * @author donghongyu @@ -16,7 +17,7 @@ import com.alibaba.android.arouter.facade.annotation.Route; */ @Route(path = IMogoSmallMapProvider.path) public class SmallVisionProvider implements IMogoSmallMapProvider { - private static final String TAG = "SmallVisionProvider"; + private final String TAG = "SmallVisionProvider"; @Override public Fragment createFragment(Context context, Bundle data) { @@ -31,16 +32,23 @@ public class SmallVisionProvider implements IMogoSmallMapProvider { @NonNull @Override public String getModuleName() { - return null; + return TAG; } @Override public int getType() { - return 0; + return ModuleType.TYPE_SERVICE; } @Override public void init(Context context) { Log.d(TAG, "小地图模块初始化……"); + + } + + @Override + public void onDestroy() { + Log.d(TAG, "小地图模块销毁……"); + } } From 0cc76358f0920c78fabab5e2557afe6ca627615f Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 10 Dec 2020 17:34:55 +0800 Subject: [PATCH 5/5] modify music --- .../common/entity/MogoSnapshotSetData.java | 3 + .../media/widget/PercentageRingView.java | 165 ++++++++ .../module/media/window/MediaWindow2.java | 374 ++++++++++++------ ...le_media_music_window_alert_layout_new.xml | 44 +++ .../src/main/res/values-xhdpi/dimens.xml | 8 +- .../src/main/res/values/attrs.xml | 8 + .../src/main/res/values/colors.xml | 2 + .../src/main/res/values/dimens.xml | 6 + 8 files changed, 491 insertions(+), 119 deletions(-) create mode 100755 modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/PercentageRingView.java create mode 100644 modules/mogo-module-media/src/main/res/layout/module_media_music_window_alert_layout_new.xml diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java index 225b38d90c..e0c65c2ff9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MogoSnapshotSetData.java @@ -30,6 +30,9 @@ class MogoSnapshotSetData implements Parcelable { //红绿灯 private CloudRoadData trafficLight; + //路边摄像头 + private CloudRoadData camera; + // 自车速度 本地添加 public double curSpeed = 0.0; diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/PercentageRingView.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/PercentageRingView.java new file mode 100755 index 0000000000..8cb65969ab --- /dev/null +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/widget/PercentageRingView.java @@ -0,0 +1,165 @@ +package com.mogo.module.media.widget; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Paint.Align; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; + +import com.mogo.module.media.R; + +/** + * 环形进度条 + */ +public class PercentageRingView extends View { + private Paint mCirclePaint; + private Paint mTextPaint; + private Paint mArcPaint; + private int mCircleX; + private int mCircleY; + private float mCurrentAngle; + private RectF mArcRectF; + private float mStartSweepValue; + private float mTargetPercent; + private float mCurrentPercent; + + private int mRadius; + private int mCircleBackground; + private int mRingColor; + private int mTextSize; + private int mTextColor; + + + public PercentageRingView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context); + } + + public PercentageRingView(Context context, AttributeSet attrs) { + super(context, attrs); + //自定义属性 values/attr + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PercentageRing); + //中间圆的背景颜色 默认为浅紫色 + mCircleBackground = typedArray.getColor(R.styleable.PercentageRing_circleBackground, 0xffafb4db); + //外圆环的颜色 默认为深紫色 + mRingColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, 0xff6950a1); + //中间圆的半径 默认为60 + mRadius = typedArray.getInt(R.styleable.PercentageRing_radius, 60); + //字体颜色 默认为白色 + mTextColor = typedArray.getColor(R.styleable.PercentageRing_textColor, 0xffffffff); + //最后一定要调用这个 释放掉TypedArray + typedArray.recycle(); + //初始化数据 + init(context); + } + + public PercentageRingView(Context context) { + super(context); + init(context); + } + + private void init(Context context) { + //圆环开始角度 -90° 正北方向 + mStartSweepValue = -90; + //当前角度 + mCurrentAngle = 0; + //当前百分比 + mCurrentPercent = 0; + //设置中心园的画笔 + mCirclePaint = new Paint(); + mCirclePaint.setAntiAlias(true); + mCirclePaint.setColor(mCircleBackground); + mCirclePaint.setStyle(Paint.Style.FILL); + //设置文字的画笔 + mTextPaint = new Paint(); + mTextPaint.setColor(mTextColor); + mTextPaint.setAntiAlias(true); + mTextPaint.setStyle(Paint.Style.FILL); + mTextPaint.setStrokeWidth((float) (0.025 * mRadius)); + mTextPaint.setTextSize(mRadius / 2); + mTextPaint.setTextAlign(Align.CENTER); + //设置外圆环的画笔 + mArcPaint = new Paint(); + mArcPaint.setAntiAlias(true); + mArcPaint.setColor(mRingColor); + mArcPaint.setStyle(Paint.Style.STROKE); +// mArcPaint.setStrokeWidth((float) (0.075 * mRadius)); + mArcPaint.setStrokeWidth((float) (0.17 * mRadius)); + //获得文字的字号 因为要设置文字在圆的中心位置 + mTextSize = (int) mTextPaint.getTextSize(); + } + + //主要是测量wrap_content时候的宽和高,因为宽高一样,只需要测量一次宽即可,高等于宽 + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + setMeasuredDimension(measure(widthMeasureSpec), measure(widthMeasureSpec)); + //设置圆心坐标 + mCircleX = getMeasuredWidth() / 2; + mCircleY = getMeasuredHeight() / 2; + //如果半径大于圆心横坐标,需要手动缩小半径的值,否则就画到外面去了 + if (mRadius > mCircleX) { + //设置半径大小为圆心横坐标到原点的距离 + mRadius = mCircleX; + mRadius = (int) (mCircleX - 0.075 * mRadius); + //因为半径改变了,所以要重新设置一下字体宽度 + mTextPaint.setStrokeWidth((float) (0.025 * mRadius)); + //重新设置字号 + mTextPaint.setTextSize(mRadius / 2); + //重新设置外圆环宽度 +// mArcPaint.setStrokeWidth((float) (0.075 * mRadius)); + mArcPaint.setStrokeWidth((float) (0.17 * mRadius)); + //重新获得字号大小 + mTextSize = (int) mTextPaint.getTextSize(); + } + //画中心园的外接矩形,用来画圆环用 + mArcRectF = new RectF(mCircleX - mRadius, mCircleY - mRadius, mCircleX + mRadius, mCircleY + mRadius); + } + + //当wrap_content的时候,view的大小根据半径大小改变,但最大不会超过屏幕 + private int measure(int measureSpec) { + int result = 0; + int specMode = MeasureSpec.getMode(measureSpec); + int specSize = MeasureSpec.getSize(measureSpec); + if (specMode == MeasureSpec.EXACTLY) { + result = specSize; + } else { + result = (int) (1.075 * mRadius * 2); + if (specMode == MeasureSpec.AT_MOST) { + result = Math.min(result, specSize); + } + } + return result; + + } + + //开始画中间圆、文字和外圆环 + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + //画中间圆 + canvas.drawCircle(mCircleX, mCircleY, mRadius, mCirclePaint); + //画圆环 + canvas.drawArc(mArcRectF, mStartSweepValue, mCurrentAngle, false, mArcPaint); + //画文字 + canvas.drawText(String.valueOf(mCurrentPercent) + "%", mCircleX, mCircleY + mTextSize / 4, mTextPaint); + //判断当前百分比是否小于设置目标的百分比 + if (mCurrentPercent < mTargetPercent) { + //当前百分比+1 + mCurrentPercent += 1; + //当前角度+360 + mCurrentAngle += 3.6; + //每10ms重画一次 + postInvalidateDelayed(10); + } + + } + + //设置目标的百分比 + public void setTargetPercent(int percent) { + this.mTargetPercent = percent; + } + +} diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java index 4bdaa9eec7..5a9f514f9a 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java @@ -26,6 +26,7 @@ import com.mogo.module.media.presenter.PresenterFactory; import com.mogo.module.media.utils.Utils; import com.mogo.module.media.view.IMusicView; import com.mogo.module.media.widget.AnimCircleImageView; +import com.mogo.module.media.widget.PercentageRingView; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.WindowUtils; @@ -65,6 +66,10 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { private boolean mIsCallChatWindowVisible; private ICallProviderResponse mCallProviderResponse; + private PercentageRingView mPercentageRingView; + private ImageView mPauseImage; + private AnimCircleImageView mAnimCircleImageView; + public void initMedia(Context context) { mContext = context; @@ -122,71 +127,129 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { return; } - if (!mHasAddWindow) { + if (!mHasAddWindow) { //TODO mHasAddWindow = true; - mWindowView = - LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null); - mCircleImg = mWindowView.findViewById(R.id.window_circle_img); - mScrollText = mWindowView.findViewById(R.id.window_scroll_txt); - mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause); - mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next); - mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time); - mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time); - mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar); - if (mWindowPlayPause != null) { - mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); - } - int yPos = - getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location); - int xPos = - getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x); - int statusBarHeight = WindowUtils.getStatusBarHeight(mContext); - Logger.d(TAG, - "yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight); - Log.d(TAG, "addMediaWindoView"); - FrameLayout.LayoutParams params = - new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height)); - params.leftMargin = xPos; - params.topMargin = yPos; - ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false); - updateWindowUI(true); - mWindowView.setOnClickListener(new NoDoubleClickListener() { - @Override - public void onClicks(View view) { - mPresenter.openApp(); - } - }); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + mWindowView = + LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout_new, null); + mPercentageRingView = mWindowView.findViewById(R.id.window_circle_bg); + mAnimCircleImageView = mWindowView.findViewById(R.id.window_circle_img_new); + mPauseImage = mWindowView.findViewById(R.id.window_play_pause_new); - mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() { - @Override - public void onClicks(View view) { - if (mMediaInfoData != null) { - if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) { - mPresenter.play(mMediaInfoData); - } else { - // 没有做详细判断,不是暂停就是播放 - mPresenter.pause(mMediaInfoData); - } - } else { + if (mPauseImage != null) { + mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause); + } + + int yPos = + getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_new); + int xPos = + getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x_new); + int statusBarHeight = WindowUtils.getStatusBarHeight(mContext); + Logger.d(TAG, + "yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight); + Log.d(TAG, "addMediaWindoView"); + FrameLayout.LayoutParams params = + new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width_new), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height_new)); + params.leftMargin = xPos; + params.topMargin = yPos; + ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false); + updateWindowUI(true); + + mWindowView.setOnClickListener(new NoDoubleClickListener() { + @Override + public void onClicks(View view) { mPresenter.openApp(); } - } - }); + }); - mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() { - @Override - public void onClicks(View view) { - if (mPresenter != null) { - mPresenter.next(); + mPauseImage.setOnClickListener(new NoDoubleClickListener() { + @Override + public void onClicks(View view) { + if (mMediaInfoData != null) { + if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) { + mPresenter.play(mMediaInfoData); + } else { + // 没有做详细判断,不是暂停就是播放 + mPresenter.pause(mMediaInfoData); + } + } else { + mPresenter.openApp(); + } } - } - }); + }); + + if ( mIsCallChatWindowVisible ) { + Logger.d( TAG, "vr mWindowView.setVisibility: status = " + mIsCallChatWindowVisible ); + mWindowView.setVisibility(View.GONE); + } else { + mWindowView.setVisibility(View.VISIBLE); + } - if ( mIsCallChatWindowVisible ) { - Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible ); - mWindowView.setVisibility(View.GONE); } else { - mWindowView.setVisibility(View.VISIBLE); + mWindowView = + LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null); + mCircleImg = mWindowView.findViewById(R.id.window_circle_img); + mScrollText = mWindowView.findViewById(R.id.window_scroll_txt); + mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause); + mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next); + mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time); + mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time); + mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar); + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); + } + int yPos = + getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location); + int xPos = + getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x); + int statusBarHeight = WindowUtils.getStatusBarHeight(mContext); + Logger.d(TAG, + "yPos: " + yPos + " xPos: " + xPos + " statusBarHeight: " + statusBarHeight); + Log.d(TAG, "addMediaWindoView"); + FrameLayout.LayoutParams params = + new FrameLayout.LayoutParams((int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_width), (int) mContext.getResources().getDimension(R.dimen.module_media_pop_window_height)); + params.leftMargin = xPos; + params.topMargin = yPos; + ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, params, false); + updateWindowUI(true); + mWindowView.setOnClickListener(new NoDoubleClickListener() { + @Override + public void onClicks(View view) { + mPresenter.openApp(); + } + }); + + mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() { + @Override + public void onClicks(View view) { + if (mMediaInfoData != null) { + if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) { + mPresenter.play(mMediaInfoData); + } else { + // 没有做详细判断,不是暂停就是播放 + mPresenter.pause(mMediaInfoData); + } + } else { + mPresenter.openApp(); + } + } + }); + + mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() { + @Override + public void onClicks(View view) { + if (mPresenter != null) { + mPresenter.next(); + } + } + }); + + if ( mIsCallChatWindowVisible ) { + Logger.d( TAG, "mWindowView.setVisibility: status = " + mIsCallChatWindowVisible ); + mWindowView.setVisibility(View.GONE); + } else { + mWindowView.setVisibility(View.VISIBLE); + } } } } @@ -214,41 +277,71 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { return; } - if (mScrollText != null) { - mScrollText.setText(mMediaInfoData.getMediaName()); - } - - if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) { - if (mWindowMaxTime != null) { - mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime())); - } - if (mWindowCurrTime != null) { - mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime())); - } - - if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) { - // kw音乐做的容错 - if (mWindowPlayPause != null) { - mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); - } - if (mCircleImg != null) { - mCircleImg.startAnim(); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) { + if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) { + // kw音乐做的容错 + if (mPauseImage != null) { + mPauseImage.setImageResource(R.drawable.module_media_window_pop_play); + } + if (mAnimCircleImageView != null) { + mAnimCircleImageView.startAnim(); + } } } - } - if (mCircleImg != null) { - if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) { - int size = - mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size); - Logger.d(TAG, "overload: " + size); - com.bumptech.glide.request.RequestOptions options = - new com.bumptech.glide.request.RequestOptions() - .placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size); - GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options)); + if (mAnimCircleImageView != null) { + if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) { + int size = + mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size_new); + Logger.d(TAG, "overload: " + size); + com.bumptech.glide.request.RequestOptions options = + new com.bumptech.glide.request.RequestOptions() + .placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size); + GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mAnimCircleImageView, options)); // GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options)); - }else{ - mCircleImg.setImageResource(R.drawable.module_media_default_music_img); + }else{ + mAnimCircleImageView.setImageResource(R.drawable.module_media_default_music_img); + } + } + + } else { + if (mScrollText != null) { + mScrollText.setText(mMediaInfoData.getMediaName()); + } + + if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) { + if (mWindowMaxTime != null) { + mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime())); + } + if (mWindowCurrTime != null) { + mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime())); + } + + if( mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) { + // kw音乐做的容错 + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); + } + if (mCircleImg != null) { + mCircleImg.startAnim(); + } + } + } + + if (mCircleImg != null) { + if(mMediaInfoData!=null&&mMediaInfoData.getMediaImg()!=null&&!mMediaInfoData.getMediaImg().isEmpty()) { + int size = + mContext.getResources().getDimensionPixelSize(R.dimen.module_media_pop_window_anim_img_size); + Logger.d(TAG, "overload: " + size); + com.bumptech.glide.request.RequestOptions options = + new com.bumptech.glide.request.RequestOptions() + .placeholder(R.drawable.module_media_default_music_img).error(R.drawable.module_media_default_music_img).override(size, size); + GlideApp.with(mContext).asBitmap().apply(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options)); +// GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(new SkinAbleBitmapTarget(mCircleImg, options)); + }else{ + mCircleImg.setImageResource(R.drawable.module_media_default_music_img); + } } } @@ -265,12 +358,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { Log.d(TAG, "onMusicPlaying===" + mMediaInfoData); isFirstPlay = false; updateWindowUI(false); - if (mWindowPlayPause != null) { - mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); - } + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + if (mPauseImage != null) { + mPauseImage.setImageResource(R.drawable.module_media_window_pop_play); + } - if (mCircleImg != null) { - mCircleImg.startAnim(); + if (mAnimCircleImageView != null) { + mAnimCircleImageView.startAnim(); + } + } else { + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play); + } + + if (mCircleImg != null) { + mCircleImg.startAnim(); + } } MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG, true); @@ -280,12 +383,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { public void onMusicPause() { Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData); Log.d(TAG, "onMusicPause: ===" + mMediaInfoData); - if (mWindowPlayPause != null) { - mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); - } + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + if (mPauseImage != null) { + mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause); + } - if (mCircleImg != null) { - mCircleImg.stopAnim(); + if (mAnimCircleImageView != null) { + mAnimCircleImageView.stopAnim(); + } + } else { + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); + } + + if (mAnimCircleImageView != null) { + mAnimCircleImageView.stopAnim(); + } } MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false); @@ -295,12 +408,22 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { public void onMusicStopped() { Logger.d(TAG, "onMusicStopped===" + mMediaInfoData); Log.d(TAG, "onMusicStopped===" + mMediaInfoData); - if (mWindowPlayPause != null) { - mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); - } + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + if (mPauseImage != null) { + mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause); + } - if (mCircleImg != null) { - mCircleImg.stopAnim(); + if (mAnimCircleImageView != null) { + mAnimCircleImageView.stopAnim(); + } + } else { + if (mWindowPlayPause != null) { + mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); + } + + if (mCircleImg != null) { + mCircleImg.stopAnim(); + } } MogoApisHandler.getInstance().getApis().getStatusManagerApi().setMediaPlayStatus(TAG,false); @@ -318,22 +441,37 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener { @Override public void onMusicProgress(long current, long total) { // Logger.d(TAG, "onMusicProgress==current: " + current + " total: " + total); - if (mMediaInfoData != null) { - mMediaInfoData.setCurTime((int) current); - mMediaInfoData.setMaxTime((int) total); - } - if (mWindowCurrTime != null) { - mWindowCurrTime.setText(Utils.calculateTime((int) current)); - mWindowMaxTime.setText(Utils.calculateTime((int) total)); - } - try { - int progress = - (int) ((current * 1.0f * 100) / (total * 1.0f)); - if (mWindowProgress != null) { - mWindowProgress.setProgress(progress); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + try { + int progress = + (int) ((current * 1.0f * 100) / (total * 1.0f)); + if (mPercentageRingView != null) { + mPercentageRingView.setVisibility(View.VISIBLE); + Log.d(TAG, "progress vr = " + progress); + mPercentageRingView.setTargetPercent(progress); + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + if (mMediaInfoData != null) { + mMediaInfoData.setCurTime((int) current); + mMediaInfoData.setMaxTime((int) total); + } + if (mWindowCurrTime != null) { + mWindowCurrTime.setText(Utils.calculateTime((int) current)); + mWindowMaxTime.setText(Utils.calculateTime((int) total)); + } + try { + int progress = + (int) ((current * 1.0f * 100) / (total * 1.0f)); + if (mWindowProgress != null) { + Log.d(TAG, "progress = " + progress); + mWindowProgress.setProgress(progress); + } + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); } } diff --git a/modules/mogo-module-media/src/main/res/layout/module_media_music_window_alert_layout_new.xml b/modules/mogo-module-media/src/main/res/layout/module_media_music_window_alert_layout_new.xml new file mode 100644 index 0000000000..8d2d4cebc0 --- /dev/null +++ b/modules/mogo-module-media/src/main/res/layout/module_media_music_window_alert_layout_new.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + diff --git a/modules/mogo-module-media/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-media/src/main/res/values-xhdpi/dimens.xml index f31888dd72..d783c1911d 100644 --- a/modules/mogo-module-media/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-media/src/main/res/values-xhdpi/dimens.xml @@ -2,7 +2,8 @@ 872px 1067px - + 40px + 1760px 660px 660px @@ -63,9 +64,14 @@ 600px 140px + 116px + 116px 112px 30px 80px + 90px + 60px + 116px 230px 14px 35px diff --git a/modules/mogo-module-media/src/main/res/values/attrs.xml b/modules/mogo-module-media/src/main/res/values/attrs.xml index 80f3c0bd3d..d8f98cf7bf 100644 --- a/modules/mogo-module-media/src/main/res/values/attrs.xml +++ b/modules/mogo-module-media/src/main/res/values/attrs.xml @@ -35,4 +35,12 @@ + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-media/src/main/res/values/colors.xml b/modules/mogo-module-media/src/main/res/values/colors.xml index b156f1f106..b0944c76eb 100644 --- a/modules/mogo-module-media/src/main/res/values/colors.xml +++ b/modules/mogo-module-media/src/main/res/values/colors.xml @@ -2,4 +2,6 @@ #fff #7affffff + #444E6E + #B63737 diff --git a/modules/mogo-module-media/src/main/res/values/dimens.xml b/modules/mogo-module-media/src/main/res/values/dimens.xml index de1d893a59..48da6e24fd 100644 --- a/modules/mogo-module-media/src/main/res/values/dimens.xml +++ b/modules/mogo-module-media/src/main/res/values/dimens.xml @@ -2,6 +2,8 @@ 467px 573px + 80px + 930px 352px @@ -63,9 +65,13 @@ 338px 82px + 116px + 116px 60px 18px 44px + 55px + 60px 123px 10px 18px