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