Commit 1637acf5 authored by wangfugui's avatar wangfugui

先行服务器、先行卡下载相关逻辑判断

pre-card server related judgement code
parent 7f478c9e
......@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.res.AssetManager;
import android.media.AudioManager;
import android.media.SoundPool;
import android.util.Log;
import java.io.File;
import java.io.IOException;
......@@ -23,6 +24,7 @@ public abstract class GameApplication extends Application implements IrrlichtBri
public void onCreate() {
super.onCreate();
// Reflection.unseal(this);
Log.i("webCrwaler", "application");
}
public static GameApplication get() {
......
......@@ -162,6 +162,9 @@ public interface Constants {
String URL_YGO233_DATAVER = "https://ygo233.com/pre/dataver";
String URL_YGO233_FILE = "https://ygo233.com/pre/download-ygomobile";
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 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;
import cn.garymb.ygomobile.bean.ServerInfo;
public class ServerInfoEvent {
public int position;
public ServerInfo serverInfo;//为了让接受event的HomeFragment能获取到当前server的端口号等信息,加入该属性
public boolean delete;
public boolean join;
public ServerInfoEvent() {
}
public ServerInfoEvent(int position, boolean delete) {
public ServerInfoEvent(int position, boolean delete, ServerInfo serverInfo) {
this.position = position;
this.delete = delete;
this.serverInfo = serverInfo;
}
}
......@@ -3,21 +3,30 @@ package cn.garymb.ygomobile.ex_card;
import android.os.Parcel;
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 {
private String name;
private String imageUrl;
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.imageUrl = imageUrl;
this.description = description;
this.type = type;
}
protected ExCard(Parcel in) {
name = in.readString();
imageUrl = in.readString();
description = in.readString();
type = in.readInt();
}
public static final Creator<ExCard> CREATOR = new Creator<ExCard>() {
......@@ -56,6 +65,17 @@ public class ExCard implements Parcelable {
this.description = description;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public boolean isUpdatingLog(){
return (type == 1);
}
@Override
public int describeContents() {
return 0;
......@@ -66,5 +86,6 @@ public class ExCard implements Parcelable {
dest.writeString(this.name);
dest.writeString(this.imageUrl);
dest.writeString(this.description);
dest.writeInt(this.type);
}
}
......@@ -6,7 +6,6 @@ import static cn.garymb.ygomobile.Constants.URL_YGO233_FILE_ALT;
import static cn.garymb.ygomobile.utils.DownloadUtil.TYPE_DOWNLOAD_EXCEPTION;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
......@@ -14,6 +13,7 @@ import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -22,6 +22,8 @@ import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
......@@ -33,16 +35,16 @@ import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.ServerInfo;
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.ui.activities.BaseActivity;
import cn.garymb.ygomobile.ui.activities.WebActivity;
import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.ui.home.ServerListManager;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.SystemUtils;
import cn.garymb.ygomobile.utils.UnzipUtils;
......@@ -61,6 +63,20 @@ public class ExCardActivity extends BaseActivity {
private ServerInfo mServerInfo;
private File xmlFile;
private int FailedCount;
private static final int DOWNLOAD_ING = 0;
public static final int DOWNLOAD_COMPLETE = 1;
/**
* 用于标志当前下载状态,用于防止用户多次重复点击“下载按钮”
* Mark the download state, which can prevent user from clicking the download button
* repeatedly.
*/
enum DownloadState {
DOWNLOAD_ING,
DOWNLOAD_COMPLETE;
}
private DownloadState downloadState;
@SuppressLint("HandlerLeak")
Handler handler = new Handler() {
......@@ -85,29 +101,50 @@ public class ExCardActivity extends BaseActivity {
break;
case UnzipUtils.ZIP_UNZIP_OK:
if (!AppsSettings.get().isReadExpansions()) {
Log.i("webCrawler", "Ex-card setting is not opened");
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();
Log.i("webCrawler", "After start new activity");
} else {
/* 将先行服务器信息添加到服务器列表中 */
String servername = "";
if (AppsSettings.get().getDataLanguage() == 0)
servername = "23333先行服务器";
if (AppsSettings.get().getDataLanguage() == 1)
servername = "YGOPRO 사전 게시 중국서버";
if (AppsSettings.get().getDataLanguage() == 2)
servername = "Mercury23333 OCG/TCG Pre-release";
AddServer(servername, "s1.ygo233.com", 23333, "Knight of Hanoi");
btn_download.setText(R.string.tip_redownload);
/* 注意,要先更新版本号 */
SharedPreferenceUtil.setExpansionDataVer(ServerUtil.serverExCardVersion);
ServerUtil.exCardState = ServerUtil.ExCardState.UPDATED;
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPackageChange));//安装后,通知UI做更新
DataManager.get().load(true);
Toast.makeText(getContext(), R.string.ypk_installed, Toast.LENGTH_LONG).show();
Log.i("webCrawler", "Ex-card package is installed");
}
String servername = "";
if (AppsSettings.get().getDataLanguage() == 0)
servername = "23333先行服务器";
if (AppsSettings.get().getDataLanguage() == 1)
servername = "YGOPRO 사전 게시 중국서버";
if (AppsSettings.get().getDataLanguage() == 2)
servername = "Mercury23333 OCG/TCG Pre-release";
AddServer(servername, "s1.ygo233.com", 23333, "Knight of Hanoi");
btn_download.setVisibility(View.GONE);
SharedPreferenceUtil.setExpansionDataVer(WebActivity.dataVer);
break;
case UnzipUtils.ZIP_UNZIP_EXCEPTION:
Toast.makeText(getContext(), getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show();
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 {
// btn_download.setText(R.string.tip_redownload);
// }
// } else {
// showExNew();
// }
}
}
};
......@@ -120,33 +157,88 @@ public class ExCardActivity extends BaseActivity {
/* show the recyclerView */
//get ex card data from intent
List<ExCard> exCards = this.getIntent()
.getParcelableArrayListExtra("exCards");
ExCardListAdapter exCardListAdapter = new ExCardListAdapter(R.layout.item_ex_card, exCards);
List<ExCard> exCardList = this.getIntent()
.getParcelableArrayListExtra("exCardList");
List<ExCardLogItem> exCardLogItemList = this.getIntent()
.getParcelableArrayListExtra("exCardLogList");
ExCardListAdapter exCardListAdapter = new ExCardListAdapter(R.layout.item_ex_card, exCardList);
ExCardLogAdapter exCardLogAdapter = new ExCardLogAdapter(this, exCardLogItemList);
RecyclerView exCardListView = (RecyclerView) findViewById(R.id.list_ex_cards);
ExpandableListView expandableListView = findViewById(R.id.expandableListView);
exCardListView.setLayoutManager(new LinearLayoutManager(this));
exCardListView.setAdapter(exCardListAdapter);
expandableListView.setAdapter(exCardLogAdapter);
expandableListView.setGroupIndicator(null);
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
Log.i("webCrawler",
exCardLogItemList.get(groupPosition) + " List Expanded.");
}
});
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
Log.i("webCrawler", exCardLogItemList.get(groupPosition) + " List Collapsed.");
}
});
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
ExCardLogItem exCardLogItem = exCardLogItemList.get(groupPosition);
String log = exCardLogItem.getLogs().get(childPosition);
Log.i("webCrawler", "log is:" + log);
return false;
}
});
final Toolbar toolbar = $(R.id.toolbar);
setSupportActionBar(toolbar);
enableBackHome();
serverInfos = new ArrayList<>();
xmlFile = new File(this.getFilesDir(), Constants.SERVER_FILE);
xmlFile = new File(this.getFilesDir(), Constants.SERVER_FILE);//读取文件路径下的server_list.xml
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);
if (downloadState != DownloadState.DOWNLOAD_ING) {
Log.i("webCrawler", "start downloading");
downloadState = DownloadState.DOWNLOAD_ING;
downloadfromWeb(URL_YGO233_FILE);
}
}
});
changeDownloadButton();
}
/**
* 从资源文件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) {
mServerInfo = new ServerInfo();
mServerInfo.setName(name);
......@@ -154,7 +246,8 @@ public class ExCardActivity extends BaseActivity {
mServerInfo.setPort(port);
mServerInfo.setPlayerName(playerName);
VUiKit.defer().when(() -> {
ServerList assetList = ServerListManager.readList(this.getAssets().open(ASSET_SERVER_LIST));
/* 读取本地文件server_list.xml和资源文件(assets)下的serverlist.xml,返回其中版本最新的 */
ServerList assetList = ServerListManager.readList(this.getAssets().open(ASSET_SERVER_LIST));//读取serverlist.xml文件
ServerList fileList = xmlFile.exists() ? ServerListManager.readList(new FileInputStream(xmlFile)) : null;
if (fileList == null) {
return assetList;
......@@ -186,6 +279,9 @@ public class ExCardActivity extends BaseActivity {
});
}
/**
* 将最新的服务器列表存储到本地文件server_list.xml中
*/
public void saveItems() {
OutputStream outputStream = null;
try {
......@@ -206,6 +302,7 @@ public class ExCardActivity extends BaseActivity {
DownloadUtil.get().download(fileUrl, file.getParent(), file.getName(), new DownloadUtil.OnDownloadListener() {
@Override
public void onDownloadSuccess(File file) {
downloadState = DownloadState.DOWNLOAD_COMPLETE;
Message message = new Message();
message.what = UnzipUtils.ZIP_READY;
try {
......@@ -219,7 +316,7 @@ public class ExCardActivity extends BaseActivity {
} catch (Exception e) {
message.what = UnzipUtils.ZIP_UNZIP_EXCEPTION;
} finally {
message.what = UnzipUtils.ZIP_UNZIP_OK;
message.what = UnzipUtils.ZIP_UNZIP_OK;//TODO 不对吧,finally是一定执行,这样即使有exception也会发unzip_ok啊
}
handler.sendMessage(message);
}
......@@ -246,4 +343,39 @@ public class ExCardActivity extends BaseActivity {
}
public void changeDownloadButton() {
if (ServerUtil.exCardState == ServerUtil.ExCardState.UPDATED) {
//btn_download展示默认视图
btn_download.setText(R.string.tip_redownload);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.NEED_UPDATE) {
btn_download.setText(R.string.action_download_expansions);
} else if (ServerUtil.exCardState == ServerUtil.ExCardState.ERROR) {
Toast.makeText(getActivity(), "无法获取服务器先行卡信息", Toast.LENGTH_LONG).show();
}
}
/**
* 通过http访问web读取先行卡版本号。
* 读取结果通过handler发到ui线程
* 注意在ExCardActivity中包含一个相同实现
*/
/* 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 {
String json = response.body().string();
Message message = new Message();
message.what = HomeFragment.TYPE_GET_DATA_VER_OK;
message.obj = json;
handler.sendMessage(message);
}
});
}
}*/
}
......@@ -13,7 +13,6 @@ import java.util.List;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.utils.glide.GlideCompat;
import cn.garymb.ygomobile.utils.glide.StringSignature;
public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder> {
......@@ -29,13 +28,19 @@ public class ExCardListAdapter extends BaseQuickAdapter<ExCard, BaseViewHolder>
protected void convert(BaseViewHolder helper, ExCard item) {
helper.setText(R.id.ex_card_name, item.getName());
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(...)
//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);
if (item.isUpdatingLog()) {
helper.setGone(R.id.ex_card_image, true);
} else {
helper.setGone(R.id.ex_card_image, false);
ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
//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);
}
}
}
package cn.garymb.ygomobile.ex_card;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
import java.util.List;
import cn.garymb.ygomobile.lite.R;
public class ExCardLogAdapter extends BaseExpandableListAdapter {
public ExCardLogAdapter(Context context, List<ExCardLogItem> expandalbeList) {
this.expandalbeList = expandalbeList;
this.context = context;
}
private Context context;
private List<ExCardLogItem> 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);
if(groupPosition == 0){
listTitleTextView.setTextSize(15);
}else{
listTitleTextView.setTextSize(12);
}
listTitleTextView.setTypeface(null, Typeface.BOLD);
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.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);
}
}
......@@ -50,7 +50,8 @@ import ocgcore.DataManager;
import ocgcore.data.Card;
public class WebActivity extends BaseActivity {
public static String dataVer;
/* 全局存储了扩展卡版本号,会被其他activity使用 */
private static String exCardVer;
private WebViewPlus mWebViewPlus;
private String mUrl;
private String mTitle;
......@@ -99,7 +100,7 @@ public class WebActivity extends BaseActivity {
servername = "Mercury23333 OCG/TCG Pre-release";
AddServer(servername, "s1.ygo233.com", 23333, "Knight of Hanoi");
btn_download.setVisibility(View.GONE);
SharedPreferenceUtil.setExpansionDataVer(WebActivity.dataVer);
SharedPreferenceUtil.setExpansionDataVer(WebActivity.exCardVer);
break;
case UnzipUtils.ZIP_UNZIP_EXCEPTION:
Toast.makeText(getContext(), getString(R.string.install_failed_bcos) + msg.obj, Toast.LENGTH_SHORT).show();
......
package cn.garymb.ygomobile.ui.adapters;
import static cn.garymb.ygomobile.utils.BitmapUtil.getPaint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.graphics.Paint;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.transition.Visibility;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.tubb.smrv.SwipeHorizontalMenuLayout;
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.events.ServerInfoEvent;
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 ServerListAdapter(Context context) {
......@@ -64,25 +65,26 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV
public void bindMenu() {
addChildClickViewIds(R.id.smContentView, R.id.btn_edit_delete, R.id.btn_delete, R.id.iv_fond);
setOnItemChildClickListener((adapter, view, position) -> {
ServerInfo serverInfo = (ServerInfo) adapter.getData().get(position);
switch (view.getId()) {
case R.id.smContentView:
ServerInfoEvent event = new ServerInfoEvent(position, false);
event.join = true;
EventBus.getDefault().post(event);
ServerInfoEvent serverInfoEvent = new ServerInfoEvent(position, false, serverInfo);
serverInfoEvent.join = true;
EventBus.getDefault().post(serverInfoEvent);//在cn.garymb.ygomobile.ui.home.HomeFragment.onServerInfoEvent监听
SwipeHorizontalMenuLayout menuLayout = (SwipeHorizontalMenuLayout) adapter.getViewByPosition(position, R.id.swipe_layout);
if (menuLayout.isMenuOpen()) {
menuLayout.smoothCloseMenu();
}
break;
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);
if (menuLayout1.isMenuOpen()) {
menuLayout1.smoothCloseMenu();
}
break;
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);
if (menuLayout2.isMenuOpen()) {
......@@ -122,6 +124,19 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV
} else {
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;
import cn.garymb.ygomobile.ui.settings.SettingFragment;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.ScreenUtil;
import cn.garymb.ygomobile.utils.ServerUtil;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
......@@ -114,6 +115,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
//showNewbieGuide("homePage");
initBottomNavigationBar();
onNewIntent(getIntent());
ServerUtil.initExCardState();//检查扩展卡版本
}
@Override
......
package cn.garymb.ygomobile.ui.home;
import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER;
import android.annotation.SuppressLint;
import android.content.Intent;
......@@ -52,6 +51,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import cn.garymb.ygodata.YGOGameOptions;
import cn.garymb.ygomobile.App;
......@@ -65,7 +65,8 @@ import cn.garymb.ygomobile.bean.ServerList;
import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.ex_card.ExCard;
import cn.garymb.ygomobile.ex_card.ExCardActivity;
import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.ex_card.ExCardLogItem;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader;
import cn.garymb.ygomobile.ui.activities.WebActivity;
......@@ -80,15 +81,11 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.ui.widget.Shimmer;
import cn.garymb.ygomobile.ui.widget.ShimmerTextView;
import cn.garymb.ygomobile.utils.FileLogUtil;
import cn.garymb.ygomobile.utils.OkhttpUtil;
import cn.garymb.ygomobile.utils.SharedPreferenceUtil;
import cn.garymb.ygomobile.utils.ServerUtil;
import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.CardManager;
import ocgcore.DataManager;
import ocgcore.data.Card;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListener, View.OnClickListener {
......@@ -98,7 +95,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private static final int TYPE_BANNER_QUERY_OK = 0;
private static final int TYPE_BANNER_QUERY_EXCEPTION = 1;
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 boolean isMcNewsLoadException = false;
......@@ -150,7 +147,8 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
showExNew();
changeExCardNewMark();
changeColor();
//showNewbieGuide("homePage");
return layoutView;
}
......@@ -273,44 +271,46 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
tv_banner_loading.setText(R.string.loading_failed);
isMcNewsLoadException = true;
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 {
String json = response.body().string();
Message message = new Message();
message.what = TYPE_GET_DATA_VER_OK;
message.obj = json;
handler.sendMessage(message);
}
});
/**
* 通过http访问web读取先行卡版本号。
* 读取结果通过handler发到ui线程
* 注意在ExCardActivity中包含一个相同实现
*/
public void changeExCardNewMark() {
Log.i("webCrawler", "excard 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_LONG).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() {
isMcNewsLoadException = false;
tv_banner_loading.setVisibility(View.VISIBLE);
......@@ -572,8 +572,22 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
return Util.isContextExisted(getActivity());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(ExCardEvent event) {
Log.i("webCrawler", "event received " + event.getType());
if (event.getType() == ExCardEvent.EventType.exCardPackageChange) {
changeExCardNewMark();
changeColor();
} else if (event.getType() == ExCardEvent.EventType.exCardPrefChange) {
/* 可以设置在不开启扩展卡的情况下“扩展卡下载”图标是否显示为灰色 */
changeColor();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onServerInfoEvent(ServerInfoEvent event) {
Log.i("webCrawler", "dialog");
if (event.delete) {
DialogPlus dialogPlus = new DialogPlus(getContext());
dialogPlus.setTitle(R.string.question);
......@@ -588,11 +602,22 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
dialogPlus.setOnCloseLinster(null);
dialogPlus.show();
} 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");
} else {
mServerListManager.showEditDialog(event.position);
}
}
public void setRandomCardDetail() {
......@@ -701,6 +726,10 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
YGOStarter.startGame(getActivity(), null, "-k", "-s");
break;
case R.id.action_download_ex:
// if (!AppsSettings.get().isReadExpansions()) {//如果未开启扩展卡设置,直接跳过
// Toast.makeText(getActivity(), R.string.ypk_go_setting, Toast.LENGTH_LONG).show();
// break;
// }
//using Web crawler to extract the information of pre card
final DialogPlus dialog_read_ex = DialogPlus.show(getContext(), null, getContext().getString(R.string.fetch_ex_card));
VUiKit.defer().when(() -> {
......@@ -708,27 +737,54 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
//Connect to the website
Document document = Jsoup.connect(aurl).get();
Element pre_card_content = document.getElementById("pre_release_cards");
Element pre_update_log = document.getElementById("pre_update_log");
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
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> exCards = new ArrayList<>();
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);
exCards.add(exCard);
ExCard exCard = new ExCard(name, imageUrl, description, 0);
exCardList.add(exCard);
}
Log.i("webCrawler", exCards.toString());
if (exCards.isEmpty()) {
ArrayList<ExCardLogItem> exCardLogList = new ArrayList<>();
exCardLogList.add(new ExCardLogItem(0, getString(R.string.ex_card_log_title), 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;
}
}
Intent intent = new Intent(getActivity(), ExCardActivity.class);
intent.putParcelableArrayListExtra("exCardLogList", exCardLogList);
intent.putParcelableArrayListExtra("exCardList", exCardList);
if (exCardList.isEmpty() && exCardLogList.isEmpty()) {
return null;
} else {
return exCards;
return intent;
}
}).fail((e) -> {
......@@ -748,12 +804,10 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
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) {
}).done(intent -> {
if (intent != 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,
......@@ -764,6 +818,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
aurl = aurl + "#pre_update_title";
}
WebActivity.open(getContext(), getString(R.string.action_download_expansions), aurl);
ll_new_notice.setVisibility(View.GONE);
Log.i("webCrawler", "webCrawler cannot return ex-card data");
}
//关闭异常
......@@ -774,7 +829,6 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
} catch (Exception ex) {
}
}
ll_new_notice.setVisibility(View.GONE);
});
break;
......
......@@ -44,8 +44,8 @@ public class ServerListManager {
public void syncLoadData() {
VUiKit.defer().when(() -> {
ServerList assetList = readList(getContext().getAssets().open(ASSET_SERVER_LIST));
ServerList fileList = xmlFile.exists() ? readList(new FileInputStream(xmlFile)) : null;
ServerList assetList = readList(getContext().getAssets().open(ASSET_SERVER_LIST));//程序asset文件夹下的serverlist.xml
ServerList fileList = xmlFile.exists() ? readList(new FileInputStream(xmlFile)) : null;//文件系统中的server-list.xml
if (fileList == null) {
return assetList;
}
......
......@@ -63,6 +63,8 @@ import android.widget.Toast;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.signature.MediaStoreSignature;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
......@@ -72,6 +74,7 @@ import java.util.List;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter;
......@@ -81,6 +84,8 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils;
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.glide.GlideCompat;
import ocgcore.DataManager;
......@@ -165,7 +170,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
bind(PREF_DEL_EX, getString(R.string.about_delete_ex));
bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用");
bind(PREF_WINDOW_TOP_BOTTOM, "" + mSettings.getScreenPadding());
bind(PREF_DATA_LANGUAGE, "" + mSettings.getDataLanguage());
Preference preference = findPreference(PREF_READ_EX);
if (preference != null) {
preference.setSummary(mSettings.getExpansionsPath().getAbsolutePath());
......@@ -215,6 +219,11 @@ public class SettingFragment extends PreferenceFragmentPlus {
if (preference.getKey().equals(PREF_READ_EX)) {
//设置使用额外卡库后重新加载卡片数据
DataManager.get().load(true);
EventBus.getDefault().postSticky(new ExCardEvent(ExCardEvent.EventType.exCardPrefChange));
/* TODO 考虑以下特殊情况,用户在未开启先行卡的情况下,下载了先行卡包,之后跳转到设置页面,勾选开启先行卡后,DataManager自动安装,但此时本地的先行卡版本号尚未更新。
先行卡,此时应更新先行卡状态
*/
ServerUtil.initExCardState();
}
//开关决斗助手
if (preference.getKey().equals(PREF_START_SERVICEDUELASSISTANT)) {
......@@ -288,6 +297,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
message.what = TYPE_SETTING_GET_VERSION_FAILED;
message.obj = e;
handler.sendMessage(message);
Log.i(BuildConfig.VERSION_NAME, "error" + e);
}
@Override
......@@ -317,6 +327,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
ListView listView = dialog.bind(R.id.room_list);
listView.setAdapter(simpleListAdapter);
listView.setOnItemLongClickListener((a, v, i, index) -> {
/* 删除先行卡 */
String name = simpleListAdapter.getItemById(index);
int pos = simpleListAdapter.findItem(name);
if (pos >= 0) {
......@@ -325,6 +336,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
FileUtils.delFile(mSettings.getExpansionsPath().getAbsolutePath() + "/" + name);
DataManager.get().load(true);
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;
});
......
......@@ -6,6 +6,8 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
......@@ -224,4 +226,12 @@ public class BitmapUtil {
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 android.text.TextUtils;
import android.util.Log;
import java.io.IOException;
import cn.garymb.ygomobile.Constants;
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 static ExCardState exCardState = ExCardState.ERROR;
public static String serverExCardVersion = "";
/**
* 在可能更改先行卡状态的操作后调用,
* 删除先行卡时入参为null,
* 安装先行卡时入参为版本号
*
*/
/**
* 初始化本地先行卡版本的状态,
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
*/
public static void initExCardState() {
String oldVer = SharedPreferenceUtil.getExpansionDataVer();
Log.i("webCrawler", "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);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String newVer = response.body().string();
serverExCardVersion = newVer;
Log.i("webCrawler", "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;
}
}
});
}
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;
import android.util.Log;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.loader.CardLoader;
......@@ -45,6 +47,8 @@ public class DataManager {
private boolean mInit;
public void load(boolean force) {
Log.i("webCrawler", "DataManager load data");
boolean needLoad = false;
synchronized (this) {
if (!mInit || force) {
......
<?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_height="match_parent"
android:background="@drawable/bg3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa000000" />
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="3"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft"
android:divider="@android:color/darker_gray"
android:dividerHeight="0.5dp" />
<com.tubb.smrv.SwipeMenuRecyclerView
android:id="@+id/list_ex_cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_weight="13"
android:divider="@android:color/transparent"
android:dividerHeight="4dp"
android:padding="5dp"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/web_btn_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal">
<Button
android:id="@+id/web_btn_download_prerelease"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/button_bg"
android:text="@string/Download" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
......@@ -12,10 +12,8 @@
android:id="@+id/ex_card_image"
android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical"
android:paddingTop="5dp"
android:scaleType="fitXY"
android:paddingRight="10dp"
tools:src="@drawable/unknown" />
<LinearLayout
......
<?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" />
</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:textColor="@color/item_title"/>
</LinearLayout>
......@@ -39,6 +39,9 @@
<string name="back_tip">뒤로가기 키를 한번 더 누르시면 앱이 종료됩니다</string>
<string name="string_help_text">현재 앱에 필요한 권한이 없습니다. \n설정 - 권한 - 필요한 권한 얻기를 터치하십시오.</string>
<string name="fetch_ex_card">확장 카드 불러오는 중</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 -->
<string name="settings_about">정보</string>
<string name="settings_about_sub_about">정보</string>
......@@ -297,7 +300,8 @@
<string name="tip_return_to_duel">현재 게임으로 돌아왔습니다</string>
<string name="my_favorites">즐겨 찾기★</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="install_failed_bcos">설치에 실패했습니다. 이유:</string>
<string name="deck_back_up">백업</string>
......
......@@ -39,6 +39,9 @@
<string name="back_tip">请再按一次返回键退出</string>
<string name="string_help_text">当前应用缺少必要权限。\n请点击 设置-权限 打开所需权限。</string>
<string name="fetch_ex_card">读取先行卡</string>
<string name="ex_card_log_title">更新日志</string>
<string name="ex_card_check_toast_message">检测到未下载扩展卡,如果未通过其他途径安装扩展卡,建议在扩展卡页面下载</string>
<!-- settings -->
<string name="settings_about">关于</string>
<string name="settings_about_sub_about">关于</string>
......@@ -297,7 +300,7 @@
<string name="tip_return_to_duel">已回到当前游戏</string>
<string name="my_favorites">我的收藏★</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="install_failed_bcos">安装失败,原因:</string>
<string name="deck_back_up">备份</string>
......
......@@ -45,7 +45,10 @@
<string name="back_tip">Press back key again to exit.</string>
<string name="string_help_text">The current application lacks the necessary permissions. \n
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</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 -->
<string name="settings_about">About</string>
<string name="settings_about_sub_about">About</string>
......@@ -298,7 +301,7 @@
<string name="tip_return_to_duel">Current game has been Returned</string>
<string name="my_favorites">myFav★</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="install_failed_bcos">file install failed, because\:</string>
<string name="deck_back_up">BackUp</string>
......@@ -328,7 +331,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_banner">Mycard News, you can click to see\only in Chinese now, Sorry</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="ask_delete_ex">Click OK to confirm the deletion</string>
<string name="label_ot_TCG">TCG</string>
......
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