Browse Source

课表功能完成

bfzgs 2 years ago
parent
commit
da14900c6d

+ 1 - 1
app/src/main/AndroidManifest.xml

@@ -28,7 +28,7 @@
         android:theme="@style/AppTheme.NoActionBar"
         tools:targetApi="31">
         <activity
-            android:name=".TimetableActivity"
+            android:name=".activity.common.TimetableActivity"
             android:exported="true">
 
             <meta-data

+ 0 - 170
app/src/main/java/org/brynhild/graduation/TimetableActivity.kt

@@ -1,170 +0,0 @@
-package org.brynhild.graduation
-
-import android.content.DialogInterface
-import android.graphics.Color
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.widget.LinearLayout
-import android.widget.PopupMenu
-import android.widget.Toast
-import androidx.appcompat.app.AlertDialog
-import com.zhuangfei.timetable.listener.ISchedule
-import com.zhuangfei.timetable.listener.ISchedule.OnSlideBuildListener
-import com.zhuangfei.timetable.listener.IWeekView
-import com.zhuangfei.timetable.listener.OnSlideBuildAdapter
-import com.zhuangfei.timetable.model.Schedule
-import org.brynhild.graduation.activity.common.BaseActivity
-import org.brynhild.graduation.databinding.ActivityTimetableBinding
-import org.brynhild.graduation.databinding.TimetableHeaderBinding
-import org.brynhild.graduation.timetable.model.SubjectRepertory
-
-class TimetableActivity : BaseActivity() {
-    private lateinit var binding:ActivityTimetableBinding
-    private val subjects=SubjectRepertory.loadDefaultSubjects2()
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        binding=ActivityTimetableBinding.inflate(LayoutInflater.from(this))
-        setContentView(binding.root)
-//        header= TimetableHeaderBinding.bind(binding.root)
-
-        binding.idMore.setOnClickListener {
-            showPopMenu()
-        }
-
-        subjects.addAll(SubjectRepertory.loadDefaultSubjects())
-        binding.idLayout.setOnClickListener {
-            when(it.id){
-                R.id.id_layout->{
-                    if(binding.idWeekview.isShowing){
-                        binding.idWeekview.isShow(false)
-                        binding.idTitle.setTextColor(resources.getColor(com.zhuangfei.android_timetableview.sample.R.color.app_course_textcolor_blue))
-                        val cur=binding.idTimetableView.curWeek()
-                        binding.idTimetableView.onDateBuildListener()
-                            .onUpdateDate(cur,cur)
-                        binding.idTimetableView.changeWeekOnly(cur)
-                    }else{
-                        binding.idWeekview.isShow(true)
-                        binding.idTitle.setTextColor(resources.getColor(com.zhuangfei.android_timetableview.sample.R.color.app_red))
-                    }
-                }
-
-            }
-        }
-
-
-
-        initTimetableView()
-    }
-
-    private fun initTimetableView(){
-        with(binding.idWeekview) {
-            source(subjects)
-            callback { week ->
-                val cur = binding.idTimetableView.curWeek()
-                binding.idTimetableView.onDateBuildListener()
-                    .onUpdateDate(cur, week)
-                binding.idTimetableView.changeWeekOnly(week)
-            }
-            callback(IWeekView.OnWeekLeftClickedListener {
-                val itemCount=binding.idWeekview.itemCount()
-                val items= mutableListOf<String>()
-                for(i in 1..itemCount){
-                    items.add("第${i}周")
-                }
-                var target=-1
-                val builder= AlertDialog.Builder(this@TimetableActivity)
-                with(builder) {
-                    title="设置当前周"
-                    setSingleChoiceItems(items.toTypedArray(),binding.idTimetableView.curWeek()-1
-                    ) { _, p1 -> target = p1 }
-                    setPositiveButton("设置为当前周"
-                    ) { _, _ ->
-                        if (target != -1) {
-                            binding.idWeekview.curWeek(target + 1).updateView()
-                            binding.idTimetableView.changeWeekForce(target + 1)
-                        }
-                    }
-                    setNegativeButton("取消",null)
-                    create()
-                }.show()
-            })
-            isShow(false)
-        }.showView()
-
-
-        with(binding.idTimetableView) {
-            source(subjects)
-            curWeek(1)
-            curTerm("一个学期罢了")
-            maxSlideItem(11)
-            monthWidthDp(50)
-
-            callback(ISchedule.OnItemClickListener { v, scheduleList ->
-                display(scheduleList)
-            })
-            callback(ISchedule.OnItemLongClickListener { v, day, start ->
-                Toast.makeText(this@TimetableActivity,"长按:周${day},第${start}节",Toast.LENGTH_SHORT).show()
-            })
-            callback(ISchedule.OnWeekChangedListener {
-                binding.idTitle.text = "第${it}周"
-            })
-            callback(ISchedule.OnFlaglayoutClickListener { day, start ->
-                binding.idTimetableView.hideFlaglayout()
-                Toast.makeText(this@TimetableActivity,"点击了旗标:周${day+1},第${start}节",Toast.LENGTH_SHORT).show()
-            })
-
-
-        }.showView()
-
-        val time= mutableListOf("08:00","08:55","10:10","11:05","14:00","14:55","16:10","17:05","19:00","19:55","20:50").toTypedArray()
-        val listener=binding.idTimetableView.onSlideBuildListener() as OnSlideBuildAdapter
-        listener.times=time
-        listener.setTimeTextColor(Color.BLACK)
-        binding.idTimetableView.updateSlideView()
-    }
-
-    override fun onStart() {
-        super.onStart()
-        binding.idTimetableView.onDateBuildListener()
-            .onHighLight()
-    }
-
-    private fun display(list:List<Schedule>){
-        val builder=StringBuilder()
-        for (item in list){
-            builder.append(item.name).append("、")
-        }
-        Toast.makeText(this,builder.toString(),Toast.LENGTH_SHORT).show()
-    }
-
-    private fun showPopMenu(){
-        val menu=PopupMenu(this,binding.idMore)
-        menu.menuInflater.inflate(R.menu.timetable_menu,menu.menu)
-        menu.setOnMenuItemClickListener {
-            when(it.itemId){
-                R.id.showAllCourse->{
-                    binding.idTimetableView.isShowNotCurWeek(true).updateView()
-                }
-                R.id.showCurrentCourse->{
-                    binding.idTimetableView.isShowNotCurWeek(false).updateView()
-                }
-                R.id.showTime->{
-                    val time= mutableListOf("08:00","08:55","10:10","11:05","14:00","14:55","16:10","17:05","19:00","19:55","20:50").toTypedArray()
-                    val listener=binding.idTimetableView.onSlideBuildListener() as OnSlideBuildAdapter
-                    listener.times=time
-                    listener.setTimeTextColor(Color.BLACK)
-                    binding.idTimetableView.updateSlideView()
-                }
-                R.id.hiddenTime->{
-                    binding.idTimetableView.callback(OnSlideBuildAdapter())
-                    binding.idTimetableView.updateSlideView()
-                }
-            }
-            true
-        }
-        menu.show()
-    }
-}

