Merge branch 'dev_arch_opt_3.0' into dev_opt_2.15.0
This commit is contained in:
@@ -72,36 +72,26 @@ class BindingCarNetWorkManager private constructor() {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onNext(info: BindingCarInfo) {
|
||||
if (info != null && info.getData() != null) {
|
||||
d(
|
||||
SceneConstant.M_BINDING + TAG,
|
||||
"getBindingCarInfo data =" + info.getData().toString()
|
||||
d(SceneConstant.M_BINDING + TAG, "getBindingCarInfo data =" + info.getData().toString())
|
||||
SharedPrefsMgr.getInstance(context).putString(
|
||||
SharedPrefsConstants.CAR_INFO,
|
||||
GsonUtils.toJson(info.getData())
|
||||
)
|
||||
updateCarVrIconRes(info.getData().brandId);
|
||||
when (info.getData().compare) {
|
||||
"0" -> showBindingCarDialog()
|
||||
"3" -> showModifyBindingCarDialog()
|
||||
"null" -> TipToast.shortTip("当前工控机没有入库")
|
||||
}
|
||||
SharedPrefsMgr.getInstance(context).putString(
|
||||
SharedPrefsConstants.CAR_INFO,
|
||||
GsonUtils.toJson(info.getData())
|
||||
)
|
||||
updateCarVrIconRes(info.getData().brandId);
|
||||
} else {
|
||||
// SharedPrefsMgr.getInstance(context).putString(
|
||||
// SharedPrefsConstants.CAR_INFO, "null")
|
||||
e(
|
||||
SceneConstant.M_BINDING + TAG, "getBindingCarInfo data = null "
|
||||
)
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, "")
|
||||
e(SceneConstant.M_BINDING + TAG, "getBindingCarInfo data = null ")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
// SharedPrefsMgr.getInstance(context).putString(
|
||||
// SharedPrefsConstants.CAR_INFO, e.message.toString())
|
||||
e(
|
||||
SceneConstant.M_BINDING + TAG,
|
||||
"getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message
|
||||
)
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, "")
|
||||
e(SceneConstant.M_BINDING + TAG, "getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message)
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
@@ -138,19 +128,13 @@ class BindingCarNetWorkManager private constructor() {
|
||||
override fun onNext(info: ModifyBindingcarInfo) {
|
||||
if (info != null) {
|
||||
callBack.invoke(info)
|
||||
d(
|
||||
SceneConstant.M_BINDING + TAG,
|
||||
"modifyBindingCar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString()
|
||||
)
|
||||
d(SceneConstant.M_BINDING + TAG, "modifyBindingCar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString())
|
||||
updateCarVrIconRes(info.data.brandId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
e(
|
||||
SceneConstant.M_BINDING + TAG,
|
||||
"modifyBindingCar onError e = " + e.toString() + "---e.getMessage = " + e.message
|
||||
)
|
||||
e(SceneConstant.M_BINDING + TAG, "modifyBindingCar onError e = " + e.toString() + "---e.getMessage = " + e.message)
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
|
||||
@@ -55,7 +55,7 @@ class MBoxBubbleView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
if(category == MsgCategory.NOTICE){
|
||||
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|
||||
|| msgBoxList.type == MsgBoxType.OBU){
|
||||
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
|
||||
MsgBoxConfig.noticeList.add(msgBoxList)
|
||||
if(isShowData){
|
||||
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
|
||||
|
||||
@@ -52,14 +52,9 @@ class MMsgBoxBubbleView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
if(category == MsgCategory.NOTICE){
|
||||
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|
||||
|| msgBoxList.type == MsgBoxType.OBU){
|
||||
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
|
||||
update(msgBoxList)
|
||||
}
|
||||
if(msgBoxList.type == MsgBoxType.OPERATION){
|
||||
if((msgBoxList.bean as OperationMsg).type == 2){
|
||||
update(msgBoxList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,21 +59,12 @@ class MMsgBoxListView @JvmOverloads constructor(
|
||||
UiThreadHandler.post{
|
||||
if(category == MsgCategory.NOTICE){
|
||||
if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X
|
||||
|| msgBoxList.type == MsgBoxType.OBU){
|
||||
|| msgBoxList.type == MsgBoxType.OBU || msgBoxList.type == MsgBoxType.OPERATION){
|
||||
noticeList?.add(0,msgBoxList)
|
||||
noticeList?.let {
|
||||
mMsgBoxListAdapter?.setData(it)
|
||||
}
|
||||
}
|
||||
if(msgBoxList.type == MsgBoxType.OPERATION){
|
||||
if((msgBoxList.bean as OperationMsg).type == 2){
|
||||
noticeList?.add(0,msgBoxList)
|
||||
noticeList?.let {
|
||||
mMsgBoxListAdapter?.setData(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.msgbox;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class SharpView extends View {
|
||||
|
||||
private int mWidth =0; //三角形的宽度
|
||||
private int mHeight =0; //三角形的高度
|
||||
private Context mContext;
|
||||
|
||||
public SharpView(Context context) {
|
||||
super(context);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
public SharpView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mWidth = 25;
|
||||
mHeight = 25;
|
||||
}
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(mWidth,mHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//创建画笔
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(Color.parseColor("#FFFFFFFF"));
|
||||
paint.setAntiAlias(true); //抗锯齿
|
||||
paint.setStyle(Paint.Style.FILL);//实线
|
||||
//创建路径
|
||||
Path path = new Path();
|
||||
path.moveTo(0,mHeight);
|
||||
path.lineTo(mWidth,mHeight);
|
||||
path.lineTo(mWidth/2,0);
|
||||
path.close();//闭合路径
|
||||
//画在画布上
|
||||
canvas.drawPath(path,paint);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
|
||||
private val notice: Int = 1
|
||||
private val v2x: Int = 2
|
||||
private val operation: Int = 3
|
||||
|
||||
|
||||
fun setData(data: ArrayList<MsgBoxCountDownBean>){
|
||||
@@ -37,6 +38,10 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_notice,parent,false)
|
||||
BubbleNoticeHolder(view)
|
||||
}
|
||||
operation -> {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_operation,parent,false)
|
||||
BubbleOperationHolder(view)
|
||||
}
|
||||
else -> {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_box_v2x,parent,false)
|
||||
BubbleV2XHolder(view)
|
||||
@@ -61,6 +66,14 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
|
||||
}
|
||||
}
|
||||
is BubbleOperationHolder -> {
|
||||
//运营消息
|
||||
data?.let {
|
||||
val operationMsg = it[position].msgBoxBean.bean as OperationMsg
|
||||
holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].msgBoxBean.timestamp,getHourMinFormat())
|
||||
holder.tvMOperationContent.text = operationMsg.content
|
||||
}
|
||||
}
|
||||
is BubbleV2XHolder -> {
|
||||
data?.let {
|
||||
val msgBoxBean = it[position]
|
||||
@@ -74,7 +87,7 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
}
|
||||
|
||||
val msgBoxBean: MsgBoxCountDownBean = data!![position]
|
||||
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
|
||||
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),CallerMsgBoxManager.getDismissTime()){
|
||||
override fun onTick(p0: Long) {
|
||||
|
||||
}
|
||||
@@ -95,7 +108,9 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return if(data!![position].msgBoxBean.type == MsgBoxType.NOTICE){
|
||||
notice
|
||||
}else{
|
||||
}else if(data!![position].msgBoxBean.type == MsgBoxType.OPERATION){
|
||||
operation
|
||||
} else{
|
||||
v2x
|
||||
}
|
||||
}
|
||||
@@ -115,4 +130,11 @@ class MBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter<Re
|
||||
var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent)
|
||||
}
|
||||
|
||||
//运营消息
|
||||
class BubbleOperationHolder(itemView: View): RecyclerView.ViewHolder(itemView){
|
||||
var tvMOperationTime: TextView = itemView.findViewById(R.id.tvMOperationTime)
|
||||
var tvMOperationContent: TextView = itemView.findViewById(R.id.tvMOperationContent)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter
|
||||
}
|
||||
|
||||
val msgBoxBean: MsgBoxCountDownBean = data!![position]
|
||||
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
|
||||
msgBoxBean.countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),CallerMsgBoxManager.getDismissTime()){
|
||||
override fun onTick(p0: Long) {
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.eagle.core.data.msgbox.*
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.ExpandableTextView
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
|
||||
@@ -117,7 +118,10 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter<R
|
||||
data?.let {
|
||||
val operationMsg = it[position].bean as OperationMsg
|
||||
holder.tvMOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
|
||||
holder.tvMOperationContent.text = operationMsg.content
|
||||
holder.tvMOperationContent.init(false,operationMsg.content+" ",null)
|
||||
holder.tvMOperationContent.setOnClickListener {
|
||||
holder.tvMOperationContent.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,7 +167,7 @@ class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter<R
|
||||
//运营消息
|
||||
class ListOperationHolder(itemView: View): RecyclerView.ViewHolder(itemView){
|
||||
var tvMOperationTime: TextView = itemView.findViewById(R.id.tvMOperationTime)
|
||||
var tvMOperationContent: TextView = itemView.findViewById(R.id.tvMOperationContent)
|
||||
var tvMOperationContent: ExpandableTextView = itemView.findViewById(R.id.tvMOperationContent)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
/**
|
||||
* 可伸展TextView
|
||||
*/
|
||||
public class ExpandableTextView extends androidx.appcompat.widget.AppCompatTextView{
|
||||
|
||||
/**
|
||||
* 原始内容文本
|
||||
*/
|
||||
private String originText;
|
||||
/**
|
||||
* TextView可展示宽度
|
||||
*/
|
||||
private int mWidth = Integer.MAX_VALUE;
|
||||
/**
|
||||
* TextView限制显示的最大行数
|
||||
*/
|
||||
private int mMaxLines = 0;
|
||||
/**
|
||||
* 收起状态时的拼接文案
|
||||
*/
|
||||
private SpannableString SPAN_TO_EXPAND = null;
|
||||
/**
|
||||
* 展开状态时的拼接文案
|
||||
*/
|
||||
private SpannableString SPAN_TO_CLOSE = null;
|
||||
/**
|
||||
* 文本格式(true全角 false半角)
|
||||
*/
|
||||
private boolean ToDBC = true;
|
||||
/**
|
||||
* 状态值 true:展开中 false:折叠状态 (该状态值只能在当前类内部修改)
|
||||
*/
|
||||
private boolean mIsExpanding = false;
|
||||
private int mOriginTextLines;
|
||||
/**
|
||||
* 追加的图片的宽度
|
||||
*/
|
||||
private int mToExpandImageWidth = 0;
|
||||
private int mToCloseImageWidth = 0;
|
||||
|
||||
public ExpandableTextView(Context context) {
|
||||
super(context);
|
||||
|
||||
}
|
||||
|
||||
public ExpandableTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
}
|
||||
|
||||
public ExpandableTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用前必须调用该方法
|
||||
*/
|
||||
public void init(boolean toExpand, String text, @Nullable CreateAppenderListener createAppenderListener) {
|
||||
mMaxLines = getMaxLines();
|
||||
originText = ToDBC ? ToDBC(text) : toDBC(text);
|
||||
if (createAppenderListener != null) {
|
||||
// 1.优先使用listener的生成
|
||||
SPAN_TO_CLOSE = createAppenderListener.getDefaultToCloseSpannableString();
|
||||
SPAN_TO_EXPAND = createAppenderListener.getDefaultToExpandSpannableString();
|
||||
} else {
|
||||
// 2.使用默认的SpannableString
|
||||
SPAN_TO_CLOSE = getDefaultToCloseSpannableString();
|
||||
SPAN_TO_EXPAND = getDefaultToExpandSpannableString();
|
||||
}
|
||||
|
||||
mOriginTextLines = createWorkingLayout(originText).getLineCount();
|
||||
// 设置初始显示的文本
|
||||
toggle(toExpand);
|
||||
}
|
||||
|
||||
public void toggle(boolean toExpand) {
|
||||
// 由于获取不到textview的宽度,所以这里用post方法
|
||||
post(() -> {
|
||||
mWidth = getWidth();
|
||||
if (toExpand) {
|
||||
setExpandText();
|
||||
} else {
|
||||
setCloseText();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
toggle(!mIsExpanding);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置TextView可显示的最大行数
|
||||
*
|
||||
* @param maxLines 最大行数
|
||||
*/
|
||||
@Override
|
||||
public void setMaxLines(int maxLines) {
|
||||
if (mMaxLines == 0) {
|
||||
// 这里对mMaxLines记录一次就可以
|
||||
this.mMaxLines = maxLines;
|
||||
}
|
||||
super.setMaxLines(maxLines);
|
||||
}
|
||||
|
||||
public void setToDBC(boolean toDBC) {
|
||||
ToDBC = toDBC;
|
||||
}
|
||||
|
||||
public int getToExpandImageWidth() {
|
||||
return mToExpandImageWidth;
|
||||
}
|
||||
|
||||
public int getToCloseImageWidth() {
|
||||
return mToCloseImageWidth;
|
||||
}
|
||||
|
||||
public void setToExpandImageWidth(int mToExpandImageWidth) {
|
||||
this.mToExpandImageWidth = mToExpandImageWidth;
|
||||
}
|
||||
|
||||
public void setToCloseImageWidth(int mToCloseImageWidth) {
|
||||
this.mToCloseImageWidth = mToCloseImageWidth;
|
||||
}
|
||||
|
||||
public SpannableString getDefaultToExpandSpannableString() {
|
||||
SpannableString spannableString = new SpannableString("... ");
|
||||
// 测量文字的高度,用于设置图片大小
|
||||
Paint paint = getPaint();
|
||||
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
|
||||
setToExpandImageWidth((int) (fontMetrics.descent - fontMetrics.ascent));
|
||||
// 对图片的宽高设置
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
Drawable drawable = getResources().getDrawable(R.drawable.ic_expand_more_black);
|
||||
drawable.setBounds(0, 0 , getToExpandImageWidth(), getToExpandImageWidth());
|
||||
ImageSpan span = new ImageSpan(drawable);
|
||||
spannableString.setSpan(span, spannableString.length() - 1, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
// 对imageSpan设置点击事件,也可以这里不设置,在Activity对expandTextView整个事件设置点击事件
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
|
||||
public SpannableString getDefaultToCloseSpannableString() {
|
||||
// 因为末尾要插入图片,这里空格是占位符
|
||||
SpannableString spannableString = new SpannableString(" ");
|
||||
// 测量文字的高度,用于设置图片大小
|
||||
Paint paint = getPaint();
|
||||
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
|
||||
setToCloseImageWidth((int) (fontMetrics.descent - fontMetrics.ascent));
|
||||
// 对图片的宽高设置
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
Drawable drawable = getResources().getDrawable(R.drawable.ic_expand_less_black);
|
||||
drawable.setBounds(0, 0 , getToCloseImageWidth(), getToCloseImageWidth());
|
||||
ImageSpan span = new ImageSpan(drawable);
|
||||
spannableString.setSpan(span, spannableString.length() - 1, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文本收起
|
||||
*/
|
||||
public void setCloseText() {
|
||||
mIsExpanding = false;
|
||||
setMaxLines(mMaxLines);
|
||||
|
||||
boolean needAppend = false;
|
||||
String workingText = originText;
|
||||
|
||||
if (mMaxLines != 0) {
|
||||
Layout originLayout = createWorkingLayout(originText);
|
||||
mOriginTextLines = originLayout.getLineCount();
|
||||
// 原始文本的行数 大于 最大能显示行数
|
||||
if (mOriginTextLines > mMaxLines) {
|
||||
// 获取mMaxLines行的文本
|
||||
workingText = originText.substring(0, originLayout.getLineEnd(mMaxLines - 1)).trim();
|
||||
// 计算mMaxLines行的文本的宽度
|
||||
float allWidth = getPaint().measureText(workingText);
|
||||
// 当前显示需要的宽度
|
||||
float realWidth = getPaint().measureText(workingText + SPAN_TO_EXPAND) + mToExpandImageWidth;
|
||||
|
||||
while (realWidth > allWidth) {
|
||||
int lastSpace = workingText.length() - 1;
|
||||
if (lastSpace == -1) {
|
||||
break;
|
||||
}
|
||||
workingText = workingText.substring(0, lastSpace);
|
||||
realWidth = getPaint().measureText(workingText + SPAN_TO_EXPAND) + mToExpandImageWidth;
|
||||
}
|
||||
|
||||
needAppend = true;
|
||||
}
|
||||
}
|
||||
setText(workingText);
|
||||
if (needAppend) {
|
||||
// 必须使用append,不能在上面使用+连接,否则spannable会无效
|
||||
append(SPAN_TO_EXPAND);
|
||||
}
|
||||
setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文本展开
|
||||
*/
|
||||
public void setExpandText() {
|
||||
if (mOriginTextLines <= mMaxLines) {
|
||||
return;
|
||||
}
|
||||
mIsExpanding = true;
|
||||
setMaxLines(Integer.MAX_VALUE);
|
||||
|
||||
Layout originLayout = createWorkingLayout(originText);
|
||||
Layout compareLayout = createWorkingLayout(originText + SPAN_TO_CLOSE);
|
||||
if (compareLayout.getLineCount() > originLayout.getLineCount()) {
|
||||
setText(originText + "\n");
|
||||
} else {
|
||||
setText(originText);
|
||||
}
|
||||
append(SPAN_TO_CLOSE);
|
||||
setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回textview的显示区域的layout
|
||||
*/
|
||||
private Layout createWorkingLayout(String workingText) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
||||
return StaticLayout.Builder.obtain(workingText, 0, workingText.length(), getPaint(), mWidth).build();
|
||||
} else {
|
||||
return new StaticLayout(workingText, getPaint(), mWidth - getPaddingLeft() - getPaddingRight(),
|
||||
Layout.Alignment.ALIGN_NORMAL, getLineSpacingMultiplier(), getLineSpacingExtra(), false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 屏蔽长按事件,防止崩溃
|
||||
*/
|
||||
@Override
|
||||
public void setLongClickable(boolean longClickable) {
|
||||
super.setLongClickable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转全角
|
||||
*/
|
||||
private static String toDBC(String input) {
|
||||
char[] c = input.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == '\n') {
|
||||
|
||||
} else if (c[i] == ' ') {
|
||||
c[i] = '\u3000';
|
||||
} else if (c[i] < '\177') {
|
||||
c[i] = (char) (c[i] + 65248);
|
||||
}
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转半角
|
||||
*/
|
||||
public static String ToDBC(String input) {
|
||||
char[] c = input.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == '\u3000') {
|
||||
c[i] = ' ';
|
||||
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
|
||||
c[i] = (char) (c[i] - 65248);
|
||||
|
||||
}
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于生成 文本末尾要追加的SpannableString
|
||||
*/
|
||||
public interface CreateAppenderListener {
|
||||
SpannableString getDefaultToCloseSpannableString();
|
||||
SpannableString getDefaultToExpandSpannableString();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 697 B |
Binary file not shown.
|
After Width: | Height: | Size: 716 B |
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_291"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="#CCFFFFFF"
|
||||
app:roundLayoutRadius="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMOperationImage"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:src="@drawable/icon_passenger_operation"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMOperationTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textColor="#991A273F"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_marginEnd="@dimen/dp_13"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMOperationContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivMOperationImage"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvMOperationTime"
|
||||
android:gravity="start"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:textColor="#FF203555"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
@@ -44,7 +44,7 @@
|
||||
android:ellipsize="end"
|
||||
android:textColor="#FF203555"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_18"
|
||||
android:layout_marginEnd="@dimen/dp_18"
|
||||
/>
|
||||
|
||||
|
||||
@@ -41,10 +41,11 @@
|
||||
android:gravity="start"
|
||||
android:textColor="#FF203555"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_13"
|
||||
android:layout_marginEnd="@dimen/dp_13"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
@@ -13,6 +13,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/icon_passenger_operation"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -27,7 +29,7 @@
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ExpandableTextView
|
||||
android:id="@+id/tvMOperationContent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -38,8 +40,12 @@
|
||||
android:gravity="start"
|
||||
android:textColor="#FF203555"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:maxLines="2"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
style="@style/DebugSettingText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minLines="5" />
|
||||
android:minLines="4" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -5,7 +5,9 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -19,7 +21,7 @@ import java.util.TimerTask;
|
||||
*
|
||||
* @author mogoauto
|
||||
*/
|
||||
public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener {
|
||||
public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
private final static String TAG = "SpeedLimitDataManager";
|
||||
private static volatile SpeedLimitDataManager instance;
|
||||
@@ -40,7 +42,7 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
public void onChassisLocationWGS84(@Nullable MogoLocation gnssInfo) {
|
||||
mLocation = gnssInfo;
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener
|
||||
}
|
||||
|
||||
public void start() {
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationWGS84ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new SpeedTimerTask(), 3000, 1000);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MogoRouteOverlayManager implements
|
||||
public void init() {
|
||||
CallerPlanningTrajectoryListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, 20,this);
|
||||
}
|
||||
|
||||
public static MogoRouteOverlayManager getInstance() {
|
||||
|
||||
@@ -111,8 +111,8 @@ object MarkerDrawerManager {
|
||||
)
|
||||
if (baseDiffDis > diff) {
|
||||
baseDiffDis = diff
|
||||
// 距离最近的时候判断是否走过,且车行驶是线性连续的1s不会跳点过多
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(realLon, realLat, latLng.longitude, latLng.latitude, heading) >= 90 && i - lastArrivedIndex < 3) {
|
||||
// 距离最近的时候判断是否走过
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(realLon, realLat, latLng.longitude, latLng.latitude, heading) >= 90) {
|
||||
currentIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
initMapView()
|
||||
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20,this)
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,19 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase<IMoGoChassisLocati
|
||||
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
|
||||
//Logger.d(TAG, "没设置监听频率,使用默认5HZ")
|
||||
val hzTime = (1.0 / 5) * 1000
|
||||
// 获取最后一次回调的时间
|
||||
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
|
||||
if (hzLastSendTime != null && hzLastSendTime > 0) {
|
||||
// 计算是否进入下一次回调周期
|
||||
val nowTime = TimeUtils.getNowMills()
|
||||
if (nowTime - hzLastSendTime > hzTime) {
|
||||
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, mGnssInfo!!, sourceType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,19 @@ object CallerChassisLocationWGS84ListenerManager : CallerBase<IMoGoChassisLocati
|
||||
syncLocationCallback(tag, it, mGnssInfo, sourceType)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, mGnssInfo, sourceType)
|
||||
//Logger.d(TAG, "没设置监听频率,使用默认5HZ")
|
||||
val hzTime = (1.0 / 5) * 1000
|
||||
// 获取最后一次回调的时间
|
||||
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
|
||||
if (hzLastSendTime != null && hzLastSendTime > 0) {
|
||||
// 计算是否进入下一次回调周期
|
||||
val nowTime = TimeUtils.getNowMills()
|
||||
if (nowTime - hzLastSendTime > hzTime) {
|
||||
syncLocationCallback(tag, it, mGnssInfo, sourceType)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, mGnssInfo, sourceType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,32 +132,9 @@ final class LoggerPrinter implements Printer {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void log( String tag, LogLevel logLevel, String msg, Object... args) {
|
||||
private void log( String tag, LogLevel logLevel, String msg, Object... args) {
|
||||
String message = this.createMessage(msg, args);
|
||||
int methodCount = this.getMethodCount();
|
||||
this.logTopBorder(logLevel, tag);
|
||||
this.logHeaderContent(logLevel, tag, methodCount);
|
||||
byte[] bytes = message.getBytes();
|
||||
int length = bytes.length;
|
||||
if (length <= 4000) {
|
||||
if (methodCount > 0) {
|
||||
this.logDivider(logLevel, tag);
|
||||
}
|
||||
|
||||
this.logContent(logLevel, tag, message);
|
||||
this.logBottomBorder(logLevel, tag);
|
||||
} else {
|
||||
if (methodCount > 0) {
|
||||
this.logDivider(logLevel, tag);
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; i += 4000) {
|
||||
int count = Math.min(length - i, 4000);
|
||||
this.logContent(logLevel, tag, new String(bytes, i, count));
|
||||
}
|
||||
|
||||
this.logBottomBorder(logLevel, tag);
|
||||
}
|
||||
logContent(logLevel, tag, message);
|
||||
}
|
||||
|
||||
private void logTopBorder(LogLevel logLevel, String tag) {
|
||||
@@ -198,11 +175,13 @@ final class LoggerPrinter implements Printer {
|
||||
}
|
||||
|
||||
private void logContent( LogLevel logLevel, String tag, String chunk) {
|
||||
String[] lines = chunk.split( System.getProperty("line.separator"));
|
||||
|
||||
for ( String line : lines) {
|
||||
this.logChunk(logLevel, tag, "║ " + line);
|
||||
}
|
||||
// String[] lines = chunk.split( System.getProperty("line.separator"));
|
||||
//
|
||||
// for ( String line : lines) {
|
||||
// this.logChunk(logLevel, tag, "║ " + line);
|
||||
// }
|
||||
//
|
||||
logChunk(logLevel, tag, chunk);
|
||||
}
|
||||
|
||||
private void logChunk( LogLevel logLevel, String tag, String chunk) {
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
<resources>
|
||||
<string-array name="voicer_cloud_values">
|
||||
<!-- 汉语发音人 -->
|
||||
<item>xiaoyan</item>
|
||||
<item>x4_lingxiaoying_en</item>
|
||||
<item>aisjiuxu</item>
|
||||
<item>aisxping</item>
|
||||
<item>aisjinger</item>
|
||||
<item>aisbabyxu</item>
|
||||
|
||||
<!-- 英语发音人 -->
|
||||
<item>x2_enus_catherine</item>
|
||||
<item>x2_engam_laura</item>
|
||||
|
||||
<!-- 韩语发音人 -->
|
||||
<item>zhimin</item>
|
||||
<item>x2_KoKr_Miya</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user