From 1f4f707e6ea9aa2380e62f6b128b34ab2b32004c Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 31 Aug 2020 15:00:16 +0800 Subject: [PATCH 1/6] add back module light mode res --- .idea/codeStyles/Project.xml | 15 +++------------ .idea/misc.xml | 2 +- skin/mogo-skin-light/build.gradle | 1 + .../src/main/module-back-res/values/colors.xml | 3 +++ 4 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 skin/mogo-skin-light/src/main/module-back-res/values/colors.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 0d156937bb..663459aa50 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -3,18 +3,9 @@ - diff --git a/.idea/misc.xml b/.idea/misc.xml index cd77a1f062..21e99e2dc0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/skin/mogo-skin-light/build.gradle b/skin/mogo-skin-light/build.gradle index 46ee134c64..a0ab2516a7 100644 --- a/skin/mogo-skin-light/build.gradle +++ b/skin/mogo-skin-light/build.gradle @@ -33,6 +33,7 @@ android { 'src/main/module-apps-res', 'src/main/module-extensions-res', 'src/main/module-v2x-res', + 'src/main/module-back-res', ] } } diff --git a/skin/mogo-skin-light/src/main/module-back-res/values/colors.xml b/skin/mogo-skin-light/src/main/module-back-res/values/colors.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/skin/mogo-skin-light/src/main/module-back-res/values/colors.xml @@ -0,0 +1,3 @@ + + + From eb54d72671d06974ce498181a5705989cd69e54e Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 31 Aug 2020 15:11:14 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B0=86=E6=95=B0=E6=8D=AE=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E5=88=B0=E7=94=9F=E4=BA=A7=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/service/launchercard/LauncherCardRefresher.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java index e140c4e1ff..189e9d6735 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java @@ -67,7 +67,7 @@ class LauncherCardRefresher { public static final long ONE_MINUTE = 60 * 1000L; public static final long ONE_DAY = 24 * 60 * ONE_MINUTE; private String mLaunchTTSText; - private long mDefaultTTSPlayInterval = 3 * ONE_MINUTE; + private long mDefaultTTSPlayInterval = 30 * ONE_MINUTE; private LauncherCardAdvertisementData.LauncherCardAdvertisement mDefaultLauncherCardConfig; private List< LauncherCardAdvertisementData.LauncherCardAdvertisement > mAdvertisements; @@ -154,7 +154,7 @@ class LauncherCardRefresher { new LauncherCardRefreshStrategy( 3 * ONE_MINUTE, new LauncherCardRefreshStrategy( - 5 * ONE_MINUTE, + 20 * ONE_MINUTE, null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA ), MSG_INDUCE ), @@ -358,7 +358,7 @@ class LauncherCardRefresher { int counter = SharedPrefsMgr.getInstance( mContext ).getInt( KEY_LauncherCardTipCounter, 0 ); if ( counter >= 5 ) { long lastTipTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LauncherCardTipLastTipTime, 0L ); - if ( System.currentTimeMillis() - lastTipTime < 10 * ONE_MINUTE ) { + if ( System.currentTimeMillis() - lastTipTime < 10 * ONE_DAY ) { return; } else { SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, 0 ); From 9562aa61ad81e96d56a67269da839230a8a350a7 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 31 Aug 2020 15:53:44 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E6=95=B4leakcanery=E7=89=88?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97=E7=99=BD?= =?UTF-8?q?=E5=A4=A9=E6=A8=A1=E5=BC=8F=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 5 ++--- skin/mogo-skin-light/build.gradle | 2 ++ .../src/main/module-push-res/values/colors.xml | 3 +++ .../src/main/module-services-res/values/colors.xml | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 skin/mogo-skin-light/src/main/module-push-res/values/colors.xml create mode 100644 skin/mogo-skin-light/src/main/module-services-res/values/colors.xml diff --git a/app/build.gradle b/app/build.gradle index 58c19346ce..4e1653ad8a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -275,9 +275,8 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.boostmultidex - debugImplementation rootProject.ext.dependencies.leakcanary - testImplementation rootProject.ext.dependencies.leakcanary - releaseImplementation rootProject.ext.dependencies.leakcanarynoop + debugImplementation rootProject.ext.dependencies.debugleakcanary + releaseImplementation rootProject.ext.dependencies.releaseleakcanary implementation rootProject.ext.dependencies.carcallprovider implementation rootProject.ext.dependencies.carcall diff --git a/skin/mogo-skin-light/build.gradle b/skin/mogo-skin-light/build.gradle index a0ab2516a7..2fc6c32516 100644 --- a/skin/mogo-skin-light/build.gradle +++ b/skin/mogo-skin-light/build.gradle @@ -34,6 +34,8 @@ android { 'src/main/module-extensions-res', 'src/main/module-v2x-res', 'src/main/module-back-res', + 'src/main/module-services-res', + 'src/main/module-push-res', ] } } diff --git a/skin/mogo-skin-light/src/main/module-push-res/values/colors.xml b/skin/mogo-skin-light/src/main/module-push-res/values/colors.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/skin/mogo-skin-light/src/main/module-push-res/values/colors.xml @@ -0,0 +1,3 @@ + + + diff --git a/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml b/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml @@ -0,0 +1,3 @@ + + + From 5673ec457f0e8b4f244f6e7f002a9243b73a99fc Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Tue, 1 Sep 2020 14:44:40 +0800 Subject: [PATCH 4/6] opt --- .../impl/amap/marker/AMapMarkerWrapper.java | 9 ++++- .../java/com/mogo/map/marker/IMogoMarker.java | 6 ++++ modules/mogo-module-push/build.gradle | 28 +++++++-------- .../launchercard/LauncherCardRefresher.java | 36 +++++++++++-------- .../service/marker/MapMarkerManager.java | 23 +++++++++++- ...odule_services_driver_info_window_bkg.xml} | 0 ...=> module_services_info_window_cursor.xml} | 0 .../layout/view_map_data_user_info_window.xml | 6 ++-- .../src/main/res/values/colors.xml | 4 +++ skin/mogo-skin-light/build.gradle | 5 +++ .../main/module-apps-res/values/colors.xml | 2 +- ..._services_driver_info_window_bkg_light.xml | 15 ++++++++ ...dule_services_info_window_cursor_light.xml | 17 +++++++++ .../module-services-res/values/colors.xml | 1 + 14 files changed, 118 insertions(+), 34 deletions(-) rename modules/mogo-module-service/src/main/res/drawable/{module_services_driver_blue_info.xml => module_services_driver_info_window_bkg.xml} (100%) rename modules/mogo-module-service/src/main/res/drawable/{bg_shape_reverse_triangle_grey.xml => module_services_info_window_cursor.xml} (100%) create mode 100644 modules/mogo-module-service/src/main/res/values/colors.xml create mode 100644 skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_driver_info_window_bkg_light.xml create mode 100644 skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_info_window_cursor_light.xml diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/AMapMarkerWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/AMapMarkerWrapper.java index 8935812bcd..d4f71eb6a0 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/AMapMarkerWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/marker/AMapMarkerWrapper.java @@ -398,7 +398,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { AnimationSet animationSet = new AnimationSet( true ); animationSet.setDuration( duration ); - animationSet.setInterpolator( interpolator); + animationSet.setInterpolator( interpolator ); animationSet.setAnimationListener( new Animation.AnimationListener() { @Override public void onAnimationStart() { @@ -510,4 +510,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { mMovingPointOverlay.startSmoothMove(); } + @Override + public boolean isInfoWindowShowing() { + if ( mMarker == null ) { + return false; + } + return mMarker.isInfoWindowShown(); + } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarker.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarker.java index 8301124d8b..841a240338 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarker.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarker.java @@ -318,4 +318,10 @@ public interface IMogoMarker { * @param duration 时长 */ void startSmooth( List< MogoLatLng > points, int duration ); + + /** + * info window 是否正在显示 + * @return + */ + boolean isInfoWindowShowing(); } diff --git a/modules/mogo-module-push/build.gradle b/modules/mogo-module-push/build.gradle index 82aab1f2be..8abc8b1c11 100644 --- a/modules/mogo-module-push/build.gradle +++ b/modules/mogo-module-push/build.gradle @@ -43,11 +43,11 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // 小智语音,免唤醒词等服务 - compileOnly rootProject.ext.dependencies.androidxconstraintlayout - compileOnly rootProject.ext.dependencies.arouter - compileOnly rootProject.ext.dependencies.aiassist + implementation rootProject.ext.dependencies.androidxconstraintlayout + implementation rootProject.ext.dependencies.arouter + implementation rootProject.ext.dependencies.aiassist kapt rootProject.ext.dependencies.aroutercompiler - compileOnly rootProject.ext.dependencies.androidxrecyclerview + implementation rootProject.ext.dependencies.androidxrecyclerview implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.androidxccorektx @@ -58,18 +58,18 @@ dependencies { if( Boolean.valueOf(RELEASE) ){ implementation rootProject.ext.dependencies.modulepushbase - compileOnly rootProject.ext.dependencies.mogomap - compileOnly rootProject.ext.dependencies.mogoutils - compileOnly rootProject.ext.dependencies.mogocommons - compileOnly rootProject.ext.dependencies.mogoserviceapi - compileOnly rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.mogomap + implementation rootProject.ext.dependencies.mogoutils + implementation rootProject.ext.dependencies.mogocommons + implementation rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.mogoserviceapi } else { implementation project(":modules:mogo-module-push-base") - compileOnly project(':libraries:mogo-map') - compileOnly project(':foudations:mogo-utils') - compileOnly project(':foudations:mogo-commons') - compileOnly project(':services:mogo-service-api') - compileOnly project(':modules:mogo-module-common') + implementation project(':libraries:mogo-map') + implementation project(':foudations:mogo-utils') + implementation project(':foudations:mogo-commons') + implementation project(':modules:mogo-module-common') + implementation project(':services:mogo-service-api') } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java index 189e9d6735..40935255db 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java @@ -119,7 +119,7 @@ class LauncherCardRefresher { loadNetworkConfigStrategy(); break; case MSG_REFRESH_DEFAULT_CARD: - renderDefaultLauncherCardConfig(); + renderDefaultLauncherCardConfig( false ); mRefreshStrategy = mRefreshStrategy.getNext(); restart(); break; @@ -134,7 +134,7 @@ class LauncherCardRefresher { } break; case MSG_START_LOOP_DEFAULT_CARD: - renderDefaultLauncherCardConfig(); + renderDefaultLauncherCardConfig( false ); break; case MSG_REFRESH_ADVERTISEMENT: int index = msg.arg1;// 当前广告索引 @@ -149,17 +149,17 @@ class LauncherCardRefresher { private boolean mStart = false; private RefreshModel mRefreshModel; private ZhidaoRefreshModel mZhidaoRefreshModel; - private LauncherCardRefreshStrategy mRefreshStrategy = new LauncherCardRefreshStrategy( - 2 * ONE_MINUTE, - new LauncherCardRefreshStrategy( - 3 * ONE_MINUTE, - new LauncherCardRefreshStrategy( - 20 * ONE_MINUTE, - null, - MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA ), - MSG_INDUCE ), - MSG_REFRESH_DEFAULT_CARD + + private LauncherCardRefreshStrategy mExplorerWayOrOnlineCarDataStrategy = new LauncherCardRefreshStrategy( + 20 * ONE_MINUTE,null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA ); + private LauncherCardRefreshStrategy mInduceStrategy = new LauncherCardRefreshStrategy( + 3 * ONE_MINUTE,mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE + ); + private LauncherCardRefreshStrategy mLauncherCardConfigStrategy = new LauncherCardRefreshStrategy( + 2 * ONE_MINUTE,mInduceStrategy, MSG_REFRESH_DEFAULT_CARD + ); + private LauncherCardRefreshStrategy mRefreshStrategy = mLauncherCardConfigStrategy; public void start() { if ( DebugConfig.isLauncher() || DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) { @@ -172,6 +172,7 @@ class LauncherCardRefresher { mLaunchTTSText = mContext.getString( R.string.module_service_open_app_tip ); mDefaultConfigCounter = 0; mRefreshTicketCounter = 0; + mRefreshStrategy = mLauncherCardConfigStrategy; // 延时加载数据,已保证accOn之后网络恢复正常 long delay = ONE_MINUTE; if ( NetworkUtils.isConnected( mContext ) ) { @@ -327,8 +328,10 @@ class LauncherCardRefresher { * 1. 刷新默认卡片样式 *

* 2. 播报默认卡片语音 + * + * @param sendConfigOnly 仅发送配置到 */ - private void renderDefaultLauncherCardConfig() { + private void renderDefaultLauncherCardConfig( boolean sendConfigOnly ) { if ( mDefaultLauncherCardConfig != null ) { long curr = System.currentTimeMillis(); if ( mDefaultLauncherCardConfig.endTime > curr && mDefaultLauncherCardConfig.startTime < curr ) { @@ -351,6 +354,10 @@ class LauncherCardRefresher { } } + if ( sendConfigOnly ) { + return; + } + if ( mDefaultConfigCounter++ >= 3 ) { return; } @@ -454,6 +461,7 @@ class LauncherCardRefresher { } if ( launcherCardAdvertisement.cardType == LauncherCardAdvertisementData.TYPE_DEFAULT_CONFIG ) { mDefaultLauncherCardConfig = launcherCardAdvertisement; + renderDefaultLauncherCardConfig( true ); } else if ( launcherCardAdvertisement.cardType == LauncherCardAdvertisementData.TYPE_ACTIVITY ) { long curr = System.currentTimeMillis(); if ( curr > launcherCardAdvertisement.startTime && curr < launcherCardAdvertisement.endTime ) { @@ -468,7 +476,7 @@ class LauncherCardRefresher { LauncherCardAdvertisementData.LauncherCardAdvertisement[] sorted = new LauncherCardAdvertisementData.LauncherCardAdvertisement[mAdvertisements.size()]; sorted = mAdvertisements.toArray( sorted ); Arrays.sort( sorted, ( ( o1, o2 ) -> { - return o1.sort < o2.sort ? 1 : ( o1.sort == o2.sort ? 0 : -1 ); + return o1.sort > o2.sort ? 1 : ( o1.sort == o2.sort ? 0 : -1 ); } ) ); mAdvertisements = Arrays.asList( sorted ); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index dada71998b..761a83dc2e 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -14,6 +14,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.IMogoMarkerManager; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.map.marker.anim.OnMarkerAnimationListener; +import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.module.common.ModuleNames; import com.mogo.module.common.entity.MarkerCarPois; import com.mogo.module.common.entity.MarkerCardResult; @@ -32,6 +33,7 @@ import com.mogo.module.service.Utils; import com.mogo.module.service.network.RefreshCallback; import com.mogo.module.service.network.RefreshModel; import com.mogo.module.service.utils.ViewUtils; +import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.mogo.service.connection.IMogoOnMessageListener; import com.mogo.service.module.IMogoBizActionDoneListener; import com.mogo.utils.ResourcesHelper; @@ -58,7 +60,8 @@ import java.util.Map; */ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessageListener< MarkerResponse >, - IMogoBizActionDoneListener { + IMogoBizActionDoneListener, + IMogoADASControlStatusChangedListener { private static final String TAG = "MapMarkerManager"; private Context mContext; @@ -108,6 +111,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, // 长连接 MarkerServiceHandler.getMogoSocketManager().registerOnMessageListener( 401001, this ); MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this ); + MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this ); } // ACC ON 的时候重置为true,ACC OFF 设置为 false @@ -949,4 +953,21 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } } } + + @Override + public void onMapUiModeChanged( EnumMapUI mapUI ) { + switch ( mapUI ) { + case Type_Light: + case Type_Night: + if ( !MarkerServiceHandler.getApis().getStatusManagerApi().isMainPageOnResume() ) { + return; + } + if ( mLastDataResult != null ) { + MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION ); + drawMarkerByCurrentType( mLastDataResult ); + mLastCheckMarker = null; + } + break; + } + } } diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_driver_blue_info.xml b/modules/mogo-module-service/src/main/res/drawable/module_services_driver_info_window_bkg.xml similarity index 100% rename from modules/mogo-module-service/src/main/res/drawable/module_services_driver_blue_info.xml rename to modules/mogo-module-service/src/main/res/drawable/module_services_driver_info_window_bkg.xml diff --git a/modules/mogo-module-service/src/main/res/drawable/bg_shape_reverse_triangle_grey.xml b/modules/mogo-module-service/src/main/res/drawable/module_services_info_window_cursor.xml similarity index 100% rename from modules/mogo-module-service/src/main/res/drawable/bg_shape_reverse_triangle_grey.xml rename to modules/mogo-module-service/src/main/res/drawable/module_services_info_window_cursor.xml diff --git a/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml b/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml index fe110eba36..80cb17242d 100644 --- a/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml +++ b/modules/mogo-module-service/src/main/res/layout/view_map_data_user_info_window.xml @@ -14,7 +14,7 @@ android:layout_width="wrap_content" android:layout_height="@dimen/module_services_info_window_height" android:paddingRight="@dimen/module_service_id_marker_content_paddingRight" - android:background="@drawable/module_services_driver_blue_info" + android:background="@drawable/module_services_driver_info_window_bkg" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -40,7 +40,7 @@ android:ellipsize="end" android:minWidth="@dimen/module_service_content_minWidth" android:singleLine="true" - android:textColor="#ffffff" + android:textColor="@color/module_service_info_window_content_textColor" android:textSize="@dimen/module_service_content_textSize" app:layout_constraintStart_toEndOf="@+id/module_service_id_user_header" app:layout_constraintTop_toTopOf="@+id/module_service_id_user_header" @@ -86,7 +86,7 @@ + android:src="@drawable/module_services_info_window_cursor" /> \ No newline at end of file diff --git a/modules/mogo-module-service/src/main/res/values/colors.xml b/modules/mogo-module-service/src/main/res/values/colors.xml new file mode 100644 index 0000000000..e5cc33f8fa --- /dev/null +++ b/modules/mogo-module-service/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #ffffff + \ No newline at end of file diff --git a/skin/mogo-skin-light/build.gradle b/skin/mogo-skin-light/build.gradle index 8b4df31f60..e7b8894954 100644 --- a/skin/mogo-skin-light/build.gradle +++ b/skin/mogo-skin-light/build.gradle @@ -44,6 +44,11 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) + if (Boolean.valueOf(RELEASE)) { + implementation rootProject.ext.dependencies.modulecommon + } else { + implementation project(':modules:mogo-module-common') + } } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/skin/mogo-skin-light/src/main/module-apps-res/values/colors.xml b/skin/mogo-skin-light/src/main/module-apps-res/values/colors.xml index 30a43fb8d6..ff5c5d096b 100644 --- a/skin/mogo-skin-light/src/main/module-apps-res/values/colors.xml +++ b/skin/mogo-skin-light/src/main/module-apps-res/values/colors.xml @@ -1,4 +1,4 @@ - #FFFFFF + #B2F5F5F5 diff --git a/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_driver_info_window_bkg_light.xml b/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_driver_info_window_bkg_light.xml new file mode 100644 index 0000000000..a702e0853b --- /dev/null +++ b/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_driver_info_window_bkg_light.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_info_window_cursor_light.xml b/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_info_window_cursor_light.xml new file mode 100644 index 0000000000..6ea27dfa6f --- /dev/null +++ b/skin/mogo-skin-light/src/main/module-services-res/drawable/module_services_info_window_cursor_light.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml b/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml index 045e125f3d..823423c2f2 100644 --- a/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml +++ b/skin/mogo-skin-light/src/main/module-services-res/values/colors.xml @@ -1,3 +1,4 @@ + #333333 From 6e6c30523018cb2e9e4e7363e6b577ee920a36a0 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 1 Sep 2020 16:46:59 +0800 Subject: [PATCH 5/6] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9TipToast=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E4=B8=BA=E6=B8=90=E5=8F=98=202.=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=B8=A6=E5=9B=BE=E7=89=87=E7=9A=84TipToast?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- .../com/mogo/commons/AbsMogoApplication.java | 24 +++- .../res/drawable/module_commons_toast_bkg.xml | 6 +- .../layout/module_commons_layout_toast.xml | 19 ++-- ...ommons_layout_toast_with_left_drawable.xml | 39 +++++++ .../src/main/res/values-xhdpi/dimens.xml | 9 +- .../src/main/res/values/dimens.xml | 9 +- .../main/java/com/mogo/utils/TipDrawable.java | 77 +++++++++++++ .../main/java/com/mogo/utils/TipToast.java | 105 +++++++++++------- .../extensions/entrance/EntranceFragment.java | 15 +++ .../res/layout/module_ext_layout_entrance.xml | 29 ++++- .../tanlu/fragment/TanluListWindow.java | 1 + 12 files changed, 274 insertions(+), 61 deletions(-) create mode 100644 foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast_with_left_drawable.xml create mode 100644 foudations/mogo-utils/src/main/java/com/mogo/utils/TipDrawable.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 21e99e2dc0..cd77a1f062 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java index 360dbb622b..3acc039d7e 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java @@ -4,6 +4,8 @@ import android.app.Application; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import com.alibaba.android.arouter.launcher.ARouter; @@ -17,6 +19,7 @@ import com.mogo.commons.network.ParamsUtil; import com.mogo.commons.network.X509TrustManagerImpl; import com.mogo.commons.storage.SpStorage; import com.mogo.utils.ThreadPoolService; +import com.mogo.utils.TipDrawable; import com.mogo.utils.TipToast; import com.mogo.utils.network.NetConfig; @@ -65,13 +68,26 @@ public class AbsMogoApplication extends Application { ARouter.openLog(); } ARouter.init( sApp ); - TipToast.init( this, ( ( context, message ) -> { + TipToast.init( this, ( ( context, message, tipDrawable ) -> { if ( TextUtils.isEmpty( message ) ) { return null; } - View contentView = LayoutInflater.from( context ).inflate( R.layout.module_commons_layout_toast, null ); - TextView txt = contentView.findViewById( R.id.module_commons_toast_msg ); - txt.setText( message ); + View contentView; + if(tipDrawable==null) { + contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast, null); + TextView txt = contentView.findViewById(R.id.module_commons_toast_msg); + txt.setText(message); + }else{ + // 有图片,使用带图片的布局,当前只实现了左侧图片 + contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast_with_left_drawable, null); + TextView txt = contentView.findViewById(R.id.module_commons_toast_msg); + ImageView img = contentView.findViewById(R.id.module_commons_toast_left_drawable); + img.setImageDrawable(tipDrawable.getDrawable()); + ViewGroup.LayoutParams params = img.getLayoutParams(); + params.width = tipDrawable.getWidth(); + params.height = tipDrawable.getHeight(); + txt.setText(message); + } return contentView; } ) ); } diff --git a/foudations/mogo-commons/src/main/res/drawable/module_commons_toast_bkg.xml b/foudations/mogo-commons/src/main/res/drawable/module_commons_toast_bkg.xml index 58389abf7c..b43a13e664 100644 --- a/foudations/mogo-commons/src/main/res/drawable/module_commons_toast_bkg.xml +++ b/foudations/mogo-commons/src/main/res/drawable/module_commons_toast_bkg.xml @@ -2,7 +2,7 @@ + android:angle="180" + android:endColor="#FF3F4057" + android:startColor="#FF5E6079" /> \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml b/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml index 0b01115f63..636128bfe7 100644 --- a/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml +++ b/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml @@ -1,27 +1,28 @@ - + android:paddingTop="@dimen/module_commons_toast_marginTop" + android:paddingBottom="@dimen/module_commons_toast_marginBottom" + android:paddingLeft="@dimen/module_commons_toast_marginLeft" + android:paddingRight="@dimen/module_commons_toast_marginRight"> - \ No newline at end of file + tools:text="测试测试测试" /> + + + \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast_with_left_drawable.xml b/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast_with_left_drawable.xml new file mode 100644 index 0000000000..8f692353dc --- /dev/null +++ b/foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast_with_left_drawable.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/foudations/mogo-commons/src/main/res/values-xhdpi/dimens.xml b/foudations/mogo-commons/src/main/res/values-xhdpi/dimens.xml index c1558d9ba0..ddb78a45af 100644 --- a/foudations/mogo-commons/src/main/res/values-xhdpi/dimens.xml +++ b/foudations/mogo-commons/src/main/res/values-xhdpi/dimens.xml @@ -1,13 +1,18 @@ - 50px - 50px + 63px + 30px + 63px 32px 32px + 19px + 19px 40px 698px 900px 130px + 94px + 21px diff --git a/foudations/mogo-commons/src/main/res/values/dimens.xml b/foudations/mogo-commons/src/main/res/values/dimens.xml index 54534fb37b..4056fd470a 100644 --- a/foudations/mogo-commons/src/main/res/values/dimens.xml +++ b/foudations/mogo-commons/src/main/res/values/dimens.xml @@ -1,11 +1,16 @@ - 30px - 30px + 33px + 17px + 33px 16px 16px + 10px + 10px 22px 371px 500px 72px + 50px + 10px \ No newline at end of file diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/TipDrawable.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/TipDrawable.java new file mode 100644 index 0000000000..9be08550d2 --- /dev/null +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/TipDrawable.java @@ -0,0 +1,77 @@ +package com.mogo.utils; + +import android.graphics.drawable.Drawable; + +/** + * TipToast弹出框的图片资源封装类 + * 当前只支持添加一张图片,可添加到文字的 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM} + * + * 当前仅支持添加左侧图片,所以{@link #gravity} 这个参数形同虚设 + * + * @author tongchenfei + */ +public class TipDrawable { + public static final int TIP_DRAWABLE_GRAVITY_LEFT = 1; + public static final int TIP_DRAWABLE_GRAVITY_TOP = 2; + public static final int TIP_DRAWABLE_GRAVITY_RIGHT = 3; + public static final int TIP_DRAWABLE_GRAVITY_BOTTOM = 4; + private Drawable drawable; + private int gravity; + private int width; + private int height; + + /** + * 默认图片居左,宽高使用{@link Drawable#getIntrinsicWidth()}和{@link Drawable#getIntrinsicHeight()} + * @param drawable 要展示的图片 + */ + public TipDrawable(Drawable drawable) { + this(drawable, TIP_DRAWABLE_GRAVITY_LEFT,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight()); + } + + /** + * 默认图片居左 + * @param drawable 要展示的图片 + * @param width 要展示的图片宽度 + * @param height 要展示的图片高度 + */ + public TipDrawable(Drawable drawable, int width, int height) { + this(drawable, TIP_DRAWABLE_GRAVITY_LEFT,width,height); + } + + /** + * 默认宽高使用{@link Drawable#getIntrinsicWidth()}和{@link Drawable#getIntrinsicHeight()} + * @param drawable 要展示的图片 + * @param gravity 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM} + */ + public TipDrawable(Drawable drawable, int gravity) { + this(drawable, gravity,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight()); + } + + /** + * 可自定义展示位置 + * @param drawable 要展示的图片 + * @param gravity 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM} + */ + public TipDrawable(Drawable drawable, int gravity, int width, int height) { + this.drawable = drawable; + this.gravity = gravity; + this.width = width; + this.height = height; + } + + public Drawable getDrawable() { + return drawable; + } + + public int getGravity() { + return gravity; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } +} diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/TipToast.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/TipToast.java index ec457c6b04..446762315f 100644 --- a/foudations/mogo-utils/src/main/java/com/mogo/utils/TipToast.java +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/TipToast.java @@ -4,6 +4,10 @@ package com.mogo.utils; * 2016/1/1 by congtaowang * * @Version 1.0 + * + * 增加了图片支持 + * + * @Version 1.1 */ import android.content.Context; @@ -45,17 +49,17 @@ public final class TipToast { sGenerator = null; } - private static void tip( final String message, int duration ) { + private static void tip( final String message, int duration ,TipDrawable tipDrawable) { if ( !checkParams() ) { return; } if ( TextUtils.isEmpty( message ) ) { return; } - new ToastThread( new StringToastRunnable( sContext, message, duration ) ).start(); + new ToastThread(new StringToastRunnable(sContext, message, duration, tipDrawable)).start(); } - private static void tip( final int msgId, int duration ) { + private static void tip( final int msgId, int duration,TipDrawable tipDrawable ) { if ( !checkParams() ) { return; } @@ -66,7 +70,7 @@ public final class TipToast { } catch ( Exception e ) { return; } - tip( ResourcesHelper.getString( sContext, msgId ), duration ); + tip( ResourcesHelper.getString( sContext, msgId ), duration ,tipDrawable); } private static boolean checkParams() { @@ -82,27 +86,53 @@ public final class TipToast { } public static void tip( final String message ) { - tip( message, Toast.LENGTH_SHORT ); + tip( message, Toast.LENGTH_SHORT,null ); } public static void tip( final int msgId ) { - tip( msgId, Toast.LENGTH_SHORT ); + tip( msgId, Toast.LENGTH_SHORT ,null); } public static void longTip( String message ) { - tip( message, Toast.LENGTH_LONG ); + tip( message, Toast.LENGTH_LONG ,null); } public static void longTip( int msgId ) { - tip( msgId, Toast.LENGTH_LONG ); + tip( msgId, Toast.LENGTH_LONG ,null); } public static void shortTip( String message ) { - tip( message, Toast.LENGTH_SHORT ); + tip( message, Toast.LENGTH_SHORT ,null); } public static void shortTip( int msgId ) { - tip( msgId, Toast.LENGTH_SHORT ); + tip( msgId, Toast.LENGTH_SHORT ,null); + } + + // -===带图片的方法===- + + public static void tip( final String message,TipDrawable tipDrawable ) { + tip( message, Toast.LENGTH_SHORT,tipDrawable ); + } + + public static void tip( final int msgId,TipDrawable tipDrawable ) { + tip( msgId, Toast.LENGTH_SHORT ,tipDrawable); + } + + public static void longTip( String message,TipDrawable tipDrawable ) { + tip( message, Toast.LENGTH_LONG ,tipDrawable); + } + + public static void longTip( int msgId ,TipDrawable tipDrawable) { + tip( msgId, Toast.LENGTH_LONG ,tipDrawable); + } + + public static void shortTip( String message,TipDrawable tipDrawable ) { + tip( message, Toast.LENGTH_SHORT ,tipDrawable); + } + + public static void shortTip( int msgId,TipDrawable tipDrawable ) { + tip( msgId, Toast.LENGTH_SHORT ,tipDrawable); } static class ToastThread extends Thread { @@ -117,11 +147,13 @@ public final class TipToast { Context context; String msg; int duration; + TipDrawable tipDrawable; - public StringToastRunnable( Context context, String msg, int duration ) { + public StringToastRunnable( Context context, String msg, int duration,TipDrawable tipDrawable ) { this.context = context; this.msg = msg; this.duration = duration; + this.tipDrawable = tipDrawable; } @Override @@ -131,44 +163,40 @@ public final class TipToast { return; } - sHandler.post( new Runnable() { + sHandler.post(() -> { + synchronized ( sSyncObject ) { - @Override - public void run() { - synchronized ( sSyncObject ) { + if ( context == null ) { + return; + } - if ( context == null ) { - return; - } + if ( sToast != null ) { + sToast.cancel(); + } - if ( sToast != null ) { - sToast.cancel(); - } - - if ( sGenerator == null ) { - sToast = Toast.makeText( context, msg, duration ); + if ( sGenerator == null ) { + sToast = Toast.makeText( context, msg, duration ); + } else { + sToast = new Toast( context ); + final View view = sGenerator.make( context, msg, tipDrawable ); + if ( view != null ) { + sToast.setView( view ); + sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() ); + sToast.setDuration( duration ); } else { - sToast = new Toast( context ); - final View view = sGenerator.make( context, msg ); - if ( view != null ) { - sToast.setView( view ); - sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() ); - sToast.setDuration( duration ); - } else { - sToast = Toast.makeText( context, msg, duration ); - } - } - if ( sToast != null ) { - sToast.show(); + sToast = Toast.makeText( context, msg, duration ); } } + if ( sToast != null ) { + sToast.show(); + } } - } ); + }); } } public interface ToastViewGenerator { - View make( Context context, String message ); + View make( Context context, String message,TipDrawable tipDrawable ); default int gravity() { return Gravity.CENTER; @@ -182,5 +210,4 @@ public final class TipToast { return 0; } } - } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 032ba4ee85..11ef74de23 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -55,6 +55,8 @@ import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.service.windowview.IMogoTopViewStatusListener; import com.mogo.utils.LaunchUtils; import com.mogo.utils.ResourcesHelper; +import com.mogo.utils.TipDrawable; +import com.mogo.utils.TipToast; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.glide.GlideApp; import com.mogo.utils.logger.Logger; @@ -595,6 +597,19 @@ public class EntranceFragment extends MvpFragment TipToast.tip("分享成功")); + + findViewById(R.id.btnShowDrawableTip).setOnClickListener(v->{ + TipDrawable drawable = + new TipDrawable(getResources().getDrawable(R.drawable.model_ext_default_user_head), 150, 150); + TipToast.tip("分享成功",drawable); + }); + + findViewById(R.id.btnShowDrawableTipNoSize).setOnClickListener(v->{ + TipDrawable drawable = + new TipDrawable(getResources().getDrawable(R.drawable.model_ext_default_user_head)); + TipToast.tip("分享成功",drawable); + }); } @Override diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml index 495a892b37..655613c89d 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml @@ -174,6 +174,7 @@ android:visibility="gone" /> +