+ 2 - 0
app/src/main/java/org/brynhild/graduation/activity/admin/AdminMainPageActivity.kt

@@ -765,6 +765,8 @@ class AdminMainPageActivity : BaseActivity() {
         activityMainPageBinding = ActivityMainPageBinding.inflate(LayoutInflater.from(this))
         setContentView(activityMainPageBinding.root)
 
+        LoginConfiguration.loadTimeTableConfig()
+
         setSupportActionBar(activityMainPageBinding.toolBar)
         supportActionBar?.let {
             it.setDisplayHomeAsUpEnabled(true)

+ 5 - 12
app/src/main/java/org/brynhild/graduation/activity/admin/ClassDetailInfoActivity.kt

@@ -1,7 +1,6 @@
 package org.brynhild.graduation.activity.admin
 
 import android.app.AlertDialog
-import android.app.ProgressDialog
 import android.content.Intent
 import android.os.Bundle
 import android.os.Handler
@@ -13,7 +12,7 @@ import androidx.recyclerview.widget.GridLayoutManager
 import com.example.devicemanager.view.ConfirmPopupWindow
 import com.google.gson.Gson
 import org.brynhild.graduation.R
-import org.brynhild.graduation.TimetableActivity
+import org.brynhild.graduation.activity.common.TimetableActivity
 import org.brynhild.graduation.activity.common.BaseActivity
 import org.brynhild.graduation.common.callback.RecyclerViewCallback
 import org.brynhild.graduation.common.config.LoginConfiguration
@@ -30,7 +29,6 @@ import org.brynhild.graduation.common.utils.MultipleSelectHandler
 import org.brynhild.graduation.databinding.ActivityClassDetailInfoBinding
 import org.brynhild.graduation.databinding.AdminClassBatchEnrollDeviceMacDialogBinding
 import org.brynhild.graduation.databinding.AdminClassBatchPushDeviceMacDialogBinding
-import org.brynhild.graduation.databinding.AdminCreateClassDialogBinding
 import org.brynhild.graduation.databinding.AdminCreateUserDialogBinding
 import org.brynhild.graduation.databinding.AdminModifyClassDialogBinding
 import org.brynhild.graduation.network.adapter.UserAdapter
@@ -286,7 +284,6 @@ class ClassDetailInfoActivity : BaseActivity() {
                                                             ResponseHandler.showMessage(it)
                                                         })
                                                     }
