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
09db41a9
Commit
09db41a9
authored
Jun 14, 2022
by
fengquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 倾诉列表添加搜索框
parent
9014f2e8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
384 additions
and
53 deletions
+384
-53
ConfideHomeActivity.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
+2
-1
ConfideHomeAdapter.kt
m-confide/src/main/java/com/ydl/confide/home/adapter/ConfideHomeAdapter.kt
+123
-40
IConfideHomeConfig.kt
m-confide/src/main/java/com/ydl/confide/home/config/IConfideHomeConfig.kt
+2
-0
ConfideHomeRecyleSuspendListener.kt
m-confide/src/main/java/com/ydl/confide/home/listener/ConfideHomeRecyleSuspendListener.kt
+110
-11
confide_icon_input_search.png
m-confide/src/main/res/drawable-xxhdpi/confide_icon_input_search.png
+0
-0
confide_bg_hot_search_input.xml
m-confide/src/main/res/drawable/confide_bg_hot_search_input.xml
+9
-0
confide_edit_cursor_drawable.xml
m-confide/src/main/res/drawable/confide_edit_cursor_drawable.xml
+8
-0
confide_home_activity.xml
m-confide/src/main/res/layout/confide_home_activity.xml
+66
-1
confide_home_search_header.xml
m-confide/src/main/res/layout/confide_home_search_header.xml
+64
-0
No files found.
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
View file @
09db41a9
...
@@ -410,6 +410,7 @@ class ConfideHomeActivity :
...
@@ -410,6 +410,7 @@ class ConfideHomeActivity :
initParam
()
initParam
()
hideError
()
hideError
()
cacheList
?.
addAll
(
0
,
list
)
cacheList
?.
addAll
(
0
,
list
)
cacheList
?.
add
(
0
,
ConfideHomeDataBean
(
IConfideHomeConfig
.
TYPE_SEARCH
,
null
,
null
,
null
,
-
1
))
updateAdapter
()
updateAdapter
()
setSuspendListener
()
setSuspendListener
()
v_filterView
.
refreshView
()
v_filterView
.
refreshView
()
...
@@ -419,7 +420,7 @@ class ConfideHomeActivity :
...
@@ -419,7 +420,7 @@ class ConfideHomeActivity :
* 设置筛选模块悬浮顶部监听数据
* 设置筛选模块悬浮顶部监听数据
*/
*/
private
fun
setSuspendListener
()
{
private
fun
setSuspendListener
()
{
listSuspendListener
?.
setFilterView
(
v_filterView
,
vFilterLine
)
listSuspendListener
?.
setFilterView
(
v_filterView
,
rl_search_head
,
vFilterLine
)
listSuspendListener
?.
setSectionAdapter
(
mConfideAdapter
!!
)
listSuspendListener
?.
setSectionAdapter
(
mConfideAdapter
!!
)
}
}
...
...
m-confide/src/main/java/com/ydl/confide/home/adapter/ConfideHomeAdapter.kt
View file @
09db41a9
package
com.ydl.confide.home.adapter
package
com.ydl.confide.home.adapter
import
android.app.Activity
import
android.content.Context
import
android.content.Context
import
androidx.recyclerview.widget.RecyclerView
import
android.text.Editable
import
android.text.TextUtils
import
android.text.TextWatcher
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.view.inputmethod.EditorInfo
import
android.widget.EditText
import
android.widget.ImageView
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.confide.R
import
com.ydl.confide.R
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.config.IConfideHomeConfig
import
com.ydl.confide.home.config.IConfideHomeConfig
...
@@ -12,6 +21,8 @@ import com.ydl.confide.home.contract.IConfideHomeContract
...
@@ -12,6 +21,8 @@ import com.ydl.confide.home.contract.IConfideHomeContract
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.confide.home.widget.*
import
com.ydl.confide.home.widget.*
import
com.ydl.ydlcommon.utils.DisplayUtils
import
com.ydl.ydlcommon.utils.DisplayUtils
import
com.ydl.ydlcommon.utils.KeyboardChangeListener
import
com.yidianling.common.tools.RxKeyboardTool
/**
/**
* @author yuanwai
* @author yuanwai
...
@@ -20,9 +31,11 @@ import com.ydl.ydlcommon.utils.DisplayUtils
...
@@ -20,9 +31,11 @@ import com.ydl.ydlcommon.utils.DisplayUtils
* @Company 壹点灵
* @Company 壹点灵
* @date 2018/12/14
* @date 2018/12/14
*/
*/
class
ConfideHomeAdapter
(
private
val
mContext
:
Context
,
class
ConfideHomeAdapter
(
private
var
confideHomeEvent
:
IConfideHomeEvent
,
private
val
mContext
:
Context
,
private
var
confideHomeView
:
IConfideHomeContract
.
View
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
private
var
confideHomeEvent
:
IConfideHomeEvent
,
private
var
confideHomeView
:
IConfideHomeContract
.
View
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
private
var
mListData
:
List
<
ConfideHomeDataBean
>?
=
null
private
var
mListData
:
List
<
ConfideHomeDataBean
>?
=
null
private
var
mFilterViewHolder
:
FilterViewHolder
?
=
null
private
var
mFilterViewHolder
:
FilterViewHolder
?
=
null
...
@@ -101,7 +114,13 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -101,7 +114,13 @@ class ConfideHomeAdapter(private val mContext: Context,
}
}
//为你推荐
//为你推荐
IConfideHomeConfig
.
TYPE_RECOMMEND
->
{
IConfideHomeConfig
.
TYPE_RECOMMEND
->
{
return
RecommendViewHolder
(
ConfideHomeRecommendView
(
confideHomeView
,
parent
.
context
,
confideHomeEvent
))
return
RecommendViewHolder
(
ConfideHomeRecommendView
(
confideHomeView
,
parent
.
context
,
confideHomeEvent
)
)
}
}
IConfideHomeConfig
.
TYPE_VIDEO_SHOW
->
{
IConfideHomeConfig
.
TYPE_VIDEO_SHOW
->
{
val
recyclerView
=
RecyclerView
(
parent
.
context
)
val
recyclerView
=
RecyclerView
(
parent
.
context
)
...
@@ -114,6 +133,15 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -114,6 +133,15 @@ class ConfideHomeAdapter(private val mContext: Context,
}
}
return
VideoShowHolder
(
recyclerView
)
return
VideoShowHolder
(
recyclerView
)
}
}
//顶部搜索
IConfideHomeConfig
.
TYPE_SEARCH
->
{
return
SearchViewHolder
(
LayoutInflater
.
from
(
mContext
)
.
inflate
(
R
.
layout
.
confide_home_search_header
,
parent
,
false
)
)
}
// //听声寻人
// //听声寻人
// IConfideHomeConfig.TYPE_SOUND -> {
// IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
...
@@ -125,40 +153,82 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -125,40 +153,82 @@ class ConfideHomeAdapter(private val mContext: Context,
}
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
=
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
=
/*if (holder is BannerViewHolder && null != holder.bannerView) {
/*if (holder is BannerViewHolder && null != holder.bannerView) {
//banner
//banner
holder.bannerView!!.initData(mListData!![position])
holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类
//分类
holder.categoryView!!.initData(mListData!![position])
holder.categoryView!!.initData(mListData!![position])
} else */
if
(
holder
is
FilterViewHolder
&&
null
!=
holder
.
filterView
)
{
} else */
if
(
holder
is
FilterViewHolder
&&
null
!=
holder
.
filterView
)
{
mFilterViewHolder
=
holder
mFilterViewHolder
=
holder
//筛选模块
//筛选模块
holder
.
filterView
.
initData
(
mListData
!!
[
position
])
holder
.
filterView
.
initData
(
mListData
!!
[
position
])
}
else
if
(
holder
is
ConfideHomeListenAndFoundViewHolder
)
{
}
else
if
(
holder
is
ConfideHomeListenAndFoundViewHolder
)
{
//听声寻人
//听声寻人
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
}
else
if
(
holder
is
RecentConfideHolder
)
{
}
else
if
(
holder
is
RecentConfideHolder
)
{
//最近倾诉
//最近倾诉
holder
.
rv
.
layoutManager
=
holder
.
rv
.
layoutManager
=
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
val
recentBody
=
mListData
!!
[
position
].
body
val
recentBody
=
mListData
!!
[
position
].
body
val
data
=
recentBody
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
val
data
=
recentBody
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
holder
.
rv
.
adapter
=
RecentConfideAdapter
(
data
,
confideHomeEvent
)
holder
.
rv
.
adapter
=
RecentConfideAdapter
(
data
,
confideHomeEvent
)
// holder.consultView!!.initData(mListData!![position])
// holder.consultView!!.initData(mListData!![position])
}
else
if
(
holder
is
RecommendViewHolder
&&
null
!=
mListData
!!
[
position
]
&&
null
!=
mListData
!!
[
position
].
body
&&
!
mListData
!!
[
position
].
body
!!
.
isEmpty
())
{
}
else
if
(
holder
is
RecommendViewHolder
&&
null
!=
mListData
!!
[
position
]
&&
null
!=
mListData
!!
[
position
].
body
&&
!
mListData
!!
[
position
].
body
!!
.
isEmpty
())
{
//为你推荐
//为你推荐
holder
.
confideHomeRecommendView
.
initData
(
mListData
!!
[
position
].
body
!!
[
0
],
position
,
mListData
!!
[
position
].
recommendId
)
holder
.
confideHomeRecommendView
.
initData
(
}
else
if
(
holder
is
VideoShowHolder
)
{
mListData
!!
[
position
].
body
!!
[
0
],
holder
.
rv
.
layoutManager
=
position
,
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
mListData
!!
[
position
].
recommendId
val
recentBody
=
mListData
!!
[
position
].
body
)
holder
.
rv
.
adapter
=
VideoShowAdapter
(
recentBody
,
confideHomeEvent
)
}
else
if
(
holder
is
VideoShowHolder
)
{
}
else
if
(
holder
is
EmptyViewHolder
)
{
holder
.
rv
.
layoutManager
=
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
}
else
{
val
recentBody
=
mListData
!!
[
position
].
body
holder
.
rv
.
adapter
=
VideoShowAdapter
(
recentBody
,
confideHomeEvent
)
}
else
if
(
holder
is
SearchViewHolder
)
{
holder
.
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
)
.
setOnEditorActionListener
{
_
,
actionId
,
_
->
if
(
actionId
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
Log
.
e
(
"fqLog"
,
"点击了"
);
RxKeyboardTool
.
hideSoftInput
(
mContext
as
Activity
?)
}
true
}
val
keyboardChangeListener
=
KeyboardChangeListener
(
mContext
as
Activity
?)
keyboardChangeListener
.
setKeyBoardListener
{
isShow
,
i
->
if
(!
isShow
){
holder
.
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
clearFocus
()
}
}
holder
.
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
afterTextChanged
(
p0
:
Editable
?)
{
if
(
TextUtils
.
isEmpty
(
p0
))
{
holder
.
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
visibility
=
View
.
INVISIBLE
}
else
{
holder
.
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
visibility
=
View
.
VISIBLE
}
}
override
fun
beforeTextChanged
(
p0
:
CharSequence
,
p1
:
Int
,
p2
:
Int
,
p3
:
Int
)
{
}
override
fun
onTextChanged
(
char
:
CharSequence
,
p1
:
Int
,
p2
:
Int
,
p3
:
Int
)
{
}
}
})
holder
.
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
setOnClickListener
{
holder
.
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
setText
(
""
)
}
}
else
if
(
holder
is
EmptyViewHolder
)
{
}
else
{
}
override
fun
getItemCount
():
Int
{
override
fun
getItemCount
():
Int
{
return
mListData
!!
.
size
return
mListData
!!
.
size
...
@@ -167,7 +237,8 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -167,7 +237,8 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
/**
* banner viewHolder
* banner viewHolder
*/
*/
inner
class
BannerViewHolder
(
itemView
:
ConfideHomeBannerView
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
inner
class
BannerViewHolder
(
itemView
:
ConfideHomeBannerView
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
var
bannerView
:
ConfideHomeBannerView
?
=
null
var
bannerView
:
ConfideHomeBannerView
?
=
null
init
{
init
{
...
@@ -178,7 +249,8 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -178,7 +249,8 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
/**
* 分类测评 viewHolder
* 分类测评 viewHolder
*/
*/
inner
class
CategoryViewHolder
(
itemView
:
ConfideHomeCategoryView
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
inner
class
CategoryViewHolder
(
itemView
:
ConfideHomeCategoryView
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
var
categoryView
:
ConfideHomeCategoryView
?
=
null
var
categoryView
:
ConfideHomeCategoryView
?
=
null
init
{
init
{
...
@@ -189,22 +261,31 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -189,22 +261,31 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
/**
* 筛选模块 viewHolder
* 筛选模块 viewHolder
*/
*/
inner
class
FilterViewHolder
(
var
filterView
:
ConfideHomeFilterView
)
:
RecyclerView
.
ViewHolder
(
filterView
)
inner
class
FilterViewHolder
(
var
filterView
:
ConfideHomeFilterView
)
:
RecyclerView
.
ViewHolder
(
filterView
)
/**
* 搜索模块 viewHolder
*/
inner
class
SearchViewHolder
(
var
searchView
:
View
)
:
RecyclerView
.
ViewHolder
(
searchView
)
/**
/**
* 听声寻人 viewHolder
* 听声寻人 viewHolder
*/
*/
inner
class
ConfideHomeListenAndFoundViewHolder
(
var
confideHomeListenAndFoundView
:
ConfideHomeListenAndFoundView
)
:
RecyclerView
.
ViewHolder
(
confideHomeListenAndFoundView
)
inner
class
ConfideHomeListenAndFoundViewHolder
(
var
confideHomeListenAndFoundView
:
ConfideHomeListenAndFoundView
)
:
RecyclerView
.
ViewHolder
(
confideHomeListenAndFoundView
)
/**
/**
* 最近倾诉 viewHolder
* 最近倾诉 viewHolder
*/
*/
inner
class
ConsultViewHolder
(
var
consultView
:
ConfideHomeRecentView
)
:
RecyclerView
.
ViewHolder
(
consultView
)
inner
class
ConsultViewHolder
(
var
consultView
:
ConfideHomeRecentView
)
:
RecyclerView
.
ViewHolder
(
consultView
)
/**
/**
* 为你推荐 viewHolder
* 为你推荐 viewHolder
*/
*/
inner
class
RecommendViewHolder
(
var
confideHomeRecommendView
:
ConfideHomeRecommendView
)
:
RecyclerView
.
ViewHolder
(
confideHomeRecommendView
)
inner
class
RecommendViewHolder
(
var
confideHomeRecommendView
:
ConfideHomeRecommendView
)
:
RecyclerView
.
ViewHolder
(
confideHomeRecommendView
)
/**
/**
* 空ViewHolder
* 空ViewHolder
...
@@ -216,6 +297,7 @@ class ConfideHomeAdapter(private val mContext: Context,
...
@@ -216,6 +297,7 @@ class ConfideHomeAdapter(private val mContext: Context,
view
=
itemView
view
=
itemView
}
}
}
}
class
VideoShowHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
class
VideoShowHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
class
RecentConfideHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
class
RecentConfideHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
}
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/home/config/IConfideHomeConfig.kt
View file @
09db41a9
...
@@ -20,6 +20,7 @@ interface IConfideHomeConfig{
...
@@ -20,6 +20,7 @@ interface IConfideHomeConfig{
const
val
TYPE_RECOMMEND
=
5
const
val
TYPE_RECOMMEND
=
5
const
val
TYPE_SOUND
=
6
const
val
TYPE_SOUND
=
6
const
val
TYPE_VIDEO_SHOW
=
7
const
val
TYPE_VIDEO_SHOW
=
7
const
val
TYPE_SEARCH
=
8
const
val
TYPE_FOOTER
=
999
const
val
TYPE_FOOTER
=
999
/**
/**
* section id. 与上面相对应
* section id. 与上面相对应
...
@@ -31,6 +32,7 @@ interface IConfideHomeConfig{
...
@@ -31,6 +32,7 @@ interface IConfideHomeConfig{
const
val
SECTION_RECOMMEND
=
10005
const
val
SECTION_RECOMMEND
=
10005
const
val
SECTION_SOUND
=
10006
const
val
SECTION_SOUND
=
10006
const
val
SECTION_CONSULTANT
=
10007
const
val
SECTION_CONSULTANT
=
10007
const
val
SECTION_SEARCH
=
10008
const
val
SECTION_FOOTER
=
19999
const
val
SECTION_FOOTER
=
19999
...
...
m-confide/src/main/java/com/ydl/confide/home/listener/ConfideHomeRecyleSuspendListener.kt
View file @
09db41a9
package
com.ydl.confide.home.listener
package
com.ydl.confide.home.listener
import
android.text.Editable
import
android.text.TextUtils
import
android.text.TextWatcher
import
android.util.Log
import
android.view.View
import
android.widget.EditText
import
android.widget.ImageView
import
android.widget.RelativeLayout
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
android.view.View
import
com.ydl.confide.R
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxImageTool
import
com.ydl.confide.home.adapter.ConfideHomeAdapter
import
com.ydl.confide.home.adapter.ConfideHomeAdapter
import
com.ydl.confide.home.config.IConfideHomeConfig
import
com.ydl.confide.home.config.IConfideHomeConfig
import
com.ydl.confide.home.widget.ConfideHomeFilterView
import
com.ydl.confide.home.widget.ConfideHomeFilterView
import
com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.utils.KeyboardChangeListener
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxImageTool
/**
/**
* @author yuanwai
* @author yuanwai
...
@@ -22,9 +32,14 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
...
@@ -22,9 +32,14 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
private
var
mSuspensionHeight
:
Int
=
RxImageTool
.
dip2px
(
48f
)
private
var
mSuspensionHeight
:
Int
=
RxImageTool
.
dip2px
(
48f
)
private
var
mSearchViewHeight
:
Int
=
RxImageTool
.
dip2px
(
48f
)
private
var
filterView
:
ConfideHomeFilterView
?
=
null
private
var
filterView
:
ConfideHomeFilterView
?
=
null
private
var
searchView
:
RelativeLayout
?
=
null
private
var
divView
:
View
?
=
null
private
var
divView
:
View
?
=
null
private
var
searchText
=
""
private
var
adapter
:
ConfideHomeAdapter
?
=
null
private
var
adapter
:
ConfideHomeAdapter
?
=
null
fun
setFilterView
(
filterView
:
ConfideHomeFilterView
,
divView
:
View
)
{
fun
setFilterView
(
filterView
:
ConfideHomeFilterView
,
divView
:
View
)
{
...
@@ -32,6 +47,49 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
...
@@ -32,6 +47,49 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
this
.
divView
=
divView
this
.
divView
=
divView
}
}
fun
setFilterView
(
filterView
:
ConfideHomeFilterView
,
searchView
:
RelativeLayout
,
divView
:
View
)
{
this
.
filterView
=
filterView
this
.
divView
=
divView
this
.
searchView
=
searchView
val
keyboardChangeListener
=
KeyboardChangeListener
(
BaseActivityMgr
.
INST
.
topActivity
)
keyboardChangeListener
.
setKeyBoardListener
{
isShow
,
i
->
if
(!
isShow
)
{
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
clearFocus
()
}
}
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
afterTextChanged
(
p0
:
Editable
?)
{
if
(
TextUtils
.
isEmpty
(
p0
))
{
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
visibility
=
View
.
INVISIBLE
}
else
{
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
visibility
=
View
.
VISIBLE
}
}
override
fun
beforeTextChanged
(
p0
:
CharSequence
,
p1
:
Int
,
p2
:
Int
,
p3
:
Int
)
{
}
override
fun
onTextChanged
(
char
:
CharSequence
,
p1
:
Int
,
p2
:
Int
,
p3
:
Int
)
{
if
(
char
!=
null
){
searchText
=
char
.
toString
()
}
}
})
searchView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_delete_icon
).
setOnClickListener
{
searchView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
setText
(
""
)
}
}
fun
setSectionAdapter
(
adapter
:
ConfideHomeAdapter
)
{
fun
setSectionAdapter
(
adapter
:
ConfideHomeAdapter
)
{
this
.
adapter
=
adapter
this
.
adapter
=
adapter
}
}
...
@@ -41,6 +99,20 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
...
@@ -41,6 +99,20 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
if
(
null
!=
filterView
)
{
if
(
null
!=
filterView
)
{
mSuspensionHeight
=
filterView
!!
.
height
mSuspensionHeight
=
filterView
!!
.
height
}
}
if
(
searchView
!=
null
)
{
mSearchViewHeight
=
searchView
!!
.
height
}
searchView
!!
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
clearFocus
()
val
viewHolder
=
recyclerView
.
findViewHolderForAdapterPosition
(
1
)
if
(
viewHolder
!=
null
&&
viewHolder
is
ConfideHomeAdapter
.
SearchViewHolder
)
{
viewHolder
.
itemView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
clearFocus
()
if
(
newState
==
1
){
searchView
!!
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
setText
(
viewHolder
.
itemView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
text
)
}
}
}
}
override
fun
onScrolled
(
recyclerView
:
RecyclerView
,
dx
:
Int
,
dy
:
Int
)
{
override
fun
onScrolled
(
recyclerView
:
RecyclerView
,
dx
:
Int
,
dy
:
Int
)
{
...
@@ -49,26 +121,52 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
...
@@ -49,26 +121,52 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
return
return
}
}
val
manager
=
recyclerView
!!
.
layoutManager
as
LinearLayoutManager
val
manager
=
recyclerView
!!
.
layoutManager
as
LinearLayoutManager
val
findFirstCompletelyVisibleItemPosition
=
manager
.
findFirstCompletelyVisibleItemPosition
();
if
(
findFirstCompletelyVisibleItemPosition
!=
0
&&
findFirstCompletelyVisibleItemPosition
!=
1
)
{
searchView
?.
visibility
=
View
.
VISIBLE
}
else
{
searchView
?.
visibility
=
View
.
INVISIBLE
}
if
(
mCurrentPosition
!=
manager
.
findFirstVisibleItemPosition
())
{
if
(
mCurrentPosition
!=
manager
.
findFirstVisibleItemPosition
())
{
mCurrentPosition
=
manager
.
findFirstVisibleItemPosition
()
mCurrentPosition
=
manager
.
findFirstVisibleItemPosition
()
}
}
LogUtil
.
e
(
"http----------------type="
+
adapter
!!
.
getItemViewType
(
mCurrentPosition
))
if
(
adapter
!!
.
getItemViewType
(
mCurrentPosition
)
==
IConfideHomeConfig
.
TYPE_RECOMMEND
)
{
LogUtil
.
e
(
"http----------------type="
+
adapter
!!
.
getItemViewType
(
mCurrentPosition
))
if
(
adapter
!!
.
getItemViewType
(
mCurrentPosition
+
1
)
==
IConfideHomeConfig
.
TYPE_RECOMMEND
)
{
var
view
=
manager
.
findViewByPosition
(
mCurrentPosition
+
1
)
var
view
=
manager
.
findViewByPosition
(
mCurrentPosition
+
1
)
if
(
view
!=
null
)
{
if
(
view
!=
null
)
{
if
(
view
.
top
<=
mSuspensionHeight
)
{
if
(
view
is
ConfideHomeFilterView
)
{
filterView
!!
.
visibility
=
View
.
VISIBLE
if
(
view
.
top
<=
mSuspensionHeight
)
{
divView
?.
visibility
=
View
.
VISIBLE
filterView
!!
.
visibility
=
View
.
VISIBLE
}
else
{
divView
?.
visibility
=
View
.
VISIBLE
}
else
{
// filterView!!.visibility = View.INVISIBLE
// filterView!!.visibility = View.INVISIBLE
filterView
!!
.
visibility
=
View
.
INVISIBLE
divView
?.
visibility
=
View
.
INVISIBLE
}
}
}
}
}
}
else
if
(
adapter
!!
.
getItemViewType
(
mCurrentPosition
)
==
IConfideHomeConfig
.
TYPE_RECOMMEND
||
adapter
!!
.
getItemViewType
(
mCurrentPosition
)
==
IConfideHomeConfig
.
TYPE_SOUND
){
}
else
if
(
adapter
!!
.
getItemViewType
(
mCurrentPosition
+
1
)
==
IConfideHomeConfig
.
TYPE_RECOMMEND
||
adapter
!!
.
getItemViewType
(
mCurrentPosition
+
1
)
==
IConfideHomeConfig
.
TYPE_SOUND
)
{
filterView
!!
.
visibility
=
View
.
VISIBLE
filterView
!!
.
visibility
=
View
.
VISIBLE
divView
?.
visibility
=
View
.
VISIBLE
divView
?.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
filterView
!!
.
visibility
=
View
.
INVISIBLE
filterView
!!
.
visibility
=
View
.
INVISIBLE
divView
?.
visibility
=
View
.
INVISIBLE
divView
?.
visibility
=
View
.
INVISIBLE
}
}
if
(
searchView
?.
visibility
!=
View
.
VISIBLE
){
val
viewHolder
=
recyclerView
.
findViewHolderForAdapterPosition
(
1
)
if
(
viewHolder
!=
null
&&
viewHolder
is
ConfideHomeAdapter
.
SearchViewHolder
)
{
viewHolder
.
itemView
.
findViewById
<
EditText
>(
R
.
id
.
etSearch
).
setText
(
searchText
)
}
}
}
}
}
}
\ No newline at end of file
m-confide/src/main/res/drawable-xxhdpi/confide_icon_input_search.png
0 → 100644
View file @
09db41a9
1.53 KB
m-confide/src/main/res/drawable/confide_bg_hot_search_input.xml
0 → 100644
View file @
09db41a9
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"40dp"
/>
<solid
android:color=
"#F7F7F7"
/>
<stroke
android:width=
"1px"
android:color=
"#E6E6E6"
/>
</shape>
\ No newline at end of file
m-confide/src/main/res/drawable/confide_edit_cursor_drawable.xml
0 → 100644
View file @
09db41a9
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"1dp"
/>
<span
style=
"font-family: Arial, Helvetica, sans-serif;"
/>
<solid
android:color=
"@color/platform_main_theme"
/>
</shape>
\ No newline at end of file
m-confide/src/main/res/layout/confide_home_activity.xml
View file @
09db41a9
...
@@ -16,7 +16,8 @@
...
@@ -16,7 +16,8 @@
<com.jcodecraeer.xrecyclerview.XRecyclerView
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id=
"@+id/rv_list"
android:id=
"@+id/rv_list"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/quick_consult_card"
android:id=
"@+id/quick_consult_card"
...
@@ -137,11 +138,75 @@
...
@@ -137,11 +138,75 @@
android:background=
"#80000000"
android:background=
"#80000000"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<RelativeLayout
android:id=
"@+id/rl_search_head"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/platform_dp_48"
android:background=
"@color/white"
android:visibility=
"gone"
tools:visibility=
"gone"
>
<View
android:id=
"@+id/view_search_input_bg"
android:layout_width=
"match_parent"
android:layout_height=
"32dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/confide_dp_15"
android:layout_marginRight=
"@dimen/confide_dp_15"
android:background=
"@drawable/confide_bg_hot_search_input"
android:tag=
"tag_search_input_bg"
/>
<ImageView
android:id=
"@+id/iv_search_icon"
android:layout_width=
"14dp"
android:layout_height=
"14dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/platform_dp_25"
android:layout_marginRight=
"10dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/confide_icon_input_search"
android:tag=
"tag_search_input_img"
/>
<EditText
android:id=
"@+id/etSearch"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"20dp"
android:layout_toLeftOf=
"@+id/iv_delete_icon"
android:layout_toRightOf=
"@id/iv_search_icon"
android:background=
"@null"
android:cursorVisible=
"true"
android:hint=
"请输入倾诉师姓名"
android:imeOptions=
"actionSearch"
android:maxLength=
"100"
android:singleLine=
"true"
android:tag=
"tag_search_input_edit"
android:textColor=
"#242424"
android:textColorHint=
"#b3b3b3"
android:textCursorDrawable=
"@drawable/confide_edit_cursor_drawable"
android:textSize=
"13sp"
/>
<ImageView
android:id=
"@+id/iv_delete_icon"
android:layout_width=
"14dp"
android:layout_height=
"14dp"
android:layout_alignRight=
"@+id/view_search_input_bg"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"12dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/platform_delete"
android:visibility=
"invisible"
/>
</RelativeLayout>
<com.ydl.confide.home.widget.ConfideHomeFilterView
<com.ydl.confide.home.widget.ConfideHomeFilterView
android:id=
"@+id/v_filterView"
android:id=
"@+id/v_filterView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_height=
"48dp"
android:background=
"@color/white"
android:background=
"@color/white"
android:layout_below=
"@+id/rl_search_head"
android:visibility=
"gone"
android:visibility=
"gone"
tools:visibility=
"gone"
/>
tools:visibility=
"gone"
/>
...
...
m-confide/src/main/res/layout/confide_home_search_header.xml
0 → 100644
View file @
09db41a9
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/rl_search"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/platform_dp_48"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
>
<View
android:id=
"@+id/view_search_input_bg"
android:layout_width=
"match_parent"
android:layout_height=
"32dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/confide_dp_15"
android:layout_marginRight=
"@dimen/confide_dp_15"
android:background=
"@drawable/confide_bg_hot_search_input"
android:tag=
"tag_search_input_bg"
/>
<ImageView
android:id=
"@+id/iv_search_icon"
android:layout_width=
"14dp"
android:layout_height=
"14dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/platform_dp_25"
android:layout_marginRight=
"10dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/confide_icon_input_search"
android:tag=
"tag_search_input_img"
/>
<EditText
android:id=
"@+id/etSearch"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"20dp"
android:layout_toLeftOf=
"@+id/iv_delete_icon"
android:layout_toRightOf=
"@id/iv_search_icon"
android:background=
"@null"
android:cursorVisible=
"true"
android:hint=
"请输入倾诉师姓名"
android:imeOptions=
"actionSearch"
android:maxLength=
"100"
android:singleLine=
"true"
android:tag=
"tag_search_input_edit"
android:textColor=
"#242424"
android:textColorHint=
"#b3b3b3"
android:textCursorDrawable=
"@drawable/confide_edit_cursor_drawable"
android:textSize=
"13sp"
/>
<ImageView
android:id=
"@+id/iv_delete_icon"
android:layout_width=
"14dp"
android:layout_height=
"14dp"
android:layout_alignRight=
"@+id/view_search_input_bg"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"12dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/platform_delete"
android:visibility=
"invisible"
/>
</RelativeLayout>
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