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
cebfd9c4
Commit
cebfd9c4
authored
Nov 18, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡包展示时不显示undo redo按钮
修正cacheDeck下的卡包ydk加载没有进入卡包展示模式的问题
parent
3cd073dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
+27
-12
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
View file @
cebfd9c4
...
@@ -156,7 +156,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -156,7 +156,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
private
List
<
DeckInfo
>
deckHistory
=
new
ArrayList
<>();
private
List
<
DeckInfo
>
deckHistory
=
new
ArrayList
<>();
// 当前历史记录索引
// 当前历史记录索引
private
int
historyIndex
=
-
1
;
private
int
historyIndex
=
-
1
;
private
boolean
isPackMode
;
private
File
mPreLoadFile
;
//预加载卡组,用于外部打开ydk文件或通过卡组广场预览卡组时,值为file。当未通过预加载打开ydk(打开卡组时),值为null
private
File
mPreLoadFile
;
//预加载卡组,用于外部打开ydk文件或通过卡组广场预览卡组时,值为file。当未通过预加载打开ydk(打开卡组时),值为null
private
DeckItemTouchHelper
mDeckItemTouchHelper
;
private
DeckItemTouchHelper
mDeckItemTouchHelper
;
private
TextView
tv_deck
;
private
TextView
tv_deck
;
...
@@ -598,8 +598,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -598,8 +598,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
}).
done
((
rs
)
->
{
}).
done
((
rs
)
->
{
// 关闭加载对话框并设置当前卡牌包
// 关闭加载对话框并设置当前卡牌包
dlg
.
dismiss
();
dlg
.
dismiss
();
//setCurDeck(rs, file.getParent().equals(mSettings.getPackDeckDir()) || file.getParent().equals(mSettings.getCacheDeckDir()));
// 根据资源路径判断是否进入卡包展示模式
setCurDeck
(
rs
,
file
.
getParent
().
equals
(
mSettings
.
getPackDeckDir
()));
isPackMode
=
rs
.
source
.
getParent
().
equals
(
mSettings
.
getPackDeckDir
())
||
rs
.
source
.
getParent
().
equals
(
mSettings
.
getCacheDeckDir
());
setCurDeck
(
rs
,
isPackMode
);
});
});
}
}
...
@@ -650,10 +651,11 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -650,10 +651,11 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
dlg
.
dismiss
();
dlg
.
dismiss
();
mCardSearcher
.
initItems
();
mCardSearcher
.
initItems
();
initLimitListSpinners
(
mLimitSpinner
,
mCardLoader
.
getLimitList
());
initLimitListSpinners
(
mLimitSpinner
,
mCardLoader
.
getLimitList
());
// 根据资源路径判断是否进入卡包展示模式
isPackMode
=
rs
.
source
.
getParent
().
equals
(
mSettings
.
getPackDeckDir
())
||
rs
.
source
.
getParent
().
equals
(
mSettings
.
getCacheDeckDir
());
// 设置当前卡组显示
// 设置当前卡组显示
if
(
rs
.
source
!=
null
)
{
if
(
rs
.
source
!=
null
)
{
setCurDeck
(
rs
,
rs
.
source
.
getParent
().
equals
(
mSettings
.
getPackDeckDir
())
);
setCurDeck
(
rs
,
isPackMode
);
}
else
{
}
else
{
setCurDeck
(
rs
,
false
);
setCurDeck
(
rs
,
false
);
}
}
...
@@ -684,6 +686,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -684,6 +686,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
// 通知适配器更新卡组数据和界面
// 通知适配器更新卡组数据和界面
mDeckAdapater
.
setDeck
(
deckInfo
,
isPack
);
mDeckAdapater
.
setDeck
(
deckInfo
,
isPack
);
mDeckAdapater
.
notifyDataSetChanged
();
mDeckAdapater
.
notifyDataSetChanged
();
isPackMode
=
isPack
;
// 清空历史记录并添加初始状态
// 清空历史记录并添加初始状态
clearDeckHistory
();
clearDeckHistory
();
...
@@ -702,7 +705,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -702,7 +705,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
}
}
/**
/**
* 将当前卡组状态添加到历史记录中
* 将当前卡组状态添加到历史记录中
(仅当与上一个状态不同时)
*
*
* @param deckInfo 当前卡组状态
* @param deckInfo 当前卡组状态
*/
*/
...
@@ -712,9 +715,19 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -712,9 +715,19 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
deckHistory
.
subList
(
historyIndex
+
1
,
deckHistory
.
size
()).
clear
();
deckHistory
.
subList
(
historyIndex
+
1
,
deckHistory
.
size
()).
clear
();
}
}
// 添加新的历史记录
// 检查当前状态是否与最近的历史记录相同
deckHistory
.
add
(
deckInfo
);
// 使用clone确保是深拷贝
boolean
isSameAsLast
=
false
;
historyIndex
=
deckHistory
.
size
()
-
1
;
if
(!
deckHistory
.
isEmpty
())
{
DeckInfo
lastState
=
deckHistory
.
get
(
deckHistory
.
size
()
-
1
);
// 这里将DeckInfo.toLongString来实现了 equals 方法来比较内容
isSameAsLast
=
lastState
.
toLongString
().
equals
(
deckInfo
.
toLongString
());
}
// 只有在状态不同时才添加新的历史记录
if
(!
isSameAsLast
)
{
deckHistory
.
add
(
deckInfo
);
historyIndex
=
deckHistory
.
size
()
-
1
;
}
// 更新按钮状态
// 更新按钮状态
updateUndoRedoButtons
();
updateUndoRedoButtons
();
...
@@ -771,8 +784,8 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -771,8 +784,8 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
*/
*/
private
void
updateUndoRedoButtons
()
{
private
void
updateUndoRedoButtons
()
{
if
(
btnUndo
!=
null
&&
btnRedo
!=
null
)
{
if
(
btnUndo
!=
null
&&
btnRedo
!=
null
)
{
// 只有历史记录大于1时才显示按钮
// 只有历史记录大于1
且不是卡包展示模式
时才显示按钮
if
(
deckHistory
.
size
()
>
1
)
{
if
(
deckHistory
.
size
()
>
1
&&
!
isPackMode
)
{
btnUndo
.
setVisibility
(
View
.
VISIBLE
);
btnUndo
.
setVisibility
(
View
.
VISIBLE
);
btnRedo
.
setVisibility
(
View
.
VISIBLE
);
btnRedo
.
setVisibility
(
View
.
VISIBLE
);
...
@@ -788,7 +801,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -788,7 +801,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
btnRedo
.
setVisibility
(
View
.
INVISIBLE
);
btnRedo
.
setVisibility
(
View
.
INVISIBLE
);
}
}
}
else
{
}
else
{
// 历史记录小于等于1时隐藏按钮
// 历史记录小于等于1
或为卡包展示模式
时隐藏按钮
btnUndo
.
setVisibility
(
View
.
INVISIBLE
);
btnUndo
.
setVisibility
(
View
.
INVISIBLE
);
btnRedo
.
setVisibility
(
View
.
INVISIBLE
);
btnRedo
.
setVisibility
(
View
.
INVISIBLE
);
}
}
...
@@ -1666,6 +1679,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -1666,6 +1679,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
return
layerDrawable
;
return
layerDrawable
;
}
}
private
void
animRotate
(
View
view
)
{
private
void
animRotate
(
View
view
)
{
// 获取背景并启动旋转动画
// 获取背景并启动旋转动画
LayerDrawable
layerDrawable
=
(
LayerDrawable
)
view
.
getBackground
();
LayerDrawable
layerDrawable
=
(
LayerDrawable
)
view
.
getBackground
();
...
@@ -1735,6 +1749,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -1735,6 +1749,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
});
});
}
else
{
}
else
{
Log
.
d
(
"seesee"
,
deckFile
.
getPathFile
().
getAbsolutePath
());
loadDeckFromFile
(
deckFile
.
getPathFile
());
loadDeckFromFile
(
deckFile
.
getPathFile
());
ll_click_like
.
setVisibility
(
View
.
GONE
);
ll_click_like
.
setVisibility
(
View
.
GONE
);
}
}
...
...
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