Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
杨凯
YDL-Component-Medical
Commits
5105a007
Commit
5105a007
authored
Jul 06, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:热门词修改
parent
8f8a4292
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
19 deletions
+54
-19
HotSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/HotSearchActivity.kt
+45
-13
SearchWordsBean.kt
m-consultant/src/main/java/com/yidianling/consultant/bean/SearchWordsBean.kt
+9
-6
No files found.
m-consultant/src/main/java/com/yidianling/consultant/HotSearchActivity.kt
View file @
5105a007
...
...
@@ -15,6 +15,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydl_router.manager.YDLRouterParams
import
com.ydl.ydlcommon.base.BaseMvpActivity
...
...
@@ -100,15 +102,20 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
// 搜索的关联词
var
relatedWords
=
""
var
isRecommendWords
=
false
if
(
searchSuggestList
.
isNotEmpty
()&&
searchSuggestList
.
size
>
0
){
if
(
searchSuggestList
[
0
].
suggest_relations
.
size
>
0
)
{
if
(
searchSuggestList
.
isNotEmpty
()&&
searchSuggestList
.
size
>
0
)
{
if
(
searchSuggestList
[
0
].
suggest_relations
.
size
>
0
)
{
relatedWords
=
searchSuggestList
[
0
].
suggest_relations
[
0
]
isRecommendWords
=
true
}
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&!
TextUtils
.
isEmpty
(
searchSuggestList
[
0
].
suggest_content
))
{
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&
!
TextUtils
.
isEmpty
(
searchSuggestList
[
0
].
suggest_content
))
{
relatedWords
=
searchSuggestList
[
0
].
suggest_content
}
doSearch
(
etSearch
.
text
.
toString
(),
relatedWords
,
isRecommendWords
)
if
(
searchSuggestList
?.
get
(
0
)
?.
suggest_types
?.
contains
(
"jump_word"
))
{
NewH5Activity
.
start
(
this
,
H5Params
(
searchSuggestList
[
0
].
jump_url
!!
,
null
))
}
else
{
doSearch
(
etSearch
.
text
.
toString
(),
relatedWords
,
isRecommendWords
)
}
}
else
{
val
searchWords
=
etSearch
.
text
.
toString
()
if
(
TextUtils
.
isEmpty
(
searchWords
)){
...
...
@@ -150,19 +157,33 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
// 搜索的关联词
var
relatedWords
=
""
var
isRecommendWords
=
false
if
(
searchSuggestList
.
isNotEmpty
()
&&
searchSuggestList
.
size
>
0
)
{
if
(
searchSuggestList
[
position
].
suggest_relations
.
size
>
0
)
{
if
(
searchSuggestList
.
isNotEmpty
()
&&
searchSuggestList
.
size
>
0
)
{
if
(
searchSuggestList
[
position
].
suggest_relations
.
size
>
0
)
{
relatedWords
=
searchSuggestList
[
position
].
suggest_relations
[
0
]
isRecommendWords
=
true
}
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&!
TextUtils
.
isEmpty
(
searchSuggestList
[
position
].
suggest_content
))
{
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&
!
TextUtils
.
isEmpty
(
searchSuggestList
[
position
].
suggest_content
))
{
relatedWords
=
searchSuggestList
[
position
].
suggest_content
}
}
doSearch
(
searchSuggestList
[
position
].
suggest_content
,
relatedWords
,
isRecommendWords
)
if
(
searchSuggestList
[
position
].
suggest_types
?.
contains
(
"jump_word"
))
{
NewH5Activity
.
start
(
this
,
H5Params
(
searchSuggestList
[
position
].
jump_url
!!
,
null
))
}
else
{
doSearch
(
searchSuggestList
[
position
].
suggest_content
,
relatedWords
,
isRecommendWords
)
}
// 埋点
ActionCountUtils
.
baiDuCountSign3
(
ConsultBIConstants
.
PART_ID_YDL_USER_MAIN_PAGE
,
ConsultBIConstants
.
POSITION_YDL_USER_ASSOCIATE_WORD_CLICK
,
etSearch
.
text
.
toString
(),
searchSuggestList
[
position
].
suggest_content
,
"app"
)
ActionCountUtils
.
baiDuCountSign3
(
ConsultBIConstants
.
PART_ID_YDL_USER_MAIN_PAGE
,
ConsultBIConstants
.
POSITION_YDL_USER_ASSOCIATE_WORD_CLICK
,
etSearch
.
text
.
toString
(),
searchSuggestList
[
position
].
suggest_content
,
"app"
)
}
etSearch
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
afterTextChanged
(
s
:
Editable
?)
{
...
...
@@ -204,19 +225,30 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
override
fun
getSearchWordsSuccess
(
searchWordsBean
:
SearchWordsBean
,
searchContent
:
String
,
isClickWords
:
Boolean
)
{
if
(
isClickWords
){
//判断 suggest_classify_types 有值则通过 jump_url跳转
// 搜索的关联词
var
relatedWords
=
""
var
isRecommendWords
=
false
if
(!
searchWordsBean
.
search_suggests
.
isNullOrEmpty
()
&&
searchWordsBean
.
search_suggests
.
size
>
0
)
{
if
(
searchWordsBean
.
search_suggests
[
0
].
suggest_relations
.
size
>
0
)
{
if
(!
searchWordsBean
.
search_suggests
.
isNullOrEmpty
()
&&
searchWordsBean
.
search_suggests
.
size
>
0
)
{
if
(
searchWordsBean
.
search_suggests
[
0
].
suggest_relations
.
size
>
0
)
{
relatedWords
=
searchWordsBean
.
search_suggests
[
0
].
suggest_relations
[
0
]
isRecommendWords
=
true
}
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&!
TextUtils
.
isEmpty
(
searchWordsBean
.
search_suggests
[
0
].
suggest_content
))
{
if
(
TextUtils
.
isEmpty
(
relatedWords
)
&&
!
TextUtils
.
isEmpty
(
searchWordsBean
.
search_suggests
[
0
].
suggest_content
))
{
relatedWords
=
searchWordsBean
.
search_suggests
[
0
].
suggest_content
}
}
doSearch
(
searchContent
,
relatedWords
,
isRecommendWords
)
if
(!
searchWordsBean
.
search_suggests
.
isNullOrEmpty
()
&&
searchWordsBean
.
search_suggests
?.
get
(
0
)
?.
suggest_types
?.
contains
(
"jump_word"
)
)
{
NewH5Activity
.
start
(
this
,
H5Params
(
searchWordsBean
.
search_suggests
[
0
].
jump_url
!!
,
null
)
)
}
else
{
doSearch
(
searchContent
,
relatedWords
,
isRecommendWords
)
}
}
else
{
searchSuggestList
.
clear
()
if
(!
searchWordsBean
.
search_suggests
.
isNullOrEmpty
()){
...
...
m-consultant/src/main/java/com/yidianling/consultant/bean/SearchWordsBean.kt
View file @
5105a007
...
...
@@ -8,11 +8,13 @@ data class SearchWordsBean(
)
data class
SearchSuggestListBean
(
val
id
:
String
,
val
score
:
String
,
val
suggest_content
:
String
,
val
suggest_relations
:
ArrayList
<
String
>,
val
id
:
String
,
val
score
:
String
,
val
suggest_content
:
String
,
val
suggest_relations
:
ArrayList
<
String
>,
val
search_count
:
Int
,
val
suggest_classify_types
:
ArrayList
<
String
>,
val
mapping_classify_type_exist
:
Boolean
val
suggest_classify_types
:
ArrayList
<
String
>?,
val
mapping_classify_type_exist
:
Boolean
,
val
jump_url
:
String
?,
val
suggest_types
:
ArrayList
<
String
>
)
\ No newline at end of file
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