Commit fca51383 authored by fallenstardust's avatar fallenstardust
parents e8ac0786 ec75c6db
......@@ -156,7 +156,7 @@ public interface Constants {
String URL_DONATE = "https://afdian.net/@ygomobile";
String URL_MASTER_RULE_CN = "https://ocg-rule.readthedocs.io/";
String WIKI_SEARCH_URL = "https://ygocdb.com/card/";
String URL_HOME_VERSION = "https://ygomobile.top/version.txt";
String URL_HOME_VERSION = "https://ygomobile.top/verndwnload.txt";
String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile";
String URL_YGO233_ADVANCE = "https://ygo233.com/pre";
String URL_YGO233_DATAVER = "https://ygo233.com/pre/dataver";
......
......@@ -94,11 +94,11 @@ public class ExCardActivity extends BaseActivity {
Toast.makeText(getContext(), R.string.ypk_installed, Toast.LENGTH_LONG).show();
}
String servername = "";
if (getPackageName().equals(BuildConfig.APPLICATION_ID))
if (AppsSettings.get().getDataLanguage() == 0)
servername = "23333先行服务器";
if (getPackageName().equals((BuildConfig.APPLICATION_ID) + ".KO"))
if (AppsSettings.get().getDataLanguage() == 1)
servername = "YGOPRO 사전 게시 중국서버";
if (getPackageName().equals((BuildConfig.APPLICATION_ID) + ".EN"))
if (AppsSettings.get().getDataLanguage() == 2)
servername = "Mercury23333 OCG/TCG Pre-release";
AddServer(servername, "s1.ygo233.com", 23333, "Knight of Hanoi");
btn_download.setVisibility(View.GONE);
......
......@@ -47,6 +47,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
long exitLasttime = 0;
public static String Version;
public static String Cache_link;
private static final int TYPE_GET_VERSION_OK = 0;
private static final int TYPE_GET_VERSION_FAILED = 1;
......@@ -71,15 +72,16 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
super.handleMessage(msg);
switch (msg.what) {
case TYPE_GET_VERSION_OK:
Version = msg.obj.toString();
Log.i(BuildConfig.VERSION_NAME, Version);
if (!Version.equals(BuildConfig.VERSION_NAME) && !Version.isEmpty()) {
Version = msg.obj.toString().substring(0, msg.obj.toString().indexOf("|"));//截取版本号
Cache_link = msg.obj.toString().substring(msg.obj.toString().indexOf("|") + 1);
Log.i(BuildConfig.VERSION_NAME, Version + "和" + Cache_link);
if (!Version.equals(BuildConfig.VERSION_NAME) && !Version.isEmpty() && !Cache_link.isEmpty()) {
DialogPlus dialog = new DialogPlus(getActivity());
dialog.setMessage(R.string.Found_Update);
dialog.setLeftButtonText(R.string.download_home);
dialog.setLeftButtonListener((dlg, s) -> {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://netdisk.link/YGOMobile_" + Version + ".apk/links"));
intent.setData(Uri.parse(Cache_link));
startActivity(intent);
dialog.dismiss();
});
......@@ -174,7 +176,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
private void showNewsCounts() {
mTextBadgeItem = new TextBadgeItem()
.setBorderWidth(4)//文本大小
.setGravity(Gravity.LEFT )//位置 默认右上
.setGravity(Gravity.LEFT)//位置 默认右上
.setBackgroundColorResource(R.color.holo_orange_bright)//背景颜色
.setAnimationDuration(200)//动画时间
.setText("3")
......@@ -356,12 +358,12 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
message.what = TYPE_GET_VERSION_FAILED;
message.obj = e;
handlerHome.sendMessage(message);
Log.i(BuildConfig.VERSION_NAME, "error" + e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String json = response.body().string();
Log.i(BuildConfig.VERSION_NAME, json);
Message message = new Message();
message.what = TYPE_GET_VERSION_OK;
message.obj = json;
......
......@@ -749,7 +749,6 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
ll_new_notice.setVisibility(View.GONE);
Log.i("webCrawler", "webCrawler fail");
}).done((tmp) -> {
if (tmp != null) {
Log.i("webCrawler", "webCrawler done");
Intent intent = new Intent(getActivity(), ExCardActivity.class);
......@@ -765,7 +764,6 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
aurl = aurl + "#pre_update_title";
}
WebActivity.open(getContext(), getString(R.string.action_download_expansions), aurl);
ll_new_notice.setVisibility(View.GONE);
Log.i("webCrawler", "webCrawler cannot return ex-card data");
}
//关闭异常
......@@ -776,6 +774,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
} catch (Exception ex) {
}
}
ll_new_notice.setVisibility(View.GONE);
});
break;
......
......@@ -93,6 +93,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
private static final int TYPE_SETTING_GET_VERSION_FAILED = 1;
private AppsSettings mSettings;
public static String Version;
public static String Cache_link;
private boolean isInit = true;
public SettingFragment() {
......@@ -106,15 +107,16 @@ public class SettingFragment extends PreferenceFragmentPlus {
super.handleMessage(msg);
switch (msg.what) {
case TYPE_SETTING_GET_VERSION_OK:
Version = msg.obj.toString();
Log.i(BuildConfig.VERSION_NAME, Version);
if (!Version.equals(BuildConfig.VERSION_NAME) && !Version.isEmpty()) {
DialogPlus dialog = new DialogPlus(getContext());
Version = msg.obj.toString().substring(0, msg.obj.toString().indexOf("|"));//截取版本号
Cache_link = msg.obj.toString().substring(msg.obj.toString().indexOf("|") + 1);
Log.i(BuildConfig.VERSION_NAME, Version + "和" + Cache_link);
if (!Version.equals(BuildConfig.VERSION_NAME) && !Version.isEmpty() && !Cache_link.isEmpty()) {
DialogPlus dialog = new DialogPlus(getActivity());
dialog.setMessage(R.string.Found_Update);
dialog.setLeftButtonText(R.string.download_home);
dialog.setLeftButtonListener((dlg, s) -> {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://netdisk.link/YGOMobile_" + Version + ".apk/links"));
intent.setData(Uri.parse(Cache_link));
startActivity(intent);
dialog.dismiss();
});
......@@ -250,7 +252,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
mSettings.setDataLanguage(Integer.valueOf(listPreference.getValue()));
Log.i(BuildConfig.VERSION_NAME, mSettings.getDataLanguage() + preference.getKey() + listPreference.getValue());
Toast.makeText(getContext(), R.string.restart_app, Toast.LENGTH_LONG).show();
DataManager.get().load(true);
}
......@@ -287,12 +288,12 @@ public class SettingFragment extends PreferenceFragmentPlus {
message.what = TYPE_SETTING_GET_VERSION_FAILED;
message.obj = e;
handler.sendMessage(message);
Log.i(BuildConfig.VERSION_NAME, "error" + e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String json = response.body().string();
Log.i(BuildConfig.VERSION_NAME, json);
Message message = new Message();
message.what = TYPE_SETTING_GET_VERSION_OK;
message.obj = json;
......
......@@ -8,12 +8,6 @@
<!-- set the layout_height in the linear layout to “wrap_content”
so it doesn’t only show one TextView per page.-->
<!-- <LinearLayout
android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle">
</LinearLayout>-->
<ImageView
android:id="@+id/ex_card_image"
android:layout_width="@dimen/card_width_middle"
......@@ -49,7 +43,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:textSize="17sp" />
android:textSize="15sp" />
<View
android:id="@+id/view_bar"
......
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