Commit 233b3027 authored by fallenstardust's avatar fallenstardust

添加genesys limit list下载

parent 7f4ee78e
......@@ -76,6 +76,7 @@ public interface Constants {
String FONT_DIRECTORY = "fonts";
String CORE_STRING_PATH = "strings.conf";
String CORE_LIMIT_PATH = "lflist.conf";
String CORE_GENESYS_LIMIT_PATH = "genesys_offical_lflist.conf";
String CORE_CUSTOM_LIMIT_PATH = "expansions/lflist.conf";
String CORE_CUSTOM_STRING_PATH = "pre-strings.conf";
String CORE_SYSTEM_PATH = "system.conf";
......@@ -175,7 +176,7 @@ public interface Constants {
String ID1 = "[versionname]";
String ID2 = "[download_link]";
String ID3 = "#pre_release_code";
//String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile";
String URL_GENESYS_LFLIST_DOWNLOAD_LINK = "https://cdntx.moecube.com/ygopro-genesys/lflist.conf";
String URL_YGO233_ADVANCE = "";//"https://ygo233.com/pre#pre_release_cards";//关闭233先行卡服务器,但不要删除该字段,许多未调用的遗留代码使用该contant
String URL_CN_DATAVER = "https://cdn02.moecube.com:444/ygopro-super-pre/data/version.txt";
String URL_PRE_CARD = "https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.json";
......
......@@ -3,8 +3,12 @@ package cn.garymb.ygomobile.ui.home;
import static cn.garymb.ygomobile.Constants.ID1;
import static cn.garymb.ygomobile.Constants.ID2;
import static cn.garymb.ygomobile.Constants.ID3;
import static cn.garymb.ygomobile.Constants.URL_GENESYS_LFLIST_DOWNLOAD_LINK;
import static cn.garymb.ygomobile.Constants.URL_HOME_VERSION;
import static cn.garymb.ygomobile.Constants.URL_HOME_VERSION_ALT;
import static cn.garymb.ygomobile.ui.cards.CardDetail.TYPE_DOWNLOAD_CARD_IMAGE_EXCEPTION;
import static cn.garymb.ygomobile.ui.cards.CardDetail.TYPE_DOWNLOAD_CARD_IMAGE_ING;
import static cn.garymb.ygomobile.ui.cards.CardDetail.TYPE_DOWNLOAD_CARD_IMAGE_OK;
import android.annotation.SuppressLint;
import android.content.Intent;
......@@ -31,6 +35,7 @@ import com.tencent.smtt.export.external.TbsCoreSettings;
import com.tencent.smtt.sdk.QbSdk;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
......@@ -39,6 +44,7 @@ import java.util.List;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.core.IrrlichtBridge;
import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.CardLoader;
......@@ -50,6 +56,8 @@ import cn.garymb.ygomobile.ui.mycard.MycardFragment;
import cn.garymb.ygomobile.ui.mycard.mcchat.MycardChatFragment;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.settings.SettingFragment;
import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.ScreenUtil;
import cn.garymb.ygomobile.utils.ServerUtil;
......@@ -442,4 +450,39 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
}
}
private void downloadGeneSysLflist() {
File geneSysLflist = new File(AppsSettings.get().getExpansionsPath() + "/" + Constants.CORE_GENESYS_LIMIT_PATH);
DownloadUtil.get().download(URL_GENESYS_LFLIST_DOWNLOAD_LINK, geneSysLflist.getParent(), geneSysLflist.getName(), new DownloadUtil.OnDownloadListener() {
@Override
public void onDownloadSuccess(File file) {
Message message = new Message();
message.what = TYPE_DOWNLOAD_CARD_IMAGE_OK;
message.arg1 = code;
handler.sendMessage(message);
}
@Override
public void onDownloading(int progress) {
Message message = new Message();
message.what = TYPE_DOWNLOAD_CARD_IMAGE_ING;
message.arg1 = progress;
handler.sendMessage(message);
}
@Override
public void onDownloadFailed(Exception e) {
Log.w(IrrlichtBridge.TAG, "download image error:" + e.getMessage());
//下载失败后删除下载的文件
FileUtils.deleteFile(tmp);
// downloadCardImage(code, file);
Message message = new Message();
message.what = TYPE_DOWNLOAD_CARD_IMAGE_EXCEPTION;
message.obj = e.toString();
handler.sendMessage(message);
}
});
}
}
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