This commit is contained in:
unknown
2020-09-01 17:42:04 +08:00
28 changed files with 409 additions and 101 deletions

View File

@@ -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

View File

@@ -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;
} ) );
}

View File

@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="90dp" />
<gradient
android:angle="270"
android:endColor="#F2161616"
android:startColor="#F2161616" />
android:angle="180"
android:endColor="#FF3F4057"
android:startColor="#FF5E6079" />
</shape>

View File

@@ -1,27 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_commons_toast_bkg"
android:orientation="vertical">
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">
<TextView
android:id="@+id/module_commons_toast_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/module_commons_toast_marginLeft"
android:layout_marginTop="@dimen/module_commons_toast_marginTop"
android:layout_marginRight="@dimen/module_commons_toast_marginRight"
android:layout_marginBottom="@dimen/module_commons_toast_marginBottom"
android:ellipsize="end"
android:gravity="center"
android:drawablePadding="@dimen/module_commons_toast_space_between_icon_and_msg"
android:maxWidth="@dimen/module_commons_toast_maxWidth"
android:maxLength="20"
android:maxLines="1"
android:minWidth="@dimen/module_commons_toast_minWidth"
android:textColor="#FFFF"
android:textSize="@dimen/module_commons_toast_textSize"
tools:text="测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" />
</LinearLayout>
tools:text="测试测试测试" />
<!-- android:minWidth="@dimen/module_commons_toast_minWidth"-->
</FrameLayout>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_commons_toast_bkg"
android:orientation="horizontal"
android:paddingLeft="@dimen/module_commons_toast_with_left_drawable_marginLeft"
android:paddingTop="@dimen/module_commons_toast_with_left_drawable_marginTop"
android:paddingRight="@dimen/module_commons_toast_marginRight"
android:paddingBottom="@dimen/module_commons_toast_with_left_drawable_marginBottom">
<ImageView
android:id="@+id/module_commons_toast_left_drawable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<Space
android:layout_width="@dimen/module_commons_toast_space_between_icon_and_msg"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/module_commons_toast_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="@dimen/module_commons_toast_space_between_icon_and_msg"
android:ellipsize="end"
android:gravity="center"
android:maxWidth="@dimen/module_commons_toast_maxWidth"
android:maxLength="20"
android:maxLines="1"
android:textColor="#FFFF"
android:textSize="@dimen/module_commons_toast_textSize"
tools:text="测试测试测试" />
<!-- android:minWidth="@dimen/module_commons_toast_minWidth"-->
</LinearLayout>

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_commons_toast_marginLeft">50px</dimen>
<dimen name="module_commons_toast_marginRight">50px</dimen>
<dimen name="module_commons_toast_marginLeft">63px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginLeft">30px</dimen>
<dimen name="module_commons_toast_marginRight">63px</dimen>
<dimen name="module_commons_toast_marginTop">32px</dimen>
<dimen name="module_commons_toast_marginBottom">32px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginTop">19px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginBottom">19px</dimen>
<dimen name="module_commons_toast_textSize">40px</dimen>
<dimen name="module_commons_toast_minWidth">698px</dimen>
<dimen name="module_commons_toast_maxWidth">900px</dimen>
<dimen name="module_commons_toast_y_offset">130px</dimen>
<dimen name="module_commons_toast_icon_width">94px</dimen>
<dimen name="module_commons_toast_space_between_icon_and_msg">21px</dimen>
</resources>

View File

@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_commons_toast_marginLeft">30px</dimen>
<dimen name="module_commons_toast_marginRight">30px</dimen>
<dimen name="module_commons_toast_marginLeft">33px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginLeft">17px</dimen>
<dimen name="module_commons_toast_marginRight">33px</dimen>
<dimen name="module_commons_toast_marginTop">16px</dimen>
<dimen name="module_commons_toast_marginBottom">16px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginTop">10px</dimen>
<dimen name="module_commons_toast_with_left_drawable_marginBottom">10px</dimen>
<dimen name="module_commons_toast_textSize">22px</dimen>
<dimen name="module_commons_toast_minWidth">371px</dimen>
<dimen name="module_commons_toast_maxWidth">500px</dimen>
<dimen name="module_commons_toast_y_offset">72px</dimen>
<dimen name="module_commons_toast_icon_width">50px</dimen>
<dimen name="module_commons_toast_space_between_icon_and_msg">10px</dimen>
</resources>

