lmw
2024-07-18 252736e890fd50550ab9dec218159356e2a953c1
app/src/main/java/com/dollearn/student/ui/home/WeekSelectActivity.kt
@@ -1,8 +1,11 @@
package com.dollearn.student.ui.home
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import cn.sinata.xldutils.utils.showAllowingStateLoss
import com.dollearn.student.R
import com.dollearn.student.dialog.TipDialog
import com.dollearn.student.network.HttpManager
import com.dollearn.student.network.entity.Week
import com.dollearn.student.network.request
@@ -28,7 +31,13 @@
        }
        weekAdapter.setOnItemClickListener { view, position ->
            startActivity<ScheduleActivity>("week" to weeks[position].week,"season" to seasonAdapter.checked+1)
            if (weeks[position].canStudy)
                startActivity<ScheduleActivity>("week" to weeks[position].week,"season" to seasonAdapter.checked+1)
            else{
                val tipDialog = TipDialog()
                tipDialog.arguments = bundleOf("msg" to "请先完成上一周练习","isAlert" to true)
                tipDialog.showAllowingStateLoss(supportFragmentManager,"noStart")
            }
        }
    }
@@ -38,7 +47,6 @@
        rv_week.layoutManager = GridLayoutManager(this,3)
        rv_week.adapter = weekAdapter
        getWeeks()
    }
    private fun getWeeks(){
@@ -49,4 +57,9 @@
            weekAdapter.notifyDataSetChanged()
        }
    }
    override fun onResume() {
        super.onResume()
        getWeeks()
    }
}