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
63f1f44a
Commit
63f1f44a
authored
Feb 12, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
输入关键字后点击搜索才进行筛选卡组
parent
aa29d829
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
61 deletions
+92
-61
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
...rc/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
+52
-17
mobile/src/main/res/drawable/ic_live_help_white.xml
mobile/src/main/res/drawable/ic_live_help_white.xml
+0
-12
mobile/src/main/res/drawable/ic_search.xml
mobile/src/main/res/drawable/ic_search.xml
+1
-1
mobile/src/main/res/drawable/item_bg.xml
mobile/src/main/res/drawable/item_bg.xml
+0
-6
mobile/src/main/res/drawable/textview_border.xml
mobile/src/main/res/drawable/textview_border.xml
+0
-7
mobile/src/main/res/layout/dialog_deck_select.xml
mobile/src/main/res/layout/dialog_deck_select.xml
+32
-9
mobile/src/main/res/layout/fragment_ex_card_list.xml
mobile/src/main/res/layout/fragment_ex_card_list.xml
+7
-9
No files found.
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
View file @
63f1f44a
...
...
@@ -11,6 +11,8 @@ import android.util.Log;
import
android.view.Gravity
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -74,6 +76,7 @@ public class YGODialogUtil {
private
final
int
IMAGE_COPY
=
1
;
private
final
int
IMAGE_DEL
=
2
;
private
final
EditText
et_input_deck_name
;
private
final
ImageView
iv_search_deck_name
;
private
final
LinearLayout
ll_main_ui
;
private
final
LinearLayout
ll_move
;
private
final
LinearLayout
ll_copy
;
...
...
@@ -87,6 +90,11 @@ public class YGODialogUtil {
private
final
TextView
tv_del
;
private
final
TextSelectAdapter
<
DeckType
>
typeAdp
;
private
final
DeckListAdapter
<
DeckFile
>
deckAdp
;
private
final
DeckListAdapter
<
DeckFile
>
resultListAdapter
;
private
final
List
<
DeckFile
>
allDeckList
;
private
final
RecyclerView
rv_type
,
rv_deck
,
rv_result_list
;
private
final
List
<
DeckFile
>
resultList
;
private
final
DialogPlus
ygoDialog
;
public
ViewHolder
(
Context
context
,
String
selectDeckPath
,
OnDeckMenuListener
onDeckMenuListener
)
{
...
...
@@ -94,9 +102,12 @@ public class YGODialogUtil {
ygoDialog
.
setContentView
(
R
.
layout
.
dialog_deck_select
);
ygoDialog
.
setTitle
(
R
.
string
.
category_manager
);
allDeckList
=
new
ArrayList
<>();
resultList
=
new
ArrayList
<>();
resultListAdapter
=
new
DeckListAdapter
<
DeckFile
>(
context
,
resultList
,
-
1
);
et_input_deck_name
=
ygoDialog
.
findViewById
(
R
.
id
.
input_deck_name
);
iv_search_deck_name
=
ygoDialog
.
findViewById
(
R
.
id
.
iv_search_deck_name
);
RecyclerView
rv_type
,
rv_deck
,
rv_result_list
;
ll_main_ui
=
ygoDialog
.
findViewById
(
R
.
id
.
ll_main_ui
);
rv_deck
=
ygoDialog
.
findViewById
(
R
.
id
.
rv_deck
);
rv_type
=
ygoDialog
.
findViewById
(
R
.
id
.
rv_type
);
...
...
@@ -148,7 +159,6 @@ public class YGODialogUtil {
}
}
deckList
=
DeckUtil
.
getDeckList
(
typeList
.
get
(
typeSelectPosition
).
getPath
());
List
<
DeckFile
>
allDeckList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
typeList
.
size
();
i
++)
{
allDeckList
.
addAll
(
DeckUtil
.
getDeckList
(
typeList
.
get
(
i
).
getPath
()));
Log
.
i
(
TAG
,
allDeckList
.
size
()
+
""
);
...
...
@@ -219,8 +229,7 @@ public class YGODialogUtil {
return
true
;
}
});
List
<
DeckFile
>
resultList
=
new
ArrayList
<>();
DeckListAdapter
<
DeckFile
>
resultListAdapter
=
new
DeckListAdapter
<
DeckFile
>(
context
,
resultList
,
-
1
);
rv_result_list
.
setAdapter
(
resultListAdapter
);
resultListAdapter
.
setOnItemSelectListener
(
new
DeckListAdapter
.
OnItemSelectListener
<
DeckFile
>()
{
@Override
...
...
@@ -232,33 +241,44 @@ public class YGODialogUtil {
onDeckMenuListener
.
onDeckSelect
(
item
);
}
});
iv_search_deck_name
.
setOnClickListener
(
v
->
{
searchDeck
();
});
et_input_deck_name
.
setOnEditorActionListener
((
v
,
actionId
,
event
)
->
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
v
.
getWindowToken
(),
0
);
searchDeck
();
return
true
;
}
return
false
;
});
et_input_deck_name
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
// 输入中监听
if
(
s
.
toString
().
isEmpty
())
{
ll_main_ui
.
setVisibility
(
View
.
VISIBLE
);
rv_result_list
.
setVisibility
(
View
.
GONE
);
iv_search_deck_name
.
setVisibility
(
View
.
GONE
);
}
else
{
iv_search_deck_name
.
setVisibility
(
View
.
VISIBLE
);
}
}
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
//
输入前的
监听
//
输入前
监听
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
// 输入后的监听
resultList
.
clear
();
String
keyword
=
et_input_deck_name
.
getText
().
toString
();
if
(
keyword
.
isEmpty
())
{
ll_main_ui
.
setVisibility
(
View
.
VISIBLE
);
rv_result_list
.
setVisibility
(
View
.
GONE
);
}
else
{
resultList
.
addAll
(
getResultList
(
keyword
,
allDeckList
));
rv_result_list
.
setVisibility
(
View
.
VISIBLE
);
ll_main_ui
.
setVisibility
(
View
.
GONE
);
Log
.
i
(
TAG
,
et_input_deck_name
.
getText
().
toString
()
+
"和"
+
resultList
.
size
());
resultListAdapter
.
notifyDataSetChanged
();
}
}
});
...
...
@@ -473,6 +493,21 @@ public class YGODialogUtil {
itemTouchHelper
.
attachToRecyclerView
(
rv_type
);
}
private
void
searchDeck
(){
resultList
.
clear
();
et_input_deck_name
.
clearFocus
();
String
keyword
=
et_input_deck_name
.
getText
().
toString
();
if
(
keyword
.
isEmpty
())
{
ll_main_ui
.
setVisibility
(
View
.
VISIBLE
);
rv_result_list
.
setVisibility
(
View
.
GONE
);
}
else
{
resultList
.
addAll
(
getResultList
(
keyword
,
allDeckList
));
rv_result_list
.
setVisibility
(
View
.
VISIBLE
);
ll_main_ui
.
setVisibility
(
View
.
GONE
);
resultListAdapter
.
notifyDataSetChanged
();
}
}
private
String
[]
getStringType
(
List
<
DeckType
>
deckTypeList
)
{
String
[]
types
=
new
String
[
deckTypeList
.
size
()];
for
(
int
i
=
0
;
i
<
types
.
length
;
i
++)
{
...
...
mobile/src/main/res/drawable/ic_live_help_white.xml
deleted
100644 → 0
View file @
aa29d829
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"@color/white"
android:pathData=
"M12,19m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
/>
<path
android:fillColor=
"@color/white"
android:pathData=
"M10,3h4v12h-4z"
/>
</vector>
mobile/src/main/res/drawable/ic_search.xml
View file @
63f1f44a
...
...
@@ -4,6 +4,6 @@
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"
#FF000000
"
android:fillColor=
"
@color/holo_blue_bright
"
android:pathData=
"M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"
/>
</vector>
mobile/src/main/res/drawable/item_bg.xml
deleted
100644 → 0
View file @
aa29d829
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/item_bg"
/>
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
mobile/src/main/res/drawable/textview_border.xml
deleted
100644 → 0
View file @
aa29d829
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<stroke
android:width=
"1dp"
android:color=
"@color/white"
/>
</shape>
\ No newline at end of file
mobile/src/main/res/layout/dialog_deck_select.xml
View file @
63f1f44a
...
...
@@ -12,16 +12,39 @@
android:layout_marginBottom=
"5dp"
android:orientation=
"vertical"
>
<EditText
android:id=
"@+id/input_deck_name"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:gravity=
"center"
android:hint=
"@string/intpu_name"
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/gray"
/>
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingLeft=
"30dp"
android:weightSum=
"10"
>
<EditText
android:id=
"@+id/input_deck_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"9"
android:gravity=
"center"
android:hint=
"@string/intpu_name"
android:imeOptions=
"actionSearch"
android:inputType=
"textNoSuggestions"
android:singleLine=
"true"
android:textSize=
"15sp"
android:textColor=
"@color/holo_blue_bright"
android:textColorHint=
"@color/gray"
/>
<ImageView
android:id=
"@+id/iv_search_deck_name"
android:layout_width=
"0dp"
android:layout_height=
"30dp"
android:layout_weight=
"1"
android:padding=
"3dp"
android:gravity=
"center"
android:text=
"@string/search"
android:src=
"@drawable/ic_search"
android:visibility=
"gone"
android:background=
"@drawable/ic_radius_bg"
/>
</LinearLayout>
<com.tubb.smrv.SwipeMenuRecyclerView
android:id=
"@+id/rv_result_list"
...
...
mobile/src/main/res/layout/fragment_ex_card_list.xml
View file @
63f1f44a
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/fragment_ex_card"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
...
...
@@ -17,36 +16,35 @@
<LinearLayout
android:id=
"@+id/btn_download_prerelease"
android:focusableInTouchMode=
"true"
android:clickable=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|right"
android:layout_marginRight=
"20dp"
android:layout_marginBottom=
"70dp"
android:clickable=
"true"
android:focusableInTouchMode=
"true"
android:orientation=
"vertical"
android:padding=
"20dp"
>
<Button
android:clickable=
"false"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/downloadimages"
/>
android:clickable=
"false"
/>
<TextView
android:clickable=
"false"
android:id=
"@+id/text_download_prerelease"
android:layout_width=
"60dp"
android:layout_height=
"30dp"
android:background=
"@drawable/radius"
android:background=
"@drawable/ic_radius_bg"
android:clickable=
"false"
android:gravity=
"center"
android:textAlignment=
"center"
android:textSize=
"10sp"
android:textColor=
"@color/gold"
/>
android:textSize=
"10sp"
/>
</LinearLayout>
...
...
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