|
@@ -6,21 +6,28 @@ package jx.cn.escort.ui.fragment
|
|
|
import android.content.Context
|
|
|
import android.content.SharedPreferences
|
|
|
import android.graphics.Color
|
|
|
+import android.graphics.Typeface
|
|
|
import android.os.Bundle
|
|
|
-import android.util.Log
|
|
|
+import android.view.Gravity
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import androidx.appcompat.widget.AppCompatTextView
|
|
|
import androidx.fragment.app.Fragment
|
|
|
+import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.necer.calendar.Miui9Calendar
|
|
|
-import com.necer.listener.OnCalendarChangedListener
|
|
|
import com.xuexiang.xui.widget.actionbar.TitleBar
|
|
|
+import com.xuexiang.xui.widget.banner.recycler.BannerLayout
|
|
|
+import com.xuexiang.xui.widget.dialog.materialdialog.DialogAction
|
|
|
import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog
|
|
|
import jx.cn.escort.R
|
|
|
+import jx.cn.escort.adapter.IndexAbilityRecycleAdapter
|
|
|
import jx.cn.escort.adapter.IndexRecycleAdapter
|
|
|
+import jx.cn.escort.adapter.IndexStatRecycleAdapter
|
|
|
+import jx.cn.escort.beans.AbilityData
|
|
|
+import jx.cn.escort.beans.StatData
|
|
|
import jx.cn.escort.beans.TaskData
|
|
|
import jx.cn.escort.ui.activity.LoginActivity
|
|
|
import org.koin.core.component.KoinComponent
|
|
@@ -86,9 +93,12 @@ class BaseNavFragment(name:Int,context: Context?):Fragment(),KoinComponent {
|
|
|
val inflate = li.inflate(jx.cn.escort.R.layout.layout_task_calendar, null)
|
|
|
var miui9Calendar=inflate.findViewById<Miui9Calendar>(jx.cn.escort.R.id.miui9Calendar)
|
|
|
var textView=inflate.findViewById<AppCompatTextView>(jx.cn.escort.R.id.calendarTitle)
|
|
|
- miui9Calendar.setOnCalendarChangedListener(OnCalendarChangedListener { baseCalendar, year, month, localDate, dateChangeBehavior ->
|
|
|
- textView.setText(year.toString() + "年" + month + "月" + " 当前页面选中 " + localDate)
|
|
|
- })
|
|
|
+ miui9Calendar.setOnCalendarChangedListener { baseCalendar, year, month, localDate, dateChangeBehavior ->
|
|
|
+ textView.text = localDate.toString()
|
|
|
+ textView.setTypeface(null, Typeface.BOLD)
|
|
|
+ textView.setGravity(Gravity.CENTER)
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
context?.let {
|
|
|
MaterialDialog.Builder(it)
|
|
@@ -96,6 +106,12 @@ class BaseNavFragment(name:Int,context: Context?):Fragment(),KoinComponent {
|
|
|
.title("选择日期")
|
|
|
.positiveText("确定")
|
|
|
.negativeText("取消")
|
|
|
+ .onPositive(object:MaterialDialog.SingleButtonCallback{
|
|
|
+ override fun onClick(dialog: MaterialDialog, which: DialogAction) {
|
|
|
+ divideTitle.setTitle(textView.text)
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
.show()
|
|
|
|
|
|
}
|
|
@@ -106,6 +122,57 @@ class BaseNavFragment(name:Int,context: Context?):Fragment(),KoinComponent {
|
|
|
|
|
|
}
|
|
|
return view
|
|
|
+ }else if(name==R.layout.fragment_index){
|
|
|
+ val view:View=inflater.inflate(name!!,container,false)
|
|
|
+ val recycle=view.findViewById<BannerLayout>(R.id.index_stat_recycle)
|
|
|
+ val abilityRecycle=view.findViewById<RecyclerView>(R.id.index_ability_recycle)
|
|
|
+
|
|
|
+
|
|
|
+ var statDatas=mutableListOf<StatData>()
|
|
|
+ for(index in 0..<4 step 1){
|
|
|
+ when(index){
|
|
|
+ 0->{
|
|
|
+ var data=StatData("当日线路","10")
|
|
|
+ statDatas.add(data)
|
|
|
+ }
|
|
|
+ 1->{
|
|
|
+ var data= StatData("网点任务","120")
|
|
|
+ statDatas.add(data)
|
|
|
+ }
|
|
|
+ 2->{
|
|
|
+ var data= StatData("周转箱(出)","30")
|
|
|
+ statDatas.add(data)
|
|
|
+ }
|
|
|
+ 3->{
|
|
|
+ var data=StatData("周转箱(入)","150")
|
|
|
+ statDatas.add(data)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var indexStatRecycleAdapter=IndexStatRecycleAdapter(context,statDatas)
|
|
|
+ recycle.setAdapter(indexStatRecycleAdapter)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var abilityDatas=mutableListOf<AbilityData>()
|
|
|
+ for(index in 0..<18 step 1){
|
|
|
+ var activity=AbilityData("测试${index}",null)
|
|
|
+ abilityDatas.add(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ var layoutManager=GridLayoutManager(context,9,GridLayoutManager.HORIZONTAL,false)
|
|
|
+ layoutManager.spanSizeLookup=object:GridLayoutManager.SpanSizeLookup(){
|
|
|
+ override fun getSpanSize(p0: Int): Int {
|
|
|
+ return 9
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ abilityRecycle.layoutManager=layoutManager
|
|
|
+ abilityRecycle.adapter = IndexAbilityRecycleAdapter(context,abilityDatas)
|
|
|
+ return view
|
|
|
}else{
|
|
|
return inflater.inflate(name!!,container,false)
|
|
|
}
|