-
                                                     override fun onFailure(
                                                         call: Call<Result>,
                                                         t: Throwable
@@ -298,17 +295,11 @@ class ClassDetailInfoActivity : BaseActivity() {
                                                 ResponseHandler.showMessage(it)
                                             })
                                         }
-
                                         override fun onFailure(call: Call<Result>, t: Throwable) {
                                             t.printStackTrace()
                                         }
                                     })
-
                                 }
-
-
-
-
                             },{
                                 ResponseHandler.showMessage(it)
                             })
@@ -326,7 +317,9 @@ class ClassDetailInfoActivity : BaseActivity() {
         }
 
         binding.queryTimeTable.setOnClickListener {
-            val intent=Intent(this,TimetableActivity::class.java)
+            val intent=Intent(this, TimetableActivity::class.java)
+            val gson=Gson()
+            intent.putExtra("classEntity",gson.toJson(classEntity))
             startActivity(intent)
         }
     }
@@ -345,7 +338,7 @@ class ClassDetailInfoActivity : BaseActivity() {
     override fun onOptionsItemSelected(item: MenuItem): Boolean {
         when (item.itemId) {
             R.id.admin_class_modify->{
-                    val dialogLayout= AdminModifyClassDialogBinding.inflate(LayoutInflater.from(this))
+                val dialogLayout= AdminModifyClassDialogBinding.inflate(LayoutInflater.from(this))
                 dialogLayout.no.setText(classEntity.no)
                 dialogLayout.name.setText(classEntity.name)
 

+ 265 - 0
app/src/main/java/org/brynhild/graduation/activity/common/TimetableActivity.kt

@@ -0,0 +1,265 @@
+package org.brynhild.graduation.activity.common
+
+import android.graphics.Color
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.widget.PopupMenu
+import android.widget.Toast
+import androidx.appcompat.app.AlertDialog
+import com.google.gson.Gson
+import com.zhuangfei.timetable.listener.ISchedule
+import com.zhuangfei.timetable.listener.IWeekView
+import com.zhuangfei.timetable.listener.OnSlideBuildAdapter
+import com.zhuangfei.timetable.model.Schedule
+import org.brynhild.graduation.R
+import org.brynhild.graduation.common.config.LoginConfiguration
+import org.brynhild.graduation.common.constant.AccountConstant
+import org.brynhild.graduation.common.transfer.Result
+import org.brynhild.graduation.common.transfer.handler.ResponseHandler
+import org.brynhild.graduation.common.transfer.utils.ServiceCreator
+import org.brynhild.graduation.common.transfer.vo.timetable.AdminAddTimeTable
+import org.brynhild.graduation.common.transfer.vo.timetable.QueryTimeTableRequest
+import org.brynhild.graduation.common.transfer.vo.user.AdminModifyClass
+import org.brynhild.graduation.common.utils.JsonUtils
+import org.brynhild.graduation.databinding.ActivityTimetableBinding
+import org.brynhild.graduation.databinding.AdminAddTimetableDialogBinding
+import org.brynhild.graduation.databinding.AdminModifyClassDialogBinding
+import org.brynhild.graduation.network.entiity.ClassEntity
+import org.brynhild.graduation.network.entiity.TimeTableInfo
+import org.brynhild.graduation.service.http.AdminService
+import org.brynhild.graduation.timetable.model.SubjectRepertory
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+
+class TimetableActivity : BaseActivity() {
+    private lateinit var binding:ActivityTimetableBinding
+    private lateinit var classEntity: ClassEntity
+    private val subjects=ArrayList<TimeTableInfo>()
+
+    private fun loadTimeTableData(){
+        when(LoginConfiguration.userInfo!!.user.type){
+            AccountConstant.ADMIN->{
+                val service=ServiceCreator.create(AdminService::class.java)
+                val data=QueryTimeTableRequest(null,null,null,null,null,null,"${classEntity.id}",null,null,null)
+                service.queryTimeTable(LoginConfiguration.userInfo!!.token,data).enqueue(object :Callback<org.brynhild.graduation.common.transfer.Result>{
+                    override fun onResponse(call: Call<Result>, response: Response<Result>) {
+                        ResponseHandler.handle(response,{
+                            val gson=Gson()
+                            for(item in it.data as ArrayList<*>){
+                                val json=gson.toJson(item)
+                                val timetable=JsonUtils.fromJson<TimeTableInfo>(json)
+                                if(timetable!=null){
+                                    subjects.add(timetable)
+                                }
+                            }
+//                            Toast.makeText(this@TimetableActivity,"${subjects.size}",Toast.LENGTH_SHORT).show()
+//                                binding.idTimetableView.updateDateView()
+                            initTimetableView()
+                        },{
+                            ResponseHandler.showMessage(it)
+                        })
+                    }
+                    override fun onFailure(call: Call<Result>, t: Throwable) {
+                        t.printStackTrace()
+                    }
+                })
+            }
+            AccountConstant.TEACHER->{
+
+            }
+            AccountConstant.USER->{
+
+            }
+            else->{
+                return
+            }
+        }
+
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        binding=ActivityTimetableBinding.inflate(LayoutInflater.from(this))
+        setContentView(binding.root)
+
+        val json = intent.getStringExtra("classEntity")
+
+
+        binding.idMore.setOnClickListener {
+            showPopMenu()
+        }
+
+//        subjects.addAll()
+        binding.idLayout.setOnClickListener {
+            when(it.id){
+                R.id.id_layout ->{
+                    if(binding.idWeekview.isShowing){
+                        binding.idWeekview.isShow(false)
+                        binding.idTitle.setTextColor(resources.getColor(com.zhuangfei.android_timetableview.sample.R.color.app_course_textcolor_blue))
+                        val cur=binding.idTimetableView.curWeek()
+                        binding.idTimetableView.onDateBuildListener()
+                            .onUpdateDate(cur,cur)
+                        binding.idTimetableView.changeWeekOnly(cur)
+                    }else{
+                        binding.idWeekview.isShow(true)
+                        binding.idTitle.setTextColor(resources.getColor(com.zhuangfei.android_timetableview.sample.R.color.app_red))
+                    }
+                }
+            }
+        }
+
+        initTimetableView()
+
+        if(json!=null){
+            classEntity= JsonUtils.fromJson<ClassEntity>(json)!!
+            loadTimeTableData()
+        }
+    }
+
+    private fun initTimetableView(){
+        with(binding.idWeekview) {
+            source(subjects)
+            callback { week ->
+                val cur = binding.idTimetableView.curWeek()
+                binding.idTimetableView.onDateBuildListener()
+                    .onUpdateDate(cur, week)
+                binding.idTimetableView.changeWeekOnly(week)
+            }
+            callback(IWeekView.OnWeekLeftClickedListener {
+                val itemCount=binding.idWeekview.itemCount()
+                val items= mutableListOf<String>()
+                for(i in 1..itemCount){
+                    items.add("第${i}周")
+                }
+                var target=-1
+                val builder= AlertDialog.Builder(this@TimetableActivity)
+                with(builder) {
+                    title="设置当前周"
+                    setSingleChoiceItems(items.toTypedArray(),binding.idTimetableView.curWeek()-1
+                    ) { _, p1 -> target = p1 }
+                    setPositiveButton("设置为当前周"
+                    ) { _, _ ->
+                        if (target != -1) {
+                            binding.idWeekview.curWeek(target + 1).updateView()
+                            binding.idTimetableView.changeWeekForce(target + 1)
+                        }
+                    }
+                    setNegativeButton("取消",null)
+                    create()
+                }.show()
+            })
+            isShow(false)
+        }.showView()
+
+
+        with(binding.idTimetableView) {
+            source(subjects)
+            curWeek(LoginConfiguration.timetableConfig!!.week)
+            curTerm("一个学期罢了")
+            maxSlideItem(11)
+            monthWidthDp(50)
+            callback(ISchedule.OnItemClickListener { v, scheduleList ->
+                display(scheduleList)
+            })
+            callback(ISchedule.OnItemLongClickListener { v, day, start ->
+                Toast.makeText(this@TimetableActivity,"长按:周${day},第${start}节",Toast.LENGTH_SHORT).show()
+            })
+            callback(ISchedule.OnWeekChangedListener {
+                binding.idTitle.text = "第${it}周"
+            })
+            callback(ISchedule.OnFlaglayoutClickListener { day, start ->
+                binding.idTimetableView.hideFlaglayout()
+                val dialogLayout= AdminAddTimetableDialogBinding.inflate(LayoutInflater.from(this@TimetableActivity))
+                AlertDialog.Builder(this@TimetableActivity)
+                    .setTitle("添加课程")
+                    .setView(dialogLayout.root)
+                    .setPositiveButton("确认添加"){_,_->
+                        val service= ServiceCreator.create(AdminService::class.java)
+                        val data= AdminAddTimeTable(
+                            dialogLayout.areaId.text.toString().toLongOrNull(),
+                            start,
+                            dialogLayout.week.text.toString(),
+                            dialogLayout.step.text.toString().toIntOrNull(),
+                            day,
+                            dialogLayout.teacher.text.toString().toLongOrNull(),
+                            "${classEntity.id}",
+                            dialogLayout.courseId.text.toString().toLongOrNull(),
+                            LoginConfiguration.timetableConfig!!.year,
+                            LoginConfiguration.timetableConfig!!.term
+                        )
+                        service.addTimeTable(LoginConfiguration.userInfo!!.token,data).enqueue(object :
+                            Callback<Result> {
+                            override fun onResponse(
+                                call: Call<Result>,
+                                response: Response<Result>
+                            ) {
+                                ResponseHandler.handle(response,{
+                                    finish()
+                                },{
+                                    ResponseHandler.showMessage(it)
+                                })
+                            }
+
+                            override fun onFailure(call: Call<Result>, t: Throwable) {
+                                t.printStackTrace()
+                            }
+                        })
+                    }
+                    .setNegativeButton("取消添加"){_,_->
+
+                    }
+                    .show()
+//                Toast.makeText(this@TimetableActivity,"点击了旗标:周${day+1},第${start}节",Toast.LENGTH_SHORT).show()
+            })
+        }.showView()
+
+//        val time= mutableListOf("08:00","08:55","10:10","11:05","14:00","14:55","16:10","17:05","19:00","19:55","20:50").toTypedArray()
+        val listener=binding.idTimetableView.onSlideBuildListener() as OnSlideBuildAdapter
+        listener.times=LoginConfiguration.timetableConfig!!.times.toTypedArray()
+        listener.setTimeTextColor(Color.BLACK)
+        binding.idTimetableView.updateSlideView()
+    }
+
+    override fun onStart() {
+        super.onStart()
+        binding.idTimetableView.onDateBuildListener()
+            .onHighLight()
+    }
+
+    private fun display(list:List<Schedule>){
+        val builder=StringBuilder()
+        for (item in list){
+            builder.append(item.name).append("、")
+        }
+        Toast.makeText(this,builder.toString(),Toast.LENGTH_SHORT).show()
+    }
+
+    private fun showPopMenu(){
+        val menu=PopupMenu(this,binding.idMore)
+        menu.menuInflater.inflate(R.menu.timetable_menu,menu.menu)
+        menu.setOnMenuItemClickListener {
+            when(it.itemId){
+                R.id.showAllCourse ->{
+                    binding.idTimetableView.isShowNotCurWeek(true).updateView()
+                }
+                R.id.showCurrentCourse ->{
+                    binding.idTimetableView.isShowNotCurWeek(false).updateView()
+                }
+                R.id.showTime ->{
+                    val time= mutableListOf("08:00","08:55","10:10","11:05","14:00","14:55","16:10","17:05","19:00","19:55","20:50").toTypedArray()
+                    val listener=binding.idTimetableView.onSlideBuildListener() as OnSlideBuildAdapter
+                    listener.times=time
+                    listener.setTimeTextColor(Color.BLACK)
+                    binding.idTimetableView.updateSlideView()
+                }
+                R.id.hiddenTime ->{
+                    binding.idTimetableView.callback(OnSlideBuildAdapter())
+                    binding.idTimetableView.updateSlideView()
+                }
+            }
+            true
+        }
+        menu.show()
+    }
+}

+ 21 - 0
app/src/main/java/org/brynhild/graduation/common/config/LoginConfiguration.kt

@@ -7,12 +7,14 @@ import android.widget.Toast
 import com.google.gson.Gson
 import org.brynhild.graduation.common.constant.BroadcastConstant
 import org.brynhild.graduation.common.transfer.Result
+import org.brynhild.graduation.common.transfer.bo.timetable.TimeTableConfig
 import org.brynhild.graduation.common.transfer.dto.UserInfo
 import org.brynhild.graduation.common.transfer.handler.ResponseHandler
 import org.brynhild.graduation.common.transfer.utils.ServiceCreator
 import org.brynhild.graduation.common.transfer.vo.user.AccountLoginInfo
 import org.brynhild.graduation.common.utils.JsonUtils
 import org.brynhild.graduation.service.http.AccountService
+import org.brynhild.graduation.service.http.CommonService
 import retrofit2.Call
 import retrofit2.Callback
 import retrofit2.Response
@@ -22,6 +24,7 @@ object LoginConfiguration {
     var login_username: String? = null
     var login_password: String? = null
     var userInfo: UserInfo? = null
+    var timetableConfig:TimeTableConfig?=null
 
     fun isValid(): Boolean {
         return login_username?.trim()?.isNotBlank() ?: false && login_password?.trim()
@@ -82,4 +85,22 @@ object LoginConfiguration {
         }
         Log.d("LoginActivity", "save info:name:$accountName,password:$accountPassword")
     }
+
+    fun loadTimeTableConfig(){
+        val service=ServiceCreator.create(CommonService::class.java)
+        service.loadTimeTableConfig().enqueue(object :Callback<org.brynhild.graduation.common.transfer.Result>{
+            override fun onResponse(call: Call<Result>, response: Response<Result>) {
+                ResponseHandler.handle(response) {
+                    val gson = Gson()
+                    val json = gson.toJson(it.data)
+                    timetableConfig = JsonUtils.fromJson<TimeTableConfig>(json)
+//                    Toast.makeText(this@LoginConfiguration, timetableConfig.toString(),Toast.LENGTH_SHORT)
+                }
+            }
+            override fun onFailure(call: Call<Result>, t: Throwable) {
+                t.printStackTrace()
+            }
+        })
+
+    }
 }

+ 8 - 0
app/src/main/java/org/brynhild/graduation/common/transfer/bo/timetable/TimeTableConfig.kt

@@ -0,0 +1,8 @@
+package org.brynhild.graduation.common.transfer.bo.timetable
+
+data class TimeTableConfig(
+	val year:Int,
+	val term:Int,
+	val week:Int,
+	val times:List<String>
+)

+ 2 - 2
app/src/main/java/org/brynhild/graduation/common/transfer/vo/timetable/AdminAddTimeTable.kt

@@ -1,14 +1,14 @@
 package org.brynhild.graduation.common.transfer.vo.timetable
 
 data class AdminAddTimeTable(
-	val areaId:Long,
+	val areaId:Long?,
 	val index:Int,
 	val week:String,
 	val step:Int?,
 	val day:Int?,
 	val teacher:Long?,
 	val clazz:String,
-	val courseId:Long,
+	val courseId:Long?,
 	val year:Int,
 	val term:Int,
 )

+ 2 - 2
app/src/main/java/org/brynhild/graduation/common/transfer/vo/timetable/QueryTimeTableRequest.kt

@@ -6,8 +6,8 @@ data class QueryTimeTableRequest(
 	val day:Int?,
 	val teacher:Long?,
 	val index:Int?,
-	val week:Int,
-	val clazz:String,
+	val week:Int?,
+	val clazz:String?,
 	val courseId:Long?,
 	val year:Int?,
 	val term:Int?,

+ 14 - 0
app/src/main/java/org/brynhild/graduation/service/http/CommonService.kt

@@ -0,0 +1,14 @@
+package org.brynhild.graduation.service.http
+
+import org.brynhild.graduation.common.transfer.Result
+import org.brynhild.graduation.common.transfer.vo.user.AccountLoginInfo
+import retrofit2.Call
+import retrofit2.http.Body
+import retrofit2.http.GET
+import retrofit2.http.POST
+
+interface CommonService {
+
+    @GET("timetable/public/config")
+    fun loadTimeTableConfig(): Call<Result>
+}

+ 1 - 1
app/src/main/res/layout/activity_timetable.xml

@@ -5,7 +5,7 @@
     android:layout_width="match_parent"
     android:orientation="vertical"
     android:layout_height="match_parent"
-    tools:context=".TimetableActivity">
+    tools:context=".activity.common.TimetableActivity">
 
     <RelativeLayout
         android:layout_width="match_parent"

+ 105 - 0
app/src/main/res/layout/admin_add_timetable_dialog.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:id="@+id/layout_category_add">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="教室编号"
+            android:textAlignment="center" />
+
+        <EditText
+            android:id="@+id/areaId"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="3" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="周次"
+            android:textAlignment="center" />
+
+        <EditText
+            android:id="@+id/week"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="3" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="节数"
+            android:textAlignment="center" />
+
+        <EditText
+            android:id="@+id/step"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="3" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="教师编号"
+            android:textAlignment="center" />
+
+        <EditText
+            android:id="@+id/teacher"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="3" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:orientation="horizontal"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:text="课程编号"
+            android:textAlignment="center" />
+
+        <EditText
+            android:id="@+id/courseId"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="3" />
+    </LinearLayout>
+
+
+
+</LinearLayout>