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