Commit 6fbed2e6 authored by fallenstardust's avatar fallenstardust

收藏夹mList为空时不保存只重载

parent 8afcfcbb
...@@ -87,15 +87,19 @@ public class CardFavorites { ...@@ -87,15 +87,19 @@ public class CardFavorites {
mList.add(Integer.parseInt(tmp)); mList.add(Integer.parseInt(tmp));
} }
} }
Log.d(TAG, "load favorites success:"+mList.size()); Log.d(TAG, "load favorites success:" + mList.size());
} }
public void save() { public void save() {
List<String> ret = new ArrayList<>(); List<String> ret = new ArrayList<>();
for (Integer id : mList) { if (!mList.isEmpty()) {
ret.add(String.valueOf(id)); for (Integer id : mList) {
ret.add(String.valueOf(id));
}
File conf = AppsSettings.get().getSystemConfig();
FileUtils.writeLines(conf.getPath(), ret, Constants.DEF_ENCODING, "\n");
} else {
load();
} }
File conf = AppsSettings.get().getSystemConfig();
FileUtils.writeLines(conf.getPath(), ret, Constants.DEF_ENCODING, "\n");
} }
} }
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