功能优化

This commit is contained in:
hayu 2025-01-02 15:06:13 +08:00
parent 02d6f9ae84
commit ac43e73361
3 changed files with 38 additions and 2 deletions

View File

@ -121,4 +121,5 @@ dependencies {
implementation 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'
//okhttputils
implementation 'org.bouncycastle:bcprov-jdk15on:1.56'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
}

View File

@ -436,8 +436,10 @@ public class MainActivity extends BaseActivity implements ClickUtils.OnClick2Exi
@Override
public void onDestroy() {
time.cancel();
time = null;
if (time != null) {
time.cancel();
time = null;
}
super.onDestroy();
}

View File

@ -31,6 +31,10 @@ import com.bonus.app.util.mail.PinyinComparator;
import com.bonus.app.util.mail.SideBar;
import com.bonus.app.util.mail.SortAdapter;
import com.bonus.app.util.mail.SortModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xutil.common.ClickUtils;
@ -39,6 +43,7 @@ import org.easydarwin.easypusher.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@ -193,6 +198,7 @@ public class MailTreeContentFragment extends BaseFragment implements ClickUtils.
String orgCode = orgJsonObject.getString("code");
if (orgCode.equals("200")) {
String data = orgJsonObject.getString("data");
data = getStringJSON(data);
listTree = JsonHelper.jsonArrStrToBeanList(data, MailContentBean.class);
listTree.forEach(c->{
c.setName(c.getName() + "\n" + c.getPhone());
@ -215,6 +221,33 @@ public class MailTreeContentFragment extends BaseFragment implements ClickUtils.
}
};
/**
* 去除JSON字符串中的null值
*/
public String getStringJSON(String value) {
// 创建 ObjectMapper 实例
ObjectMapper mapper = new ObjectMapper();
// 将字符串转换为 JsonNode
ArrayNode jsonArray = null;
try {
jsonArray = (ArrayNode) mapper.readTree(value);
// 迭代器遍历数组元素
Iterator<JsonNode> it = jsonArray.elements();
while (it.hasNext()) {
JsonNode node = it.next();
if (node.isNull()) {
// 如果是 null则从迭代器中移除
it.remove();
}
}
return mapper.writeValueAsString(jsonArray);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return value;
}
/**
* ΪListView<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param date