Commit 2065d51c by YKai

feat: 咨询地区筛选接口调整,逻辑调整

parent 4cf90405
......@@ -20,9 +20,9 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.13",
"m-consultant" : "0.0.59.92",
"m-consultant" : "0.0.59.93",
"m-fm" : "0.0.30.04",
"m-user" : "0.0.61.56",
"m-home" : "0.0.22.71",
......@@ -89,7 +89,7 @@ ext {
//第三步 若干
"m-confide" : "0.0.49.13",
"m-consultant" : "0.0.59.92",
"m-consultant" : "0.0.59.93",
"m-fm" : "0.0.30.04",
"m-user" : "0.0.61.56",
"m-home" : "0.0.22.71",
......
......@@ -561,16 +561,16 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
val textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
bean.key = hotData.id
bean.code = hotData.id
bean.value = hotData.value
for (headBean in headData!!.region) {
if (TextUtils.equals(headBean.key, bean.key)) {
if (TextUtils.equals(headBean.code, bean.code)) {
bean.sub = headBean.sub
break
}
......@@ -712,7 +712,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
"8" -> {
//市
if (headData?.region!!.size > 0) {
var bean = SubItem()
val bean = SubItem()
if (isAdd) {
//热门中如果选择过地区、要把其他已选中的置位未选中
if (hasSelectedArea) {
......@@ -725,12 +725,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
}
bean.key = hotData.id
bean.code = hotData.id
bean.value = hotData.value
for (headBean in headData!!.region) {
if (TextUtils.equals(
headBean.key!!.substring(0, 2),
bean.key!!.substring(0, 2)
headBean.code!!.substring(0, 2),
bean.code!!.substring(0, 2)
)
) {
allFilter.region = headBean
......@@ -1292,24 +1292,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (region.key == null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if (TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = "地区"
} else if (region.key != null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
} else {
// LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
......@@ -1323,12 +1314,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter!!.withIndex()) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.key)) {
if (TextUtils.equals(sub.key, hot.id)) {
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
......@@ -1337,7 +1328,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
} else {
if (TextUtils.equals(region.key, hot.id)) {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
......
......@@ -512,22 +512,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
"2" -> {//省
if (headData?.region!!.size > 0) {
var bean = RegionItem()
val bean = RegionItem()
if (isAdd) {
//热门中如果选择过地区、要把其他已选中的置位未选中
if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
val textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
bean.key = hotData.id
bean.code = hotData.id
bean.value = hotData.value
for (headBean in headData!!.region) {
if (TextUtils.equals(headBean.key, bean.key)) {
if (TextUtils.equals(headBean.code, bean.code)) {
bean.sub = headBean.sub
break
}
......@@ -669,25 +669,25 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
"8" -> {
//市
if (headData?.region!!.size > 0) {
var bean = SubItem()
val bean = SubItem()
if (isAdd) {
//热门中如果选择过地区、要把其他已选中的置位未选中
if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
val textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
bean.key = hotData.id
bean.code = hotData.id
bean.value = hotData.value
for (headBean in headData!!.region) {
if (TextUtils.equals(
headBean.key!!.substring(0, 2),
bean.key!!.substring(0, 2)
headBean.code!!.substring(0, 2),
bean.code!!.substring(0, 2)
)
) {
allFilter.region = headBean
......@@ -1237,10 +1237,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//显示地区弹窗
private fun showAreaPopupWindow() {
if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(
mActivity, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub
)
val regionPopupWindow = AreaPopupWindow(mActivity, headData?.region ?: ArrayList(), allFilter.region, allFilter.sub)
regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
......@@ -1258,24 +1255,15 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (region.key == null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if ( TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = "地区"
} else if (region.key != null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
} else {
// LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
......@@ -1289,12 +1277,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter!!.withIndex()) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
val textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.key)) {
if (TextUtils.equals(sub.key, hot.id)) {
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
......@@ -1303,7 +1291,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
} else {
if (TextUtils.equals(region.key, hot.id)) {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
......
......@@ -44,17 +44,17 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
/**
* 加载缓存
*/
fun localData(showType : Int){
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult{
fun localData(showType: Int) {
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult {
override fun doAsyncAction(): Any {
return when(showType){
0 ->{//按专家
return when (showType) {
0 -> {//按专家
YDLCacheUtils.getDoctorListData()
}
1 ->{//按服务
1 -> {//按服务
YDLCacheUtils.getServerListData()
}
else ->{
else -> {
YDLCacheUtils.getServerListData()
}
}
......@@ -62,23 +62,24 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)){
if (`object` !is String || TextUtils.isEmpty(`object`)) {
mView.showRefreshLayout()
}
if (`object` is String){
if (`object` is String) {
val gson = Gson()
val bean = gson.fromJson<ExpertSearchBean>(`object`,ExpertSearchBean::class.java)
val bean =
gson.fromJson<ExpertSearchBean>(`object`, ExpertSearchBean::class.java)
// val bean = gson.fromJson<ExpertSearchBean>(`object`, object : TypeToken<ExpertSearchBean>() {}.type)
if(bean?.list != null){
when(showType){
0 ->{
if (bean?.list != null) {
when (showType) {
0 -> {
mView.onDoctorListFetched(bean.list, 1, 1)
}
1 ->{
1 -> {
mView.onServiceListFetched(bean.list, 1, 1)
}
else ->{
else -> {
mView.onServiceListFetched(bean.list, 1, 1)
}
}
......@@ -89,14 +90,14 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
})
}
fun updateCache(showType: Int,searchBean: ExpertSearchBean){
fun updateCache(showType: Int, searchBean: ExpertSearchBean) {
val gson = Gson()
val json = gson.toJson(searchBean)
when(showType){
0 ->{
when (showType) {
0 -> {
YDLCacheUtils.saveDoctorListData(json)
}
1 ->{
1 -> {
YDLCacheUtils.saveServerListData(json)
}
}
......@@ -105,11 +106,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
@SuppressLint("CheckResult")
fun fetchListData(allFilter: AllFilter, page: Int) {
//是否亲子教育字段
ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size==1&&allFilter.categories[0].cateId=="23"
ConsultAssistantDialogUtils.REALATION_EDUCATION =
allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23"
var showType = 0
val sb = StringBuffer()
sb.append("searchWord=").append(if(TextUtils.isEmpty(allFilter.searchWord)) "" else allFilter.searchWord)
sb.append("searchWord=")
.append(if (TextUtils.isEmpty(allFilter.searchWord)) "" else allFilter.searchWord)
if (allFilter.categories.isNotEmpty()) {
var categorys = allFilter.categories.map { it.cateId }.joinToString(",")
if ("0" == categorys) {
......@@ -117,11 +120,15 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
sb.append("&directionTags=").append(categorys)
}
if (allFilter.sub.key != null) {
sb.append("&city=").append(Integer.parseInt(allFilter.sub.key))
if (allFilter.region.value == "海外"||allFilter.region.value=="全国") {
sb.append("&country=").append(allFilter.sub.code)
} else{
if (allFilter.region.code != null) {
sb.append("&province=").append(allFilter.region.code)
}
if (allFilter.sub.code != null) {
sb.append("&city=").append(allFilter.sub.code)
}
if (allFilter.region.key != null) {
sb.append("&province=").append(Integer.parseInt(allFilter.region.key))
}
if (allFilter.reorder.key != null) {
sb.append("&reorder=").append(allFilter.reorder.key)
......@@ -133,8 +140,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
sb.append("&ages=").append(allFilter.ages.map { it.key }.joinToString(","))
}
// 擅长人群拼接
if (allFilter.specialityCrowd.isNotEmpty()){
sb.append("&crowdsTags=").append(allFilter.specialityCrowd.map { it.key }.joinToString(","))
if (allFilter.specialityCrowd.isNotEmpty()) {
sb.append("&crowdsTags=")
.append(allFilter.specialityCrowd.map { it.key }.joinToString(","))
}
if (allFilter.others.isNotEmpty()) {
sb.append("&others=").append(allFilter.others.map { it.key }.joinToString(","))
......@@ -143,10 +151,10 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// showType = allFilter.showType.key!!
// sb.append("&showType=").append(allFilter.showType.key!!)
// }
if(allFilter.title.isNotEmpty()){
if (allFilter.title.isNotEmpty()) {
sb.append("&title=").append(allFilter.title.map { it.key }.joinToString(","))
}
if (allFilter.priceRanges !=null) {
if (allFilter.priceRanges != null) {
sb.append("&minPrice=").append(allFilter.priceRanges?.minPrice)
sb.append("&maxPrice=").append(allFilter.priceRanges?.maxPrice)
}
......@@ -165,8 +173,8 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// }
mView.onDoctorListFetched(it.list, page, it.pages)
//更新缓存 只更新第一页的缓存
if (page == 1){
updateCache(showType,it)
if (page == 1) {
updateCache(showType, it)
}
} else {
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
......
......@@ -16,35 +16,32 @@ import kotlinx.android.synthetic.main.consultant_item_region.view.*
* 省份列表适配器
* Created by zqk on 17-7-21.
*/
class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<RegionItem>, var selectedRegion: RegionItem) : RecyclerView.Adapter<RegionRecyclerViewAdapter.ViewHolder>() {
class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<RegionItem>, var selectedRegion: RegionItem
) : RecyclerView.Adapter<RegionRecyclerViewAdapter.ViewHolder>() {
var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var region = RegionItem(ArrayList(), "全国", null)
if (position > 0) {
region = regionList[position - 1]
}
val region = regionList[position]
holder.itemView.tvRegionName.text = region.value
if (selectedRegion.key == region.key) {
if (selectedRegion.code == region.code) {
//选中状态
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT_BOLD)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(255, 255, 255))
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_main_theme))
holder.itemView.view_select.visibility = View.VISIBLE
} else {
//未选中状态
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(245, 245, 245))
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_default_text_color))
holder.itemView.view_select.visibility = View.INVISIBLE
}
}
override fun getItemCount(): Int = regionList.size + 1
override fun getItemCount(): Int = regionList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_region, parent, false)
val view =
LayoutInflater.from(context).inflate(R.layout.consultant_item_region, parent, false)
return ViewHolder(view)
}
......@@ -53,13 +50,9 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
itemView.setOnClickListener {
val position = adapterPosition
if (position != RecyclerView.NO_POSITION) {
selectedRegion = if (position == 0) {
RegionItem(ArrayList(), "全国", null)
} else {
regionList[position - 1]
}
notifyDataSetChanged()
selectedRegion = regionList[position]
onItemClickListener?.onItemClickListener(itemView, adapterPosition, selectedRegion)
notifyDataSetChanged()
}
}
}
......
......@@ -21,25 +21,20 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var region = SubItem("不限", null)
if (position > 0) {
region = subList[position - 1]
}
holder.itemView.tvConsultTypeName.text = region.value
if (selectedSub.key == region.key) {
val subItem = subList[position]
holder.itemView.tvConsultTypeName.text = subItem.value
if (selectedSub.code == subItem.code) {
//选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT_BOLD)
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.platform_main_theme))
// holder.itemView.ivCheckCircle.visibility = View.VISIBLE
} else {
//未选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT)
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.platform_default_text_color))
// holder.itemView.ivCheckCircle.visibility = View.INVISIBLE
}
}
override fun getItemCount(): Int = subList.size + 1
override fun getItemCount(): Int = subList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_consult_type, parent, false)
......@@ -51,13 +46,9 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
itemView.setOnClickListener {
val position = adapterPosition
if (position != RecyclerView.NO_POSITION) {
selectedSub = if (position == 0) {
SubItem("不限", null)
} else {
subList[adapterPosition - 1]
}
notifyDataSetChanged()
selectedSub = subList[adapterPosition]
onItemClickListener?.onItemClickListener(itemView, adapterPosition, selectedSub)
notifyDataSetChanged()
}
}
}
......
......@@ -38,7 +38,7 @@ interface SearchApi {
fun listHead(@FieldMap maps: Map<String, String>): Observable<BaseResponse<HeadData>>
//搜索条件
@GET("consult/search/conditions")
@GET("consult/search/v2/conditions")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchConditions(@Query("cateSource") cateSource: Int): Observable<BaseAPIResponse<HeadData>>
......
......@@ -11,5 +11,8 @@ data class RegionItem(
var value: String? = null,
@field:SerializedName("key")
var key: String? = null
var key: String? = null,
@field:SerializedName("code")
var code: String?=null
)
\ No newline at end of file
......@@ -8,5 +8,8 @@ data class SubItem(
var value: String? = null,
@field:SerializedName("key")
var key: String? = null
var key: String? = null,
@field:SerializedName("code")
var code: String?=null
)
\ No newline at end of file
......@@ -20,18 +20,16 @@ import kotlinx.android.synthetic.main.consultant_ui_region_popup_window.view.*
/**
* 地区选择弹窗
*/
class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
private var selectedRegion: RegionItem, private var selectedSub: SubItem)
class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, private var selectedRegion: RegionItem, private var selectedSub: SubItem)
: PopupWindow(null, ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(369f)) {
private val subList = ArrayList<SubItem>()
private val regionAdapter = RegionRecyclerViewAdapter(context, regionList, selectedRegion)
private val subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub)
private var subAdapter:SubRecyclerViewAdapter
var onRegionSelectedListener: OnRegionSelectedListener? = null
init {
subList.addAll(selectedRegion.sub)
val view = LayoutInflater.from(context).inflate(R.layout.consultant_ui_region_popup_window, null)
this.contentView = view
this.isFocusable = true
......@@ -40,6 +38,13 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
this.isOutsideTouchable = true
this.height = ((RxDeviceTool.getScreenHeight(context) - RxImageTool.dp2px(90f)) * 0.618).toInt() //设置高度为屏幕的80%
if (selectedRegion.sub.isNotEmpty()){
subList.addAll(selectedRegion.sub)
}else{
subList.addAll(regionList[0].sub)
}
subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub)
view.rvRegion.layoutManager =
LinearLayoutManager(
context,
......@@ -54,13 +59,10 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
view.rvSub.scrollToPosition(0)
}
view.rvRegion.adapter = regionAdapter
// view.rvRegion.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
val helper = LinearSnapHelper()
// LinearSnapHelper().attachToRecyclerView(view.rvRegion)
val i = regionList
.takeWhile { it.key != selectedRegion.key }
.count()
view.rvRegion.scrollToPosition(i + 1)
view.rvRegion.scrollToPosition(i)
view.rvSub.layoutManager =
......@@ -74,8 +76,6 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
onRegionSelectedListener?.onRegionSelected(selectedRegion, selectedSub)
}
view.rvSub.adapter = subAdapter
// view.rvSub.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
// LinearSnapHelper().attachToRecyclerView(view.rvSub)
view.rvSub.scrollToPosition(subList.indexOf(selectedSub) + 1)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment