| | |
| | | package com.example.firstapp.ui.home |
| | | |
| | | import android.content.Intent |
| | | import android.os.Bundle |
| | | import android.view.LayoutInflater |
| | | import android.view.View |
| | |
| | | import androidx.recyclerview.widget.LinearLayoutManager |
| | | import androidx.recyclerview.widget.RecyclerView |
| | | import com.example.firstapp.R |
| | | import com.example.firstapp.activity.PickupActivity |
| | | import com.example.firstapp.adapter.ExpressAdapter |
| | | import com.example.firstapp.core.Core |
| | | import com.example.firstapp.databinding.FragmentHomeBinding |
| | |
| | | } |
| | | |
| | | private fun setupRecyclerViews() { |
| | | // 快递列表 |
| | | //layoutManager = LinearLayoutManager(context):设置 RecyclerView 的布局管理器为线性布局管理器,表示列表是垂直排列的。 |
| | | //创建一个 ExpressAdapter 的实例,用于提供 RecyclerView 的数据。 |
| | | //将适配器设置给 RecyclerView,以便显示数据。 |
| | | binding.expressRecycler.apply { |
| | | layoutManager = LinearLayoutManager(context) |
| | | expressAdapter = ExpressAdapter() |
| | | adapter = expressAdapter |
| | | |
| | | // 设置点击监听 |
| | | expressAdapter.setOnPackageClickListener { group, pack -> |
| | | // 跳转到取件页面 |
| | | val intent = Intent(requireContext(), PickupActivity::class.java).apply { |
| | | putExtra("station_name", group.stationName) |
| | | putExtra("company", pack.company) |
| | | } |
| | | startActivity(intent) |
| | | } |
| | | } |
| | | |
| | | // // 财务列表 |