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
987d00f8
Commit
987d00f8
authored
Jun 05, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除我的云卡组后禁用刷新按钮3秒
移除无用布局
parent
5f735674
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
144 deletions
+107
-144
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
...arymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
+28
-2
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
...va/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
+78
-12
mobile/src/main/res/layout/dialog_deck.xml
mobile/src/main/res/layout/dialog_deck.xml
+0
-33
mobile/src/main/res/layout/dialog_login.xml
mobile/src/main/res/layout/dialog_login.xml
+0
-64
mobile/src/main/res/layout/fragment_mc_online_manage.xml
mobile/src/main/res/layout/fragment_mc_online_manage.xml
+0
-33
mobile/src/main/res/layout/item_my_deck.xml
mobile/src/main/res/layout/item_my_deck.xml
+1
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
View file @
987d00f8
package
cn.garymb.ygomobile.deck_square
;
import
android.graphics.Color
;
import
android.graphics.PorterDuff
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.View
;
...
...
@@ -9,6 +12,8 @@ import androidx.annotation.NonNull;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
com.google.android.material.snackbar.Snackbar
;
import
cn.garymb.ygomobile.bean.DeckType
;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginResponse
;
...
...
@@ -25,7 +30,7 @@ import cn.garymb.ygomobile.utils.YGOUtil;
//打开页面后,先扫描本地的卡组,读取其是否包含deckId,是的话代表平台上可能有
//之后读取平台上的卡组,与本地卡组列表做比较。
public
class
DeckSquareMyDeckFragment
extends
Fragment
{
public
class
DeckSquareMyDeckFragment
extends
Fragment
implements
MyDeckListAdapter
.
OnDeckDeleteListener
{
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
private
FragmentDeckSquareMyDeckBinding
binding
;
private
MyDeckListAdapter
deckListAdapter
;
...
...
@@ -92,7 +97,8 @@ public class DeckSquareMyDeckFragment extends Fragment {
onDeckMenuListener
.
onDeckSelect
(
deckFile
);
}
);
// 设置删除监听器
deckListAdapter
.
setOnDeckDeleteListener
(
this
);
return
binding
.
getRoot
();
}
...
...
@@ -148,4 +154,24 @@ public class DeckSquareMyDeckFragment extends Fragment {
});
}
@Override
public
void
onDeckDeleteStarted
()
{
binding
.
refreshData
.
setEnabled
(
false
);
// 设置灰色滤镜
binding
.
refreshData
.
setColorFilter
(
Color
.
GRAY
,
PorterDuff
.
Mode
.
SRC_IN
);
}
@Override
public
void
onDeckDeleteProgress
(
int
secondsRemaining
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
binding
.
refreshData
.
setTooltipText
(
secondsRemaining
+
"s waiting"
);
}
}
@Override
public
void
onDeckDeleteFinished
()
{
binding
.
refreshData
.
setEnabled
(
true
);
// 移除滤镜,恢复原颜色
binding
.
refreshData
.
clearColorFilter
();
}
}
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
View file @
987d00f8
package
cn.garymb.ygomobile.deck_square
;
import
android.os.CountDownTimer
;
import
android.util.Log
;
import
android.widget.ImageView
;
...
...
@@ -13,16 +14,20 @@ import java.util.List;
import
cn.garymb.ygomobile.deck_square.api_response.LoginToken
;
import
cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.PushDeckResponse
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.LogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
//提供“我的”卡组数据,打开后先从sharePreference查询,没有则从服务器查询,然后缓存到sharePreference
public
class
MyDeckListAdapter
extends
BaseQuickAdapter
<
MyDeckItem
,
BaseViewHolder
>
{
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
private
ImageLoader
imageLoader
;
// 添加监听器变量
private
OnDeckDeleteListener
deleteListener
;
public
MyDeckListAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
...
...
@@ -30,10 +35,41 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
imageLoader
=
new
ImageLoader
();
}
public
void
loadData
()
{
List
<
MyDeckItem
>
myOnlieDecks
=
new
ArrayList
<>();
// 在MyDeckListAdapter中添加接口
public
interface
OnDeckDeleteListener
{
void
onDeckDeleteStarted
();
void
onDeckDeleteProgress
(
int
secondsRemaining
);
void
onDeckDeleteFinished
();
}
// 添加设置监听器的方法
public
void
setOnDeckDeleteListener
(
OnDeckDeleteListener
listener
)
{
this
.
deleteListener
=
listener
;
}
private
void
startButtonCountdown
()
{
final
int
countdownSeconds
=
3
;
new
CountDownTimer
(
countdownSeconds
*
1000
,
1000
)
{
@Override
public
void
onTick
(
long
millisUntilFinished
)
{
int
secondsLeft
=
(
int
)
(
millisUntilFinished
/
1000
);
if
(
deleteListener
!=
null
)
{
deleteListener
.
onDeckDeleteProgress
(
secondsLeft
);
}
}
@Override
public
void
onFinish
()
{
if
(
deleteListener
!=
null
)
{
deleteListener
.
onDeckDeleteFinished
();
}
}
}.
start
();
}
public
void
loadData
()
{
List
<
MyDeckItem
>
myOnlineDecks
=
new
ArrayList
<>();
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
if
(
loginToken
==
null
)
{
return
;
...
...
@@ -70,13 +106,13 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
item
.
setDeckId
(
detail
.
getDeckId
());
item
.
setUserId
(
detail
.
getUserId
());
item
.
setUpdateDate
(
detail
.
getDeckUpdateDate
());
myOnlieDecks
.
add
(
item
);
myOnli
n
eDecks
.
add
(
item
);
}
}
LogUtil
.
i
(
TAG
,
"load mycard from server done"
);
getData
().
clear
();
addData
(
myOnlieDecks
);
addData
(
myOnli
n
eDecks
);
notifyDataSetChanged
();
if
(
dialog_read_ex
.
isShowing
())
{
...
...
@@ -89,21 +125,50 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
}
private
static
Boolean
isMonster
(
List
<
String
>
list
)
{
for
(
String
data
:
list
)
{
if
(
data
.
equals
(
"怪兽"
))
{
return
true
;
private
void
deleteMyDeckOnLine
(
MyDeckItem
item
)
{
if
(
deleteListener
!=
null
)
{
deleteListener
.
onDeckDeleteStarted
();
}
if
(
item
!=
null
)
{
item
.
getDeckId
();
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
if
(
loginToken
==
null
)
{
return
;
}
VUiKit
.
defer
().
when
(()
->
{
PushDeckResponse
result
=
DeckSquareApiUtil
.
deleteDeck
(
item
.
getDeckId
(),
loginToken
);
return
result
;
}).
fail
(
e
->
{
if
(
deleteListener
!=
null
)
{
deleteListener
.
onDeckDeleteFinished
();
}
LogUtil
.
i
(
TAG
,
"square deck detail fail"
+
e
.
getMessage
());
}).
done
(
data
->
{
if
(
data
.
isData
())
{
/*
*服务器的api有问题:获取指定用户的卡组列表(无已删卡组)
*删除成功后,通过http://rarnu.xyz:38383/api/mdpro3/sync/795610/nodel接口查询用户卡组时
*要等待2~3秒api响应内容才会对应更新
*/
YGOUtil
.
showTextToast
(
"删除成功,3秒后服务器将完成同步"
);
remove
(
item
);
// 开始倒计时
startButtonCountdown
();
}
else
{
if
(
deleteListener
!=
null
)
{
deleteListener
.
onDeckDeleteFinished
();
}
YGOUtil
.
showTextToast
(
"delete fail "
+
data
.
getMessage
());
}
});
}
return
false
;
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
MyDeckItem
item
)
{
helper
.
setText
(
R
.
id
.
my_deck_name
,
item
.
getDeckName
());
//helper.setText(R.id.deck_upload_date, item.getDeckUploadDate());
//ImageView imageView = helper.getView(R.id.deck_upload_state_img);
helper
.
setText
(
R
.
id
.
deck_update_date
,
item
.
getUpdateDate
());
ImageView
cardImage
=
helper
.
getView
(
R
.
id
.
deck_info_image
);
long
code
=
item
.
getDeckCoverCard1
();
...
...
@@ -114,6 +179,7 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
imageLoader
.
bindImage
(
cardImage
,
-
1
,
null
,
ImageLoader
.
Type
.
small
);
}
helper
.
getView
(
R
.
id
.
delete_my_online_deck_btn
).
setOnClickListener
(
view
->
{
deleteMyDeckOnLine
(
item
);
});
// else if (item.getDeckSouce() == 1) {
// helper.setText(R.id.my_deck_id, item.getDeckId());
// imageView.setImageResource(R.drawable.ic_server_download);
...
...
mobile/src/main/res/layout/dialog_deck.xml
deleted
100644 → 0
View file @
5f735674
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:text=
"@string/label_limitlist"
android:textAppearance=
"@style/TextAppearance.AppCompat.Medium"
android:textColor=
"@color/blackLinght"
/>
<androidx.appcompat.widget.AppCompatSpinner
android:id=
"@+id/sp_limit_list"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/item_height"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:text=
"@string/deck_list"
android:textAppearance=
"@style/TextAppearance.AppCompat.Medium"
android:textColor=
"@color/blackLinght"
/>
<androidx.appcompat.widget.AppCompatSpinner
android:id=
"@+id/sp_ydk_list"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/item_height"
/>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/dialog_login.xml
deleted
100644 → 0
View file @
5f735674
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"16dp"
android:gravity=
"center"
android:text=
"Login"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<EditText
android:id=
"@+id/et_username"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:hint=
"Username"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_password"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"16dp"
android:hint=
"Password"
android:inputType=
"textPassword"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:weightSum=
"2"
>
<Button
android:id=
"@+id/btn_cancel"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"4dp"
android:layout_weight=
"1"
android:text=
"Cancel"
/>
<Button
android:id=
"@+id/btn_login"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"4dp"
android:layout_weight=
"1"
android:backgroundTint=
"@color/colorPrimary"
android:text=
"Login"
/>
</LinearLayout>
<ProgressBar
android:id=
"@+id/progressBar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:visibility=
"gone"
/>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/fragment_mc_online_manage.xml
deleted
100644 → 0
View file @
5f735674
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/fragment_deck_cards"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"left"
android:orientation=
"vertical"
android:paddingLeft=
"4dp"
android:paddingTop=
"2dp"
android:paddingRight=
"5dp"
>
<Button
android:id=
"@+id/mc_login_btn"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"登录"
/>
<Button
android:id=
"@+id/mc_logout_btn"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"注销"
/>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
mobile/src/main/res/layout/item_my_deck.xml
View file @
987d00f8
...
...
@@ -49,6 +49,7 @@
</LinearLayout>
<ImageView
android:id=
"@+id/delete_my_online_deck_btn"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_gravity=
"end"
...
...
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