Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
TangKuPos
Commits
9f5d3859
Commit
9f5d3859
authored
Jan 30, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改搜索框;
parent
e33d96e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
+12
-6
No files found.
app/src/main/java/com/xingdata/zzdpos/view/SearchBar.java
View file @
9f5d3859
...
...
@@ -22,6 +22,12 @@ import com.xingdata.zzdpos.util.Global;
public
class
SearchBar
extends
ConstraintLayout
{
private
ViewSearchBarBinding
mViewBinding
;
private
boolean
isEmptyEnabled
;
public
void
setEmptyEnabled
(
boolean
emptyEnabled
)
{
isEmptyEnabled
=
emptyEnabled
;
}
public
interface
OnSearchListener
{
void
onSearch
(
String
keyword
);
}
...
...
@@ -61,7 +67,7 @@ public class SearchBar extends ConstraintLayout {
* 显示软键盘
*/
public
void
showSoftInput
()
{
Global
.
setFocus
(
mViewBinding
.
etSearch
,
getContext
());
Global
.
setFocus
(
mViewBinding
.
etSearch
,
getContext
());
// KeyboardUtils.showSoftInput(mViewBinding.etSearch);
}
...
...
@@ -79,20 +85,20 @@ public class SearchBar extends ConstraintLayout {
mViewBinding
.
etSearch
.
setOnEditorActionListener
((
textView
,
i
,
keyEvent
)
->
{
if
(
i
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
String
str
=
mViewBinding
.
etSearch
.
getText
().
toString
();
if
(
StringUtils
.
isEmpty
(
str
))
{
if
(
StringUtils
.
isEmpty
(
str
)
&&
!
isEmptyEnabled
)
{
ToastUtils
.
showShort
(
"请输入搜索内容"
);
return
fals
e
;
return
tru
e
;
}
KeyboardUtils
.
hideSoftInput
(
mViewBinding
.
etSearch
);
mOnSearchListener
.
onSearch
(
str
);
}
return
fals
e
;
return
tru
e
;
});
mViewBinding
.
tvSearch
.
setOnClickListener
(
view
->
{
String
str
=
mViewBinding
.
etSearch
.
getText
().
toString
();
if
(
StringUtils
.
isEmpty
(
str
))
{
if
(
StringUtils
.
isEmpty
(
str
)
&&
!
isEmptyEnabled
)
{
ToastUtils
.
showShort
(
"请输入搜索内容"
);
this
.
showSoftInput
();
return
;
}
KeyboardUtils
.
hideSoftInput
(
mViewBinding
.
etSearch
);
...
...
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