Commit 967c2356 authored by fallenstardust's avatar fallenstardust

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

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