Commit ba39e838 authored by feihuaduo's avatar feihuaduo

按名称排序

parent 19aa0720
...@@ -507,12 +507,12 @@ public class AppsSettings { ...@@ -507,12 +507,12 @@ public class AppsSettings {
/*** /***
* 保存最后卡组绝对路径 * 保存最后卡组绝对路径
*/ */
public void setLastDeckPath(String name) { public void setLastDeckPath(String path) {
if (TextUtils.equals(name, getCurLastDeck())) { if (TextUtils.equals(path, getCurLastDeck())) {
//一样 //一样
return; return;
} }
mSharedPreferences.putString(Constants.PREF_LAST_YDK, name); mSharedPreferences.putString(Constants.PREF_LAST_YDK, path);
} }
public String getCurLastDeck() { public String getCurLastDeck() {
......
...@@ -7,6 +7,8 @@ import java.io.File; ...@@ -7,6 +7,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
...@@ -47,6 +49,7 @@ public class DeckUtil { ...@@ -47,6 +49,7 @@ public class DeckUtil {
} }
} }
} }
Collections.sort(deckList,nameCom);
return deckList; return deckList;
} }
...@@ -81,8 +84,16 @@ public class DeckUtil { ...@@ -81,8 +84,16 @@ public class DeckUtil {
IOUtils.close(zipFile); IOUtils.close(zipFile);
} }
} }
} }
Collections.sort(deckList,nameCom);
return deckList; return deckList;
} }
static Comparator nameCom= new Comparator<DeckFile>() {
@Override
public int compare(DeckFile ydk1, DeckFile ydk2) {
return ydk1.getName().compareTo(ydk2.getName());
}
};
} }
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