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
8bb96095
Commit
8bb96095
authored
Dec 19, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一cardsearcher设置触摸监听,切换禁卡表时通知deckmanagerfragment和cardsearchfragment刷新禁限显示
parent
5c2760e6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
65 deletions
+62
-65
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
.../java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+8
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
...java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
+6
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
.../main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
+15
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
+27
-56
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
...c/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
+3
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
View file @
8bb96095
...
...
@@ -133,7 +133,7 @@ public class ExCardListFragment extends Fragment {
textDownload
.
setText
(
"0%"
);
//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
String
path
=
AppsSettings
.
get
().
getExpansionsPath
().
getAbsolutePath
();
String
fileName
=
Constants
.
officialExCardPackageName
;
File
file
=
new
File
(
path
+
"/"
+
fileName
+
Constants
.
YPK_FILE_EX
);
File
file
=
new
File
(
path
,
fileName
+
Constants
.
YPK_FILE_EX
);
/* 删除旧的先行卡包 */
File
[]
files
=
AppsSettings
.
get
().
getExpansionsPath
().
listFiles
();
if
(
files
!=
null
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
8bb96095
...
...
@@ -17,6 +17,7 @@ import java.io.Closeable;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -244,14 +245,15 @@ public class ImageLoader implements Closeable {
public
File
getImageFile
(
long
code
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
+
ex
);
File
file
=
new
File
(
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_IMAGE_PATH
),
code
+
ex
);
if
(
file
.
exists
())
{
return
file
;
}
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
+
ex
);
File
file_ex
=
new
File
(
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
),
code
+
ex
);
if
(
file_ex
.
exists
())
{
return
file_ex
;
}
}
return
null
;
}
...
...
@@ -261,8 +263,10 @@ public class ImageLoader implements Closeable {
Log
.
v
(
TAG
,
"bind image:"
+
code
+
", type="
+
type
);
}
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
String
name
=
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
;
String
name_ex
=
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
;
String
name
=
Paths
.
get
(
Constants
.
CORE_IMAGE_PATH
,
String
.
valueOf
(
code
)).
toString
();
String
name_ex
=
Paths
.
get
(
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
,
String
.
valueOf
(
code
)).
toString
();
//cache
if
(
useCache
)
{
Cache
cache
=
zipDataCache
.
get
(
code
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
View file @
8bb96095
...
...
@@ -230,6 +230,12 @@ public class CardSearchFragment extends BaseFragemnt implements CardLoader.CallB
||
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
RIGHT
);
}
@Override
public
void
setLimit
(
LimitList
limit
)
{
mCardListAdapter
.
setLimitList
(
limit
);
mCardListAdapter
.
notifyDataSetChanged
();
}
@Override
public
void
onSearchStart
()
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
...
...
@@ -242,7 +248,6 @@ public class CardSearchFragment extends BaseFragemnt implements CardLoader.CallB
if
(
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
}
mCardListAdapter
.
setLimitList
(
limitList
);
}
@Override
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
View file @
8bb96095
...
...
@@ -432,6 +432,20 @@ public class CardSearcher implements View.OnClickListener {
if
(
index
>=
0
)
{
spinner
.
setSelection
(
index
);
}
// 设置选择监听器
spinner
.
setOnItemSelectedListener
(
new
AdapterView
.
OnItemSelectedListener
()
{
@Override
public
void
onItemSelected
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Log
.
e
(
"onItemSelected"
,
"position:"
+
position
+
" id:"
+
id
);
//同时通知整个界面都显示该禁卡表的禁限情况
mCallBack
.
setLimit
(
mLimitManager
.
getLimit
(
SimpleSpinnerAdapter
.
getSelectText
(
spinner
)));
}
@Override
public
void
onNothingSelected
(
AdapterView
<?>
parent
)
{
}
});
}
private
void
refreshLimitListSpinnerItems
(
Spinner
spinner
)
{
...
...
@@ -696,6 +710,7 @@ public class CardSearcher implements View.OnClickListener {
}
public
interface
CallBack
{
void
setLimit
(
LimitList
limit
);
void
onSearchStart
();
void
onSearchResult
(
List
<
Card
>
Cards
,
boolean
isHide
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
View file @
8bb96095
...
...
@@ -44,6 +44,7 @@ import android.widget.TextView;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.appcompat.widget.AppCompatSpinner
;
import
androidx.core.content.ContextCompat
;
import
androidx.drawerlayout.widget.DrawerLayout
;
...
...
@@ -69,10 +70,12 @@ import org.greenrobot.eventbus.ThreadMode;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Objects
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
...
...
@@ -881,6 +884,11 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
return
TextUtils
.
equals
(
deck
,
file
.
getParent
());
}
@Override
public
void
setLimit
(
LimitList
limit
)
{
setLimitList
(
limit
);
}
@Override
public
void
onSearchStart
()
{
hideDrawers
();
...
...
@@ -1604,75 +1612,37 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
* @param spinner 要初始化的Spinner控件
*/
private
void
initLimitListSpinners
(
Spinner
spinner
)
{
// 刷新该spinner并配置选项
refreshLimitListSpinnerItems
(
spinner
);
// 设置选择监听器
spinner
.
setOnItemSelectedListener
(
new
AdapterView
.
OnItemSelectedListener
()
{
@Override
public
void
onItemSelected
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
//同时通知整个界面都显示该禁卡表的禁限情况
setLimitList
(
activity
.
getmLimitManager
().
getLimit
(
SimpleSpinnerAdapter
.
getSelectText
(
spinner
)));
}
@Override
public
void
onNothingSelected
(
AdapterView
<?>
parent
)
{
}
});
}
/**
* 仅刷新限制列表下拉框的项目列表
*
* @param spinner 要刷新的Spinner控件
*/
private
void
refreshLimitListSpinnerItems
(
Spinner
spinner
)
{
int
index
=
0
;
int
old_count
=
0
;
// 首先清除所有现有的item
if
(
spinner
.
getAdapter
()
!=
null
&&
spinner
.
getAdapter
()
instanceof
SimpleSpinnerAdapter
)
{
// 清除前先记录下当前选中项的索引
index
=
spinner
.
getSelectedItemPosition
();
//清除前先记录下当前选项总数量
old_count
=
spinner
.
getCount
();
//清空选项
((
SimpleSpinnerAdapter
)
spinner
.
getAdapter
()).
clear
();
//重新加载禁卡表,获取可能存在的变动后情况
activity
.
getmLimitManager
().
load
();
}
List
<
SimpleSpinnerItem
>
items
=
new
ArrayList
<>();
List
<
String
>
limitLists
=
activity
.
getmLimitManager
().
getLimitNames
();
int
limit_count
=
activity
.
getmLimitManager
().
getCount
();
List
<
String
>
limits
=
activity
.
getmLimitManager
().
getLimitNames
();
int
index
=
-
1
;
int
count
=
activity
.
getmLimitManager
().
getCount
();
LimitList
cur
=
null
;
if
(
mCardLoader
!=
null
)
{
cur
=
mCardLoader
.
getLimitList
();
}
// 添加默认选项
items
.
add
(
new
SimpleSpinnerItem
(
0
,
getString
(
R
.
string
.
label_limitlist
)));
// 遍历所有限制列表,构建下拉项
for
(
int
i
=
0
;
i
<
limit_
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
j
=
i
+
1
;
String
name
=
limit
List
s
.
get
(
i
);
String
name
=
limits
.
get
(
i
);
items
.
add
(
new
SimpleSpinnerItem
(
j
,
name
));
if
(
cur
!=
null
&&
TextUtils
.
equals
(
cur
.
getName
(),
name
))
{
index
=
j
;
}
}
// 设置适配器
SimpleSpinnerAdapter
adapter
=
new
SimpleSpinnerAdapter
(
getContext
()
);
SimpleSpinnerAdapter
adapter
=
new
SimpleSpinnerAdapter
(
mContext
);
adapter
.
setColor
(
Color
.
WHITE
);
adapter
.
set
(
items
);
spinner
.
setAdapter
(
adapter
);
// 禁卡表变化时,相应调整index
index
+=
spinner
.
getCount
()
-
old_count
;
if
(
index
>=
0
)
{
spinner
.
setSelection
(
index
);
}
// 不设置监听器,避免通知整个布局变化,降低性能占用,只在initLimitListSpinners执行后另行设置
}
/**
* 设置传参禁卡表的禁限,并更新相关适配器
*
...
...
@@ -1703,7 +1673,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
if
(
limitList
.
getCreditLimits
()
!=
null
&&
limitList
.
getCreditLimits
()
>
0
)
{
ll_genesys_scoreboard
.
setVisibility
(
View
.
VISIBLE
);
// 重新初始化卡片搜索器中的限制类型下拉框
mCardSearcher
.
initItems
();
//
mCardSearcher.initItems();
}
else
{
ll_genesys_scoreboard
.
setVisibility
(
View
.
GONE
);
}
...
...
@@ -1869,6 +1839,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
//在卡组选择的dialog中点击某个卡组(来自本地或服务器)后,dialog通过本回调函数通知本页面。
//在本页面中根据卡组来源(本地或服务器)显示卡组内容
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
@Override
public
void
onDeckSelect
(
DeckFile
deckFile
)
{
if
(!
deckFile
.
isLocal
())
{
//不在本地,在云上(卡组广场中或用户的云上)
...
...
@@ -1891,7 +1862,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
boolean
result
=
DeckSquareFileUtil
.
saveFileToPath
(
dir
.
getPath
(),
fileFullName
,
deckData
.
getDeckYdk
(),
deckData
.
getDeckUpdateDate
());
if
(
result
)
{
//存储成功,使用预加载功能
LogUtil
.
i
(
TAG
,
"square deck detail done"
);
preLoadFile
(
dir
.
getPath
()
+
"/"
+
fileFullName
);
preLoadFile
(
Paths
.
get
(
dir
.
getPath
(),
fileFullName
).
toString
()
);
tv_add_1
.
setText
(
R
.
string
.
like_deck_thumb
);
ll_click_like
.
setVisibility
(
View
.
VISIBLE
);
}
...
...
@@ -1899,7 +1870,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
});
}
else
{
Log
.
d
(
"seesee"
,
deckFile
.
getPathFile
().
getAbsolutePath
());
Log
.
d
(
TAG
,
deckFile
.
getPathFile
().
getAbsolutePath
());
loadDeckFromFile
(
deckFile
.
getPathFile
());
ll_click_like
.
setVisibility
(
View
.
GONE
);
}
...
...
@@ -1916,7 +1887,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
if
(
TextUtils
.
equals
(
deckFile
.
getPath
(),
currentDeckPath
))
{
List
<
File
>
files
=
getYdkFiles
();
File
file
=
null
;
if
(
files
!=
null
&&
files
.
size
()
>
0
)
{
if
(
files
!=
null
&&
!
files
.
isEmpty
()
)
{
file
=
files
.
get
(
0
);
}
if
(
file
!=
null
)
{
...
...
@@ -1925,7 +1896,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
setCurDeck
(
new
DeckInfo
(),
false
);
}
// 对于当前卡组,也应该删除在线卡组
DeckSquareApiUtil
.
deleteDecks
(
Arrays
.
asList
(
deckFile
));
DeckSquareApiUtil
.
deleteDecks
(
List
.
of
(
deckFile
));
return
;
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
8bb96095
...
...
@@ -464,7 +464,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
}
private
void
downloadGeneSysLflist
()
{
File
geneSysLflist
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
Constants
.
CORE_GENESYS_LIMIT_PATH
);
File
geneSysLflist
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
,
Constants
.
CORE_GENESYS_LIMIT_PATH
);
DownloadUtil
.
get
().
download
(
URL_GENESYS_LFLIST_DOWNLOAD_LINK
,
geneSysLflist
.
getParent
(),
geneSysLflist
.
getName
(),
new
DownloadUtil
.
OnDownloadListener
()
{
@Override
public
void
onDownloadSuccess
(
File
file
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
View file @
8bb96095
...
...
@@ -12,6 +12,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.ExecutorService
;
...
...
@@ -160,7 +162,7 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
private
boolean
existImage
()
{
String
name
;
if
(
item
.
isField
)
{
name
=
Constants
.
CORE_IMAGE_FIELD_PATH
+
"/"
+
item
.
code
;
name
=
Paths
.
get
(
Constants
.
CORE_IMAGE_FIELD_PATH
,
String
.
valueOf
(
item
.
code
)).
toString
()
;
}
else
{
name
=
""
+
item
.
code
;
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
8bb96095
...
...
@@ -124,7 +124,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
});
dialog
.
setOnDismissListener
(
dialogInterface
->
{
DialogPlus
dialogplus
=
new
DialogPlus
(
this
);
File
oldypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
officialExCardPackageName
+
Constants
.
YPK_FILE_EX
);
File
oldypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
,
officialExCardPackageName
+
Constants
.
YPK_FILE_EX
);
if
(
oldypk
.
exists
())
{
FileUtils
.
deleteFile
(
oldypk
);
dialogplus
.
setMessage
(
R
.
string
.
tip_ypk_is_deleted
);
...
...
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