This commit is contained in:
wangcongtao
2020-09-18 10:01:53 +08:00
225 changed files with 1038 additions and 623 deletions

View File

@@ -204,7 +204,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
mLoopRecyclerView.setLayoutManager(layoutManager);
mTanluSlideAdapter = new TanluSlideAdapterNew(mContext, mAnalytics, mTanluModelData, mogoImageloader);
mTanluSlideAdapter = new TanluSlideAdapterNew(mContext, mAnalytics, mTanluModelData, mogoImageloader, mMogoRegisterCenter);
mLoopRecyclerView.setAdapter(mTanluSlideAdapter);
//保证滑动单页显示

View File

@@ -5,6 +5,7 @@ import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -18,6 +19,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
import com.mogo.module.tanlu.R;
@@ -30,9 +32,13 @@ import com.mogo.module.tanlu.model.event.StartPlayInfo;
import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
import com.mogo.module.tanlu.util.ChartUtil;
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
import com.mogo.module.tanlu.view.RoundLayout;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.imageloader.IMogoImageloader;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.skin.support.SkinMode;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
@@ -57,7 +63,7 @@ import static com.mogo.module.tanlu.util.Utils.handleDistance;
* @description
* @since 2020/3/11
*/
public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHolderNew> {
public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHolderNew> implements IMogoADASControlStatusChangedListener {
private List<MarkerExploreWay> markerExploreWayList = new ArrayList<>();
private static final String TAG = "TanluSlideAdapterNew";
private Context mContext;
@@ -66,7 +72,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
private TextView mDistanceTv;
private TextView mTimeTv;
private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
private ImageView autoZoomInImageView;
private MogoImageView autoZoomInImageView;
private MogoImageView mHeadImage;
private ImageView mChatImage;
private ImageView mLikeImage;
@@ -74,6 +80,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
private TextView mTypeTv;
private IMogoImageloader mogoImageloader;
private ImageView mCloseImage;
private RoundLayout mRoundLayout;
//media
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
@@ -87,11 +94,14 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
private HashMap<Integer, SimpleCoverVideoPlayer> list = new HashMap<>();
public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader) {
public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader,
IMogoRegisterCenter mogoRegisterCenter) {
this.mContext = context;
this.mAnalytics = analytics;
this.mTanluModelData = tanluModelData;
this.mogoImageloader = mogoImageloader;
mogoRegisterCenter.registerADASControlStatusChangedListener( TAG, this );
EventBus.getDefault().register(this);
}
@@ -121,6 +131,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
mLikeLayout = holder.itemView.findViewById(R.id.tanlu_like_layout);
mTypeTv = holder.itemView.findViewById(R.id.tv_information_type);
mCloseImage = holder.itemView.findViewById(R.id.tanlu_close_imageView);
mRoundLayout = holder.itemView.findViewById(R.id.media_layout);
mCloseImage.setOnClickListener(new View.OnClickListener() {
@Override
@@ -330,19 +341,18 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
simpleCoverVideoPlayer.setVisibility(GONE);
autoZoomInImageView.setVisibility(View.VISIBLE);
//加载图片
RequestOptions requestOptions = new RequestOptions()
.placeholder(R.drawable.tanlu_normal_image)
.error(R.drawable.tanlu_normal_image);
Glide.with(mContext)
.load(mImageUrl)
.apply(requestOptions)
.into(autoZoomInImageView);
// RequestOptions requestOptions = new RequestOptions()
// .placeholder(R.drawable.tanlu_normal_image)
// .error(R.drawable.tanlu_normal_image);
//
// Glide.with(mContext)
// .asBitmap()
// .load(mImageUrl)
// .apply(requestOptions)
// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
mogoImageloader.displayImage(mImageUrl, autoZoomInImageView);
}
traceVideoPlayStatusData();
@@ -372,15 +382,16 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
autoZoomInImageView.setVisibility(View.VISIBLE);
Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
//加载图片
RequestOptions requestOptions = new RequestOptions()
.placeholder(R.drawable.tanlu_normal_image)
.error(R.drawable.tanlu_normal_image)
.fallback(R.drawable.tanlu_normal_image);
Glide.with(mContext)
.asBitmap()
.load(imageUrl)
.apply(requestOptions)
.into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
// RequestOptions requestOptions = new RequestOptions()
// .placeholder(R.drawable.tanlu_normal_image)
// .error(R.drawable.tanlu_normal_image);
// Glide.with(mContext)
// .asBitmap()
// .load(imageUrl)
// .apply(requestOptions)
// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
mogoImageloader.displayImage(imageUrl, autoZoomInImageView);
}
@@ -469,19 +480,19 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
typeName = "封路";
break;
case TanluConstants.TANLU_ROAD_CONSTRUCTION:
typeName = "道路施工";
typeName = "施工";
break;
case TanluConstants.TANLU_ROAD_CONGESTION_COMPAT:
typeName = "道路拥堵";
typeName = "拥堵";
break;
case TanluConstants.TANLU_ROAD_PONDING:
typeName = "道路积水";
break;
case TanluConstants.TANLU_ROAD_ICING:
typeName = "结冰";
typeName = "路结冰";
break;
case TanluConstants.TANLU_ROAD_HEAVY_FOG:
typeName = "出现浓雾";
typeName = "浓雾";
break;
case TanluConstants.TANLU_ROAD_ACCIDENT:
typeName = "交通事故";
@@ -496,5 +507,24 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
return typeName;
}
@Override
public void onMapUiModeChanged(EnumMapUI mapUI) {
switch ( mapUI ) {
case Type_Night:
Log.d("liyz", "Type_Night ---------> ");
mRoundLayout.setBackgroundResource(R.drawable.shape_tanlu_top_bg);
break;
case Type_Light:
Log.d("liyz", "Type_Light ---------> ");
mRoundLayout.setBackgroundResource(R.drawable.shape_tanlu_top_bg_light);
break;
}
}
@Override
public void onCarStatusChanged(boolean visible) {
}
}

View File

@@ -8,6 +8,7 @@ import android.view.View
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.mogo.module.common.glide.SkinAbleBitmapTarget
import com.mogo.module.tanlu.R
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
@@ -57,13 +58,12 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
fun loadCoverImage(url: String, mContext: Context) {
//加载图片
val requestOptions = RequestOptions()
.placeholder(R.drawable.tanlu_normal_image)
// .placeholder(R.drawable.tanlu_normal_image)
.error(R.drawable.tanlu_normal_image)
Glide.with(mContext)
Glide.with(mContext).asBitmap()
.load(url)
.apply(requestOptions)
.into(coverImage)
.into(SkinAbleBitmapTarget(coverImage, requestOptions))
}

View File

@@ -8,7 +8,11 @@ import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import androidx.annotation.DrawableRes;
import com.mogo.module.tanlu.R;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
/**
* author : donghongyu
@@ -17,29 +21,34 @@ import com.mogo.module.tanlu.R;
* desc :
* version: 1.0
*/
public class RoundLayout extends RelativeLayout {
public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
public RoundLayout(Context context) {
this(context, null);
}
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs);
public RoundLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundLayout(Context context, AttributeSet attrs) {
super(context, attrs);
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
typedArray.recycle();
init();
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
private void init() {
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
roundPath = new Path();
@@ -58,6 +67,15 @@ public class RoundLayout extends RelativeLayout {
postInvalidate();
}
@Override
public void setBackgroundResource(@DrawableRes int resId) {
super.setBackgroundResource(resId);
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.onSetBackgroundResource(resId);
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
@@ -72,5 +90,13 @@ public class RoundLayout extends RelativeLayout {
}
super.draw(canvas);
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}