解决filter数据没添加进数据库问题,获取filter数据时如果返回的数据等于500则继续获取数据

This commit is contained in:
huangzhuanghua
2016-05-19 18:37:12 +08:00
parent 735702034f
commit 8bdee4f73b
5 changed files with 11 additions and 8 deletions

View File

@ -188,13 +188,13 @@ public class SplashScreenActivity extends BaseActivity {
if (hasFocus && isFirst) {
// 第一次启动把package.txt文件内容加载进数据库
if (sp.getBoolean("isFirstLaunch", true)) {
if (!sp.getBoolean("isLoadFilter", false)) {
try {
List<FilterInfo> list = new ArrayList<FilterInfo>();
BufferedReader reader = new BufferedReader(
new InputStreamReader(getAssets().open(
"package.txt")));
String line = null;
String line;
while ((line = reader.readLine()) != null) {
list.add(new FilterInfo(line));
}
@ -202,8 +202,8 @@ public class SplashScreenActivity extends BaseActivity {
FilterManager filterManager = new FilterManager(
getApplicationContext());
filterManager.addAllFilter(list);
sp.edit().putBoolean("isLoadFilter", true).apply();
} catch (IOException e1) {
e1.printStackTrace();
}
}