Commit 7e3a7f78 authored by wangfugui's avatar wangfugui

更改部分class名称,更符合语义

parent 18305c8c
...@@ -19,9 +19,9 @@ import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE; ...@@ -19,9 +19,9 @@ import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE;
import static cn.garymb.ygomobile.Constants.DEF_PREF_NOTCH_HEIGHT; import static cn.garymb.ygomobile.Constants.DEF_PREF_NOTCH_HEIGHT;
import static cn.garymb.ygomobile.Constants.DEF_PREF_ONLY_GAME; import static cn.garymb.ygomobile.Constants.DEF_PREF_ONLY_GAME;
import static cn.garymb.ygomobile.Constants.DEF_PREF_READ_EX; import static cn.garymb.ygomobile.Constants.DEF_PREF_READ_EX;
import static cn.garymb.ygomobile.Constants.PREF_DEF_KEY_WORDS_SPLIT;
import static cn.garymb.ygomobile.Constants.PREF_DEF_DATA_LANGUAGE; import static cn.garymb.ygomobile.Constants.PREF_DEF_DATA_LANGUAGE;
import static cn.garymb.ygomobile.Constants.PREF_DEF_IMMERSIVE_MODE; import static cn.garymb.ygomobile.Constants.PREF_DEF_IMMERSIVE_MODE;
import static cn.garymb.ygomobile.Constants.PREF_DEF_KEY_WORDS_SPLIT;
import static cn.garymb.ygomobile.Constants.PREF_DEF_SENSOR_REFRESH; import static cn.garymb.ygomobile.Constants.PREF_DEF_SENSOR_REFRESH;
import static cn.garymb.ygomobile.Constants.PREF_FONT_SIZE; import static cn.garymb.ygomobile.Constants.PREF_FONT_SIZE;
import static cn.garymb.ygomobile.Constants.PREF_IMMERSIVE_MODE; import static cn.garymb.ygomobile.Constants.PREF_IMMERSIVE_MODE;
...@@ -499,6 +499,7 @@ public class AppsSettings { ...@@ -499,6 +499,7 @@ public class AppsSettings {
public String getCoreSkinPath() { public String getCoreSkinPath() {
return new File(getResourcePath(), Constants.CORE_SKIN_PATH).getAbsolutePath(); return new File(getResourcePath(), Constants.CORE_SKIN_PATH).getAbsolutePath();
} }
public String getAvatarPath() { public String getAvatarPath() {
return new File(getResourcePath(), Constants.CORE_AVATAR_PATH).getAbsolutePath(); return new File(getResourcePath(), Constants.CORE_AVATAR_PATH).getAbsolutePath();
} }
...@@ -510,6 +511,7 @@ public class AppsSettings { ...@@ -510,6 +511,7 @@ public class AppsSettings {
public String getBgPath() { public String getBgPath() {
return new File(getResourcePath(), Constants.CORE_BG_PATH).getAbsolutePath(); return new File(getResourcePath(), Constants.CORE_BG_PATH).getAbsolutePath();
} }
/*** /***
* 字体路径 * 字体路径
*/ */
...@@ -613,7 +615,12 @@ public class AppsSettings { ...@@ -613,7 +615,12 @@ public class AppsSettings {
return mSharedPreferences.getString(Constants.PREF_DEF_LAST_YDK, null); return mSharedPreferences.getString(Constants.PREF_DEF_LAST_YDK, null);
} }
//获得最后卡组绝对路径 /**
* 获得(最后)上次打开的卡组的绝对路径
* setCurDeck()方法负责设置上次打开的卡组的路径
*
* @return
*/
public @Nullable public @Nullable
String getLastDeckPath() { String getLastDeckPath() {
String path; String path;
...@@ -804,7 +811,7 @@ public class AppsSettings { ...@@ -804,7 +811,7 @@ public class AppsSettings {
Korean(1, "ko"), Korean(1, "ko"),
English(2, "en"), English(2, "en"),
Spanish(3, "es"), Spanish(3, "es"),
Japanese(4,"jp"), Japanese(4, "jp"),
Portuguese(5, "pt"); Portuguese(5, "pt");
public Integer code; public Integer code;
...@@ -913,7 +920,7 @@ public class AppsSettings { ...@@ -913,7 +920,7 @@ public class AppsSettings {
setDataLanguage(languageEnum.Portuguese.code); setDataLanguage(languageEnum.Portuguese.code);
} }
private void replaceLineFeed(){ private void replaceLineFeed() {
//替换换行符 //替换换行符
String stringConfPath = new File(getResourcePath(), CORE_STRING_PATH).getAbsolutePath(); String stringConfPath = new File(getResourcePath(), CORE_STRING_PATH).getAbsolutePath();
String botConfPath = new File(getResourcePath(), BOT_CONF).getAbsolutePath(); String botConfPath = new File(getResourcePath(), BOT_CONF).getAbsolutePath();
......
...@@ -9,7 +9,7 @@ import androidx.annotation.NonNull; ...@@ -9,7 +9,7 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord; import cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareBinding; import cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareBinding;
...@@ -36,7 +36,7 @@ public class DeckSquareFragment extends Fragment { ...@@ -36,7 +36,7 @@ public class DeckSquareFragment extends Fragment {
// Set click listener in your adapter // Set click listener in your adapter
deckSquareListAdapter.setOnItemClickListener((adapter, view, position) -> { deckSquareListAdapter.setOnItemClickListener((adapter, view, position) -> {
// Handle item click // Handle item click
ApiDeckRecord item = (ApiDeckRecord) adapter.getItem(position); OnlineDeckDetail item = (OnlineDeckDetail) adapter.getItem(position);
// Show the dialog // Show the dialog
......
...@@ -9,8 +9,6 @@ import androidx.annotation.NonNull; ...@@ -9,8 +9,6 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord;
import cn.garymb.ygomobile.deck_square.api_response.DeckDetail;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareMyDeckBinding; import cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareMyDeckBinding;
......
...@@ -14,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -14,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.deck_square.api_response.DeckDetail; import cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail;
import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse;
import cn.garymb.ygomobile.deck_square.api_response.PushDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.PushDeckResponse;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
...@@ -30,7 +30,7 @@ public class MyDeckDetailDialog extends Dialog { ...@@ -30,7 +30,7 @@ public class MyDeckDetailDialog extends Dialog {
private static final String TAG = DeckSquareListAdapter.class.getSimpleName(); private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
DeckPreviewListAdapter mListAdapter; DeckPreviewListAdapter mListAdapter;
private RecyclerView mListView; private RecyclerView mListView;
private DeckDetail mDeckDetail = null; private MyOnlineDeckDetail mMyOnlineDeckDetail = null;
MyDeckItem mItem = null;//存储触发本dialog的卡组的基本信息 MyDeckItem mItem = null;//存储触发本dialog的卡组的基本信息
...@@ -104,9 +104,9 @@ public class MyDeckDetailDialog extends Dialog { ...@@ -104,9 +104,9 @@ public class MyDeckDetailDialog extends Dialog {
//下载用户在平台上的卡组 //下载用户在平台上的卡组
btnDownload.setOnClickListener(v -> { btnDownload.setOnClickListener(v -> {
if (mDeckDetail != null) { if (mMyOnlineDeckDetail != null) {
String path = AppsSettings.get().getDeckDir(); String path = AppsSettings.get().getDeckDir();
DeckSquareFileUtil.saveFileToPath(path, mDeckDetail.getDeckName() + ".ydk", mDeckDetail.getDeckYdk()); DeckSquareFileUtil.saveFileToPath(path, mMyOnlineDeckDetail.getDeckName() + ".ydk", mMyOnlineDeckDetail.getDeckYdk());
} }
}); });
...@@ -134,7 +134,7 @@ public class MyDeckDetailDialog extends Dialog { ...@@ -134,7 +134,7 @@ public class MyDeckDetailDialog extends Dialog {
}).done((deckData) -> { }).done((deckData) -> {
if (deckData != null) { if (deckData != null) {
mDeckDetail = deckData; mMyOnlineDeckDetail = deckData;
LogUtil.i(TAG, "square deck detail done"); LogUtil.i(TAG, "square deck detail done");
......
...@@ -9,7 +9,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder; ...@@ -9,7 +9,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.deck_square.api_response.DeckDetail; import cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail;
import cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
...@@ -65,7 +65,7 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold ...@@ -65,7 +65,7 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
// List<MyDeckItem> serverItems = new ArrayList<>(); // List<MyDeckItem> serverItems = new ArrayList<>();
if (serverDecks != null) {//将服务端的卡组也放到LocalDecks中 if (serverDecks != null) {//将服务端的卡组也放到LocalDecks中
for (DeckDetail detail : serverDecks) { for (MyOnlineDeckDetail detail : serverDecks) {
MyDeckItem item = new MyDeckItem(); MyDeckItem item = new MyDeckItem();
item.setDeckName(detail.getDeckName()); item.setDeckName(detail.getDeckName());
item.setDeckSouce(1); item.setDeckSouce(1);
......
...@@ -12,9 +12,9 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,9 +12,9 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.deck_square.api_response.ApiDeckRecord; import cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail;
import cn.garymb.ygomobile.deck_square.api_response.BasicResponse; import cn.garymb.ygomobile.deck_square.api_response.BasicResponse;
import cn.garymb.ygomobile.deck_square.api_response.DeckDetail; import cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail;
import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse; import cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.adapters.DeckPreviewListAdapter; import cn.garymb.ygomobile.ui.adapters.DeckPreviewListAdapter;
...@@ -30,11 +30,11 @@ public class SquareDeckDetailDialog extends Dialog { ...@@ -30,11 +30,11 @@ public class SquareDeckDetailDialog extends Dialog {
DeckPreviewListAdapter mListAdapter; DeckPreviewListAdapter mListAdapter;
private RecyclerView mListView; private RecyclerView mListView;
private DeckDetail mDeckDetail = null; private MyOnlineDeckDetail mMyOnlineDeckDetail = null;
private ApiDeckRecord mItem = null; private OnlineDeckDetail mItem = null;
public SquareDeckDetailDialog(Context context, ApiDeckRecord item) { public SquareDeckDetailDialog(Context context, OnlineDeckDetail item) {
super(context); super(context);
mItem = item; mItem = item;
...@@ -60,9 +60,9 @@ public class SquareDeckDetailDialog extends Dialog { ...@@ -60,9 +60,9 @@ public class SquareDeckDetailDialog extends Dialog {
//下载卡组广场的卡组 //下载卡组广场的卡组
btnDownload.setOnClickListener(v -> { btnDownload.setOnClickListener(v -> {
if (mDeckDetail != null) { if (mMyOnlineDeckDetail != null) {
String path = AppsSettings.get().getDeckDir(); String path = AppsSettings.get().getDeckDir();
boolean result = DeckSquareFileUtil.saveFileToPath(path, mDeckDetail.getDeckName() + ".ydk", mDeckDetail.getDeckYdk()); boolean result = DeckSquareFileUtil.saveFileToPath(path, mMyOnlineDeckDetail.getDeckName() + ".ydk", mMyOnlineDeckDetail.getDeckYdk());
if (result) { if (result) {
YGOUtil.showTextToast("Download deck success!"); YGOUtil.showTextToast("Download deck success!");
...@@ -113,7 +113,7 @@ public class SquareDeckDetailDialog extends Dialog { ...@@ -113,7 +113,7 @@ public class SquareDeckDetailDialog extends Dialog {
}).done((deckData) -> { }).done((deckData) -> {
if (deckData != null) { if (deckData != null) {
mDeckDetail = deckData; mMyOnlineDeckDetail = deckData;
LogUtil.i(TAG, "square deck detail done"); LogUtil.i(TAG, "square deck detail done");
......
...@@ -3,7 +3,7 @@ package cn.garymb.ygomobile.deck_square.api_response; ...@@ -3,7 +3,7 @@ package cn.garymb.ygomobile.deck_square.api_response;
public class DownloadDeckResponse { public class DownloadDeckResponse {
private Integer code; private Integer code;
private String message; private String message;
private DeckDetail data; private MyOnlineDeckDetail data;
public Integer getCode() { public Integer getCode() {
return code; return code;
...@@ -22,11 +22,11 @@ public class DownloadDeckResponse { ...@@ -22,11 +22,11 @@ public class DownloadDeckResponse {
this.message = message; this.message = message;
} }
public DeckDetail getData() { public MyOnlineDeckDetail getData() {
return data; return data;
} }
public void setData(DeckDetail data) { public void setData(MyOnlineDeckDetail data) {
this.data = data; this.data = data;
} }
} }
...@@ -5,7 +5,7 @@ import java.util.List; ...@@ -5,7 +5,7 @@ import java.util.List;
public class MyDeckResponse { public class MyDeckResponse {
public Integer code; public Integer code;
public String message; public String message;
public List<DeckDetail> data; public List<MyOnlineDeckDetail> data;
public Integer getCode() { public Integer getCode() {
return code; return code;
...@@ -23,11 +23,11 @@ public class MyDeckResponse { ...@@ -23,11 +23,11 @@ public class MyDeckResponse {
this.message = message; this.message = message;
} }
public List<DeckDetail> getData() { public List<MyOnlineDeckDetail> getData() {
return data; return data;
} }
public void setData(List<DeckDetail> data) { public void setData(List<MyOnlineDeckDetail> data) {
this.data = data; this.data = data;
} }
......
...@@ -6,7 +6,7 @@ import android.os.Parcelable; ...@@ -6,7 +6,7 @@ import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
public class DeckDetail implements Parcelable { public class MyOnlineDeckDetail implements Parcelable {
private String deckId; private String deckId;
private String deckContributor; private String deckContributor;
...@@ -27,7 +27,7 @@ public class DeckDetail implements Parcelable { ...@@ -27,7 +27,7 @@ public class DeckDetail implements Parcelable {
private String isDelete; private String isDelete;
protected DeckDetail(Parcel in) { protected MyOnlineDeckDetail(Parcel in) {
deckId = in.readString(); deckId = in.readString();
deckContributor = in.readString(); deckContributor = in.readString();
deckName = in.readString(); deckName = in.readString();
...@@ -47,15 +47,15 @@ public class DeckDetail implements Parcelable { ...@@ -47,15 +47,15 @@ public class DeckDetail implements Parcelable {
isDelete = in.readString(); isDelete = in.readString();
} }
public static final Creator<DeckDetail> CREATOR = new Creator<DeckDetail>() { public static final Creator<MyOnlineDeckDetail> CREATOR = new Creator<MyOnlineDeckDetail>() {
@Override @Override
public DeckDetail createFromParcel(Parcel in) { public MyOnlineDeckDetail createFromParcel(Parcel in) {
return new DeckDetail(in); return new MyOnlineDeckDetail(in);
} }
@Override @Override
public DeckDetail[] newArray(int size) { public MyOnlineDeckDetail[] newArray(int size) {
return new DeckDetail[size]; return new MyOnlineDeckDetail[size];
} }
}; };
......
...@@ -5,7 +5,7 @@ import android.os.Parcelable; ...@@ -5,7 +5,7 @@ import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
public class ApiDeckRecord implements Parcelable { public class OnlineDeckDetail implements Parcelable {
private String deckId; private String deckId;
private String deckContributor; private String deckContributor;
...@@ -20,7 +20,7 @@ public class ApiDeckRecord implements Parcelable { ...@@ -20,7 +20,7 @@ public class ApiDeckRecord implements Parcelable {
private int userId; private int userId;
protected ApiDeckRecord(Parcel in) { protected OnlineDeckDetail(Parcel in) {
deckId = in.readString(); deckId = in.readString();
deckContributor = in.readString(); deckContributor = in.readString();
deckName = in.readString(); deckName = in.readString();
...@@ -34,15 +34,15 @@ public class ApiDeckRecord implements Parcelable { ...@@ -34,15 +34,15 @@ public class ApiDeckRecord implements Parcelable {
userId = in.readInt(); userId = in.readInt();
} }
public static final Creator<ApiDeckRecord> CREATOR = new Creator<ApiDeckRecord>() { public static final Creator<OnlineDeckDetail> CREATOR = new Creator<OnlineDeckDetail>() {
@Override @Override
public ApiDeckRecord createFromParcel(Parcel in) { public OnlineDeckDetail createFromParcel(Parcel in) {
return new ApiDeckRecord(in); return new OnlineDeckDetail(in);
} }
@Override @Override
public ApiDeckRecord[] newArray(int size) { public OnlineDeckDetail[] newArray(int size) {
return new ApiDeckRecord[size]; return new OnlineDeckDetail[size];
} }
}; };
...@@ -65,6 +65,7 @@ public class ApiDeckRecord implements Parcelable { ...@@ -65,6 +65,7 @@ public class ApiDeckRecord implements Parcelable {
dest.writeString(lastDate); dest.writeString(lastDate);
dest.writeInt(userId); dest.writeInt(userId);
} }
public String getDeckId() { public String getDeckId() {
return deckId; return deckId;
} }
......
...@@ -2,7 +2,7 @@ package cn.garymb.ygomobile.deck_square.api_response; ...@@ -2,7 +2,7 @@ package cn.garymb.ygomobile.deck_square.api_response;
import java.util.List; import java.util.List;
public class ApiResponse { public class SquareDeckResponse {
private Integer code; private Integer code;
private String message; private String message;
private ApiData data; private ApiData data;
...@@ -12,7 +12,7 @@ public class ApiResponse { ...@@ -12,7 +12,7 @@ public class ApiResponse {
private int size; private int size;
private int total; private int total;
private int pages; private int pages;
private List<ApiDeckRecord> records; private List<OnlineDeckDetail> records;
// Getters and setters // Getters and setters
public int getCurrent() { public int getCurrent() {
...@@ -31,7 +31,7 @@ public class ApiResponse { ...@@ -31,7 +31,7 @@ public class ApiResponse {
return pages; return pages;
} }
public List<ApiDeckRecord> getRecords() { public List<OnlineDeckDetail> getRecords() {
return records; return records;
} }
} }
......
...@@ -109,6 +109,14 @@ class DeckItemUtils { ...@@ -109,6 +109,14 @@ class DeckItemUtils {
return deck; return deck;
} }
/**
* 将file内容更新为List<DeckItem>中的内容
* 删除file,之后将List<DeckItem>中的内容保存到file中
* @param items
* @param file 原有file
* @return 如果file为null,返回false
*/
public static boolean save(List<DeckItem> items, File file) { public static boolean save(List<DeckItem> items, File file) {
FileOutputStream outputStream = null; FileOutputStream outputStream = null;
OutputStreamWriter writer = null; OutputStreamWriter writer = null;
......
...@@ -184,7 +184,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On ...@@ -184,7 +184,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
enableStart = error >= 0; enableStart = error >= 0;
getGameUriManager().doIntent(getIntent()); getGameUriManager().doIntent(getIntent());
}); });
} else { } else {//外部选择通过本应用打开ydk文件,会执行到这里
getGameUriManager().doIntent(intent); getGameUriManager().doIntent(intent);
} }
} }
......
...@@ -52,6 +52,11 @@ public class ImageUtil { ...@@ -52,6 +52,11 @@ public class ImageUtil {
show(context, url, im, null); show(context, url, im, null);
} }
/**
* 将图片变换为灰度图(变成灰白色)
* @param key
* @param imageView
*/
public static void setGrayImage(int key, ImageView imageView) { public static void setGrayImage(int key, ImageView imageView) {
ColorMatrix matrix = new ColorMatrix(); ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0); matrix.setSaturation(0);
......
...@@ -293,6 +293,8 @@ ...@@ -293,6 +293,8 @@
<string name="category_pack">Pack</string> <string name="category_pack">Pack</string>
<string name="category_windbot_deck">AI Decks</string> <string name="category_windbot_deck">AI Decks</string>
<string name="category_Uncategorized">Uncategorized</string> <string name="category_Uncategorized">Uncategorized</string>
<string name="category_online_deck">Online Deck</string>
<string name="category_my_online_deck">My Online Deck</string>
<string name="please_input_category_name">please input category name</string> <string name="please_input_category_name">please input category name</string>
<string name="invalid_category_name">invalid category name</string> <string name="invalid_category_name">invalid category name</string>
<string name="please_select_target_category">please select target category</string> <string name="please_select_target_category">please select target category</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