@@ -9,6 +9,7 @@ import android.os.Bundle
99import android.text.TextUtils
1010import android.view.Gravity
1111import android.view.LayoutInflater
12+ import android.view.MotionEvent
1213import android.view.View
1314import android.view.ViewGroup
1415import android.widget.ImageView
@@ -112,7 +113,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
112113 HttpRequest .instance.getSecondLevelCategoryList(categoryKey, this )
113114 }
114115
115- var bleToGoView = object : BleToGoView {
116+ private val bleToGoView = object : BleToGoView {
116117 override fun onGoH5Ble (productId : String ) {
117118 var bundle = Bundle ()
118119 bundle.putString(CommonField .EXTRA_INFO , productId)
@@ -238,11 +239,17 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
238239 llTitleLp.rightMargin = Utils .dp2px(requireContext(), 10 )
239240 mLlTitleMap[it.SubCategoryKey ] = llTitle
240241 second_category_container.addView(llTitle, llTitleLp)
241- val deviceGridView = RecyclerView (requireContext())
242+ val deviceGridView = object : RecyclerView (requireContext()) {
243+ override fun onTouchEvent (e : MotionEvent ? ) = false
244+ }
245+ deviceGridView.overScrollMode = View .OVER_SCROLL_NEVER
242246 deviceGridView.tag = " ${it.SubCategoryKey } _gridview_tag"
243247 val gridAdapter = GridAdapter (onItemClickListener)
244248 deviceGridView.adapter = gridAdapter
245- deviceGridView.layoutManager = GridLayoutManager (requireContext(), 3 )
249+ deviceGridView.layoutManager = object : GridLayoutManager (requireContext(), 3 ) {
250+ override fun canScrollHorizontally () = false
251+ override fun canScrollVertically () = false
252+ }
246253 deviceGridView.isVisible = false
247254 mGridAdapterMap[it.SubCategoryKey ] = deviceGridView
248255 second_category_container.addView(deviceGridView)
@@ -331,7 +338,11 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
331338
332339 private val onItemClickListener = object : OnItemClickListener <CategoryDeviceInfo > {
333340 override fun onItemClick (position : Int , data : CategoryDeviceInfo ) {
334- if (ContextCompat .checkSelfPermission(requireContext(), Manifest .permission.ACCESS_FINE_LOCATION ) != PackageManager .PERMISSION_GRANTED ) {
341+ if (ContextCompat .checkSelfPermission(
342+ requireContext(),
343+ Manifest .permission.ACCESS_FINE_LOCATION
344+ ) != PackageManager .PERMISSION_GRANTED
345+ ) {
335346 clickDeviceInfo = data
336347 // 查看请求location权限的时间是否大于48小时
337348 var locationJsonString = Utils .getStringValueFromXml(
@@ -365,7 +376,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
365376 )
366377
367378 } else {
368- if (data.IsRelatedProduct ){// 根据推荐设备的配网方式,跳转到SmartConfig或者SoftAp配网界面
379+ if (data.IsRelatedProduct ) {// 根据推荐设备的配网方式,跳转到SmartConfig或者SoftAp配网界面
369380 if (goBleH5Presenter != null ) {
370381 conditionPrefix = false
371382 goBleH5Presenter!! .checkProductConfig(data.ProductId )
@@ -374,7 +385,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
374385 listOf (data.ProductId ), this @SecondDeviceCategoryFragment
375386 )
376387 }
377- }else {
388+ } else {
378389 startActivityWithExtra(SmartConfigStepActivity ::class .java, " " )
379390 }
380391 }
0 commit comments