修正了String类型的为null的时候对外的数据统一返回""字符串

This commit is contained in:
董宏宇
2020-01-15 10:50:42 +08:00
parent be5333865e
commit 9d7c31557b
11 changed files with 60 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
while ( iterator.hasNext() ) {
IMogoOnMessageListener listener = iterator.next();
if ( listener != null ) {
Logger.d(TAG, "received msg ==" + payload.getPayload().toStringUtf8());
listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() ) );
}
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -11,6 +13,9 @@ public class MarkerCarInfo implements Serializable {
private String carTypeName;
public String getCarBrandLogoUrl() {
if (TextUtils.isEmpty(carBrandLogoUrl)) {
return "";
}
return carBrandLogoUrl;
}
@@ -19,6 +24,9 @@ public class MarkerCarInfo implements Serializable {
}
public String getCarTypeName() {
if (TextUtils.isEmpty(carTypeName)) {
return "未知";
}
return carTypeName;
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -20,6 +22,9 @@ public class MarkerDynamicData implements Serializable {
}
public String getName() {
if (TextUtils.isEmpty(name)) {
return "未知";
}
return name;
}

View File

@@ -1,6 +1,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
import java.util.List;
@@ -21,6 +23,9 @@ public class MarkerExploreWay implements Serializable {
private List<MarkerExploreWayItem> items;//视频地址和图片地址
public String getAddr() {
if (TextUtils.isEmpty(addr)) {
return "未知";
}
return addr;
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -11,6 +13,9 @@ public class MarkerExploreWayItem implements Serializable {
private String url;
public String getThumbnail() {
if (TextUtils.isEmpty(thumbnail)) {
return "";
}
return thumbnail;
}
@@ -19,6 +24,9 @@ public class MarkerExploreWayItem implements Serializable {
}
public String getUrl() {
if (TextUtils.isEmpty(url)) {
return "";
}
return url;
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -12,6 +14,9 @@ public class MarkerHobbyDatum implements Serializable {
private int isCheck;
public String getContent() {
if (TextUtils.isEmpty(content)) {
return "未知";
}
return content;
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -37,6 +39,9 @@ public class MarkerLocation implements Serializable {
}
public String getAddress() {
if (TextUtils.isEmpty(address)) {
return "未知";
}
return address;
}

View File

@@ -2,6 +2,8 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
@@ -54,6 +56,9 @@ public class MarkerShareMusic implements Serializable {
}
public String getMediaImg() {
if (TextUtils.isEmpty(mediaImg)) {
return "";
}
return mediaImg;
}
@@ -62,6 +67,9 @@ public class MarkerShareMusic implements Serializable {
}
public String getMediaName() {
if (TextUtils.isEmpty(mediaName)) {
return "未知";
}
return mediaName;
}

View File

@@ -1,5 +1,7 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.util.Objects;
/**
@@ -51,6 +53,9 @@ public class MarkerShowEntity {
}
public String getTextContent() {
if (TextUtils.isEmpty(textContent)) {
return "未知";
}
return textContent;
}

View File

@@ -90,6 +90,9 @@ public class MarkerUserInfo implements Serializable {
}
public String getSn() {
if (TextUtils.isEmpty(sn)) {
return "";
}
return sn;
}
@@ -98,6 +101,9 @@ public class MarkerUserInfo implements Serializable {
}
public String getUserHead() {
if (TextUtils.isEmpty(userHead)) {
return "";
}
return userHead;
}
@@ -114,6 +120,9 @@ public class MarkerUserInfo implements Serializable {
}
public String getUserName() {
if (TextUtils.isEmpty(userName)) {
return "";
}
return userName;
}

View File

@@ -358,6 +358,7 @@ public class MogoModulesManager implements MogoModulesHandler,
try {
getApplicationContext().unregisterReceiver( mReceiver );
} catch ( Exception e ) {
e.printStackTrace();
}
}
mReceiver = null;