Commit 967c2356 authored by fallenstardust's avatar fallenstardust

在线卡组的userid改为Integer以符合标准

parent dc5e8e37
......@@ -51,7 +51,7 @@ public class Deck implements Parcelable {
/**
* 卡组广场用的用户id,可以为空
*/
public String userId = null;
public Integer userId = null;
public Deck() {
mainlist = new ArrayList<>();
......@@ -203,7 +203,7 @@ public class Deck implements Parcelable {
deckId = id;
}
public void setUserId(String id) {
public void setUserId(Integer id) {
userId = id;
}
}
......@@ -30,7 +30,7 @@ public class DeckInfo {
private int mainCount, extraCount, sideCount;
public String deckId = null;//当前的卡组id(卡组广场)
public String userId = null;//当前的用户id(卡组广场)
public Integer userId = null;//当前的用户id(卡组广场)
public DeckInfo() {
mainCards = new ArrayList<>();
......@@ -361,7 +361,7 @@ public class DeckInfo {
deckId = id;
}
public void setUserId(String id) {
public void setUserId(Integer id) {
userId = id;
}
}
......@@ -73,7 +73,7 @@ public class DeckLoader {
} else if (line.startsWith("###")) {
line = line.trim().substring(3);
if (line.length() > 0)
deck.setUserId(line);
deck.setUserId(Integer.parseInt(line));
} else if (line.startsWith("##")) {
line = line.trim().substring(2);
if (line.length() > 0)
......
......@@ -69,7 +69,7 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
private String mDeckMd5;
private DeckInfo mDeckInfo;
private String deckId = null;
private String userId = null;
private Integer userId = null;
public DeckAdapater(Context context, RecyclerView recyclerView, ImageLoader imageLoader) {
this.context = context;
......@@ -668,7 +668,7 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
deckId = id;
}
public void setUserId(String id) {
public void setUserId(Integer id) {
userId = id;
}
}
......@@ -117,7 +117,7 @@ class DeckItemUtils {
* @param file 原有file
* @return 如果file为null,返回false
*/
public static boolean save(List<DeckItem> items, String deckId, String userId, File file) {
public static boolean save(List<DeckItem> items, String deckId, Integer userId, File file) {
FileOutputStream outputStream = null;
OutputStreamWriter writer = null;
try {
......
......@@ -71,9 +71,9 @@ public class DeckSquareFileUtil {
// LogUtil.i(TAG, line);
if (line.startsWith("###")) {//注意,先判断###,后判断##。因为###会包括##的情况
try {
String data = line.replace("#", "");
if (!data.isEmpty()) {
deckId = data;
line = line.replace("#", "");
if (!line.isEmpty()) {
userId = Integer.parseInt(line);
}
// userId = Integer.parseInt(line.replaceAll("###", ""));
} catch (NumberFormatException e) {
......@@ -81,8 +81,7 @@ public class DeckSquareFileUtil {
}
} else if (line.startsWith("##")) {
line = line.replace("#", "");
userId = Integer.parseInt(line);
deckId = line.replace("#", "");
}
......@@ -266,14 +265,14 @@ public class DeckSquareFileUtil {
IOUtils.close(inputStream);
}
if (!userIdFlag) {//原始ydk中不存在userId,添加userId行
if (!deckIdFlag) {//原始ydk中不存在deckId,添加deckId行
contentBuilder.append("\n");
contentBuilder.append("##" + userId);
contentBuilder.append("##" + deckId);
}
if (!deckIdFlag) {//原始ydk中不存在deckId,添加deckId行
if (!userIdFlag) {//原始ydk中不存在userId,添加userId行
contentBuilder.append("\n");
contentBuilder.append("###" + deckId);
contentBuilder.append("###" + userId);
}
String content = contentBuilder.toString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment