Commit 5a50a7df authored by fallenstardust's avatar fallenstardust

getAiDeckDir为WINDBOT_PATH

arrange strings.xml
parent b48921de
...@@ -46,12 +46,11 @@ public class AppsSettings { ...@@ -46,12 +46,11 @@ public class AppsSettings {
private float mScreenHeight, mScreenWidth, mDensity; private float mScreenHeight, mScreenWidth, mDensity;
private AppsSettings(Context context) { private AppsSettings(Context context) {
this.context = context; this.context = context;
mSharedPreferences = PreferenceFragmentPlus.SharedPreferencesPlus.create(context, context.getPackageName() + ".settings"); mSharedPreferences = PreferenceFragmentPlus.SharedPreferencesPlus.create(context, context.getPackageName() + ".settings");
mSharedPreferences.setAutoSave(true); mSharedPreferences.setAutoSave(true);
Log.e("YGOMobileLog", "初始化类地址: "+ System.identityHashCode(this)); Log.e("YGOMobileLog", "初始化类地址: " + System.identityHashCode(this));
update(context); update(context);
} }
...@@ -79,9 +78,9 @@ public class AppsSettings { ...@@ -79,9 +78,9 @@ public class AppsSettings {
if (dm != null) { if (dm != null) {
int height = Math.max(dm.widthPixels, dm.heightPixels); int height = Math.max(dm.widthPixels, dm.heightPixels);
Log.e("YGOMobileLog","类地址"+System.identityHashCode(this)); Log.e("YGOMobileLog", "类地址" + System.identityHashCode(this));
int notchHeight=getNotchHeight(); int notchHeight = getNotchHeight();
try { try {
FileLogUtil.writeAndTime("是否沉浸: " + isImmerSiveMode()); FileLogUtil.writeAndTime("是否沉浸: " + isImmerSiveMode());
...@@ -89,7 +88,7 @@ public class AppsSettings { ...@@ -89,7 +88,7 @@ public class AppsSettings {
FileLogUtil.writeAndTime("原始宽: " + mScreenWidth); FileLogUtil.writeAndTime("原始宽: " + mScreenWidth);
FileLogUtil.writeAndTime("界面长: " + dm.heightPixels); FileLogUtil.writeAndTime("界面长: " + dm.heightPixels);
FileLogUtil.writeAndTime("界面宽: " + dm.widthPixels); FileLogUtil.writeAndTime("界面宽: " + dm.widthPixels);
FileLogUtil.writeAndTime("刘海长: "+notchHeight); FileLogUtil.writeAndTime("刘海长: " + notchHeight);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -147,7 +146,7 @@ public class AppsSettings { ...@@ -147,7 +146,7 @@ public class AppsSettings {
return mSharedPreferences.getInt(PREF_NOTCH_HEIGHT, DEF_PREF_NOTCH_HEIGHT); return mSharedPreferences.getInt(PREF_NOTCH_HEIGHT, DEF_PREF_NOTCH_HEIGHT);
} }
public void setNotchHeight(int height){ public void setNotchHeight(int height) {
mSharedPreferences.putInt(PREF_NOTCH_HEIGHT, height); mSharedPreferences.putInt(PREF_NOTCH_HEIGHT, height);
} }
...@@ -469,7 +468,7 @@ public class AppsSettings { ...@@ -469,7 +468,7 @@ public class AppsSettings {
//获取ai卡组文件夹 //获取ai卡组文件夹
public String getAiDeckDir() { public String getAiDeckDir() {
return new File(getResourcePath(), Constants.CORE_DECK_PATH+"/Decks").getAbsolutePath(); return new File(getResourcePath(), Constants.WINDBOT_PATH + "/Decks").getAbsolutePath();
} }
//获取新卡卡包文件夹 //获取新卡卡包文件夹
...@@ -478,7 +477,7 @@ public class AppsSettings { ...@@ -478,7 +477,7 @@ public class AppsSettings {
} }
//获取临时存放卡组的目录 //获取临时存放卡组的目录
public String getCacheDeckDir(){ public String getCacheDeckDir() {
return context.getExternalFilesDir("cacheDeck").getAbsolutePath(); return context.getExternalFilesDir("cacheDeck").getAbsolutePath();
} }
......
package cn.garymb.ygomobile.utils; package cn.garymb.ygomobile.utils;
import android.content.Context;
import android.os.Build; import android.os.Build;
import java.io.File; import java.io.File;
...@@ -15,14 +16,15 @@ import cn.garymb.ygomobile.AppsSettings; ...@@ -15,14 +16,15 @@ import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants; import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.DeckType; import cn.garymb.ygomobile.bean.DeckType;
import cn.garymb.ygomobile.bean.events.DeckFile; import cn.garymb.ygomobile.bean.events.DeckFile;
import cn.garymb.ygomobile.lite.R;
public class DeckUtil { public class DeckUtil {
public static List<DeckType> getDeckTypeList() { public static List<DeckType> getDeckTypeList(Context context) {
List<DeckType> deckTypeList = new ArrayList<>(); List<DeckType> deckTypeList = new ArrayList<>();
deckTypeList.add(new DeckType("卡包展示", AppsSettings.get().getPackDeckDir())); deckTypeList.add(new DeckType(context.getResources().getString(R.string.category_pack), AppsSettings.get().getPackDeckDir()));
deckTypeList.add(new DeckType("人机卡组", AppsSettings.get().getAiDeckDir())); deckTypeList.add(new DeckType(context.getResources().getString(R.string.category_windbot_deck), AppsSettings.get().getAiDeckDir()));
deckTypeList.add(new DeckType("未分类", AppsSettings.get().getDeckDir())); deckTypeList.add(new DeckType(context.getResources().getString(R.string.category_Uncategorized), AppsSettings.get().getDeckDir()));
File[] files = new File(AppsSettings.get().getDeckDir()).listFiles(); File[] files = new File(AppsSettings.get().getDeckDir()).listFiles();
if (files != null) { if (files != null) {
...@@ -38,7 +40,7 @@ public class DeckUtil { ...@@ -38,7 +40,7 @@ public class DeckUtil {
public static List<DeckFile> getDeckList(String path) { public static List<DeckFile> getDeckList(String path) {
List<DeckFile> deckList = new ArrayList<>(); List<DeckFile> deckList = new ArrayList<>();
File[] files = new File(path).listFiles(); File[] files = new File(path).listFiles();
if (files != null){ if (files != null) {
for (File file : files) { for (File file : files) {
if (file.isFile() && file.getName().endsWith(".ydk")) { if (file.isFile() && file.getName().endsWith(".ydk")) {
deckList.add(new DeckFile(file)); deckList.add(new DeckFile(file));
...@@ -49,10 +51,10 @@ public class DeckUtil { ...@@ -49,10 +51,10 @@ public class DeckUtil {
} }
public static List<DeckFile> getExpansionsDeckList() throws IOException { public static List<DeckFile> getExpansionsDeckList() throws IOException {
AppsSettings appsSettings= AppsSettings.get(); AppsSettings appsSettings = AppsSettings.get();
List<DeckFile> deckList = new ArrayList<>(); List<DeckFile> deckList = new ArrayList<>();
File[] files = new File(appsSettings.getExpansionsPath(), Constants.CORE_DECK_PATH).listFiles(); File[] files = new File(appsSettings.getExpansionsPath(), Constants.CORE_DECK_PATH).listFiles();
if(files!=null) { if (files != null) {
for (File file : files) { for (File file : files) {
if (file.isFile() && file.getName().endsWith(".ydk")) { if (file.isFile() && file.getName().endsWith(".ydk")) {
deckList.add(new DeckFile(file)); deckList.add(new DeckFile(file));
...@@ -66,13 +68,13 @@ public class DeckUtil { ...@@ -66,13 +68,13 @@ public class DeckUtil {
Enumeration entries = zipFile.entries(); Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement(); ZipEntry entry = (ZipEntry) entries.nextElement();
if (entry.getName().endsWith(".ydk")){ if (entry.getName().endsWith(".ydk")) {
String name=entry.getName(); String name = entry.getName();
name=name.substring(name.lastIndexOf("/"),name.length()); name = name.substring(name.lastIndexOf("/"), name.length());
InputStream inputStream = zipFile.getInputStream(entry); InputStream inputStream = zipFile.getInputStream(entry);
deckList.add(new DeckFile( deckList.add(new DeckFile(
IOUtils.asFile(inputStream, IOUtils.asFile(inputStream,
appsSettings.getCacheDeckDir()+"/"+name))); appsSettings.getCacheDeckDir() + "/" + name)));
} }
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
......
...@@ -251,4 +251,7 @@ ...@@ -251,4 +251,7 @@
<string name="save_n_open">저장후 열기</string> <string name="save_n_open">저장후 열기</string>
<string name="searchresult">결과</string> <string name="searchresult">결과</string>
<string name="Pre_share">공유 준비</string> <string name="Pre_share">공유 준비</string>
<string name="category_pack">한 갑</string>
<string name="category_windbot_deck">AI 덱</string>
<string name="category_Uncategorized">분류되지 않은</string>
</resources> </resources>
...@@ -250,4 +250,7 @@ ...@@ -250,4 +250,7 @@
<string name="save_n_open">保存并打开</string> <string name="save_n_open">保存并打开</string>
<string name="searchresult">搜索结果</string> <string name="searchresult">搜索结果</string>
<string name="Pre_share">准备分享,请稍候……</string> <string name="Pre_share">准备分享,请稍候……</string>
<string name="category_pack">卡包展示</string>
<string name="category_windbot_deck">人机卡组</string>
<string name="category_Uncategorized">未分类卡组</string>
</resources> </resources>
...@@ -253,4 +253,7 @@ ...@@ -253,4 +253,7 @@
<string name="save_n_open">Save and Open</string> <string name="save_n_open">Save and Open</string>
<string name="searchresult">Results</string> <string name="searchresult">Results</string>
<string name="Pre_share">Prepare to Share</string> <string name="Pre_share">Prepare to Share</string>
<string name="category_pack">Pack</string>
<string name="category_windbot_deck">BotDeck</string>
<string name="category_Uncategorized">UncategorizedDeck</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