Merge remote-tracking branch 'origin/4.0-dev' into 4.0-dev

This commit is contained in:
HuanCheng65 2021-12-03 20:45:59 +08:00
commit 55ebc34007
3 changed files with 34 additions and 4 deletions

View File

@ -38,11 +38,11 @@
-dontnote com.google.android.material.**
-dontwarn androidx.**
-keepclasseswithmembernames class * {
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
@ -85,7 +85,7 @@
void *(**On*Listener);
}
# 保留本地native方法不被混淆
-keepclasseswithmembernames class * {
-keepclasseswithmembers class * {
native <methods>;
}

View File

@ -0,0 +1,27 @@
package com.huanchengfly.tieba.post.api.adapters;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.huanchengfly.tieba.post.api.models.ThreadContentBean;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
public class ContentMsgAdapter implements JsonDeserializer<List<ThreadContentBean.ContentBean>> {
@Override
public List<ThreadContentBean.ContentBean> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
List<ThreadContentBean.ContentBean> list = new ArrayList<>();
if(json.isJsonArray()){
json.getAsJsonArray().forEach(element->{
if(element.isJsonObject()){
list.add(context.deserialize(element,ThreadContentBean.ContentBean.class));
}
});
}
return list;
}
}

View File

@ -2,6 +2,7 @@ package com.huanchengfly.tieba.post.api.models
import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName
import com.huanchengfly.tieba.post.api.adapters.ContentMsgAdapter
import com.huanchengfly.tieba.post.api.adapters.PortraitAdapter
import com.huanchengfly.tieba.post.api.adapters.SubPostListAdapter
import com.huanchengfly.tieba.post.models.BaseBean
@ -158,6 +159,7 @@ class ThreadContentBean : BaseBean() {
class OriginThreadInfo {
val title: String? = null
@JsonAdapter(ContentMsgAdapter::class)
val content: List<ContentBean>? = null
}
@ -166,6 +168,7 @@ class ThreadContentBean : BaseBean() {
val title: String? = null
val floor: String? = null
val time: String? = null
@JsonAdapter(ContentMsgAdapter::class)
val content: List<ContentBean>? = null
val agree: AgreeBean? = null