Commit 9b0b2111 authored by JSY1728's avatar JSY1728 Committed by GitHub

Merge branch 'fallenstardust:master' into revert-71-patch-1

parents 4527a263 cb86a25c
...@@ -1412,7 +1412,7 @@ int32 card::get_old_union_count() { ...@@ -1412,7 +1412,7 @@ int32 card::get_old_union_count() {
void card::xyz_overlay(card_set* materials) { void card::xyz_overlay(card_set* materials) {
if(materials->size() == 0) if(materials->size() == 0)
return; return;
card_set des, leave_grave; card_set des, leave_grave, leave_deck;
field::card_vector cv; field::card_vector cv;
for(auto& pcard : *materials) for(auto& pcard : *materials)
cv.push_back(pcard); cv.push_back(pcard);
...@@ -1482,12 +1482,20 @@ void card::xyz_overlay(card_set* materials) { ...@@ -1482,12 +1482,20 @@ void card::xyz_overlay(card_set* materials) {
if(pcard->previous.location == LOCATION_GRAVE) { if(pcard->previous.location == LOCATION_GRAVE) {
leave_grave.insert(pcard); leave_grave.insert(pcard);
pduel->game_field->raise_single_event(pcard, 0, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, pcard->current.reason, pduel->game_field->core.reason_player, 0, 0); pduel->game_field->raise_single_event(pcard, 0, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, pcard->current.reason, pduel->game_field->core.reason_player, 0, 0);
} else if(pcard->previous.location == LOCATION_DECK || pcard->previous.location == LOCATION_EXTRA) {
leave_deck.insert(pcard);
pduel->game_field->raise_single_event(pcard, 0, EVENT_LEAVE_DECK, pduel->game_field->core.reason_effect, pcard->current.reason, pduel->game_field->core.reason_player, 0, 0);
} }
pduel->write_buffer32(pcard->get_info_location()); pduel->write_buffer32(pcard->get_info_location());
pduel->write_buffer32(pcard->current.reason); pduel->write_buffer32(pcard->current.reason);
} }
if(leave_grave.size()) { if(leave_grave.size() || leave_deck.size()) {
pduel->game_field->raise_event(&leave_grave, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0); if(leave_grave.size()) {
pduel->game_field->raise_event(&leave_grave, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
}
if(leave_deck.size()) {
pduel->game_field->raise_event(&leave_deck, EVENT_LEAVE_DECK, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
}
pduel->game_field->process_single_event(); pduel->game_field->process_single_event();
pduel->game_field->process_instant_event(); pduel->game_field->process_instant_event();
} }
......
...@@ -493,6 +493,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -493,6 +493,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EVENT_DESTROYED 1029 #define EVENT_DESTROYED 1029
#define EVENT_MOVE 1030 #define EVENT_MOVE 1030
#define EVENT_LEAVE_GRAVE 1031 #define EVENT_LEAVE_GRAVE 1031
#define EVENT_LEAVE_DECK 1032
#define EVENT_ADJUST 1040 #define EVENT_ADJUST 1040
#define EVENT_BREAK_EFFECT 1050 #define EVENT_BREAK_EFFECT 1050
#define EVENT_SUMMON_SUCCESS 1100 #define EVENT_SUMMON_SUCCESS 1100
......
...@@ -3798,7 +3798,7 @@ int32 field::send_replace(uint16 step, group * targets, card * target) { ...@@ -3798,7 +3798,7 @@ int32 field::send_replace(uint16 step, group * targets, card * target) {
int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
struct exargs { struct exargs {
group* targets; group* targets;
card_set leave_field, leave_grave, detach; card_set leave_field, leave_grave, leave_deck, detach;
bool show_decktop[2]; bool show_decktop[2];
card_vector cv; card_vector cv;
card_vector::iterator cvit; card_vector::iterator cvit;
...@@ -4083,6 +4083,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4083,6 +4083,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
param->leave_field.insert(pcard); param->leave_field.insert(pcard);
} else if(oloc == LOCATION_GRAVE) { } else if(oloc == LOCATION_GRAVE) {
param->leave_grave.insert(pcard); param->leave_grave.insert(pcard);
} else if(oloc == LOCATION_DECK || oloc == LOCATION_EXTRA) {
param->leave_deck.insert(pcard);
} }
if(pcard->previous.location == LOCATION_OVERLAY) if(pcard->previous.location == LOCATION_OVERLAY)
pcard->previous.controler = control_player; pcard->previous.controler = control_player;
...@@ -4190,6 +4192,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4190,6 +4192,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_single_event(pcard, 0, EVENT_LEAVE_FIELD, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_LEAVE_FIELD, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
for(auto& pcard : param->leave_grave) for(auto& pcard : param->leave_grave)
raise_single_event(pcard, 0, EVENT_LEAVE_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_LEAVE_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
for(auto& pcard : param->leave_deck)
raise_single_event(pcard, 0, EVENT_LEAVE_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) { if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) {
for(auto& pcard : param->detach) { for(auto& pcard : param->detach) {
if(pcard->current.location & LOCATION_MZONE) if(pcard->current.location & LOCATION_MZONE)
...@@ -4201,6 +4205,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4201,6 +4205,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_event(&param->leave_field, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0); raise_event(&param->leave_field, EVENT_LEAVE_FIELD, reason_effect, reason, reason_player, 0, 0);
if(param->leave_grave.size()) if(param->leave_grave.size())
raise_event(&param->leave_grave, EVENT_LEAVE_GRAVE, reason_effect, reason, reason_player, 0, 0); raise_event(&param->leave_grave, EVENT_LEAVE_GRAVE, reason_effect, reason, reason_player, 0, 0);
if(param->leave_deck.size())
raise_event(&param->leave_deck, EVENT_LEAVE_DECK, reason_effect, reason, reason_player, 0, 0);
if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size()) if((core.global_flag & GLOBALFLAG_DETACH_EVENT) && param->detach.size())
raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0); raise_event(&param->detach, EVENT_DETACH_MATERIAL, reason_effect, reason, reason_player, 0, 0);
process_instant_event(); process_instant_event();
...@@ -4674,6 +4680,9 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4674,6 +4680,9 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
if(target->previous.location == LOCATION_GRAVE) { if(target->previous.location == LOCATION_GRAVE) {
raise_single_event(target, 0, EVENT_LEAVE_GRAVE, target->current.reason_effect, target->current.reason, move_player, 0, 0); raise_single_event(target, 0, EVENT_LEAVE_GRAVE, target->current.reason_effect, target->current.reason, move_player, 0, 0);
raise_event(target, EVENT_LEAVE_GRAVE, target->current.reason_effect, target->current.reason, move_player, 0, 0); raise_event(target, EVENT_LEAVE_GRAVE, target->current.reason_effect, target->current.reason, move_player, 0, 0);
} else if(target->previous.location == LOCATION_DECK || target->previous.location == LOCATION_EXTRA) {
raise_single_event(target, 0, EVENT_LEAVE_DECK, target->current.reason_effect, target->current.reason, move_player, 0, 0);
raise_event(target, EVENT_LEAVE_DECK, target->current.reason_effect, target->current.reason, move_player, 0, 0);
} }
raise_single_event(target, 0, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0); raise_single_event(target, 0, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0);
raise_event(target, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0); raise_event(target, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0);
......
...@@ -6,6 +6,7 @@ import android.content.Context; ...@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.SoundPool; import android.media.SoundPool;
import android.util.Log;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -23,6 +24,7 @@ public abstract class GameApplication extends Application implements IrrlichtBri ...@@ -23,6 +24,7 @@ public abstract class GameApplication extends Application implements IrrlichtBri
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// Reflection.unseal(this); // Reflection.unseal(this);
Log.i("webCrwaler", "application");
} }
public static GameApplication get() { public static GameApplication get() {
......
...@@ -817,6 +817,7 @@ ...@@ -817,6 +817,7 @@
#setname 0x7a 圣 聖 #setname 0x7a 圣 聖
!setname 0x107a 圣骑士 聖騎士(せいきし) !setname 0x107a 圣骑士 聖騎士(せいきし)
!setname 0x207a 圣剑 聖剣(せいけん) !setname 0x207a 圣剑 聖剣(せいけん)
!setname 0x507a 焰圣骑士 焔聖騎士
!setname 0x7b 银河 ギャラクシー !setname 0x7b 银河 ギャラクシー
!setname 0x107b 银河眼 ギャラクシーアイズ !setname 0x107b 银河眼 ギャラクシーアイズ
!setname 0x307b 银河眼时空龙 ギャラクシーアイズ・タキオン・ドラゴン !setname 0x307b 银河眼时空龙 ギャラクシーアイズ・タキオン・ドラゴン
......
...@@ -813,6 +813,7 @@ ...@@ -813,6 +813,7 @@
!setname 0x7a Ignoble Knight !setname 0x7a Ignoble Knight
!setname 0x107a Noble Knight !setname 0x107a Noble Knight
!setname 0x207a Noble Arms !setname 0x207a Noble Arms
!setname 0x507a Infernoble Knight
!setname 0x7b Galaxy !setname 0x7b Galaxy
!setname 0x107b Galaxy-Eyes !setname 0x107b Galaxy-Eyes
!setname 0x307b Galaxy-Eyes Tachyon !setname 0x307b Galaxy-Eyes Tachyon
......
...@@ -739,9 +739,9 @@ ...@@ -739,9 +739,9 @@
!setname 0x41 LV(레벨) !setname 0x41 LV(레벨)
!setname 0x42 극성 !setname 0x42 극성
!setname 0x3042 극성천 !setname 0x3042 극성천
!setname 0x5042 극성보
!setname 0x6042 극성수 !setname 0x6042 극성수
!setname 0xa042 극성령 !setname 0xa042 극성령
!setname 0x5042 극성보
!setname 0x43 정크 !setname 0x43 정크
!setname 0x44 대행자 !setname 0x44 대행자
!setname 0x45 데몬 !setname 0x45 데몬
...@@ -759,8 +759,8 @@ ...@@ -759,8 +759,8 @@
#setname 0x4d N/A #setname 0x4d N/A
#setname 0x4e 에볼 #setname 0x4e 에볼
!setname 0x304e 에볼드 !setname 0x304e 에볼드
!setname 0x604e 에볼더
!setname 0x504e 에볼카이저 !setname 0x504e 에볼카이저
!setname 0x604e 에볼더
#setname 0x4f 버스터 #setname 0x4f 버스터
!setname 0x104f / 버스터 !setname 0x104f / 버스터
!setname 0x50 베놈 !setname 0x50 베놈
...@@ -817,6 +817,7 @@ ...@@ -817,6 +817,7 @@
#setname 0x7a 성(聖) #setname 0x7a 성(聖)
!setname 0x107a 성기사 !setname 0x107a 성기사
!setname 0x207a 성검 !setname 0x207a 성검
!setname 0x507a 불꽃성기사
!setname 0x7b 갤럭시 !setname 0x7b 갤럭시
!setname 0x107b 갤럭시아이즈 !setname 0x107b 갤럭시아이즈
!setname 0x307b 갤럭시아이즈 타키온 드래곤 !setname 0x307b 갤럭시아이즈 타키온 드래곤
......
...@@ -29,7 +29,7 @@ android { ...@@ -29,7 +29,7 @@ android {
} }
buildTypes { buildTypes {
debug { debug {
debuggable false debuggable true
buildConfigField 'boolean', 'DEBUG_MODE', 'true' buildConfigField 'boolean', 'DEBUG_MODE', 'true'
} }
release { release {
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
<!-- android:screenOrientation="landscape"--> <!-- android:screenOrientation="landscape"-->
<activity <activity
android:name="cn.garymb.ygomobile.ex_card.ExCardActivity" android:name="cn.garymb.ygomobile.ex_card.ExCardActivity2"
android:theme="@style/AppTheme.Mycard" android:theme="@style/AppTheme.Mycard"
android:launchMode="singleTop" android:launchMode="singleTop"
/> />
......
...@@ -162,6 +162,9 @@ public interface Constants { ...@@ -162,6 +162,9 @@ public interface Constants {
String URL_YGO233_DATAVER = "https://ygo233.com/pre/dataver"; String URL_YGO233_DATAVER = "https://ygo233.com/pre/dataver";
String URL_YGO233_FILE = "https://ygo233.com/pre/download-ygomobile"; String URL_YGO233_FILE = "https://ygo233.com/pre/download-ygomobile";
String URL_YGO233_FILE_ALT = "https://ygo233.com/pre/download-ygomobile/alt"; String URL_YGO233_FILE_ALT = "https://ygo233.com/pre/download-ygomobile/alt";
int PORT_YGO233 = 23333;
String URL_YGO233_1 = "s1.ygo233.com";
String URL_YGO233_2 = "s2.ygo233.com";
String SERVER_FILE = "server_list.xml"; String SERVER_FILE = "server_list.xml";
String SHARE_FILE = ".share_deck.png"; String SHARE_FILE = ".share_deck.png";
......
package cn.garymb.ygomobile.bean.events;
public class ExCardEvent {
public enum EventType {
exCardPackageChange,exCardPrefChange;
}
private EventType eventType;
public ExCardEvent(EventType eventType) {
this.eventType = eventType;
}
public EventType getType() {
return eventType;
}
public void setType(EventType eventType) {
this.eventType = eventType;
}
}
package cn.garymb.ygomobile.bean.events; package cn.garymb.ygomobile.bean.events;
import cn.garymb.ygomobile.bean.ServerInfo;
public class ServerInfoEvent { public class ServerInfoEvent {
public int position; public int position;
public ServerInfo serverInfo;//为了让接受event的HomeFragment能获取到当前server的端口号等信息,加入该属性
public boolean delete; public boolean delete;
public boolean join; public boolean join;
public ServerInfoEvent() { public ServerInfoEvent() {
} }
public ServerInfoEvent(int position, boolean delete) { public ServerInfoEvent(int position, boolean delete, ServerInfo serverInfo) {
this.position = position; this.position = position;
this.delete = delete; this.delete = delete;
this.serverInfo = serverInfo;
} }
} }
...@@ -3,21 +3,30 @@ package cn.garymb.ygomobile.ex_card; ...@@ -3,21 +3,30 @@ package cn.garymb.ygomobile.ex_card;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
/*
This class contains two information types:ex-card information and updating log, which is marked
by "type 0" and "type 1", respectively.
本类包括两种信息,先行卡信息和更新日志(分别对应type 0和type 1)。
*/
public class ExCard implements Parcelable { public class ExCard implements Parcelable {
private String name; private String name;
private String imageUrl; private String imageUrl;
private String description; private String description;
/* used to mark this object as ex-card(the value is 0) or updating log(the value is 1) */
private Integer type;
public ExCard(String name, String imageUrl, String description) { public ExCard(String name, String imageUrl, String description, Integer type) {
this.name = name; this.name = name;
this.imageUrl = imageUrl; this.imageUrl = imageUrl;
this.description = description; this.description = description;
this.type = type;
} }
protected ExCard(Parcel in) { protected ExCard(Parcel in) {
name = in.readString(); name = in.readString();
imageUrl = in.readString(); imageUrl = in.readString();
description = in.readString(); description = in.readString();
type = in.readInt();
} }
public static final Creator<ExCard> CREATOR = new Creator<ExCard>() { public static final Creator<ExCard> CREATOR = new Creator<ExCard>() {
...@@ -56,6 +65,17 @@ public class ExCard implements Parcelable { ...@@ -56,6 +65,17 @@ public class ExCard implements Parcelable {
this.description = description; this.description = description;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public boolean isUpdatingLog(){
return (type == 1);
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
...@@ -66,5 +86,6 @@ public class ExCard implements Parcelable { ...@@ -66,5 +86,6 @@ public class ExCard implements Parcelable {
dest.writeString(this.name); dest.writeString(this.name);
dest.writeString(this.imageUrl); dest.writeString(this.imageUrl);
dest.writeString(this.description); dest.writeString(this.description);
dest.writeInt(this.type);
} }
} }
package cn.garymb.ygomobile.ex_card;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import java.util.List;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.activities.BaseActivity;
public class ExCardActivity2 extends BaseActivity {
private Context context;
private Toolbar toolbar;
public static TabLayout tabLayout;
public static ViewPager viewPager;
private PackageTabAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ex_card2);
viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setOffscreenPageLimit(2);
tabLayout = (TabLayout) findViewById(R.id.packagetablayout);
createTabFragment();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i("webCrawler", "excard activity destroy");
}
private void createTabFragment() {
adapter = new PackageTabAdapter(getSupportFragmentManager(), tabLayout);
viewPager.setAdapter(adapter);
/* setupWithViewPager() is used to link the TabLayout to the ViewPager */
tabLayout.setupWithViewPager(viewPager);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
}
...@@ -2,40 +2,113 @@ package cn.garymb.ygomobile.ex_card; ...@@ -2,40 +2,113 @@ package cn.garymb.ygomobile.ex_card;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestBuilder;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.glide.GlideCompat; import cn.garymb.ygomobile.utils.glide.GlideCompat;
import cn.garymb.ygomobile.utils.glide.StringSignature;
public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> { public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> {
private ImageLoader imageLoader; private ImageLoader imageLoader;
public ExCardListAdapter(int layoutResId, List<ExCard> data) { public ExCardListAdapter(int layoutResId) {
super(layoutResId, data); super(layoutResId);
//use the imageLoader to load image from url }
imageLoader = new ImageLoader(true);
public void loadData() {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> {
String aurl = Constants.URL_YGO233_ADVANCE;
//Connect to the website
Document document = Jsoup.connect(aurl).get();
Element pre_card_content = document.getElementById("pre_release_cards");
Element tbody = pre_card_content.getElementsByTag("tbody").get(0);
Elements cards = tbody.getElementsByTag("tr");
if (cards.size() > 1000) {//Considering the efficiency of html parse, if the size of
// pre cards list is to large, return null directly.
return null;
}
ArrayList<ExCard> exCardList = new ArrayList<>();
for (Element card : cards) {
Elements card_attributes = card.getElementsByTag("td");
String imageUrl = card_attributes.get(0).getElementsByTag("a").attr("href");
String name = card_attributes.get(1).text();
String description = card_attributes.get(2).text();
ExCard exCard = new ExCard(name, imageUrl, description, 0);
exCardList.add(exCard);
}
if (exCardList.isEmpty()) {
return null;
} else {
return exCardList;
}
}).fail((e) -> {
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
//Log.i("webCrawler", "webCrawler fail");
}).done(exCardList -> {
if (exCardList != null) {
//Log.i("webCrawler", "webCrawler done");
getData().clear();
addData(exCardList);
notifyDataSetChanged();
}
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
});
} }
@Override @Override
protected void convert(BaseViewHolder helper, ExCard item) { protected void convert(BaseViewHolder helper, ExCard item) {
helper.setText(R.id.ex_card_name, item.getName()); helper.setText(R.id.ex_card_name, item.getName());
helper.setText(R.id.ex_card_description, item.getDescription()); helper.setText(R.id.ex_card_description, item.getDescription());
ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...) if (item.isUpdatingLog()) {
//cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...) helper.setGone(R.id.ex_card_image, true);
//is a private function,so I copied the content of it to here } else {
RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(item.getImageUrl()); helper.setGone(R.id.ex_card_image, false);
resource.placeholder(R.drawable.unknown); ImageView imageview = helper.getView(R.id.ex_card_image);
resource.error(R.drawable.unknown); //the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
resource.into(imageview); //cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...)
//is a private function,so I copied the content of it to here
RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(item.getImageUrl());
resource.placeholder(R.drawable.unknown);
resource.error(R.drawable.unknown);
resource.into(imageview);
}
} }
} }
...@@ -9,18 +9,27 @@ import android.annotation.SuppressLint; ...@@ -9,18 +9,27 @@ import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import org.greenrobot.eventbus.EventBus;
import androidx.annotation.Nullable; import org.greenrobot.eventbus.Subscribe;
import androidx.appcompat.widget.Toolbar; import org.greenrobot.eventbus.ThreadMode;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -33,16 +42,15 @@ import cn.garymb.ygomobile.AppsSettings; ...@@ -33,16 +42,15 @@ import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants; import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.ServerInfo; import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.bean.ServerList; import cn.garymb.ygomobile.bean.ServerList;
import cn.garymb.ygomobile.lite.BuildConfig; import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.activities.BaseActivity;
import cn.garymb.ygomobile.ui.activities.WebActivity;
import cn.garymb.ygomobile.ui.home.MainActivity; import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.ui.home.ServerListManager; import cn.garymb.ygomobile.ui.home.ServerListManager;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.DownloadUtil; import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils; import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil; import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.SystemUtils; import cn.garymb.ygomobile.utils.SystemUtils;
import cn.garymb.ygomobile.utils.UnzipUtils; import cn.garymb.ygomobile.utils.UnzipUtils;
...@@ -50,18 +58,95 @@ import cn.garymb.ygomobile.utils.XmlUtils; ...@@ -50,18 +58,95 @@ import cn.garymb.ygomobile.utils.XmlUtils;
import cn.garymb.ygomobile.utils.YGOUtil; import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.DataManager; import ocgcore.DataManager;
public class ExCardActivity extends BaseActivity {
private View layoutView; public class ExCardListFragment extends Fragment {
public static String dataVer; private Context context;
private String mTitle; private View layoutView;
private Button btn_download; private ExCardListAdapter mExCardListAdapter;
private RecyclerView mExCardListView;
private LinearLayout btnDownload;
private TextView textDownload;
private List<ServerInfo> serverInfos; private List<ServerInfo> serverInfos;
private ServerInfo mServerInfo; private ServerInfo mServerInfo;
private File xmlFile; private File xmlFile;
private int FailedCount; private int FailedCount;
/**
* 用于标志当前下载状态,用于防止用户多次重复点击“下载按钮”
* Mark the download state, which can prevent user from clicking the download button
* repeatedly.
*/
enum DownloadState {
DOWNLOAD_ING,
NO_DOWNLOAD;
}
private DownloadState downloadState;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
layoutView = inflater.inflate(R.layout.fragment_ex_card_list, container, false);
serverInfos = new ArrayList<>();
this.context = getContext();
xmlFile = new File(context.getFilesDir(), Constants.SERVER_FILE);//读取文件路径下的server_list.xml
initView(layoutView);
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
return layoutView;
}
@Override
public void onStop() {
super.onStop();
Log.i("webCrawler", "excard fragmetn on stop");
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
}
public void initView(View layoutView) {
mExCardListView = layoutView.findViewById(R.id.list_ex_card);
mExCardListAdapter = new ExCardListAdapter(R.layout.item_ex_card);
//RecyclerView: No layout manager attached; skipping layout
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
mExCardListView.setLayoutManager(linearLayoutManager);
mExCardListView.setAdapter(mExCardListAdapter);
mExCardListAdapter.loadData();
textDownload = layoutView.findViewById(R.id.text_download_prerelease);
btnDownload = layoutView.findViewById(R.id.btn_download_prerelease);
//TODO
btnDownload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (downloadState != DownloadState.DOWNLOAD_ING) {
downloadState = DownloadState.DOWNLOAD_ING;
downloadfromWeb(URL_YGO233_FILE);
}
}
});
changeDownloadText();
}
/**
* 根据先行卡包状态改变按钮样式
*/
public void changeDownloadText() {
if (ServerUtil.exCardState == ServerUtil.ExCardState.UPDATED) {
//btn_download展示默认视图
textDownload.setText(R.string.tip_redownload);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.NEED_UPDATE) {
textDownload.setText(R.string.action_download_expansions);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) {
Toast.makeText(getActivity(), "无法获取服务器先行卡信息", Toast.LENGTH_LONG).show();
}
}
//TODO eventbus receive event
@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
Handler handler = new Handler() { Handler handler = new Handler() {
...@@ -70,7 +155,7 @@ public class ExCardActivity extends BaseActivity { ...@@ -70,7 +155,7 @@ public class ExCardActivity extends BaseActivity {
super.handleMessage(msg); super.handleMessage(msg);
switch (msg.what) { switch (msg.what) {
case DownloadUtil.TYPE_DOWNLOAD_ING: case DownloadUtil.TYPE_DOWNLOAD_ING:
btn_download.setText(msg.arg1 + "%"); textDownload.setText(msg.arg1 + "%");
break; break;
case DownloadUtil.TYPE_DOWNLOAD_EXCEPTION: case DownloadUtil.TYPE_DOWNLOAD_EXCEPTION:
++FailedCount; ++FailedCount;
...@@ -81,18 +166,11 @@ public class ExCardActivity extends BaseActivity { ...@@ -81,18 +166,11 @@ public class ExCardActivity extends BaseActivity {
YGOUtil.show("error" + msg.obj); YGOUtil.show("error" + msg.obj);
break; break;
case UnzipUtils.ZIP_READY: case UnzipUtils.ZIP_READY:
btn_download.setText(R.string.title_use_ex); textDownload.setText(R.string.title_use_ex);
break; break;
case UnzipUtils.ZIP_UNZIP_OK: case UnzipUtils.ZIP_UNZIP_OK:
if (!AppsSettings.get().isReadExpansions()) {
Intent startSetting = new Intent(getContext(), MainActivity.class); /* 将先行服务器信息添加到服务器列表中 */
startSetting.putExtra("flag", 4);
startActivity(startSetting);
Toast.makeText(getContext(), R.string.ypk_go_setting, Toast.LENGTH_LONG).show();
} else {
DataManager.get().load(true);
Toast.makeText(getContext(), R.string.ypk_installed, Toast.LENGTH_LONG).show();
}
String servername = ""; String servername = "";
if (AppsSettings.get().getDataLanguage() == 0) if (AppsSettings.get().getDataLanguage() == 0)
servername = "23333先行服务器"; servername = "23333先行服务器";
...@@ -101,52 +179,66 @@ public class ExCardActivity extends BaseActivity { ...@@ -101,52 +179,66 @@ public class ExCardActivity extends BaseActivity {
if (AppsSettings.get().getDataLanguage() == 2) 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); //changeDownloadButton();在下载完成后,通过EventBus通知下载完成(加入用户点击下载后临时切出本fragment,又在下载完成后切回,通过eventbus能保证按钮样式正确更新
SharedPreferenceUtil.setExpansionDataVer(WebActivity.dataVer);
/* 注意,要先更新版本号 */
SharedPreferenceUtil.setExpansionDataVer(ServerUtil.serverExCardVersion);
ServerUtil.exCardState = ServerUtil.ExCardState.UPDATED;
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPackageChange));//安装后,通知UI做更新
DataManager.get().load(true);
Toast.makeText(context, R.string.ypk_installed, Toast.LENGTH_LONG).show();
Log.i("webCrawler", "Ex-card package is installed");
/* 如果未开启先行卡设置,则跳转到设置页面 */
if (!AppsSettings.get().isReadExpansions()) {//解压完毕,但此时
Log.i("webCrawler", "Ex-card setting is not opened");
Intent startSetting = new Intent(context, MainActivity.class);
startSetting.putExtra("flag", 4);
startActivity(startSetting);
Toast.makeText(context, R.string.ypk_go_setting, Toast.LENGTH_LONG).show();
}
break; break;
case UnzipUtils.ZIP_UNZIP_EXCEPTION: case UnzipUtils.ZIP_UNZIP_EXCEPTION:
Toast.makeText(getContext(), getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show(); Toast.makeText(context, getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show();
break; break;
// case HomeFragment.TYPE_GET_DATA_VER_OK:
// WebActivity.exCardVer = msg.obj.toString();
// String oldVer = SharedPreferenceUtil.getExpansionDataVer();
// if (!TextUtils.isEmpty(WebActivity.exCardVer)) {
// if (!WebActivity.exCardVer.equals(oldVer)) {
// //btn_download展示默认视图
// } else {
// btnDownload.setText(R.string.tip_redownload);
// }
// } else {
// showExNew();
// }
} }
} }
}; };
@Override /**
protected void onCreate(@Nullable Bundle savedInstanceState) { * @param event
super.onCreate(savedInstanceState); */
Log.i("webCrawler", "ExCardActivity onCreate"); @Subscribe(threadMode = ThreadMode.MAIN)
setContentView(R.layout.activity_ex_card); public void onMessageReceived(ExCardEvent event) {
if (event.getType() == ExCardEvent.EventType.exCardPackageChange) {
/* show the recyclerView */ changeDownloadText();
//get ex card data from intent }
List<ExCard> exCards = this.getIntent()
.getParcelableArrayListExtra("exCards");
ExCardListAdapter exCardListAdapter = new ExCardListAdapter(R.layout.item_ex_card, exCards);
RecyclerView exCardListView = (RecyclerView) findViewById(R.id.list_ex_cards);
exCardListView.setLayoutManager(new LinearLayoutManager(this));
exCardListView.setAdapter(exCardListAdapter);
final Toolbar toolbar = $(R.id.toolbar);
setSupportActionBar(toolbar);
enableBackHome();
serverInfos = new ArrayList<>();
xmlFile = new File(this.getFilesDir(), Constants.SERVER_FILE);
initButton();
}
public void initButton() {
btn_download = $(R.id.web_btn_download_prerelease);
btn_download.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
downloadfromWeb(URL_YGO233_FILE);
}
});
} }
/**
* 从资源文件serverlist.xml(或本地文件server_list.xml)解析服务器列表,并将新添加的服务器信息(name,addr,port)合并到服务器列表中。
*
* @param name
* @param Addr
* @param port
* @param playerName
*/
public void AddServer(String name, String Addr, int port, String playerName) { public void AddServer(String name, String Addr, int port, String playerName) {
mServerInfo = new ServerInfo(); mServerInfo = new ServerInfo();
mServerInfo.setName(name); mServerInfo.setName(name);
...@@ -154,7 +246,8 @@ public class ExCardActivity extends BaseActivity { ...@@ -154,7 +246,8 @@ public class ExCardActivity extends BaseActivity {
mServerInfo.setPort(port); mServerInfo.setPort(port);
mServerInfo.setPlayerName(playerName); mServerInfo.setPlayerName(playerName);
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
ServerList assetList = ServerListManager.readList(this.getAssets().open(ASSET_SERVER_LIST)); /* 读取本地文件server_list.xml和资源文件(assets)下的serverlist.xml,返回其中版本最新的 */
ServerList assetList = ServerListManager.readList(context.getAssets().open(ASSET_SERVER_LIST));//读取serverlist.xml文件
ServerList fileList = xmlFile.exists() ? ServerListManager.readList(new FileInputStream(xmlFile)) : null; ServerList fileList = xmlFile.exists() ? ServerListManager.readList(new FileInputStream(xmlFile)) : null;
if (fileList == null) { if (fileList == null) {
return assetList; return assetList;
...@@ -186,11 +279,14 @@ public class ExCardActivity extends BaseActivity { ...@@ -186,11 +279,14 @@ public class ExCardActivity extends BaseActivity {
}); });
} }
/**
* 将最新的服务器列表存储到本地文件server_list.xml中
*/
public void saveItems() { public void saveItems() {
OutputStream outputStream = null; OutputStream outputStream = null;
try { try {
outputStream = new FileOutputStream(xmlFile); outputStream = new FileOutputStream(xmlFile);
XmlUtils.get().saveXml(new ServerList(SystemUtils.getVersion(getContext()), serverInfos), outputStream); XmlUtils.get().saveXml(new ServerList(SystemUtils.getVersion(context), serverInfos), outputStream);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
...@@ -199,6 +295,7 @@ public class ExCardActivity extends BaseActivity { ...@@ -199,6 +295,7 @@ public class ExCardActivity extends BaseActivity {
} }
private void downloadfromWeb(String fileUrl) { private void downloadfromWeb(String fileUrl) {
textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉
File file = new File(AppsSettings.get().getResourcePath() + "-preRlease.zip"); File file = new File(AppsSettings.get().getResourcePath() + "-preRlease.zip");
if (file.exists()) { if (file.exists()) {
FileUtils.deleteFile(file); FileUtils.deleteFile(file);
...@@ -206,6 +303,7 @@ public class ExCardActivity extends BaseActivity { ...@@ -206,6 +303,7 @@ public class ExCardActivity extends BaseActivity {
DownloadUtil.get().download(fileUrl, file.getParent(), file.getName(), new DownloadUtil.OnDownloadListener() { DownloadUtil.get().download(fileUrl, file.getParent(), file.getName(), new DownloadUtil.OnDownloadListener() {
@Override @Override
public void onDownloadSuccess(File file) { public void onDownloadSuccess(File file) {
downloadState = DownloadState.NO_DOWNLOAD;
Message message = new Message(); Message message = new Message();
message.what = UnzipUtils.ZIP_READY; message.what = UnzipUtils.ZIP_READY;
try { try {
...@@ -219,7 +317,7 @@ public class ExCardActivity extends BaseActivity { ...@@ -219,7 +317,7 @@ public class ExCardActivity extends BaseActivity {
} catch (Exception e) { } catch (Exception e) {
message.what = UnzipUtils.ZIP_UNZIP_EXCEPTION; message.what = UnzipUtils.ZIP_UNZIP_EXCEPTION;
} finally { } finally {
message.what = UnzipUtils.ZIP_UNZIP_OK; message.what = UnzipUtils.ZIP_UNZIP_OK;//TODO 不对吧,finally是一定执行,这样即使有exception也会发unzip_ok啊
} }
handler.sendMessage(message); handler.sendMessage(message);
} }
...@@ -246,4 +344,5 @@ public class ExCardActivity extends BaseActivity { ...@@ -246,4 +344,5 @@ public class ExCardActivity extends BaseActivity {
} }
}
}
\ No newline at end of file
package cn.garymb.ygomobile.ex_card;
import android.content.Context;
import android.graphics.Typeface;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
public class ExCardLogAdapter extends BaseExpandableListAdapter {
public ExCardLogAdapter(Context context) {
this.context = context;
}
private Context context;
private List<ExCardLogItem> expandalbeList = new ArrayList<>();
public void setData(List<ExCardLogItem> expandalbeList) {
this.expandalbeList = expandalbeList;
}
@Override
public int getChildrenCount(int groupPosition) {
return this.expandalbeList.get(groupPosition).getCount();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return expandalbeList.get(groupPosition).getLogs().get(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
Object result = getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.item_log, null);
}
TextView expandedListTextView = (TextView) convertView
.findViewById(R.id.expandedListItem);
expandedListTextView.setText(expandalbeList.get(groupPosition).getLogs().get(childPosition));
return convertView;
}
@Override
public int getGroupCount() {
return this.expandalbeList.size();
}
@Override
public Object getGroup(int groupPosition) {
return this.expandalbeList.get(groupPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.context.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.item_log_group, null);
}
TextView listTitleTextView = (TextView) convertView
.findViewById(R.id.listTitle);
listTitleTextView.setText(expandalbeList.get(groupPosition).getDateTime());
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
@Override
public boolean hasStableIds() {
return false;
}
}
package cn.garymb.ygomobile.ex_card;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
public class ExCardLogFragment extends Fragment {
private View layoutView;
private ExCardLogAdapter mExCardLogAdapter;
private ExpandableListView mExCardLogView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
layoutView = inflater.inflate(R.layout.fragment_ex_card_log, container, false);
initView(layoutView);
loadData();
return layoutView;
}
public void initView(View layoutView) {
mExCardLogView = layoutView.findViewById(R.id.expandableListView);
mExCardLogAdapter = new ExCardLogAdapter(getContext());
mExCardLogView.setAdapter(mExCardLogAdapter);
}
public void loadData() {
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> {
String aurl = Constants.URL_YGO233_ADVANCE;
//Connect to the website
Document document = Jsoup.connect(aurl).get();
Element pre_update_log = document.getElementById("pre_update_log");
ArrayList<ExCardLogItem> exCardLogList = new ArrayList<>();
Elements cardLogElements = pre_update_log.select("ul[class=auto-generated]").get(0).getElementsByTag("li");
pre_update_log.getElementsByTag("ul");
for (Element cardLog : cardLogElements) {
String judgeData = cardLog.toString();
Pattern p = Pattern.compile("<li>\\d{4}");
boolean result = p.matcher(judgeData).find();
if (result) {
Elements logItems = cardLog.getElementsByTag("li");
List<String> logs = new ArrayList<>();
logItems.get(0).select("ul").remove();
String dateTime = logItems.get(0).text();
for (int i = 1; i < logItems.size(); i++) {
logs.add(logItems.get(i).text());
}
exCardLogList.add(new ExCardLogItem(logs.size(), dateTime, logs));
} else {
continue;
}
}
if (exCardLogList.isEmpty()) {
return null;
} else {
return exCardLogList;
}
}).fail((e) -> {
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
Log.i("webCrawler", "webCrawler fail");
}).done(exCardLogList -> {
mExCardLogAdapter.setData(exCardLogList);
mExCardLogAdapter.notifyDataSetChanged();
mExCardLogView.expandGroup(0);
mExCardLogView.expandGroup(1);
mExCardLogView.expandGroup(2);
if (exCardLogList != null) {
Log.i("webCrawler", "webCrawler parse html complete");
}
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
});
}
}
\ No newline at end of file
package cn.garymb.ygomobile.ex_card;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public class ExCardLogItem implements Parcelable {
private int count;
private String dateTime;
private List<String> logs;
public ExCardLogItem(int count, String dateTime, List<String> logs) {
this.count = count;
this.dateTime = dateTime;
this.logs = logs;
}
protected ExCardLogItem(Parcel in) {
count = in.readInt();
dateTime = in.readString();
logs = in.createStringArrayList();
}
public static final Creator<ExCardLogItem> CREATOR = new Creator<ExCardLogItem>() {
@Override
public ExCardLogItem createFromParcel(Parcel in) {
return new ExCardLogItem(in);
}
@Override
public ExCardLogItem[] newArray(int size) {
return new ExCardLogItem[size];
}
};
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public List<String> getLogs() {
return logs;
}
public void setLogs(List<String> logs) {
this.logs = logs;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(count);
dest.writeString(dateTime);
dest.writeStringList(logs);
}
}
package cn.garymb.ygomobile.ex_card;
import android.util.Log;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.google.android.material.tabs.TabLayout;
/**
* Tab的适配器,用来实现页面切换
*/
public class PackageTabAdapter extends FragmentStatePagerAdapter {
TabLayout tabLayout;
public PackageTabAdapter(FragmentManager fm, TabLayout _tabLayout) {
super(fm);
this.tabLayout = _tabLayout;
}
@Override
public Fragment getItem(int position) {
Fragment fragment = null;
if (position == 0)
{
fragment = new ExCardListFragment();//TODO
}
else if (position == 1)
{
fragment = new ExCardLogFragment();
}
return fragment;
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
String title = null;
if (position == 0)
{
title = "先行卡";//TODO
}
else if (position == 1)
{
title = "更新日志";
}
return title;
}
}
...@@ -50,7 +50,8 @@ import ocgcore.DataManager; ...@@ -50,7 +50,8 @@ import ocgcore.DataManager;
import ocgcore.data.Card; import ocgcore.data.Card;
public class WebActivity extends BaseActivity { public class WebActivity extends BaseActivity {
public static String dataVer; /* 全局存储了扩展卡版本号,会被其他activity使用 */
private static String exCardVer;
private WebViewPlus mWebViewPlus; private WebViewPlus mWebViewPlus;
private String mUrl; private String mUrl;
private String mTitle; private String mTitle;
...@@ -99,7 +100,7 @@ public class WebActivity extends BaseActivity { ...@@ -99,7 +100,7 @@ public class WebActivity extends BaseActivity {
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);
SharedPreferenceUtil.setExpansionDataVer(WebActivity.dataVer); SharedPreferenceUtil.setExpansionDataVer(WebActivity.exCardVer);
break; break;
case UnzipUtils.ZIP_UNZIP_EXCEPTION: case UnzipUtils.ZIP_UNZIP_EXCEPTION:
Toast.makeText(getContext(), getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show();
......
package cn.garymb.ygomobile.ui.adapters; package cn.garymb.ygomobile.ui.adapters;
import static cn.garymb.ygomobile.utils.BitmapUtil.getPaint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.graphics.Paint;
import android.net.Uri; import android.util.Log;
import android.os.Build;
import android.provider.Settings;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.transition.Visibility;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.tubb.smrv.SwipeHorizontalMenuLayout; import com.tubb.smrv.SwipeHorizontalMenuLayout;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.ServerInfo; import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.bean.events.ServerInfoEvent; import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.DialogPlus; import cn.garymb.ygomobile.utils.ServerUtil;
public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseViewHolder> { public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseViewHolder> {
public ServerListAdapter(Context context) { public ServerListAdapter(Context context) {
...@@ -64,25 +65,26 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV ...@@ -64,25 +65,26 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV
public void bindMenu() { public void bindMenu() {
addChildClickViewIds(R.id.smContentView, R.id.btn_edit_delete, R.id.btn_delete, R.id.iv_fond); addChildClickViewIds(R.id.smContentView, R.id.btn_edit_delete, R.id.btn_delete, R.id.iv_fond);
setOnItemChildClickListener((adapter, view, position) -> { setOnItemChildClickListener((adapter, view, position) -> {
ServerInfo serverInfo = (ServerInfo) adapter.getData().get(position);
switch (view.getId()) { switch (view.getId()) {
case R.id.smContentView: case R.id.smContentView:
ServerInfoEvent event = new ServerInfoEvent(position, false); ServerInfoEvent serverInfoEvent = new ServerInfoEvent(position, false, serverInfo);
event.join = true; serverInfoEvent.join = true;
EventBus.getDefault().post(event); EventBus.getDefault().post(serverInfoEvent);//在cn.garymb.ygomobile.ui.home.HomeFragment.onServerInfoEvent监听
SwipeHorizontalMenuLayout menuLayout = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout); SwipeHorizontalMenuLayout menuLayout = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout);
if (menuLayout.isMenuOpen()) { if (menuLayout.isMenuOpen()) {
menuLayout.smoothCloseMenu(); menuLayout.smoothCloseMenu();
} }
break; break;
case R.id.btn_edit_delete: case R.id.btn_edit_delete:
EventBus.getDefault().post(new ServerInfoEvent(position, false)); EventBus.getDefault().post(new ServerInfoEvent(position, false, serverInfo));
SwipeHorizontalMenuLayout menuLayout1 = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout); SwipeHorizontalMenuLayout menuLayout1 = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout);
if (menuLayout1.isMenuOpen()) { if (menuLayout1.isMenuOpen()) {
menuLayout1.smoothCloseMenu(); menuLayout1.smoothCloseMenu();
} }
break; break;
case R.id.btn_delete: case R.id.btn_delete:
EventBus.getDefault().post(new ServerInfoEvent(position, true)); EventBus.getDefault().post(new ServerInfoEvent(position, true, serverInfo));
SwipeHorizontalMenuLayout menuLayout2 = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout); SwipeHorizontalMenuLayout menuLayout2 = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout);
if (menuLayout2.isMenuOpen()) { if (menuLayout2.isMenuOpen()) {
...@@ -122,6 +124,19 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV ...@@ -122,6 +124,19 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV
} else { } else {
baseViewHolder.findView(R.id.iv_fond).setVisibility(View.GONE); baseViewHolder.findView(R.id.iv_fond).setVisibility(View.GONE);
} }
if (ServerUtil.isPreServer(serverInfo.getPort(), serverInfo.getServerAddr())) {
if (!AppsSettings.get().isReadExpansions() || ServerUtil.exCardState != ServerUtil.ExCardState.UPDATED) {
Paint paint = getPaint(0);
baseViewHolder.getView(R.id.swipe_layout).setLayerType(View.LAYER_TYPE_HARDWARE, paint);
} else {
Paint paint = getPaint(1);
baseViewHolder.getView(R.id.swipe_layout).setLayerType(View.LAYER_TYPE_HARDWARE, paint);
}
} else {//假设先行卡item在某个postion,将其设为灰色后,如果移动先行卡item,填充该位置的其他item仍是灰色,因此需要显式设置
Paint paint = getPaint(1);
baseViewHolder.getView(R.id.swipe_layout).setLayerType(View.LAYER_TYPE_HARDWARE, paint);
}
} }
} }
...@@ -39,6 +39,7 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus; ...@@ -39,6 +39,7 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.settings.SettingFragment; import cn.garymb.ygomobile.ui.settings.SettingFragment;
import cn.garymb.ygomobile.utils.OkhttpUtil; import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.ScreenUtil; import cn.garymb.ygomobile.utils.ScreenUtil;
import cn.garymb.ygomobile.utils.ServerUtil;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.Response; import okhttp3.Response;
...@@ -114,6 +115,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat ...@@ -114,6 +115,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
//showNewbieGuide("homePage"); //showNewbieGuide("homePage");
initBottomNavigationBar(); initBottomNavigationBar();
onNewIntent(getIntent()); onNewIntent(getIntent());
ServerUtil.initExCardState();//检查扩展卡版本
} }
@Override @Override
......
package cn.garymb.ygomobile.ui.home; package cn.garymb.ygomobile.ui.home;
import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST; import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
...@@ -42,10 +41,6 @@ import com.tubb.smrv.SwipeMenuRecyclerView; ...@@ -42,10 +41,6 @@ import com.tubb.smrv.SwipeMenuRecyclerView;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -63,9 +58,8 @@ import cn.garymb.ygomobile.bean.Deck; ...@@ -63,9 +58,8 @@ import cn.garymb.ygomobile.bean.Deck;
import cn.garymb.ygomobile.bean.ServerInfo; import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.bean.ServerList; import cn.garymb.ygomobile.bean.ServerList;
import cn.garymb.ygomobile.bean.events.ServerInfoEvent; import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.ex_card.ExCard; import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.ex_card.ExCardActivity; import cn.garymb.ygomobile.ex_card.ExCardActivity2;
import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.activities.WebActivity; import cn.garymb.ygomobile.ui.activities.WebActivity;
...@@ -80,15 +74,11 @@ import cn.garymb.ygomobile.ui.plus.VUiKit; ...@@ -80,15 +74,11 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.ui.widget.Shimmer; import cn.garymb.ygomobile.ui.widget.Shimmer;
import cn.garymb.ygomobile.ui.widget.ShimmerTextView; import cn.garymb.ygomobile.ui.widget.ShimmerTextView;
import cn.garymb.ygomobile.utils.FileLogUtil; import cn.garymb.ygomobile.utils.FileLogUtil;
import cn.garymb.ygomobile.utils.OkhttpUtil; import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.YGOUtil; import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.CardManager; import ocgcore.CardManager;
import ocgcore.DataManager; import ocgcore.DataManager;
import ocgcore.data.Card; import ocgcore.data.Card;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListener, View.OnClickListener { public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListener, View.OnClickListener {
...@@ -98,7 +88,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -98,7 +88,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private static final int TYPE_BANNER_QUERY_OK = 0; private static final int TYPE_BANNER_QUERY_OK = 0;
private static final int TYPE_BANNER_QUERY_EXCEPTION = 1; private static final int TYPE_BANNER_QUERY_EXCEPTION = 1;
private static final int TYPE_RES_LOADING_OK = 2; private static final int TYPE_RES_LOADING_OK = 2;
private static final int TYPE_GET_DATA_VER_OK = 3; public static final int TYPE_GET_DATA_VER_OK = 3;
private static final String ARG_MC_NEWS_LIST = "mcNewsList"; private static final String ARG_MC_NEWS_LIST = "mcNewsList";
private boolean isMcNewsLoadException = false; private boolean isMcNewsLoadException = false;
...@@ -150,7 +140,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -150,7 +140,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
if (!EventBus.getDefault().isRegistered(this)) {//加上判断 if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
} }
showExNew(); changeColor();
//showNewbieGuide("homePage"); //showNewbieGuide("homePage");
return layoutView; return layoutView;
} }
...@@ -273,44 +263,47 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -273,44 +263,47 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
tv_banner_loading.setText(R.string.loading_failed); tv_banner_loading.setText(R.string.loading_failed);
isMcNewsLoadException = true; isMcNewsLoadException = true;
break; break;
case TYPE_GET_DATA_VER_OK:
WebActivity.dataVer = msg.obj.toString();
String oldVer = SharedPreferenceUtil.getExpansionDataVer();
if (!TextUtils.isEmpty(WebActivity.dataVer)) {
if (!WebActivity.dataVer.equals(oldVer)) {
ll_new_notice.setVisibility(View.VISIBLE);
} else {
ll_new_notice.setVisibility(View.GONE);
}
} else {
showExNew();
ll_new_notice.setVisibility(View.GONE);
}
} }
} }
}; };
public void showExNew() {
if (AppsSettings.get().isReadExpansions()) {
OkhttpUtil.get(URL_YGO233_DATAVER, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.i(BuildConfig.VERSION_NAME, "error" + e);
}
@Override /**
public void onResponse(Call call, Response response) throws IOException { * 通过http访问web读取先行卡版本号。
String json = response.body().string(); * 读取结果通过handler发到ui线程
Message message = new Message(); * 注意在ExCardActivity中包含一个相同实现
message.what = TYPE_GET_DATA_VER_OK; * ServerUtil获取到版本状态后会通过eventmessage通知调用本函数,不需要在主函数显式调用
message.obj = json; */
handler.sendMessage(message); public void changeExCardNewMark() {
} Log.i("webCrawler", "check excard new mark, version:" + ServerUtil.exCardState);
}); if (ServerUtil.exCardState == ServerUtil.ExCardState.UPDATED) {
ll_new_notice.setVisibility(View.GONE);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.NEED_UPDATE) {
ll_new_notice.setVisibility(View.VISIBLE);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) {
Toast.makeText(getActivity(), "无法获取服务器先行卡信息", Toast.LENGTH_SHORT).show();
ll_new_notice.setVisibility(View.GONE);
} }
} }
private void changeColor() {
/* 同步设置服务器列表的状态,在syncLoadData()里更新recyclerview的数据,在更新数据时convert()方法自动更改item的颜色 */
mServerListManager.syncLoadData();
/* 改变“扩展卡下载”按钮的颜色 */
// if (AppsSettings.get().isReadExpansions()) {
// Paint paint = getPaint(1);
// cv_download_ex.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
// } else {
// Paint paint = getPaint(0);
// cv_download_ex.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
// }
}
private void findMcNews() { private void findMcNews() {
isMcNewsLoadException = false; isMcNewsLoadException = false;
tv_banner_loading.setVisibility(View.VISIBLE); tv_banner_loading.setVisibility(View.VISIBLE);
...@@ -572,6 +565,18 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -572,6 +565,18 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
return Util.isContextExisted(getActivity()); return Util.isContextExisted(getActivity());
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(ExCardEvent event) {
if (event.getType() == ExCardEvent.EventType.exCardPackageChange) {
changeExCardNewMark();
changeColor();
} else if (event.getType() == ExCardEvent.EventType.exCardPrefChange) {
/* 可以设置在不开启扩展卡的情况下“扩展卡下载”图标是否显示为灰色 */
changeColor();
}
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onServerInfoEvent(ServerInfoEvent event) { public void onServerInfoEvent(ServerInfoEvent event) {
if (event.delete) { if (event.delete) {
...@@ -588,11 +593,22 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -588,11 +593,22 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
dialogPlus.setOnCloseLinster(null); dialogPlus.setOnCloseLinster(null);
dialogPlus.show(); dialogPlus.show();
} else if (event.join) { } else if (event.join) {
joinRoom(event.position); if (ServerUtil.isPreServer(event.serverInfo.getPort(), event.serverInfo.getServerAddr())) {
joinRoom(event.position);
//如果是先行卡服务器,并且未开启先行卡设置,则通过toast提示
if (!AppsSettings.get().isReadExpansions()) {
Toast.makeText(getActivity(), R.string.ypk_go_setting, Toast.LENGTH_LONG).show();
} else if (ServerUtil.exCardState != ServerUtil.ExCardState.UPDATED) {
//如果是先行卡服务器,并且未开启下载先行卡,则通过toast提示
Toast.makeText(getActivity(), R.string.ex_card_check_toast_message, Toast.LENGTH_LONG).show();
}
}
//showNewbieGuide("joinRoom"); //showNewbieGuide("joinRoom");
} else { } else {
mServerListManager.showEditDialog(event.position); mServerListManager.showEditDialog(event.position);
} }
} }
public void setRandomCardDetail() { public void setRandomCardDetail() {
...@@ -701,82 +717,13 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene ...@@ -701,82 +717,13 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
YGOStarter.startGame(getActivity(), null, "-k", "-s"); YGOStarter.startGame(getActivity(), null, "-k", "-s");
break; break;
case R.id.action_download_ex: case R.id.action_download_ex:
//using Web crawler to extract the information of pre card // if (!AppsSettings.get().isReadExpansions()) {//如果未开启扩展卡设置,直接跳过
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card)); // Toast.makeText(getActivity(), R.string.ypk_go_setting, Toast.LENGTH_LONG).show();
VUiKit.defer().when(() -> { // break;
String aurl = Constants.URL_YGO233_ADVANCE; // }
//Connect to the website /* using Web crawler to extract the information of pre card */
Document document = Jsoup.connect(aurl).get(); Intent exCardIntent = new Intent(getActivity(), ExCardActivity2.class);
Element pre_card_content = document.getElementById("pre_release_cards"); startActivity(exCardIntent);
Element tbody = pre_card_content.getElementsByTag("tbody").get(0);
Elements cards = tbody.getElementsByTag("tr");
if (cards.size() > 300) {//Considering the efficiency of html parse, if the size of
// pre cards list is to large, return null directly.
return null;
}
ArrayList<ExCard> exCards = new ArrayList<>();
for (Element card : cards) {
Elements card_attributes = card.getElementsByTag("td");
String imageUrl = card_attributes.get(0).getElementsByTag("a").attr("href");
String name = card_attributes.get(1).text();
String description = card_attributes.get(2).text();
ExCard exCard = new ExCard(name, imageUrl, description);
exCards.add(exCard);
}
Log.i("webCrawler", exCards.toString());
if (exCards.isEmpty()) {
return null;
} else {
return exCards;
}
}).fail((e) -> {
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
} catch (Exception ex) {
}
}
//If the crawler process failed, open webActivity
String aurl = Constants.URL_YGO233_ADVANCE;
if (ll_new_notice.getVisibility() == View.VISIBLE) {
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 fail");
}).done((tmp) -> {
if (tmp != null) {
Log.i("webCrawler", "webCrawler done");
Intent intent = new Intent(getActivity(), ExCardActivity.class);
//intent.putExtra("exCards", tmp);
intent.putParcelableArrayListExtra("exCards", tmp);
startActivity(intent);
} else {
//If the crawler process cannot return right ex-card data,
//open webActivity
String aurl = Constants.URL_YGO233_ADVANCE;
if (ll_new_notice.getVisibility() == View.VISIBLE) {
aurl = aurl + "#pre_update_title";
}
WebActivity.open(getContext(), getString(R.string.action_download_expansions), aurl);
Log.i("webCrawler", "webCrawler cannot return ex-card data");
}
//关闭异常
if (dialog_read_ex.isShowing()) {
try {
dialog_read_ex.dismiss();
Log.i("webCrawler", "dialog close");
} catch (Exception ex) {
}
}
ll_new_notice.setVisibility(View.GONE);
});
break; break;
case R.id.action_help: { case R.id.action_help: {
final DialogPlus dialog = new DialogPlus(getContext()); final DialogPlus dialog = new DialogPlus(getContext());
......
...@@ -44,8 +44,8 @@ public class ServerListManager { ...@@ -44,8 +44,8 @@ public class ServerListManager {
public void syncLoadData() { public void syncLoadData() {
VUiKit.defer().when(() -> { VUiKit.defer().when(() -> {
ServerList assetList = readList(getContext().getAssets().open(ASSET_SERVER_LIST)); ServerList assetList = readList(getContext().getAssets().open(ASSET_SERVER_LIST));//程序asset文件夹下的serverlist.xml
ServerList fileList = xmlFile.exists() ? readList(new FileInputStream(xmlFile)) : null; ServerList fileList = xmlFile.exists() ? readList(new FileInputStream(xmlFile)) : null;//文件系统中的server-list.xml
if (fileList == null) { if (fileList == null) {
return assetList; return assetList;
} }
......
...@@ -419,7 +419,11 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener ...@@ -419,7 +419,11 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
tv_message.setText(R.string.logining_failed); tv_message.setText(R.string.logining_failed);
HandlerUtil.sendMessage(handler, TYPE_MC_LOGIN_FAILED, exception); HandlerUtil.sendMessage(handler, TYPE_MC_LOGIN_FAILED, exception);
serviceManagement.setIsListener(false); serviceManagement.setIsListener(false);
YGOUtil.show(getString(R.string.failed_reason) + exception); if(exception.endsWith("not-authorized")) {//如果弹这个exception基本上是账号没验证邮箱
YGOUtil.show(getString(R.string.notice_verify_email));
} else {
YGOUtil.show(getString(R.string.failed_reason) + exception);
}
} }
} }
......
...@@ -63,6 +63,8 @@ import android.widget.Toast; ...@@ -63,6 +63,8 @@ import android.widget.Toast;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.signature.MediaStoreSignature; import com.bumptech.glide.signature.MediaStoreSignature;
import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
...@@ -72,6 +74,7 @@ import java.util.List; ...@@ -72,6 +74,7 @@ import java.util.List;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants; import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.BuildConfig; import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter; import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter;
...@@ -81,6 +84,8 @@ import cn.garymb.ygomobile.ui.plus.VUiKit; ...@@ -81,6 +84,8 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.FileUtils; import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.OkhttpUtil; import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.SystemUtils; import cn.garymb.ygomobile.utils.SystemUtils;
import cn.garymb.ygomobile.utils.glide.GlideCompat; import cn.garymb.ygomobile.utils.glide.GlideCompat;
import ocgcore.DataManager; import ocgcore.DataManager;
...@@ -165,7 +170,6 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -165,7 +170,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
bind(PREF_DEL_EX, getString(R.string.about_delete_ex)); bind(PREF_DEL_EX, getString(R.string.about_delete_ex));
bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用"); bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用");
bind(PREF_WINDOW_TOP_BOTTOM, "" + mSettings.getScreenPadding()); bind(PREF_WINDOW_TOP_BOTTOM, "" + mSettings.getScreenPadding());
bind(PREF_DATA_LANGUAGE, "" + mSettings.getDataLanguage());
Preference preference = findPreference(PREF_READ_EX); Preference preference = findPreference(PREF_READ_EX);
if (preference != null) { if (preference != null) {
preference.setSummary(mSettings.getExpansionsPath().getAbsolutePath()); preference.setSummary(mSettings.getExpansionsPath().getAbsolutePath());
...@@ -215,6 +219,8 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -215,6 +219,8 @@ public class SettingFragment extends PreferenceFragmentPlus {
if (preference.getKey().equals(PREF_READ_EX)) { if (preference.getKey().equals(PREF_READ_EX)) {
//设置使用额外卡库后重新加载卡片数据 //设置使用额外卡库后重新加载卡片数据
DataManager.get().load(true); DataManager.get().load(true);
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPrefChange));
//ServerUtil.initExCardState();
} }
//开关决斗助手 //开关决斗助手
if (preference.getKey().equals(PREF_START_SERVICEDUELASSISTANT)) { if (preference.getKey().equals(PREF_START_SERVICEDUELASSISTANT)) {
...@@ -288,6 +294,7 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -288,6 +294,7 @@ 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
...@@ -317,6 +324,7 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -317,6 +324,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
ListView listView = dialog.bind(R.id.room_list); ListView listView = dialog.bind(R.id.room_list);
listView.setAdapter(simpleListAdapter); listView.setAdapter(simpleListAdapter);
listView.setOnItemLongClickListener((a, v, i, index) -> { listView.setOnItemLongClickListener((a, v, i, index) -> {
/* 删除先行卡 */
String name = simpleListAdapter.getItemById(index); String name = simpleListAdapter.getItemById(index);
int pos = simpleListAdapter.findItem(name); int pos = simpleListAdapter.findItem(name);
if (pos >= 0) { if (pos >= 0) {
...@@ -325,6 +333,9 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -325,6 +333,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
FileUtils.delFile(mSettings.getExpansionsPath().getAbsolutePath() + "/" + name); FileUtils.delFile(mSettings.getExpansionsPath().getAbsolutePath() + "/" + name);
DataManager.get().load(true); DataManager.get().load(true);
Toast.makeText(getContext(), R.string.done, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.done, Toast.LENGTH_LONG).show();
SharedPreferenceUtil.setExpansionDataVer(null);//删除先行卡后,更新版本状态
ServerUtil.exCardState = ServerUtil.ExCardState.NEED_UPDATE;
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPackageChange));//删除后,通知UI做更新
} }
return true; return true;
}); });
......
...@@ -6,6 +6,8 @@ import android.content.res.Resources; ...@@ -6,6 +6,8 @@ import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
...@@ -224,4 +226,12 @@ public class BitmapUtil { ...@@ -224,4 +226,12 @@ public class BitmapUtil {
return bitmap; return bitmap;
} }
public static Paint getPaint(int saturation){
Paint mPaint = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(saturation);
mPaint.setColorFilter(new ColorMatrixColorFilter(cm));
return mPaint;
}
} }
package cn.garymb.ygomobile.utils;
import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER;
import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE_ALT;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import org.greenrobot.eventbus.EventBus;
import java.io.IOException;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.BuildConfig;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class ServerUtil {
public enum ExCardState {
/* 已安装最新版扩展卡,扩展卡不是最新版本,无法查询到服务器版本 */
UPDATED, NEED_UPDATE, ERROR;
}
/* 存储了当前先行卡是否需要更新的状态,UI逻辑直接读取该变量就能获知是否已安装先行卡 */
public volatile static ExCardState exCardState = ExCardState.ERROR;//TODO 可能有并发问题
public volatile static String serverExCardVersion = "";
private volatile static int failCounter = 0;
/**
* 在可能更改先行卡状态的操作后调用,
* 删除先行卡时入参为null,
* 安装先行卡时入参为版本号
*
*/
// ++FailedCount;
// if (FailedCount <= 2) {
// Toast.makeText(getActivity(), R.string.Ask_to_Change_Other_Way, Toast.LENGTH_SHORT).show();
// downloadfromWeb(URL_YGO233_FILE_ALT);
// }
/**
* 初始化本地先行卡版本的状态,
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
*/
public static void initExCardState() {
String oldVer = SharedPreferenceUtil.getExpansionDataVer();
Log.i("webCrawler", "server util, old pre-card version:" + oldVer);
OkhttpUtil.get(URL_YGO233_DATAVER, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
exCardState = ExCardState.ERROR;
serverExCardVersion = "";
Log.i(BuildConfig.VERSION_NAME, "error" + e);
Log.i("webCrawler", "network failed, pre-card version:" + exCardState);
if (failCounter < 3) {
Log.i("webCrawler", "network failed, retry fetch pre-card version:");
failCounter++;
initExCardState();
}
}
@Override
public void onResponse(Call call, Response response) throws IOException {
failCounter = 0;//充值计数器
String newVer = response.body().string();
serverExCardVersion = newVer;
Log.i("webCrawler", "ServerUtil fetch pre-card version:" + newVer);
if (!TextUtils.isEmpty(newVer)) {
if (!newVer.equals(oldVer)) {//如果oldVer为null,也会触发
exCardState = ExCardState.NEED_UPDATE;
} else {
exCardState = ExCardState.UPDATED;
}
} else {
exCardState = ExCardState.ERROR;
}
/* 通知homeFragment更新图标 */
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPackageChange));
}
});
}
public static boolean isPreServer(int port, String addr) {
if ((port == Constants.PORT_YGO233 && addr.equals(Constants.URL_YGO233_1)) ||
(port == Constants.PORT_YGO233 && addr.equals(Constants.URL_YGO233_2))) {
return true;
} else {
return false;
}
}
}
package ocgcore; package ocgcore;
import android.util.Log;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.loader.CardLoader; import cn.garymb.ygomobile.loader.CardLoader;
...@@ -45,6 +47,8 @@ public class DataManager { ...@@ -45,6 +47,8 @@ public class DataManager {
private boolean mInit; private boolean mInit;
public void load(boolean force) { public void load(boolean force) {
//Log.i("webCrawler", "DataManager load data");
boolean needLoad = false; boolean needLoad = false;
synchronized (this) { synchronized (this) {
if (!mInit || force) { if (!mInit || force) {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:background="@drawable/bg3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa000000" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_cards"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:divider="@android:color/transparent"
android:dividerHeight="4dp" <com.google.android.material.tabs.TabLayout
android:padding="5dp" android:layout_width="match_parent"
android:scrollbars="vertical" /> android:layout_height="wrap_content"/>
</LinearLayout> <ExpandableListView
android:id="@+id/expandableListView"
<LinearLayout android:layout_width="match_parent"
android:id="@+id/web_btn_bar" android:layout_height="wrap_content"
android:layout_width="match_parent" android:divider="@android:color/darker_gray"
android:layout_height="wrap_content" android:dividerHeight="0.5dp"
android:layout_gravity="bottom" android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft" />
android:orientation="horizontal">
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_cards"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical" />
</androidx.viewpager.widget.ViewPager>
<Button <Button
android:id="@+id/web_btn_download_prerelease" android:id="@+id/web_btn_download_prerelease"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/button_bg" android:background="@drawable/button_bg"
android:text="@string/Download" /> android:text="@string/Download" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_item_bg">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:paddingBottom="5dp"
app:elevation="0dp">
<com.google.android.material.tabs.TabLayout
android:id="@+id/packagetablayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:tabGravity="fill"
app:tabMode="scrollable"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_ex_card"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical" />
<LinearLayout
android:id="@+id/btn_download_prerelease"
android:focusableInTouchMode="true"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginRight="20dp"
android:layout_marginBottom="70dp"
android:orientation="vertical"
android:padding="20dp">
<Button
android:clickable="false"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:background="@drawable/downloadimages"
/>
<TextView
android:clickable="false"
android:id="@+id/text_download_prerelease"
android:layout_width="60dp"
android:layout_height="30dp"
android:background="@drawable/radius"
android:gravity="center"
android:textAlignment="center"
android:textSize="10sp"
android:textColor="@color/gold"
/>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@android:color/darker_gray"
android:dividerHeight="0.5dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft" />
</FrameLayout>
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
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"
android:layout_height="@dimen/card_height_middle" android:layout_height="@dimen/card_height_middle"
android:layout_centerInParent="true" android:paddingTop="5dp"
android:layout_gravity="center_vertical"
android:scaleType="fitXY" android:scaleType="fitXY"
android:paddingRight="10dp"
tools:src="@drawable/unknown" /> tools:src="@drawable/unknown" />
<LinearLayout <LinearLayout
...@@ -34,7 +32,8 @@ ...@@ -34,7 +32,8 @@
android:shadowRadius="2" android:shadowRadius="2"
android:singleLine="true" android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title" android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/item_title" android:textColor="@color/brightgreen"
android:padding="20dp"
android:textSize="15sp" android:textSize="15sp"
tools:text="Card Name" /> tools:text="Card Name" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/expandedListItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:textSize="12dp"
android:textStyle="normal"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/listTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textSize="15sp"
android:textColor="@color/brightgreen"
/>
</LinearLayout>
...@@ -38,7 +38,10 @@ ...@@ -38,7 +38,10 @@
<string name="quit_tip">앱을 종료하겠습니까?</string> <string name="quit_tip">앱을 종료하겠습니까?</string>
<string name="back_tip">뒤로가기 키를 한번 더 누르시면 앱이 종료됩니다</string> <string name="back_tip">뒤로가기 키를 한번 더 누르시면 앱이 종료됩니다</string>
<string name="string_help_text">현재 앱에 필요한 권한이 없습니다. \n설정 - 권한 - 필요한 권한 얻기를 터치하십시오.</string> <string name="string_help_text">현재 앱에 필요한 권한이 없습니다. \n설정 - 권한 - 필요한 권한 얻기를 터치하십시오.</string>
<string name="fetch_ex_card">확장 카드 불러오는 중</string> <string name="fetch_ex_card">Fetching pre-cards via web</string>
<string name="ex_card_log_title">update log</string>
<string name="ex_card_check_toast_message">To use it, We recommend you to download the pre-card setting in the pre-card download page unless you have installed pre-card in another way.</string>
<!-- settings --> <!-- settings -->
<string name="settings_about">정보</string> <string name="settings_about">정보</string>
<string name="settings_about_sub_about">정보</string> <string name="settings_about_sub_about">정보</string>
...@@ -213,6 +216,7 @@ ...@@ -213,6 +216,7 @@
<string name="logining_in">로그인 중입니다. 잠시 기다려주십시오...</string> <string name="logining_in">로그인 중입니다. 잠시 기다려주십시오...</string>
<string name="logining_failed">로그인 실패했습니다. 다시 시도하십시오.</string> <string name="logining_failed">로그인 실패했습니다. 다시 시도하십시오.</string>
<string name="failed_reason">해당 이유로 로그인 실패했습니다.</string> <string name="failed_reason">해당 이유로 로그인 실패했습니다.</string>
<string name="notice_verify_email">only email verified account can login in Chatroom</string>
<string name="send">보내기</string> <string name="send">보내기</string>
<string name="mc_home"></string> <string name="mc_home"></string>
<string name="bbs">커뮤니티</string> <string name="bbs">커뮤니티</string>
...@@ -297,7 +301,8 @@ ...@@ -297,7 +301,8 @@
<string name="tip_return_to_duel">현재 게임으로 돌아왔습니다</string> <string name="tip_return_to_duel">현재 게임으로 돌아왔습니다</string>
<string name="my_favorites">즐겨 찾기★</string> <string name="my_favorites">즐겨 찾기★</string>
<string name="ypk_installed">확장 카드 팩 파일이 설치되었습니다</string> <string name="ypk_installed">확장 카드 팩 파일이 설치되었습니다</string>
<string name="ypk_go_setting">확장 카드 팩을 사용하려면 확장 카드 팩이 활성화되어 있어야합니다</string> <!--<string name="ypk_go_setting">확장 카드 팩을 사용하려면 확장 카드 팩이 활성화되어 있어야합니다</string>-->
<string name="ypk_go_setting">To use it, We recommend you to check \"Use Expansions\" unless you have installed pre-card in another way</string>
<string name="ypk_delete">해당 이름을 길게 눌러 삭제합니다e</string> <string name="ypk_delete">해당 이름을 길게 눌러 삭제합니다e</string>
<string name="install_failed_bcos">설치에 실패했습니다. 이유:</string> <string name="install_failed_bcos">설치에 실패했습니다. 이유:</string>
<string name="deck_back_up">백업</string> <string name="deck_back_up">백업</string>
......
...@@ -38,7 +38,10 @@ ...@@ -38,7 +38,10 @@
<string name="quit_tip">退出游戏?</string> <string name="quit_tip">退出游戏?</string>
<string name="back_tip">请再按一次返回键退出</string> <string name="back_tip">请再按一次返回键退出</string>
<string name="string_help_text">当前应用缺少必要权限。\n请点击 设置-权限 打开所需权限。</string> <string name="string_help_text">当前应用缺少必要权限。\n请点击 设置-权限 打开所需权限。</string>
<string name="fetch_ex_card">读取先行卡</string> <string name="fetch_ex_card">通过网络获取先行卡</string>
<string name="ex_card_log_title">更新日志</string>
<string name="ex_card_check_toast_message">检测到未下载扩展卡,如果未通过其他途径安装扩展卡,建议在扩展卡页面下载</string>
<!-- settings --> <!-- settings -->
<string name="settings_about">关于</string> <string name="settings_about">关于</string>
<string name="settings_about_sub_about">关于</string> <string name="settings_about_sub_about">关于</string>
...@@ -213,6 +216,7 @@ ...@@ -213,6 +216,7 @@
<string name="logining_in">登录中,请稍候...</string> <string name="logining_in">登录中,请稍候...</string>
<string name="logining_failed">登陆失败,请点击重试</string> <string name="logining_failed">登陆失败,请点击重试</string>
<string name="failed_reason">登录失败,原因是</string> <string name="failed_reason">登录失败,原因是</string>
<string name="notice_verify_email">请验证账号邮箱后重登方可进入聊天室</string>
<string name="send">发送</string> <string name="send">发送</string>
<string name="mc_home">大厅</string> <string name="mc_home">大厅</string>
<string name="bbs">社区</string> <string name="bbs">社区</string>
...@@ -297,7 +301,7 @@ ...@@ -297,7 +301,7 @@
<string name="tip_return_to_duel">已回到当前游戏</string> <string name="tip_return_to_duel">已回到当前游戏</string>
<string name="my_favorites">我的收藏★</string> <string name="my_favorites">我的收藏★</string>
<string name="ypk_installed">拓展卡包文件已安装</string> <string name="ypk_installed">拓展卡包文件已安装</string>
<string name="ypk_go_setting">这是拓展卡包文件,要使用须启用扩展卡包</string> <string name="ypk_go_setting">检测到未启用拓展卡包,如果未通过其他途径安装扩展卡,建议开启</string>
<string name="ypk_delete">长按相应名称以删除</string> <string name="ypk_delete">长按相应名称以删除</string>
<string name="install_failed_bcos">安装失败,原因:</string> <string name="install_failed_bcos">安装失败,原因:</string>
<string name="deck_back_up">备份</string> <string name="deck_back_up">备份</string>
......
...@@ -45,7 +45,10 @@ ...@@ -45,7 +45,10 @@
<string name="back_tip">Press back key again to exit.</string> <string name="back_tip">Press back key again to exit.</string>
<string name="string_help_text">The current application lacks the necessary permissions. \n <string name="string_help_text">The current application lacks the necessary permissions. \n
please click Settings - permissions - open the required permissions.</string> please click Settings - permissions - open the required permissions.</string>
<string name="fetch_ex_card">Fetching ex-cards</string> <string name="fetch_ex_card">Fetching pre-cards via web</string>
<string name="ex_card_log_title">update log</string>
<string name="ex_card_check_toast_message">To use it, We recommend you to download the pre-card setting in the pre-card download page unless you have installed pre-card in another way.</string>
<!-- settings --> <!-- settings -->
<string name="settings_about">About</string> <string name="settings_about">About</string>
<string name="settings_about_sub_about">About</string> <string name="settings_about_sub_about">About</string>
...@@ -211,6 +214,7 @@ ...@@ -211,6 +214,7 @@
<string name="logining_in">Logining in</string> <string name="logining_in">Logining in</string>
<string name="logining_failed">Logining failed,please try again</string> <string name="logining_failed">Logining failed,please try again</string>
<string name="failed_reason">Logining failed because of</string> <string name="failed_reason">Logining failed because of</string>
<string name="notice_verify_email">only email verified account can login in Chatroom</string>
<string name="send">Send</string> <string name="send">Send</string>
<string name="bbs">Community</string> <string name="bbs">Community</string>
<string name="McNews">News</string> <string name="McNews">News</string>
...@@ -298,7 +302,7 @@ ...@@ -298,7 +302,7 @@
<string name="tip_return_to_duel">Current game has been Returned</string> <string name="tip_return_to_duel">Current game has been Returned</string>
<string name="my_favorites">myFav★</string> <string name="my_favorites">myFav★</string>
<string name="ypk_installed">expansion file installed</string> <string name="ypk_installed">expansion file installed</string>
<string name="ypk_go_setting">check \"Use Expansions\" to use it</string> <string name="ypk_go_setting">To use it, We recommend you to check \"Use Expansions\" unless you have installed pre-card in another way</string>
<string name="ypk_delete">Long-press name to delete</string> <string name="ypk_delete">Long-press name to delete</string>
<string name="install_failed_bcos">file install failed, because\:</string> <string name="install_failed_bcos">file install failed, because\:</string>
<string name="deck_back_up">BackUp</string> <string name="deck_back_up">BackUp</string>
...@@ -328,7 +332,7 @@ ...@@ -328,7 +332,7 @@
<string name="guide_view_move_card">press a card to move it to other place\nlong-press this card to delete it</string> <string name="guide_view_move_card">press a card to move it to other place\nlong-press this card to delete it</string>
<string name="guide_view_banner">Mycard News, you can click to see\only in Chinese now, Sorry</string> <string name="guide_view_banner">Mycard News, you can click to see\only in Chinese now, Sorry</string>
<string name="title_delete_ex">delete expansions</string> <string name="title_delete_ex">delete expansions</string>
<string name="about_delete_ex">if you need to delte all expansion cards</string> <string name="about_delete_ex">if you need to delete all expansion cards</string>
<string name="file_installed">file loaded</string> <string name="file_installed">file loaded</string>
<string name="ask_delete_ex">Click OK to confirm the deletion</string> <string name="ask_delete_ex">Click OK to confirm the deletion</string>
<string name="label_ot_TCG">TCG</string> <string name="label_ot_TCG">TCG</string>
...@@ -351,4 +355,6 @@ ...@@ -351,4 +355,6 @@
<string name="reChatJoining">relogining\.\.\.</string> <string name="reChatJoining">relogining\.\.\.</string>
<string name="settings_data_language">Language</string> <string name="settings_data_language">Language</string>
<string name="settings_data_language_about">change language of YGOPro UI and card database </string> <string name="settings_data_language_about">change language of YGOPro UI and card database </string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>
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