Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
22b062da
Commit
22b062da
authored
Jul 31, 2019
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据卡组路径获取分类名
parent
12c260a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
+32
-6
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
...rc/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
+3
-2
No files found.
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
View file @
22b062da
...
...
@@ -24,9 +24,9 @@ public class DeckUtil {
public
static
List
<
DeckType
>
getDeckTypeList
(
Context
context
)
{
List
<
DeckType
>
deckTypeList
=
new
ArrayList
<>();
deckTypeList
.
add
(
new
DeckType
(
context
.
getResources
().
getString
(
R
.
string
.
category_pack
),
AppsSettings
.
get
().
getPackDeckDir
()));
deckTypeList
.
add
(
new
DeckType
(
context
.
getResources
().
getString
(
R
.
string
.
category_windbot_deck
),
AppsSettings
.
get
().
getAiDeckDir
()));
deckTypeList
.
add
(
new
DeckType
(
context
.
getResources
().
getString
(
R
.
string
.
category_Uncategorized
),
AppsSettings
.
get
().
getDeckDir
()));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_pack
),
AppsSettings
.
get
().
getPackDeckDir
()));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_windbot_deck
),
AppsSettings
.
get
().
getAiDeckDir
()));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_Uncategorized
),
AppsSettings
.
get
().
getDeckDir
()));
File
[]
files
=
new
File
(
AppsSettings
.
get
().
getDeckDir
()).
listFiles
();
if
(
files
!=
null
)
{
...
...
@@ -49,10 +49,36 @@ public class DeckUtil {
}
}
}
Collections
.
sort
(
deckList
,
nameCom
);
Collections
.
sort
(
deckList
,
nameCom
);
return
deckList
;
}
/**
* 根据卡组绝对路径获取卡组分类名称
* @param deckPath
* @return
*/
public
static
String
getDeckTypeName
(
String
deckPath
)
{
File
file
=
new
File
(
deckPath
);
if
(
file
.
exists
())
{
String
name
=
file
.
getParentFile
().
getName
();
String
lastName
=
file
.
getParentFile
().
getParentFile
().
getName
();
if
(
name
.
equals
(
"pack"
)
||
name
.
equals
(
"cacheDeck"
))
{
//卡包
return
YGOUtil
.
s
(
R
.
string
.
category_pack
);
}
else
if
(
name
.
equals
(
"Decks"
)&&
lastName
.
equals
(
Constants
.
WINDBOT_PATH
))
{
//ai卡组
return
YGOUtil
.
s
(
R
.
string
.
category_windbot_deck
);
}
else
if
(
name
.
equals
(
"deck"
)
&&
lastName
.
equals
(
Constants
.
PREF_DEF_GAME_DIR
))
{
//如果是deck并且上一个目录是ygocore的话,保证不会把名字为deck的卡包识别为未分类
return
YGOUtil
.
s
(
R
.
string
.
category_Uncategorized
);
}
else
{
return
name
;
}
}
return
null
;
}
public
static
List
<
DeckFile
>
getExpansionsDeckList
()
throws
IOException
{
AppsSettings
appsSettings
=
AppsSettings
.
get
();
List
<
DeckFile
>
deckList
=
new
ArrayList
<>();
...
...
@@ -85,11 +111,11 @@ public class DeckUtil {
}
}
}
Collections
.
sort
(
deckList
,
nameCom
);
Collections
.
sort
(
deckList
,
nameCom
);
return
deckList
;
}
static
Comparator
nameCom
=
new
Comparator
<
DeckFile
>()
{
static
Comparator
nameCom
=
new
Comparator
<
DeckFile
>()
{
@Override
public
int
compare
(
DeckFile
ydk1
,
DeckFile
ydk2
)
{
return
ydk1
.
getName
().
compareTo
(
ydk2
.
getName
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
View file @
22b062da
...
...
@@ -81,13 +81,14 @@ public class YGODialogUtil {
File
file
=
new
File
(
selectDeckPath
);
if
(
file
.
exists
())
{
String
name
=
file
.
getParentFile
().
getName
();
String
lastName
=
file
.
getParentFile
().
getParentFile
().
getName
();
if
(
name
.
equals
(
"pack"
)
||
name
.
equals
(
"cacheDeck"
))
{
//卡包
typeSelectPosition
=
0
;
}
else
if
(
name
.
equals
(
"Decks"
))
{
}
else
if
(
name
.
equals
(
"Decks"
)
&&
lastName
.
equals
(
Constants
.
WINDBOT_PATH
)
)
{
//ai卡组
typeSelectPosition
=
1
;
}
else
if
(
name
.
equals
(
"deck"
)
&&
new
File
(
selectDeckPath
).
getParentFile
().
getParentFile
().
getName
()
.
equals
(
Constants
.
PREF_DEF_GAME_DIR
))
{
}
else
if
(
name
.
equals
(
"deck"
)
&&
lastName
.
equals
(
Constants
.
PREF_DEF_GAME_DIR
))
{
//如果是deck并且上一个目录是ygocore的话,保证不会把名字为deck的卡包识别为未分类
}
else
{
//其他卡包
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment