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
f7558728
Commit
f7558728
authored
Sep 03, 2021
by
qq247321453
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收藏
parent
4aedbb45
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
298 additions
and
295 deletions
+298
-295
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
.../src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
+35
-17
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+62
-89
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardFavorites.java
...main/java/cn/garymb/ygomobile/ui/cards/CardFavorites.java
+89
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
...java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
+12
-15
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
.../main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
+33
-19
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivity.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerActivity.java
+10
-19
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+2
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+2
-3
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+8
-2
mobile/src/main/java/ocgcore/ConfigManager.java
mobile/src/main/java/ocgcore/ConfigManager.java
+0
-120
mobile/src/main/java/ocgcore/DataManager.java
mobile/src/main/java/ocgcore/DataManager.java
+0
-4
mobile/src/main/res/color/selector_text_color_white_gold.xml
mobile/src/main/res/color/selector_text_color_white_gold.xml
+5
-0
mobile/src/main/res/drawable/ic_baseline_favorite_24.xml
mobile/src/main/res/drawable/ic_baseline_favorite_24.xml
+10
-0
mobile/src/main/res/drawable/ic_baseline_favorite_border_24.xml
.../src/main/res/drawable/ic_baseline_favorite_border_24.xml
+10
-0
mobile/src/main/res/drawable/selector_favorite.xml
mobile/src/main/res/drawable/selector_favorite.xml
+6
-0
mobile/src/main/res/layout/dialog_cardinfo.xml
mobile/src/main/res/layout/dialog_cardinfo.xml
+2
-2
mobile/src/main/res/layout/nav_card_search.xml
mobile/src/main/res/layout/nav_card_search.xml
+1
-0
mobile/src/main/res/values/colors.xml
mobile/src/main/res/values/colors.xml
+4
-2
No files found.
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
f7558728
...
@@ -673,4 +673,9 @@ public class AppsSettings {
...
@@ -673,4 +673,9 @@ public class AppsSettings {
// Log.i("kk", "saveTemp:" + array);
// Log.i("kk", "saveTemp:" + array);
mSharedPreferences
.
putString
(
Constants
.
PREF_LAST_ROOM_LIST
,
array
.
toString
());
mSharedPreferences
.
putString
(
Constants
.
PREF_LAST_ROOM_LIST
,
array
.
toString
());
}
}
//获取收藏文件
public
String
getFavoriteTxt
()
{
return
new
File
(
getResourcePath
(),
"/favorite.txt"
).
getAbsolutePath
();
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
f7558728
...
@@ -219,4 +219,6 @@ public interface Constants {
...
@@ -219,4 +219,6 @@ public interface Constants {
boolean
COPY_YDK_FILE
=
false
;
boolean
COPY_YDK_FILE
=
false
;
String
TAG
=
"ygo-java"
;
String
TAG
=
"ygo-java"
;
String
DEF_ENCODING
=
"utf-8"
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
View file @
f7558728
...
@@ -170,18 +170,37 @@ public class CardLoader implements ICardLoader {
...
@@ -170,18 +170,37 @@ public class CardLoader implements ICardLoader {
});
});
}
}
private
Comparator
<
Card
>
ASCode
=
new
Comparator
<
Card
>()
{
public
List
<
Card
>
sort
(
List
<
Card
>
cards
){
@Override
List
<
Card
>
tmp
=
new
ArrayList
<
Card
>();
public
int
compare
(
Card
o1
,
Card
o2
)
{
List
<
Card
>
monster
=
new
ArrayList
<
Card
>();
int
index1
=
(
Integer
.
valueOf
(
o1
.
Code
).
intValue
());
List
<
Card
>
spell
=
new
ArrayList
<
Card
>();
int
index2
=
(
Integer
.
valueOf
(
o2
.
Code
).
intValue
());
List
<
Card
>
trap
=
new
ArrayList
<
Card
>();
return
index1
-
index2
;
int
count
=
cards
.
size
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
Card
card
=
cards
.
get
(
i
);
if
(
card
.
isType
(
CardType
.
Monster
))
{
monster
.
add
(
card
);
}
else
if
(
card
.
isType
(
CardType
.
Spell
))
{
spell
.
add
(
card
);
}
else
if
(
card
.
isType
(
CardType
.
Trap
))
{
trap
.
add
(
card
);
}
else
{
tmp
.
add
(
card
);
}
}
Collections
.
sort
(
tmp
,
ASCode
);
Collections
.
sort
(
monster
,
ASC
);
Collections
.
sort
(
spell
,
ASCode
);
Collections
.
sort
(
trap
,
ASCode
);
tmp
.
addAll
(
monster
);
tmp
.
addAll
(
spell
);
tmp
.
addAll
(
trap
);
return
tmp
;
}
}
};
private
Comparator
<
Card
>
ASC
=
new
Comparator
<
Card
>()
{
private
static
final
Comparator
<
Card
>
ASCode
=
(
o1
,
o2
)
->
o1
.
Code
-
o2
.
Code
;
@Override
public
int
compare
(
Card
o1
,
Card
o2
)
{
private
static
final
Comparator
<
Card
>
ASC
=
(
o1
,
o2
)
->
{
if
(
o1
.
getStar
()
==
o2
.
getStar
())
{
if
(
o1
.
getStar
()
==
o2
.
getStar
())
{
if
(
o1
.
Attack
==
o2
.
Attack
)
{
if
(
o1
.
Attack
==
o2
.
Attack
)
{
return
(
int
)
(
o2
.
Code
-
o1
.
Code
);
return
(
int
)
(
o2
.
Code
-
o1
.
Code
);
...
@@ -191,7 +210,6 @@ public class CardLoader implements ICardLoader {
...
@@ -191,7 +210,6 @@ public class CardLoader implements ICardLoader {
}
else
{
}
else
{
return
o2
.
getStar
()
-
o1
.
getStar
();
return
o2
.
getStar
()
-
o1
.
getStar
();
}
}
}
};
};
@Override
@Override
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
f7558728
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardFavorites.java
0 → 100644
View file @
f7558728
package
cn.garymb.ygomobile.ui.cards
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
ocgcore.data.Card
;
public
class
CardFavorites
{
private
final
List
<
Integer
>
mList
=
new
ArrayList
<>();
private
static
final
CardFavorites
sCardFavorites
=
new
CardFavorites
();
public
static
CardFavorites
get
()
{
return
sCardFavorites
;
}
private
CardFavorites
()
{
}
public
boolean
toggle
(
Integer
id
)
{
if
(!
mList
.
contains
(
id
))
{
//添加
mList
.
add
(
id
);
return
true
;
}
else
{
//移除
mList
.
remove
(
id
);
return
false
;
}
}
public
boolean
add
(
Integer
id
)
{
if
(!
mList
.
contains
(
id
))
{
mList
.
add
(
id
);
return
true
;
}
return
false
;
}
public
boolean
hasCard
(
Integer
id
){
return
mList
.
contains
(
id
);
}
public
List
<
Integer
>
getCardIds
()
{
return
mList
;
}
public
List
<
Card
>
getCards
(
CardLoader
cardLoader
)
{
SparseArray
<
Card
>
id
=
cardLoader
.
readCards
(
mList
,
false
);
List
<
Card
>
list
=
new
ArrayList
<>();
if
(
id
!=
null
)
{
for
(
int
i
=
0
;
i
<
id
.
size
();
i
++)
{
list
.
add
(
id
.
valueAt
(
i
));
}
}
return
cardLoader
.
sort
(
list
);
}
public
void
remove
(
Integer
id
)
{
mList
.
remove
(
id
);
}
public
void
load
()
{
List
<
String
>
lines
=
FileUtils
.
readLines
(
AppsSettings
.
get
().
getFavoriteTxt
(),
Constants
.
DEF_ENCODING
);
mList
.
clear
();
for
(
String
line
:
lines
)
{
String
tmp
=
line
.
trim
();
if
(
TextUtils
.
isDigitsOnly
(
tmp
))
{
mList
.
add
(
Integer
.
parseInt
(
tmp
));
}
}
}
public
void
save
()
{
List
<
String
>
ret
=
new
ArrayList
<>();
for
(
Integer
id
:
mList
)
{
ret
.
add
(
String
.
valueOf
(
id
));
}
FileUtils
.
writeLines
(
AppsSettings
.
get
().
getFavoriteTxt
(),
ret
,
Constants
.
DEF_ENCODING
,
"\n"
);
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
View file @
f7558728
...
@@ -163,6 +163,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -163,6 +163,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
super
.
onScrollStateChanged
(
recyclerView
,
newState
);
switch
(
newState
)
{
switch
(
newState
)
{
case
RecyclerView
.
SCROLL_STATE_IDLE
:
case
RecyclerView
.
SCROLL_STATE_IDLE
:
case
RecyclerView
.
SCROLL_STATE_SETTLING
:
if
(!
isFinishing
())
{
if
(!
isFinishing
())
{
Glide
.
with
(
getContext
()).
resumeRequests
();
Glide
.
with
(
getContext
()).
resumeRequests
();
}
}
...
@@ -170,11 +171,6 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -170,11 +171,6 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
Glide
.
with
(
getContext
()).
pauseRequests
();
Glide
.
with
(
getContext
()).
pauseRequests
();
break
;
break
;
case
RecyclerView
.
SCROLL_STATE_SETTLING
:
if
(!
isFinishing
())
{
Glide
.
with
(
getContext
()).
resumeRequests
();
}
break
;
}
}
}
}
});
});
...
@@ -284,6 +280,11 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -284,6 +280,11 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
if
(
cardInfo
!=
null
)
{
if
(
cardInfo
!=
null
)
{
if
(
mCardDetail
==
null
)
{
if
(
mCardDetail
==
null
)
{
mCardDetail
=
new
CardDetail
(
this
,
mImageLoader
,
mStringManager
);
mCardDetail
=
new
CardDetail
(
this
,
mImageLoader
,
mStringManager
);
mCardDetail
.
setCallBack
((
card
,
favorite
)
->
{
if
(
mCardSelector
.
isShowFavorite
())
{
mCardSelector
.
showFavorites
(
false
);
}
});
mCardDetail
.
setOnCardClickListener
(
new
CardDetail
.
DefaultOnCardClickListener
()
{
mCardDetail
.
setOnCardClickListener
(
new
CardDetail
.
DefaultOnCardClickListener
()
{
@Override
@Override
public
void
onOpenUrl
(
Card
cardInfo
)
{
public
void
onOpenUrl
(
Card
cardInfo
)
{
...
@@ -302,16 +303,6 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -302,16 +303,6 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
mDialog
.
dismiss
();
mDialog
.
dismiss
();
}
}
});
});
mCardDetail
.
setCallBack
(
new
CardDetail
.
CallBack
()
{
@Override
public
void
onSearchStart
()
{
}
@Override
public
void
onSearchResult
(
List
<
Card
>
Cards
,
boolean
isHide
)
{
CardSearchActivity
.
this
.
onSearchResult
(
Cards
,
isHide
);
}
});
}
}
if
(
mDialog
==
null
)
{
if
(
mDialog
==
null
)
{
mDialog
=
new
DialogPlus
(
this
);
mDialog
=
new
DialogPlus
(
this
);
...
@@ -347,6 +338,12 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -347,6 +338,12 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
}
}
}
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
CardFavorites
.
get
().
save
();
}
//https://www.jianshu.com/p/99649af3b191
//https://www.jianshu.com/p/99649af3b191
public
void
showNewbieGuide
()
{
public
void
showNewbieGuide
()
{
HighlightOptions
options
=
new
HighlightOptions
.
Builder
()
//绘制一个高亮虚线圈
HighlightOptions
options
=
new
HighlightOptions
.
Builder
()
//绘制一个高亮虚线圈
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
View file @
f7558728
...
@@ -4,7 +4,6 @@ package cn.garymb.ygomobile.ui.cards;
...
@@ -4,7 +4,6 @@ package cn.garymb.ygomobile.ui.cards;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
android.view.View
;
import
android.view.View
;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.InputMethodManager
;
import
android.view.inputmethod.InputMethodManager
;
...
@@ -16,6 +15,7 @@ import android.widget.TextView.OnEditorActionListener;
...
@@ -16,6 +15,7 @@ import android.widget.TextView.OnEditorActionListener;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
...
@@ -25,7 +25,6 @@ import cn.garymb.ygomobile.loader.ICardLoader;
...
@@ -25,7 +25,6 @@ import cn.garymb.ygomobile.loader.ICardLoader;
import
cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter
;
import
cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter
;
import
cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem
;
import
cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
ocgcore.ConfigManager
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.LimitManager
;
import
ocgcore.LimitManager
;
import
ocgcore.StringManager
;
import
ocgcore.StringManager
;
...
@@ -39,8 +38,6 @@ import ocgcore.enums.CardRace;
...
@@ -39,8 +38,6 @@ import ocgcore.enums.CardRace;
import
ocgcore.enums.CardType
;
import
ocgcore.enums.CardType
;
import
ocgcore.enums.LimitType
;
import
ocgcore.enums.LimitType
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
cards
.
DeckManagerActivity
.
Favorite
;
public
class
CardSearcher
implements
View
.
OnClickListener
{
public
class
CardSearcher
implements
View
.
OnClickListener
{
final
String
[]
BtnVals
=
new
String
[
9
];
final
String
[]
BtnVals
=
new
String
[
9
];
...
@@ -73,8 +70,10 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -73,8 +70,10 @@ public class CardSearcher implements View.OnClickListener {
private
final
View
layout_monster
;
private
final
View
layout_monster
;
private
final
ICardLoader
dataLoader
;
private
final
ICardLoader
dataLoader
;
private
final
Context
mContext
;
private
final
Context
mContext
;
private
final
Button
myFavButton
;
private
CallBack
mCallBack
;
private
CallBack
mCallBack
;
CardLoader
mCardLoader
;
CardLoader
mCardLoader
;
private
boolean
mShowFavorite
;
public
interface
CallBack
{
public
interface
CallBack
{
void
onSearchStart
();
void
onSearchStart
();
...
@@ -111,7 +110,7 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -111,7 +110,7 @@ public class CardSearcher implements View.OnClickListener {
atkText
=
findViewById
(
R
.
id
.
edt_atk
);
atkText
=
findViewById
(
R
.
id
.
edt_atk
);
defText
=
findViewById
(
R
.
id
.
edt_def
);
defText
=
findViewById
(
R
.
id
.
edt_def
);
LinkMarkerButton
=
findViewById
(
R
.
id
.
btn_linkmarker
);
LinkMarkerButton
=
findViewById
(
R
.
id
.
btn_linkmarker
);
Button
myFavButton
=
findViewById
(
R
.
id
.
btn_my_fav
);
myFavButton
=
findViewById
(
R
.
id
.
btn_my_fav
);
searchButton
=
findViewById
(
R
.
id
.
btn_search
);
searchButton
=
findViewById
(
R
.
id
.
btn_search
);
resetButton
=
findViewById
(
R
.
id
.
btn_reset
);
resetButton
=
findViewById
(
R
.
id
.
btn_reset
);
layout_monster
=
findViewById
(
R
.
id
.
layout_monster
);
layout_monster
=
findViewById
(
R
.
id
.
layout_monster
);
...
@@ -136,18 +135,11 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -136,18 +135,11 @@ public class CardSearcher implements View.OnClickListener {
suffixWord
.
setOnEditorActionListener
(
searchListener
);
suffixWord
.
setOnEditorActionListener
(
searchListener
);
myFavButton
.
setOnClickListener
(
v
->
{
myFavButton
.
setOnClickListener
(
v
->
{
SparseArray
<
Card
>
id
=
mCardLoader
.
readCards
(
ConfigManager
.
mLines
,
false
);
if
(
isShowFavorite
()){
Favorite
.
clear
();
hideFavorites
();
if
(
id
!=
null
)
{
}
else
{
for
(
int
i
=
0
;
i
<
id
.
size
();
i
++)
showFavorites
(
true
);
Favorite
.
add
(
id
.
valueAt
(
i
));
}
if
(
mCallBack
!=
null
)
{
mCallBack
.
onSearchStart
();
mCallBack
.
onSearchResult
(
Favorite
,
false
);
}
}
DeckManagerActivity
.
isSearchResult
=
false
;
});
});
LinkMarkerButton
.
setOnClickListener
(
v
->
{
LinkMarkerButton
.
setOnClickListener
(
v
->
{
...
@@ -282,6 +274,24 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -282,6 +274,24 @@ public class CardSearcher implements View.OnClickListener {
});
});
}
}
public
void
showFavorites
(
boolean
showList
)
{
mShowFavorite
=
true
;
myFavButton
.
setSelected
(
true
);
if
(
mCallBack
!=
null
)
{
mCallBack
.
onSearchStart
();
mCallBack
.
onSearchResult
(
CardFavorites
.
get
().
getCards
(
mCardLoader
),
!
showList
);
}
}
public
void
hideFavorites
(){
mShowFavorite
=
true
;
myFavButton
.
setSelected
(
false
);
if
(
mCallBack
!=
null
)
{
mCallBack
.
onSearchStart
();
mCallBack
.
onSearchResult
(
Collections
.
emptyList
(),
true
);
}
}
public
void
initItems
()
{
public
void
initItems
()
{
initOtSpinners
(
otSpinner
);
initOtSpinners
(
otSpinner
);
initLimitSpinners
(
limitSpinner
);
initLimitSpinners
(
limitSpinner
);
...
@@ -341,6 +351,10 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -341,6 +351,10 @@ public class CardSearcher implements View.OnClickListener {
spinner
.
setAdapter
(
adapter
);
spinner
.
setAdapter
(
adapter
);
}
}
public
boolean
isShowFavorite
()
{
return
mShowFavorite
;
}
protected
String
getString
(
int
id
)
{
protected
String
getString
(
int
id
)
{
return
mContext
.
getString
(
id
);
return
mContext
.
getString
(
id
);
}
}
...
@@ -528,9 +542,10 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -528,9 +542,10 @@ public class CardSearcher implements View.OnClickListener {
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
if
(
v
==
searchButton
)
{
if
(
v
.
getId
()
==
R
.
id
.
btn_search
)
{
hideFavorites
();
search
();
search
();
}
else
if
(
v
==
resetButton
)
{
}
else
if
(
v
.
getId
()
==
R
.
id
.
btn_reset
)
{
resetAll
();
resetAll
();
}
}
}
}
...
@@ -554,7 +569,6 @@ public class CardSearcher implements View.OnClickListener {
...
@@ -554,7 +569,6 @@ public class CardSearcher implements View.OnClickListener {
,
getSelect
(
typeMonsterSpinner2
));
,
getSelect
(
typeMonsterSpinner2
));
lineKey
=
0
;
lineKey
=
0
;
}
}
DeckManagerActivity
.
isSearchResult
=
true
;
}
}
private
void
resetAll
()
{
private
void
resetAll
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivity.java
View file @
f7558728
...
@@ -80,7 +80,6 @@ import cn.garymb.ygomobile.utils.IOUtils;
...
@@ -80,7 +80,6 @@ import cn.garymb.ygomobile.utils.IOUtils;
import
cn.garymb.ygomobile.utils.ShareUtil
;
import
cn.garymb.ygomobile.utils.ShareUtil
;
import
cn.garymb.ygomobile.utils.YGODialogUtil
;
import
cn.garymb.ygomobile.utils.YGODialogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.ConfigManager
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -117,8 +116,6 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
...
@@ -117,8 +116,6 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
private
DialogPlus
mDialog
;
private
DialogPlus
mDialog
;
private
DialogPlus
builderShareLoading
;
private
DialogPlus
builderShareLoading
;
private
boolean
isExit
=
false
;
private
boolean
isExit
=
false
;
public
static
boolean
isSearchResult
;
public
static
List
<
Card
>
Favorite
=
new
ArrayList
<>();
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
@@ -169,13 +166,18 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
...
@@ -169,13 +166,18 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
//最后卡组
//最后卡组
_file
=
new
File
(
mSettings
.
getLastDeckPath
());
_file
=
new
File
(
mSettings
.
getLastDeckPath
());
}
}
Favorite
.
clear
();
init
(
_file
);
init
(
_file
);
EventBus
.
getDefault
().
register
(
this
);
EventBus
.
getDefault
().
register
(
this
);
tv_deck
.
setOnClickListener
(
v
->
YGODialogUtil
.
dialogDeckSelect
(
getActivity
(),
AppsSettings
.
get
().
getLastDeckPath
(),
this
));
tv_deck
.
setOnClickListener
(
v
->
YGODialogUtil
.
dialogDeckSelect
(
getActivity
(),
AppsSettings
.
get
().
getLastDeckPath
(),
this
));
}
}
//endregion
//endregion
@Override
protected
void
onStop
()
{
super
.
onStop
();
CardFavorites
.
get
().
save
();
}
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
EventBus
.
getDefault
().
unregister
(
this
);
EventBus
.
getDefault
().
unregister
(
this
);
...
@@ -284,13 +286,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
...
@@ -284,13 +286,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
//设置当前卡组
//设置当前卡组
setCurDeck
(
rs
);
setCurDeck
(
rs
);
//设置收藏夹
//设置收藏夹
SparseArray
<
Card
>
id
=
mCardLoader
.
readCards
(
ConfigManager
.
mLines
,
false
);
mCardSelector
.
showFavorites
(
false
);
if
(
id
!=
null
)
{
for
(
int
i
=
0
;
i
<
id
.
size
();
i
++)
Favorite
.
add
(
id
.
valueAt
(
i
));
}
onSearchResult
(
Favorite
,
true
);
isSearchResult
=
false
;
});
});
}
}
...
@@ -440,14 +436,9 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
...
@@ -440,14 +436,9 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
addMainCard
(
cardInfo
);
addMainCard
(
cardInfo
);
}
}
});
});
mCardDetail
.
setCallBack
(
new
CardDetail
.
CallBack
()
{
mCardDetail
.
setCallBack
((
card
,
favorite
)
->
{
@Override
if
(
mCardSelector
.
isShowFavorite
()){
public
void
onSearchStart
()
{
mCardSelector
.
showFavorites
(
false
);
}
@Override
public
void
onSearchResult
(
List
<
Card
>
Cards
,
boolean
isHide
)
{
DeckManagerActivity
.
this
.
onSearchResult
(
Cards
,
isHide
);
}
}
});
});
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
f7558728
...
@@ -24,13 +24,13 @@ import cn.garymb.ygomobile.GameUriManager;
...
@@ -24,13 +24,13 @@ import cn.garymb.ygomobile.GameUriManager;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.cards.CardFavorites
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.ConfigManager
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
...
@@ -49,7 +49,6 @@ public class MainActivity extends HomeActivity {
...
@@ -49,7 +49,6 @@ public class MainActivity extends HomeActivity {
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
};
};
public
ConfigManager
favConf
=
DataManager
.
openConfig
(
AppsSettings
.
get
().
getSystemConfig
());
ResCheckTask
mResCheckTask
;
ResCheckTask
mResCheckTask
;
private
GameUriManager
mGameUriManager
;
private
GameUriManager
mGameUriManager
;
private
ImageUpdater
mImageUpdater
;
private
ImageUpdater
mImageUpdater
;
...
@@ -65,7 +64,7 @@ public class MainActivity extends HomeActivity {
...
@@ -65,7 +64,7 @@ public class MainActivity extends HomeActivity {
//资源复制
//资源复制
checkRes
();
checkRes
();
//加载收藏夹
//加载收藏夹
favConf
.
re
ad
();
CardFavorites
.
get
().
lo
ad
();
}
}
@SuppressLint
({
"StringFormatMatches"
,
"StringFormatInvalid"
})
@SuppressLint
({
"StringFormatMatches"
,
"StringFormatInvalid"
})
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
f7558728
...
@@ -379,9 +379,8 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -379,9 +379,8 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
}
}
private
void
fixString
(
String
stringfile
)
{
private
void
fixString
(
String
stringfile
)
{
String
encoding
=
"utf-8"
;
List
<
String
>
lines
=
FileUtils
.
readLines
(
stringfile
,
Constants
.
DEF_ENCODING
);
List
<
String
>
lines
=
FileUtils
.
readLines
(
stringfile
,
encoding
);
FileUtils
.
writeLines
(
stringfile
,
lines
,
Constants
.
DEF_ENCODING
,
"\n"
);
FileUtils
.
writeLines
(
stringfile
,
lines
,
encoding
,
"\n"
);
}
}
public
void
checkWindbot
()
{
public
void
checkWindbot
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
f7558728
...
@@ -44,6 +44,9 @@ public class FileUtils {
...
@@ -44,6 +44,9 @@ public class FileUtils {
InputStreamReader
in
=
null
;
InputStreamReader
in
=
null
;
FileInputStream
inputStream
=
null
;
FileInputStream
inputStream
=
null
;
List
<
String
>
lines
=
new
ArrayList
<>();
List
<
String
>
lines
=
new
ArrayList
<>();
if
(
encoding
==
null
){
encoding
=
"utf-8"
;
}
try
{
try
{
inputStream
=
new
FileInputStream
(
file
);
inputStream
=
new
FileInputStream
(
file
);
in
=
new
InputStreamReader
(
inputStream
,
encoding
);
in
=
new
InputStreamReader
(
inputStream
,
encoding
);
...
@@ -52,8 +55,8 @@ public class FileUtils {
...
@@ -52,8 +55,8 @@ public class FileUtils {
while
((
line
=
reader
.
readLine
())
!=
null
)
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
lines
.
add
(
line
);
lines
.
add
(
line
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Throwable
e
)
{
//ignore
}
finally
{
}
finally
{
IOUtils
.
close
(
in
);
IOUtils
.
close
(
in
);
IOUtils
.
close
(
inputStream
);
IOUtils
.
close
(
inputStream
);
...
@@ -62,6 +65,9 @@ public class FileUtils {
...
@@ -62,6 +65,9 @@ public class FileUtils {
}
}
public
static
boolean
writeLines
(
String
file
,
List
<
String
>
lines
,
String
encoding
,
String
newLine
)
{
public
static
boolean
writeLines
(
String
file
,
List
<
String
>
lines
,
String
encoding
,
String
newLine
)
{
if
(
encoding
==
null
){
encoding
=
"utf-8"
;
}
FileOutputStream
outputStream
=
null
;
FileOutputStream
outputStream
=
null
;
File
tmp
=
new
File
(
file
+
".tmp"
);
File
tmp
=
new
File
(
file
+
".tmp"
);
boolean
ok
=
false
;
boolean
ok
=
false
;
...
...
mobile/src/main/java/ocgcore/ConfigManager.java
deleted
100644 → 0
View file @
4aedbb45
package
ocgcore
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.Closeable
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
cn.garymb.ygomobile.utils.IOUtils
;
public
class
ConfigManager
implements
Closeable
{
public
static
List
<
Integer
>
mLines
=
new
ArrayList
<>();
private
File
file
;
ConfigManager
(
File
file
)
{
this
.
file
=
file
;
}
@Override
public
void
close
()
{
mLines
.
clear
();
}
public
void
read
()
{
mLines
.
clear
();
InputStreamReader
in
=
null
;
FileInputStream
inputStream
=
null
;
try
{
inputStream
=
new
FileInputStream
(
file
);
in
=
new
InputStreamReader
(
inputStream
,
"utf-8"
);
BufferedReader
reader
=
new
BufferedReader
(
in
);
String
line
=
null
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
if
(
line
.
startsWith
(
"#"
))
continue
;
mLines
.
add
(
Integer
.
parseInt
(
line
));
}
}
catch
(
Exception
e
)
{
}
finally
{
IOUtils
.
close
(
in
);
IOUtils
.
close
(
inputStream
);
}
}
//暂时弃用
public
boolean
isLoad
()
{
return
mLines
.
size
()
>
0
;
}
public
void
save
(
String
words
)
{
//if (!isLoad()) {
// read();
//}
OutputStreamWriter
out
=
null
;
FileOutputStream
outputStream
=
null
;
File
tmp
=
new
File
(
file
.
getAbsolutePath
()
+
".tmp"
);
boolean
ok
=
false
;
try
{
outputStream
=
new
FileOutputStream
(
tmp
);
out
=
new
OutputStreamWriter
(
outputStream
,
"utf-8"
);
BufferedWriter
writer
=
new
BufferedWriter
(
out
);
if
(
words
!=
null
||
words
!=
""
)
{
writer
.
write
(
words
);
writer
.
newLine
();
}
int
count
=
mLines
.
size
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
writer
.
write
((
mLines
.
get
(
i
)).
toString
());
if
(
i
<
count
-
1
)
{
writer
.
newLine
();
}
}
writer
.
flush
();
ok
=
true
;
}
catch
(
Exception
e
)
{
}
finally
{
IOUtils
.
close
(
out
);
IOUtils
.
close
(
outputStream
);
}
if
(
ok
)
{
if
(
file
.
exists
())
{
file
.
delete
();
}
tmp
.
renameTo
(
file
);
}
}
//已弃用通过system.conf设置字体大小
public
void
setFontSize
(
int
size
)
{
if
(!
isLoad
())
{
read
();
}
int
count
=
mLines
.
size
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
String
line
=
mLines
.
get
(
i
).
toString
();
if
(
line
==
null
)
continue
;
line
=
line
.
toLowerCase
(
Locale
.
US
);
if
(
line
.
contains
(
"textfont"
))
{
String
[]
values
=
line
.
split
(
"="
);
if
(
values
.
length
>
1
)
{
String
key
=
values
[
0
];
String
val
=
values
[
1
];
String
newline
=
key
+
"= "
;
String
[]
vs
=
val
.
trim
().
split
(
" "
);
newline
+=
vs
[
0
]
+
" "
+
size
;
mLines
.
add
(
i
,
Integer
.
parseInt
(
newline
));
mLines
.
remove
(
i
+
1
);
}
}
}
save
(
""
);
}
}
mobile/src/main/java/ocgcore/DataManager.java
View file @
f7558728
...
@@ -40,10 +40,6 @@ public class DataManager {
...
@@ -40,10 +40,6 @@ public class DataManager {
return
mLimitManager
;
return
mLimitManager
;
}
}
public
static
ConfigManager
openConfig
(
File
conf
)
{
return
new
ConfigManager
(
conf
);
}
public
CardManager
getCardManager
()
{
public
CardManager
getCardManager
()
{
return
mCardManager
;
return
mCardManager
;
}
}
...
...
mobile/src/main/res/color/selector_text_color_white_gold.xml
0 → 100644
View file @
f7558728
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:color=
"@color/gold"
android:state_selected=
"true"
/>
<item
android:color=
"@color/white"
/>
</selector>
\ No newline at end of file
mobile/src/main/res/drawable/ic_baseline_favorite_24.xml
0 → 100644
View file @
f7558728
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
android:tint=
"@color/red"
>
<path
android:fillColor=
"@color/red"
android:pathData=
"M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"
/>
</vector>
mobile/src/main/res/drawable/ic_baseline_favorite_border_24.xml
0 → 100644
View file @
f7558728
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
android:tint=
"@color/red"
>
<path
android:fillColor=
"@color/red"
android:pathData=
"M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"
/>
</vector>
mobile/src/main/res/drawable/selector_favorite.xml
0 → 100644
View file @
f7558728
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/ic_baseline_favorite_24"
android:state_selected=
"true"
/>
<item
android:drawable=
"@drawable/ic_baseline_favorite_24"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/ic_baseline_favorite_border_24"
/>
</selector>
\ No newline at end of file
mobile/src/main/res/layout/dialog_cardinfo.xml
View file @
f7558728
...
@@ -145,9 +145,9 @@
...
@@ -145,9 +145,9 @@
android:layout_width=
"30dp"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:
background=
"@drawable/ic_control_point
"
android:
src=
"@drawable/selector_favorite
"
android:paddingRight=
"5dp"
android:paddingRight=
"5dp"
android:scaleType=
"
c
enter"
/>
android:scaleType=
"
fitC
enter"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
...
...
mobile/src/main/res/layout/nav_card_search.xml
View file @
f7558728
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
android:layout_weight=
"1"
android:layout_weight=
"1"
android:background=
"@color/transparent"
android:background=
"@color/transparent"
android:text=
"@string/my_favorites"
android:text=
"@string/my_favorites"
android:textColor=
"@color/selector_text_color_white_gold"
android:visibility=
"visible"
/>
android:visibility=
"visible"
/>
</LinearLayout>
</LinearLayout>
...
...
mobile/src/main/res/values/colors.xml
View file @
f7558728
...
@@ -12,8 +12,10 @@
...
@@ -12,8 +12,10 @@
<color
name=
"mediumPurple"
>
#673AB7
</color>
<color
name=
"mediumPurple"
>
#673AB7
</color>
<color
name=
"mediumPurpleDark"
>
#572AA7
</color>
<color
name=
"mediumPurpleDark"
>
#572AA7
</color>
<color
name=
"colorPrimaryDark"
>
#2f41a5
</color>
<color
name=
"colorPrimaryDark"
>
#2f41a5
</color>
<color
name=
"gold"
>
#b8be35
</color>
<color
name=
"gold"
>
#C8BE35
</color>
<color
name=
"colorAccent"
>
#EF3934
</color>
<color
name=
"gold_light"
>
#D8DE45
</color>
<color
name=
"red"
>
#EF3934
</color>
<color
name=
"colorAccent"
>
@color/red
</color>
<color
name=
"colorAccentDark"
>
#CF3934
</color>
<color
name=
"colorAccentDark"
>
#CF3934
</color>
<color
name=
"item_title"
>
@color/gold
</color>
<color
name=
"item_title"
>
@color/gold
</color>
<color
name=
"item_bg"
>
#65ffffff
</color>
<color
name=
"item_bg"
>
#65ffffff
</color>
...
...
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