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
3c2f770b
Commit
3c2f770b
authored
Jun 18, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为云备份添加关键词筛选功能
移除不使用的布局
parent
36556ccc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
153 deletions
+68
-153
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
...arymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
+37
-13
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
...va/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
+25
-23
mobile/src/main/res/layout/dialog_square_deck_detail.xml
mobile/src/main/res/layout/dialog_square_deck_detail.xml
+0
-56
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
+0
-56
mobile/src/main/res/layout/fragment_deck_select.xml
mobile/src/main/res/layout/fragment_deck_select.xml
+2
-2
mobile/src/main/res/layout/fragment_deck_square.xml
mobile/src/main/res/layout/fragment_deck_square.xml
+2
-2
mobile/src/main/res/layout/fragment_deck_square_my_deck.xml
mobile/src/main/res/layout/fragment_deck_square_my_deck.xml
+2
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
View file @
3c2f770b
package
cn.garymb.ygomobile.deck_square
;
import
android.graphics.Color
;
import
android.graphics.PorterDuff
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.
widget.ImageView
;
import
android.
view.inputmethod.EditorInfo
;
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
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareMyDeckBinding
;
...
...
@@ -29,7 +23,6 @@ import cn.garymb.ygomobile.ui.mycard.mcchat.ChatMessage;
import
cn.garymb.ygomobile.ui.mycard.mcchat.management.UserManagement
;
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.SharedPreferenceUtil
;
import
cn.garymb.ygomobile.utils.YGODeckDialogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
...
...
@@ -42,7 +35,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
private
FragmentDeckSquareMyDeckBinding
binding
;
private
MyDeckListAdapter
deckListAdapter
;
private
String
keyWord
;
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
//通知外部调用方,(如调用本fragment的activity)
private
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
;
...
...
@@ -78,19 +71,50 @@ public class DeckSquareMyDeckFragment extends Fragment {
DialogPlus
dialogPlus
=
new
DialogPlus
(
getContext
());
dialogPlus
.
setMessage
(
R
.
string
.
logout_mycard
);
dialogPlus
.
setMessageGravity
(
Gravity
.
CENTER
);
dialogPlus
.
setLeftButtonListener
((
dlg
,
s
)->
{
dialogPlus
.
setLeftButtonListener
((
dlg
,
s
)
->
{
SharedPreferenceUtil
.
deleteServerToken
();
binding
.
llMainUi
.
setVisibility
(
View
.
GONE
);
binding
.
llDialogLogin
.
setVisibility
(
View
.
VISIBLE
);
dialogPlus
.
dismiss
();
});
dialogPlus
.
setRightButtonListener
((
dlg
,
s
)->
{
dialogPlus
.
setRightButtonListener
((
dlg
,
s
)
->
{
dialogPlus
.
dismiss
();
});
dialogPlus
.
show
();
}
});
//查询卡组名称
binding
.
etMyDeckInputDeckName
.
setOnEditorActionListener
((
v
,
actionId
,
event
)
->
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
keyWord
=
v
.
getText
().
toString
();
//直接过滤列表中的item名称,而不是像卡组广场那样重新查询
deckListAdapter
.
filter
(
keyWord
);
return
true
;
}
return
false
;
});
// 添加文本变化监听器
binding
.
etMyDeckInputDeckName
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
deckListAdapter
.
filter
(
s
.
toString
());
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
// 当输入框内容为空时
if
(
s
.
toString
().
isEmpty
())
{
deckListAdapter
.
loadData
();
//悄悄留一个刷新我的云备份的方式,方便
}
else
{
deckListAdapter
.
filter
(
s
.
toString
());
}
}
});
return
binding
.
getRoot
();
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
View file @
3c2f770b
...
...
@@ -27,10 +27,11 @@ import cn.garymb.ygomobile.utils.YGOUtil;
public
class
MyDeckListAdapter
extends
BaseQuickAdapter
<
MyDeckItem
,
BaseViewHolder
>
{
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
private
ImageLoader
imageLoader
;
private
List
<
MyDeckItem
>
originalData
;
// 保存原始数据
public
MyDeckListAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
originalData
=
new
ArrayList
<>();
imageLoader
=
new
ImageLoader
();
}
...
...
@@ -79,6 +80,8 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
}
LogUtil
.
i
(
TAG
,
"load mycard from server done"
);
originalData
.
clear
();
originalData
.
addAll
(
myOnlineDecks
);
// 保存原始数据
getData
().
clear
();
addData
(
myOnlineDecks
);
notifyDataSetChanged
();
...
...
@@ -93,6 +96,26 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
}
// 筛选函数
public
void
filter
(
String
keyword
)
{
List
<
MyDeckItem
>
filteredList
=
new
ArrayList
<>();
if
(
keyword
.
isEmpty
())
{
// 如果关键词为空,则显示所有数据
filteredList
.
addAll
(
originalData
);
}
else
{
// 遍历原始数据,筛选出包含关键词的item
for
(
MyDeckItem
item
:
originalData
)
{
if
(
item
.
getDeckName
().
contains
(
keyword
))
{
filteredList
.
add
(
item
);
}
}
}
// 更新显示的数据
getData
().
clear
();
addData
(
filteredList
);
notifyDataSetChanged
();
}
private
void
deleteMyDeckOnLine
(
MyDeckItem
item
)
{
if
(
item
!=
null
)
{
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
...
...
@@ -177,32 +200,11 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
changeDeckPublicState
(
item
);
});
helper
.
getView
(
R
.
id
.
ll_download
).
setOnClickListener
(
view
->
{
//TODO
//点击“我的卡组”中的某个卡组后,弹出dialog,dialog根据卡组的同步情况自动显示对应的下载/上传按钮
DeckFile
deckFile
=
new
DeckFile
(
item
.
getDeckId
(),
DeckType
.
ServerType
.
MY_SQUARE
);
});
// else if (item.getDeckSouce() == 1) {
// helper.setText(R.id.my_deck_id, item.getDeckId());
// imageView.setImageResource(R.drawable.ic_server_download);
// }
// long code = item.getDeckCoverCard1();
// LogUtil.i(TAG, code + " " + item.getDeckName());
// if (code != 0) {
// imageLoader.bindImage(cardImage, code, null, ImageLoader.Type.small);
// }
//
// ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
//cn.garymb.ygomobile.loader.ImageLoader.setDefaults(...)
//is a private function,so I copied the content of it to here
/* 如果查不到版本号,则不显示图片 */
/* 如果能查到版本号,则显示图片,利用glide的signature,将版本号和url作为signature,由glide判断是否使用缓存 */
}
...
...
mobile/src/main/res/layout/dialog_square_deck_detail.xml
deleted
100644 → 0
View file @
36556ccc
<?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"
>
<!--
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_server_download" />
<Button
android:id="@+id/dialog_square_deck_btn_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/delete" />
</LinearLayout>
-->
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:src=
"@drawable/ic_like"
/>
<Button
android:id=
"@+id/btnLike"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:drawablePadding=
"8dp"
android:text=
"Like"
/>
</LinearLayout>
<com.tubb.smrv.SwipeMenuRecyclerView
android:id=
"@+id/dialog_square_deck_detail_list"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:divider=
"@android:color/transparent"
android:dividerHeight=
"4dp"
android:padding=
"5dp"
android:scrollbars=
"vertical"
/>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
deleted
100644 → 0
View file @
36556ccc
<?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"
>
<LinearLayout
android:id=
"@+id/delete_my_deck"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:src=
"@drawable/delete"
/>
<Button
android:id=
"@+id/delete_my_online_deck_btn"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/delete"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/server_upload_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:src=
"@drawable/ic_server_push"
/>
<Button
android:id=
"@+id/dialog_my_deck_btn_push"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/upload"
/>
</LinearLayout>
<com.tubb.smrv.SwipeMenuRecyclerView
android:id=
"@+id/dialog_my_deck_detail_list"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:divider=
"@android:color/transparent"
android:dividerHeight=
"4dp"
android:padding=
"5dp"
android:scrollbars=
"vertical"
/>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/fragment_deck_select.xml
View file @
3c2f770b
...
...
@@ -26,12 +26,12 @@
android:layout_weight=
"9"
android:gravity=
"center"
android:hint=
"@string/intpu_name"
android:textColorHint=
"@color/star_rank"
android:imeOptions=
"actionSearch"
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textSize=
"15sp"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/gray"
/>
android:textColor=
"@color/holo_blue_bright"
/>
<ImageView
android:id=
"@+id/iv_search_deck_name"
...
...
mobile/src/main/res/layout/fragment_deck_square.xml
View file @
3c2f770b
...
...
@@ -35,7 +35,7 @@
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/
gray
"
android:textColorHint=
"@color/
star_rank
"
android:textSize=
"15sp"
app:layout_constraintEnd_toStartOf=
"@id/btn_clear_deck_name"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -72,7 +72,7 @@
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/
gray
"
android:textColorHint=
"@color/
star_rank
"
android:textSize=
"15sp"
app:layout_constraintEnd_toStartOf=
"@id/btn_clear_contributor_name"
app:layout_constraintStart_toStartOf=
"parent"
...
...
mobile/src/main/res/layout/fragment_deck_square_my_deck.xml
View file @
3c2f770b
...
...
@@ -29,6 +29,7 @@
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"@string/login_mycard"
android:textColor=
"@color/white"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
</LinearLayout>
...
...
@@ -128,7 +129,7 @@
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/
gray
"
android:textColorHint=
"@color/
star_rank
"
android:textSize=
"15sp"
/>
<com.tubb.smrv.SwipeMenuRecyclerView
...
...
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