View File

@@ -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;
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}

View File

@@ -318,4 +318,10 @@ public interface IMogoMarker {
* @param duration 时长
*/
void startSmooth( List< MogoLatLng > points, int duration );
/**
* info window 是否正在显示
* @return
*/
boolean isInfoWindowShowing();
}

View File

@@ -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<EntranceView, EntrancePresente
tv.setText("entrance add");
mApis.getEntranceButtonController().addBottomLayerView(tv, 50, 50);
});
findViewById(R.id.btnShowTextTip).setOnClickListener(v-> 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

View File

@@ -26,7 +26,7 @@
android:gravity="center_horizontal"
android:paddingTop="@dimen/dp_14"
android:text="@string/mode_north_up"
android:textColor="@color/white"
android:textColor="@color/module_ext_color_voice_text"
android:textSize="@dimen/module_ext_north_textSize"
android:textStyle="bold"
android:visibility="gone"
@@ -71,7 +71,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="全览"
android:textColor="@color/white"
android:textColor="@color/module_ext_color_voice_text"
android:textSize="@dimen/module_ext_display_overview_textSize_large"
android:textStyle="bold" />
</LinearLayout>
@@ -174,6 +174,7 @@
android:visibility="gone" />
</LinearLayout>
<Button
android:id="@+id/btnDebugCtrlTopView"
android:layout_width="wrap_content"
@@ -210,11 +211,37 @@
app:layout_constraintBottom_toTopOf="@id/btnDebugCtrlNaviView"
app:layout_constraintLeft_toLeftOf="parent" />
<Button
android:id="@+id/btnShowTextTip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示文字tip"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@id/btnDebugAddBottomLayerView"
app:layout_constraintLeft_toLeftOf="parent" />
<Button
android:id="@+id/btnShowDrawableTip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示图文tip"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@id/btnShowTextTip"
app:layout_constraintLeft_toLeftOf="parent" />
<Button
android:id="@+id/btnShowDrawableTipNoSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示图文tip没有大小"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@id/btnShowDrawableTip"
app:layout_constraintLeft_toLeftOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/groupTopViewDebug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView,btnDebugAddBottomLayerView" />
app:constraint_referenced_ids="btnShowDrawableTipNoSize,btnShowDrawableTip,btnShowTextTip,btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView,btnDebugAddBottomLayerView" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -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')
}
}

View File

@@ -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;
@@ -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(
5 * 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. 刷新默认卡片样式
* <p>
* 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;
}
@@ -358,7 +365,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 );
@@ -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 );
}

View File

@@ -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 的时候重置为trueACC 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;
}
}
}

View File

@@ -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 @@
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/bg_shape_reverse_triangle_grey" />
android:src="@drawable/module_services_info_window_cursor" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_service_info_window_content_textColor">#ffffff</color>
</resources>

View File

@@ -94,6 +94,7 @@ import com.mogo.service.module.MogoAction;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;

View File

@@ -34,6 +34,9 @@ android {
'src/main/module-callchat-res',
'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',
'src/main/module-share-res',
]
}
@@ -42,6 +45,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()

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_app_page_bkg_color_light">#FFFFFF</color>
<color name="module_app_page_bkg_color_light">#B2F5F5F5</color>
</resources>

View File

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

View File

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

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="#F5F5F5"
android:startColor="#FFFFFF" />
<corners android:radius="360dp" />
<padding
android:bottom="@dimen/dp_6"
android:left="@dimen/dp_6"
android:right="@dimen/dp_6"
android:top="@dimen/dp_6" />
</shape>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/shape_id" >
<!-- 倒三角 -->
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45" >
<shape android:shape="rectangle" >
<size android:width="@dimen/dp_20"
android:height="@dimen/dp_20"/>
<solid android:color="#F5F5F5" />
</shape >
</rotate >
</item >
</layer-list >

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_service_info_window_content_textColor_light">#333333</color>
</resources>