From 8e541a8b2a08e8300f18f7e29993bd6ff88ce9f2 Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Mon, 4 Sep 2017 10:45:53 +0800 Subject: [PATCH] fix bug https://github.com/AriaLyy/Aria/issues/108 --- .../java/com/arialyy/aria/orm/SqlUtil.java | 25 ++++++++----------- .../download/group/DownloadGroupActivity.java | 1 + 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/orm/SqlUtil.java b/Aria/src/main/java/com/arialyy/aria/orm/SqlUtil.java index 76a1f08d..616e17b9 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/SqlUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/SqlUtil.java @@ -17,6 +17,7 @@ package com.arialyy.aria.orm; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; +import android.util.Log; import com.arialyy.aria.util.CommonUtil; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -91,11 +92,11 @@ final class SqlUtil { throw new IllegalArgumentException("List中元素必须被@NormalList注解"); } if (TextUtils.isEmpty(str)) return null; - String[] datas = str.split("$$"); + String[] datas = str.split("\\$\\$"); List list = new ArrayList(); String type = normalList.clazz().getName(); for (String data : datas) { - list.add(checkData(data, type)); + list.add(checkData(type, data)); } return list; } @@ -176,18 +177,14 @@ final class SqlUtil { } private static Object checkData(String type, String data) { - switch (type) { - case "String": - return data; - case "int": - case "Integer": - return Integer.parseInt(data); - case "double": - case "Double": - return Double.parseDouble(data); - case "float": - case "Float": - return Float.parseFloat(data); + if (type.equalsIgnoreCase("java.lang.String")){ + return data; + }else if (type.equalsIgnoreCase("int") || type.equals("java.lang.Integer")){ + return Integer.parseInt(data); + }else if (type.equalsIgnoreCase("double") || type.equals("java.lang.Double")){ + return Double.parseDouble(data); + }else if (type.equalsIgnoreCase("float") || type.equals("java.lang.Float")){ + return Float.parseFloat(data); } return null; } diff --git a/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java b/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java index f7279de4..0b36fb72 100644 --- a/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java @@ -49,6 +49,7 @@ public class DownloadGroupActivity extends BaseActivity