Skip to content

Commit

Permalink
取消滑动拉升效果
Browse files Browse the repository at this point in the history
  • Loading branch information
neilyhe committed Sep 25, 2024
1 parent 918d305 commit a3a6dbb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
Expand Down Expand Up @@ -112,7 +113,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
HttpRequest.instance.getSecondLevelCategoryList(categoryKey, this)
}

var bleToGoView = object : BleToGoView {
private val bleToGoView = object : BleToGoView {
override fun onGoH5Ble(productId: String) {
var bundle = Bundle()
bundle.putString(CommonField.EXTRA_INFO, productId)
Expand Down Expand Up @@ -238,11 +239,17 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
llTitleLp.rightMargin = Utils.dp2px(requireContext(), 10)
mLlTitleMap[it.SubCategoryKey] = llTitle
second_category_container.addView(llTitle, llTitleLp)
val deviceGridView = RecyclerView(requireContext())
val deviceGridView = object : RecyclerView(requireContext()) {
override fun onTouchEvent(e: MotionEvent?) = false
}
deviceGridView.overScrollMode = View.OVER_SCROLL_NEVER
deviceGridView.tag = "${it.SubCategoryKey}_gridview_tag"
val gridAdapter = GridAdapter(onItemClickListener)
deviceGridView.adapter = gridAdapter
deviceGridView.layoutManager = GridLayoutManager(requireContext(), 3)
deviceGridView.layoutManager = object : GridLayoutManager(requireContext(), 3) {
override fun canScrollHorizontally() = false
override fun canScrollVertically() = false
}
deviceGridView.isVisible = false
mGridAdapterMap[it.SubCategoryKey] = deviceGridView
second_category_container.addView(deviceGridView)
Expand Down Expand Up @@ -331,7 +338,11 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {

private val onItemClickListener = object : OnItemClickListener<CategoryDeviceInfo> {
override fun onItemClick(position: Int, data: CategoryDeviceInfo) {
if (ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
if (ContextCompat.checkSelfPermission(
requireContext(),
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
clickDeviceInfo = data
// 查看请求location权限的时间是否大于48小时
var locationJsonString = Utils.getStringValueFromXml(
Expand Down Expand Up @@ -365,7 +376,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
)

} else {
if (data.IsRelatedProduct){// 根据推荐设备的配网方式,跳转到SmartConfig或者SoftAp配网界面
if (data.IsRelatedProduct) {// 根据推荐设备的配网方式,跳转到SmartConfig或者SoftAp配网界面
if (goBleH5Presenter != null) {
conditionPrefix = false
goBleH5Presenter!!.checkProductConfig(data.ProductId)
Expand All @@ -374,7 +385,7 @@ class SecondDeviceCategoryFragment() : BaseFragment(), MyCallback {
listOf(data.ProductId), this@SecondDeviceCategoryFragment
)
}
}else{
} else {
startActivityWithExtra(SmartConfigStepActivity::class.java, "")
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/new_fragment_devices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
android:id="@+id/ll_recommend_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="13dp"
android:gravity="center_vertical"
android:orientation="horizontal">

Expand Down Expand Up @@ -55,6 +55,7 @@
android:id="@+id/rv_recommend_devices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:tag="recommend_gridview_tag"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3" />
Expand Down

0 comments on commit a3a6dbb

Please sign in to comment.