车队管理完善

This commit is contained in:
2024-02-07 17:12:21 +08:00
parent 4c51daa245
commit 8dcf3b77c7
15 changed files with 1005 additions and 61 deletions
@@ -0,0 +1,31 @@
package com.dahe.gldriver.adapter
import android.content.Context
import android.view.ViewGroup
import android.widget.Button
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.dahe.gldriver.R
import com.dahe.glex.bean.WayBillBean
/**
* @ClassName WaybillAdapter
* @Author 用户
* @Date 2024/1/23 16:27
* @Description TODO
*/
class DriversAdapter :
BaseQuickAdapter<WayBillBean, QuickViewHolder>() {
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WayBillBean?) {
}
override fun onCreateViewHolder(
context: Context,
parent: ViewGroup,
viewType: Int
): QuickViewHolder {
// 返回一个 ViewHolder
return QuickViewHolder(R.layout.item_driver, parent)
}
}
@@ -0,0 +1,31 @@
package com.dahe.gldriver.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
/**
* @ClassName PagersAdapter
* @Author john
* @Date 2024/2/7 10:26
* @Description TODO
*/
class PagersAdapter(fragmentActivity: FragmentActivity,list:MutableList<Fragment>) : FragmentStateAdapter(fragmentActivity) {
private var fragmentList : MutableList<Fragment> =ArrayList()
init {
this.fragmentList = list
}
override fun getItemCount(): Int {
return fragmentList.size
}
override fun createFragment(position: Int): Fragment {
return fragmentList[position]
}
fun addFragment(fragment: Fragment){
fragmentList.add(fragment)
}
}
@@ -95,7 +95,7 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener {
private fun goTools(pos: Int) {
when (pos) {
0 -> {
ActivityUtils.startActivity(mContext, RulesActivity::class.java)
ActivityUtils.startActivity(mContext, CarTeamActivity::class.java)
}
1 -> {
@@ -1,8 +1,25 @@
package com.dahe.gldriver.ui.mine.activity
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.dahe.gldriver.adapter.PagersAdapter
import com.dahe.gldriver.databinding.ActivityCarTeamBinding
import com.dahe.gldriver.ui.mine.fragment.CarsManFragment
import com.dahe.gldriver.ui.mine.fragment.DriversManFragment
import com.dahe.gldriver.ui.waybill.fragment.AllWaybillFragment
import com.dahe.mylibrary.base.BaseActivity
import net.lucode.hackware.magicindicator.FragmentContainerHelper
import net.lucode.hackware.magicindicator.buildins.UIUtil
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
/**
* @ClassName CarTeamActivity
@@ -11,11 +28,116 @@ import com.dahe.mylibrary.base.BaseActivity
* @Description 车队管理
*/
class CarTeamActivity : BaseActivity<ActivityCarTeamBinding>() {
private val mFragmentContainerHelper = FragmentContainerHelper()
var mFragments = mutableListOf<Fragment>(
DriversManFragment(),
CarsManFragment(),
AllWaybillFragment()
)
val titles = mutableListOf(
"司机管理",
"车辆管理",
"车队订单"
)
override fun initView(savedInstanceState: Bundle?) {
setStatusHeightParams(binding.rlTop)
setTitleBar("车队管理",true,true)
var pagerAdapter = PagersAdapter(this,mFragments)
// pagerAdapter.addFragment(AllWaybillFragment())
// pagerAdapter.addFragment(AllWaybillFragment())
// pagerAdapter.addFragment(AllWaybillFragment())
binding.circleBarView.setProgress(30f,1000)
binding.circleBarView2.run {
text = "高风险"
valueText = "0"
unitText= ""
progress = 60
}
mFragmentContainerHelper.handlePageSelected(0,true)
binding.viewPager.adapter = pagerAdapter
binding.viewPager.currentItem = 0
binding.viewPager.registerOnPageChangeCallback(object : OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
mFragmentContainerHelper.handlePageSelected(position,true)
}
});
var commonNavigator = CommonNavigator(mContext)
commonNavigator.run {
isAdjustMode = true
adapter = object : CommonNavigatorAdapter() {
override fun getCount(): Int {
return titles.size
}
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
val colorTransitionPagerTitleView = ColorTransitionPagerTitleView(context)
colorTransitionPagerTitleView.normalColor = Color.BLACK
colorTransitionPagerTitleView.selectedColor = Color.RED
colorTransitionPagerTitleView.text = titles[index]
colorTransitionPagerTitleView.setOnClickListener {
mFragmentContainerHelper.handlePageSelected(index)
switchPages(index)
}
return colorTransitionPagerTitleView
}
override fun getIndicator(context: Context?): IPagerIndicator {
val indicator = LinePagerIndicator(context)
indicator.mode = LinePagerIndicator.MODE_WRAP_CONTENT
indicator.yOffset =
UIUtil.dip2px(context, 3.0).toFloat()
indicator.setColors(Color.RED)
return indicator
}
}
}
binding.magicIndicator.navigator = commonNavigator
mFragmentContainerHelper.attachMagicIndicator(binding.magicIndicator)
}
override fun initDate() {
}
private fun switchPages(index: Int){
binding.viewPager.currentItem = index
}
// private fun switchPages(index: Int) {
// val fragmentManager = supportFragmentManager
// val fragmentTransaction = fragmentManager.beginTransaction()
// var fragment: Fragment
// var i = 0
// val j: Int = mFragments.size
// while (i < j) {
// if (i == index) {
// i++
// continue
// }
// fragment = mFragments[i]
// if (fragment.isAdded) {
// fragmentTransaction.hide(fragment)
// }
// i++
// }
// fragment = mFragments[index]
// if (fragment.isAdded) {
// fragmentTransaction.show(fragment)
// } else {
// fragmentTransaction.add(R.id.fragmentContainer, fragment)
// }
// fragmentTransaction.commitAllowingStateLoss()
// }
}
@@ -21,6 +21,8 @@ import com.dahe.mylibrary.utils.ConvertUtils
*/
class WalletActivity : BaseActivity<ActivityWalletBinding>() {
override fun initView(savedInstanceState: Bundle?) {
setStatusHeightParams(binding.rlTop)
setTitleBar("钱包",true,true)
}
override fun initDate() {
@@ -0,0 +1,58 @@
package com.dahe.gldriver.ui.mine.fragment
import android.graphics.Color
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.CarsAdapter
import com.dahe.gldriver.adapter.WaybillAdapter
import com.dahe.gldriver.databinding.ActivityCarsManBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ConvertUtils
/**
* @ClassName CarsManActivity
* @Author john
* @Date 2024/2/1 08:59
* @Description 车辆管理
*/
class CarsManFragment : BaseFragment<FragmentWaybillListBinding>() {
override fun onFragmentVisibleChange(isVisible: Boolean) {
}
override fun onFragmentFirstVisible() {
var datas = mutableListOf<WayBillBean>(
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean()
)
var adapter = binding.recyclerView.run {
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
addItemDecoration(
RecycleViewDivider(
LinearLayout.VERTICAL,
ConvertUtils.dp2px(16.0f),
Color.TRANSPARENT
)
)
adapter = CarsAdapter()
adapter as CarsAdapter
}
adapter.submitList(datas)
}
}
@@ -0,0 +1,59 @@
package com.dahe.gldriver.ui.mine.fragment
import android.graphics.Color
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.CarsAdapter
import com.dahe.gldriver.adapter.DriversAdapter
import com.dahe.gldriver.adapter.WaybillAdapter
import com.dahe.gldriver.databinding.ActivityCarsManBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ConvertUtils
/**
* @ClassName CarsManActivity
* @Author john
* @Date 2024/2/1 08:59
* @Description 车辆管理
*/
class DriversManFragment : BaseFragment<FragmentWaybillListBinding>() {
override fun onFragmentVisibleChange(isVisible: Boolean) {
}
override fun onFragmentFirstVisible() {
var datas = mutableListOf<WayBillBean>(
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean()
)
var adapter = binding.recyclerView.run {
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
addItemDecoration(
RecycleViewDivider(
LinearLayout.VERTICAL,
ConvertUtils.dp2px(16.0f),
Color.TRANSPARENT
)
)
adapter = DriversAdapter()
adapter as DriversAdapter
}
adapter.submitList(datas)
}
}
+29 -42
View File
@@ -15,11 +15,27 @@
</RelativeLayout>
<LinearLayout
android:id="@+id/llTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_100"
android:orientation="vertical">
<com.dahe.mylibrary.weight.CircleBarView
android:id="@+id/circleBarView"
android:layout_width="300dp"
android:layout_height="@dimen/dp_150"
app:progress_color1="@color/red"
/>
<com.dahe.mylibrary.weight.CircleBarView2
android:id="@+id/circleBarView2"
android:layout_width="300dp"
android:layout_height="@dimen/dp_150"
app:progress_color1="@color/red"
/>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_75"
@@ -75,60 +91,31 @@
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_marginTop="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_height="@dimen/dp_54"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_15"
android:background="@color/white"
android:layout_marginBottom="@dimen/dp_14"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/magicIndicator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/dp_12">
/>
<ImageView
android:layout_width="@dimen/dp_48"
android:layout_height="@dimen/dp_48"
android:background="@drawable/head_defaut" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:text="王师傅的车队"
android:textColor="@color/black"
android:textSize="@dimen/sp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"
android:background="@drawable/shape_orange_5"
android:paddingLeft="@dimen/dp_4"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_4"
android:paddingBottom="@dimen/dp_2"
android:text="未认证"
android:textColor="#FF4A02"
android:textSize="@dimen/sp_9" />
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/right_gray" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<androidx.viewpager2.widget.ViewPager2
android:layout_below="@+id/llTop"
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
+3 -17
View File
@@ -4,27 +4,13 @@
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_237"
android:background="@drawable/wallet_bg"
android:paddingTop="@dimen/dp_50">
android:background="@drawable/wallet_bg">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="钱包"
android:textColor="@color/white"
android:textSize="@dimen/sp_17" />
<include layout="@layout/common_toolbar"></include>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_4"
android:background="@drawable/left"
android:baselineAlignBottom="@+id/tvTitle" />
</RelativeLayout>
<RelativeLayout
+1 -1
View File
@@ -5,7 +5,7 @@
android:orientation="vertical">
//搜索
<!-- //搜索-->
<RelativeLayout
android:layout_width="match_parent"
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_70"
android:background="@drawable/shape_bg8"
android:gravity="center_vertical">
<ImageView
android:id="@+id/ivHead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/head_defaut" />
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_toRightOf="@+id/ivHead"
android:text="王师傅"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tvPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/ivHead"
android:layout_marginLeft="@dimen/dp_12"
android:layout_toRightOf="@+id/ivHead"
android:text="15835201103"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_12" />
<View
android:layout_alignBottom="@+id/tvPhone"
android:layout_toRightOf="@+id/tvPhone"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="@dimen/dp_1"
android:layout_marginBottom="@dimen/dp_2"
android:layout_height="@dimen/dp_10"
android:background="@color/color_c"
/>
<TextView
android:id="@+id/tvDays"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/ivHead"
android:layout_marginLeft="@dimen/dp_22"
android:layout_toRightOf="@+id/tvPhone"
android:text="加入22天"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_12" />
</RelativeLayout>