leiyun hace 2 años
padre
commit
9f6256dd51
Se han modificado 17 ficheros con 707 adiciones y 60 borrados
  1. +2
    -2
      app/build.gradle
  2. +16
    -0
      app/src/main/java/com/yzx/escreen/MainActivity.kt
  3. +69
    -0
      app/src/main/java/com/yzx/escreen/adapter/HomeGridAdapter.kt
  4. +1
    -0
      app/src/main/java/com/yzx/escreen/config/YzxInterface.kt
  5. +161
    -6
      app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt
  6. +3
    -1
      app/src/main/java/com/yzx/escreen/model/EventBugBean.kt
  7. +3
    -1
      app/src/main/java/com/yzx/escreen/model/StuLeave.kt
  8. +114
    -24
      app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt
  9. +13
    -3
      app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt
  10. +5
    -0
      app/src/main/res/drawable/shape_leave_item.xml
  11. +36
    -12
      app/src/main/res/layout/dialog_leave.xml
  12. +189
    -5
      app/src/main/res/layout/fragment_home.xml
  13. +3
    -3
      app/src/main/res/layout/fragment_visitor.xml
  14. +89
    -0
      app/src/main/res/layout/layout_leave_table2.xml
  15. BIN
      app/src/main/res/mipmap-xhdpi/icon_grid.png
  16. BIN
      app/src/main/res/mipmap-xhdpi/icon_list.png
  17. +3
    -3
      app/src/main/res/values/styles.xml

+ 2
- 2
app/build.gradle Ver fichero

@@ -19,8 +19,8 @@ android {
// minSdkVersion 26
minSdkVersion 21
targetSdkVersion 25
versionCode 30102
versionName "3.1.2"
versionCode 30200
versionName "3.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ndk {


+ 16
- 0
app/src/main/java/com/yzx/escreen/MainActivity.kt Ver fichero

@@ -250,6 +250,22 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
dialogLayout.removeView(it)
dialogList.remove(it)
}
dialog.onSureClick= {view, item ->

val sureDialog = QMUIDialog.MessageDialogBuilder(this)
sureDialog.setMessage("是否确认已放行?")
sureDialog.setTitle("温馨提示")
sureDialog.addAction("取消"){ _dialog, index ->
_dialog?.dismiss()
}
sureDialog.addAction("确认"){ _dialog, index ->
_dialog?.dismiss()
dialogLayout.removeView(view)
dialogList.remove(view)
EventBus.getDefault().post(SureOutSchool(item))
}
sureDialog.show()
}
dialogLayout.addView(dialog)
dialogList.add(dialog)
}


+ 69
- 0
app/src/main/java/com/yzx/escreen/adapter/HomeGridAdapter.kt Ver fichero

@@ -0,0 +1,69 @@
package com.yzx.escreen.adapter

import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Color
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yzx.escreen.R
import com.yzx.escreen.model.StuLeave
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.layout_leave_table2.view.*

class HomeGridAdapter(list: MutableList<StuLeave>) :
BaseQuickAdapter<StuLeave, BaseViewHolder>(R.layout.layout_leave_table2, list) {

init {
addChildClickViewIds(R.id.faceEmpty,R.id.statusName)

}

@SuppressLint("SetTextI18n")
override fun convert(holder: BaseViewHolder, item: StuLeave) {
holder.itemView.studentName.text = item.leave_student_name
if (item.face_key.isNullOrBlank()) {
holder.itemView.faceEmpty.visibility = View.VISIBLE
holder.itemView.faceImg.visibility = View.GONE
} else {
holder.itemView.faceImg.visibility = View.VISIBLE
holder.itemView.faceEmpty.visibility = View.GONE
holder.itemView.faceImg.setSrc(item.face_identity, item.face_key)
}
holder.itemView.className.text = "${item.grade_name}${item.class_name}"
holder.itemView.statusName.text = when (item.status) {
1 -> "待处理"
2 -> "已确认"
3 -> "已拒绝"
4 -> "正常销假"
5 -> "超时销假"
else -> "--"
}
holder.itemView.statusName.setBackgroundColor(
when (item.status) {
1 -> Color.parseColor("#cccccc")
2 -> Color.parseColor("#3c7ef6")
3 -> Color.parseColor("#ff4040")
4 -> Color.parseColor("#3c7ef6")
5 -> Color.parseColor("#ff4040")
else -> Color.parseColor("#cccccc")
}
)
holder.itemView.statusName.setStrokeColors(
ColorStateList.valueOf(
when (item.status) {
1 -> Color.parseColor("#cccccc")
2 -> Color.parseColor("#3c7ef6")
3 -> Color.parseColor("#ff4040")
4 -> Color.parseColor("#3c7ef6")
5 -> Color.parseColor("#ff4040")
else -> Color.parseColor("#cccccc")
}
)
)
holder.itemView.applyTime.text = item.add_time.toTime()


}
}

+ 1
- 0
app/src/main/java/com/yzx/escreen/config/YzxInterface.kt Ver fichero

@@ -28,6 +28,7 @@ object YzxInterface {
const val INTERFACE_STUDENT_GET_SHOW_BOX_LIST_OLD= "/edu/attendance/student/getStudentLeaveIds" //获取需要弹出的数据
const val INTERFACE_STUDENT_GET_SHOW_BOX_LIST= "/edu/attendance/student/getStudentLeaveIdsV2" //获取需要弹出的数据
const val INTERFACE_STUDENT_POST_LEAVE_VACATION= "/edu/attendance/student/studentLeaveVacation"//人工销假操作
const val INTERFACE_STUDENT_POST_HIDE_LEAVE= "/edu/attendance/hideStudentLeave"//离校
/**
* 学籍异动
*/


+ 161
- 6
app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt Ver fichero

@@ -12,6 +12,7 @@ import android.view.View
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.blankj.utilcode.util.*
import com.huantansheng.easyphotos.EasyPhotos
@@ -20,6 +21,7 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
import com.yzx.escreen.R
import com.yzx.escreen.adapter.HomeGridAdapter
import com.yzx.escreen.adapter.HomeListAdapter
import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.*
@@ -56,6 +58,11 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
HomeListAdapter(list)
}

private val mGridAdapter: HomeGridAdapter by lazy {
val list = mutableListOf<StuLeave>()
HomeGridAdapter(list)
}

private var mPager = Pager()
var list = mutableListOf<StuLeave>()
private val statusBtnList = mutableListOf<QMUIRoundButton>()
@@ -71,6 +78,8 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
private val mVacation = Vacation()
private val mVacationAttachment = Attachment("", "", "")
private var isRefresh = false
private var listType = 2 //1 列表模式 2 grid模式
private var is_hide = 0 //1 离校 0 未离校

private val refreshRun = Runnable {
refreshData()
@@ -85,8 +94,14 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
recyclerView.adapter = mAdapter

recyclerView2.layoutManager =
GridLayoutManager(context, 5, GridLayoutManager.VERTICAL, false)
recyclerView2.adapter = mGridAdapter

preTxtBtn.setOnClickListener { pre() }
nextTxtBtn.setOnClickListener { next() }
preTxtBtn2.setOnClickListener { pre() }
nextTxtBtn2.setOnClickListener { next() }
allBtn.setOnClickListener { changeStatus(0) }
yesterday.setOnClickListener { changeStatus(2) }
last7Days.setOnClickListener { changeStatus(3) }
@@ -122,6 +137,17 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
}
}

mGridAdapter.setOnItemClickListener { adapter, view, position ->
val curr = TimeUtils.getNowMills()
if (curr - lastClickTime > 500) {
lastClickTime = curr
LogUtils.d("获取详情开始", TimeUtils.getNowMills(), mAdapter.getItem(position).id)
showLayoutLoading()
mPresenter?.getDetail(mGridAdapter.getItem(position).id)
}
}


mAdapter.setOnItemChildClickListener { adapter, view, position ->
LogUtils.d("setOnItemChildClickListener", position)
val curr = TimeUtils.getNowMills()
@@ -141,6 +167,21 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
}
}

mGridAdapter.setOnItemChildClickListener { adapter, view, position ->
LogUtils.d("setOnItemChildClickListener", position)
val curr = TimeUtils.getNowMills()
if (curr - lastClickTime > 500) {
lastClickTime = curr
when (view.id) {
R.id.sureBtn,
R.id.faceEmpty -> {
showLayoutLoading()
mPresenter?.getDetail(mGridAdapter.getItem(position).id)
}
}
}
}


switchBtn.setOnCheckedChangeListener { buttonView, isChecked ->
SPUtils.getInstance().put("auto_show_leave", isChecked)
@@ -156,6 +197,28 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,

EventBus.getDefault().post(AutoSwitchChange(1))
}

hideType0.setOnClickListener {

is_hide = if(is_hide==0){
-1
}else{
0
}
changeSwitch2BtnTxt()
initData()
}
hideType1.setOnClickListener {
is_hide = if(is_hide==1){
-1
}else{
1
}
changeSwitch2BtnTxt()
initData()
}
changeSwitch2BtnTxt()

keywordInput.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

@@ -191,9 +254,26 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
showLayoutLoading()
initData()
}
goPageOne2.setOnClickListener {
showLayoutLoading()
initData()
}
filterBtn.setOnClickListener {
showFilterDialog(this.status)
}

listType1Btn.setOnClickListener {
listType1Btn.visibility = View.GONE
listType2Btn.visibility = View.VISIBLE
listType = 1
initData()
}
listType2Btn.setOnClickListener {
listType2Btn.visibility = View.GONE
listType1Btn.visibility = View.VISIBLE
listType = 2
initData()
}
}

private fun showLayoutLoading() {
@@ -328,6 +408,19 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
}
}

private fun changeSwitch2BtnTxt() {
if (is_hide == 0) {
hideType0.isSelected = true
hideType1.isSelected = false
} else if (is_hide == 1) {
hideType0.isSelected = false
hideType1.isSelected = true
} else {
hideType0.isSelected = false
hideType1.isSelected = false
}
}

@SuppressLint("SetTextI18n")
private fun showLeaveDialog(detail: StuLeave) {
EventBus.getDefault().post(detail)
@@ -376,7 +469,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
if (NetworkUtils.isConnected()) {
showEmpty(1)
isLoading = true
mPresenter?.getLeaveList(mPager.page_no, keyword, status, add_time)
mPresenter?.getLeaveList(mPager.page_no, keyword, status, add_time, listType, is_hide)
} else {
showEmpty(2)
}
@@ -394,6 +487,12 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
this.QMUIEmptyView.setLoadingShowing(true)
this.QMUIEmptyView.setTitleText("数据加载中")
}

mGridAdapter.setEmptyView(R.layout.layout_loading)
mGridAdapter.emptyLayout?.apply {
this.QMUIEmptyView.setLoadingShowing(true)
this.QMUIEmptyView.setTitleText("数据加载中")
}
}

2 -> {
@@ -403,10 +502,18 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
NetworkUtils.openWirelessSettings()
}
}

mGridAdapter.setEmptyView(R.layout.layout_loading)
mGridAdapter.emptyLayout?.apply {
this.QMUIEmptyView.show(false, null, "网络连接异常,请检查", "去设置") {
NetworkUtils.openWirelessSettings()
}
}
}

3 -> {
mAdapter.setEmptyView(R.layout.layout_empty)
mGridAdapter.setEmptyView(R.layout.layout_empty)
}
}

@@ -418,7 +525,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
}
isLoading = true
if (NetworkUtils.isConnected()) {
mPresenter?.getLeaveList(mPager.page_no, keyword, status, add_time)
mPresenter?.getLeaveList(mPager.page_no, keyword, status, add_time, listType, is_hide)
}
}

@@ -431,7 +538,14 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} else {
isLoading = true
showLayoutLoading()
mPresenter?.getLeaveList(mPager.page_no - 1, keyword, status, add_time)
mPresenter?.getLeaveList(
mPager.page_no - 1,
keyword,
status,
add_time,
listType,
is_hide
)
}
}

@@ -444,7 +558,14 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} else {
isLoading = true
showLayoutLoading()
mPresenter?.getLeaveList(mPager.page_no + 1, keyword, status, add_time)
mPresenter?.getLeaveList(
mPager.page_no + 1,
keyword,
status,
add_time,
listType,
is_hide
)
}
}

@@ -458,29 +579,45 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
isRefresh = false
}
mAdapter.setList(list)
mGridAdapter.setList(list)

mPager = pager
pageTv.text = "${pager.page_no} / ${pager.total_pages}"
totalTv.text = "共${pager.total_count}条"

pageTv2.text = "${pager.page_no} / ${pager.total_pages}"
totalTv2.text = "共${pager.total_count}条"

val disabledColor = Color.parseColor("#666666")
val color = Color.parseColor("#3ca0e9")
if (pager.page_no <= 1) {
preTxtBtn.textColor = disabledColor
goPageOne.visibility = View.GONE
preTxtBtn2.textColor = disabledColor
goPageOne2.visibility = View.GONE
} else {
preTxtBtn.textColor = resources.getColor(R.color.s_app_color_blue)
goPageOne.visibility = View.VISIBLE
preTxtBtn2.textColor = resources.getColor(R.color.s_app_color_blue)
goPageOne2.visibility = View.VISIBLE
}

if (pager.page_no >= pager.total_pages) {
nextTxtBtn.textColor = disabledColor
nextTxtBtn2.textColor = disabledColor
} else {
nextTxtBtn.textColor = resources.getColor(R.color.s_app_color_blue)
nextTxtBtn2.textColor = resources.getColor(R.color.s_app_color_blue)
}

isLoading = false
showEmpty(3)
hideLayoutLoading()
if (listType == 1) {
listTypeLayout2.visibility = View.GONE
listTypeLayout1.visibility = View.VISIBLE
} else {
listTypeLayout1.visibility = View.GONE
listTypeLayout2.visibility = View.VISIBLE
}
pageTv.postDelayed({
refreshData()
}, 30 * 1000)
@@ -493,6 +630,13 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
EventBus.getDefault().unregister(this)
}

//接收异动消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(detail: SureOutSchool) {
showLoading("处理中...")
mPresenter?.outSchool(detail.item)
}

override fun onLeaveListError(error: String) {
isLoading = false
hideLayoutLoading()
@@ -619,5 +763,16 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
override fun onError(msg: String) {
LogUtils.d(msg)
}

override fun postHideSuccess(msg: String) {
showDialogToast(msg, 2000L)
hideLoading()
initData()
}

override fun postHideError(msg: String) {
showDialogToast(msg, 2000L)
hideLoading()
}
}


+ 3
- 1
app/src/main/java/com/yzx/escreen/model/EventBugBean.kt Ver fichero

@@ -5,4 +5,6 @@ class EventBugBean {

data class EventLeaveIds(var ids:String="")

data class UserVersionCheck(var userCheck:Boolean = true)
data class UserVersionCheck(var userCheck:Boolean = true)

data class SureOutSchool(val item:StuLeave)

+ 3
- 1
app/src/main/java/com/yzx/escreen/model/StuLeave.kt Ver fichero

@@ -1,5 +1,6 @@
package com.yzx.escreen.model

import android.os.Parcel
import android.os.Parcelable
import com.yzx.escreen.utils.durationStr
import kotlinx.android.parcel.Parcelize
@@ -37,7 +38,8 @@ data class StuLeave(
val start_time: Int = 0,
val status: Int = 0,
val todo_list_id: Int = 0,
val todo_status: Int = 0
val todo_status: Int = 0,
val is_hide:Int = 0
) : Parcelable {

fun getStep(): MutableList<LeaveActivity> {


+ 114
- 24
app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt Ver fichero

@@ -20,45 +20,104 @@ import java.util.Calendar
class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {


fun getLeaveList(pageNo: Int, keyword: String, status: String, add_time: String) {
if(User.getUser().token.isEmpty()){
fun getLeaveList(
pageNo: Int,
keyword: String,
status: String,
add_time: String,
listType: Int,
is_hide: Int
) {
if (User.getUser().token.isEmpty()) {
return
}
val calendar = Calendar.getInstance()
var endTime: Long =0
var startTime: Long =0
var endTime: Long = 0
var startTime: Long = 0
when (add_time) {
"today" -> {
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),23,59,59)
endTime = calendar.timeInMillis/1000 // 当前时间戳
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),0,0,0)
startTime = calendar.timeInMillis/1000 // 开始时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
23,
59,
59
)
endTime = calendar.timeInMillis / 1000 // 当前时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
0,
0,
0
)
startTime = calendar.timeInMillis / 1000 // 开始时间戳
}

"yesterday" -> {
calendar.add(Calendar.DAY_OF_YEAR, -1) // 将日期往前推1天
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),23,59,59)
endTime = calendar.timeInMillis/1000 // 当前时间戳
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),0,0,0)
startTime = calendar.timeInMillis/1000 // 开始时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
23,
59,
59
)
endTime = calendar.timeInMillis / 1000 // 当前时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
0,
0,
0
)
startTime = calendar.timeInMillis / 1000 // 开始时间戳
}

"last7Days" -> {
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),23,59,59)
endTime = calendar.timeInMillis/1000 // 当前时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
23,
59,
59
)
endTime = calendar.timeInMillis / 1000 // 当前时间戳
calendar.add(Calendar.DAY_OF_YEAR, -6) // 将日期往前推6天
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DATE),0,0,0)
startTime = calendar.timeInMillis/1000 // 近七天的开始时间戳
calendar.set(
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DATE),
0,
0,
0
)
startTime = calendar.timeInMillis / 1000 // 近七天的开始时间戳
}
}
val params = HashMap<String,String>()
val params = HashMap<String, String>()
params["keyword"] = keyword
params["status"] = status
params["page_size"] = "6"
if (listType == 1) {
params["page_size"] = "6"
} else {
params["page_size"] = "20"
}
params["page_no"] = "$pageNo"
if(add_time!=""){
if (add_time != "") {
params["start_time"] = "$startTime"
params["end_time"] = "$endTime"
}

if (is_hide == 0 || is_hide == 1) {
params["is_hide"] = "${is_hide}"
}

val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_GET_STU_LEAVE_LIST}"
OkGo.post<YzxResponse<StuLeave>>(url)
.tag(this)
@@ -80,8 +139,9 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
}
})
}

fun getLeaveShowIds() {
if(User.getUser().token.isEmpty()){
if (User.getUser().token.isEmpty()) {
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_GET_SHOW_BOX_LIST}"
@@ -91,7 +151,7 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
override fun onSuccess(response: Response<YzxResponse<LeaveID>>?) {
if (response?.isSuccessful == true) {
mView?.onLeaveIDsSuccess(response.body().list)
LogUtils.d("getLeaveShowIds",response.body().list)
LogUtils.d("getLeaveShowIds", response.body().list)
}
}

@@ -104,7 +164,7 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
}

fun getDetail(id: Int) {
if(User.getUser().token.isEmpty()){
if (User.getUser().token.isEmpty()) {
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_GET_STU_LEAVE_INFO_DETAIL}"
@@ -129,8 +189,8 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
})
}

fun postVacation(data:Vacation){
if(User.getUser().token.isEmpty()){
fun postVacation(data: Vacation) {
if (User.getUser().token.isEmpty()) {
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_POST_LEAVE_VACATION}"
@@ -159,6 +219,33 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
})
}

fun outSchool(item:StuLeave){
if (User.getUser().token.isEmpty()) {
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_POST_HIDE_LEAVE}"
OkGo.post<SimpleResponse>(url)
.tag(this)
.params("is_hide", 1)
.params("id", item.id)
.execute(object : JsonCallBack<SimpleResponse>() {


override fun onSuccess(response: Response<SimpleResponse>?) {
LogUtils.d(response)
if (response?.isSuccessful == true) {
mView?.postHideSuccess("已放行!")
}
}

override fun onError(response: Response<SimpleResponse>?) {
super.onError(response)
LogUtils.d(response)
mView?.postHideError(response?.body()?.msg ?: "操作失败,请重试!")
}
})
}

}

interface HomeView : IView {
@@ -169,4 +256,7 @@ interface HomeView : IView {
fun onLeaveIDsSuccess(list: MutableList<LeaveID>)
fun postVacationSuccess(msg: String)
fun postVacationError(msg: String)

fun postHideSuccess(msg: String)
fun postHideError(msg: String)
}

+ 13
- 3
app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt Ver fichero

@@ -36,7 +36,8 @@ class LeaveDialog(
val adapter: HomeDialogStepAdapter by lazy {
HomeDialogStepAdapter(mutableListOf())
}
var onCloseClick: (view:View) -> Unit = {}
var onCloseClick: (view: View) -> Unit = {}
var onSureClick: (view: View, item: StuLeave) -> Unit = { view: View, stuLeave: StuLeave -> }

init {
val view = LayoutInflater.from(context).inflate(R.layout.dialog_leave, null)
@@ -49,7 +50,7 @@ class LeaveDialog(
view.layoutParams = layoutParams
addView(view)
background = ContextCompat.getDrawable(context, R.color.dialog_bg)
setOnClickListener { } //阻止事件冒泡
setOnClickListener { } //阻止事件冒泡
}

@SuppressLint("SetTextI18n")
@@ -65,7 +66,8 @@ class LeaveDialog(
find<View>(R.id.face_img).visibility = View.GONE
}
find<ImageView>(R.id.face_img).setOnClickListener {
EventBus.getDefault().post(ViewImage(detail.id,detail.face_identity,detail?.face_key?:""))
EventBus.getDefault()
.post(ViewImage(detail.id, detail.face_identity, detail?.face_key ?: ""))
}
find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
find<TextView>(R.id.leave_request_type_name).text = detail.leave_request_type_name
@@ -96,5 +98,13 @@ class LeaveDialog(
find<View>(R.id.closeBtn).setOnClickListener {
onCloseClick(this)
}
find<View>(R.id.sureBtn).setOnClickListener {
onSureClick(this, detail)
}
find<View>(R.id.sureBtn).visibility = if (detail.is_hide == 0) {
View.VISIBLE
} else {
View.GONE
}
}
}

+ 5
- 0
app/src/main/res/drawable/shape_leave_item.xml Ver fichero

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fff"/>
<stroke android:color="#f5f5f5" android:width="1dp"/>
</shape>

+ 36
- 12
app/src/main/res/layout/dialog_leave.xml Ver fichero

@@ -172,18 +172,42 @@
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/closeBtn"
android:layout_width="300dp"
android:layout_height="80dp"
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginBottom="@dimen/d_20"
android:padding="@dimen/d_10"
android:text="关闭"
android:textSize="@dimen/sp20"
android:textColor="@color/black"
app:qmui_borderColor="@color/gray"
app:qmui_radius="@dimen/d_5" />
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/d_20">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/closeBtn"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_40"
android:padding="@dimen/d_10"
android:text="关闭"
android:textSize="@dimen/sp20"
android:textColor="@color/black"
app:qmui_borderColor="@color/gray"
app:qmui_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/sureBtn"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_40"

android:padding="@dimen/d_10"
android:text="已放行"
android:layout_marginLeft="@dimen/d_30"
android:textSize="@dimen/sp20"
android:textColor="@color/white"
app:qmui_borderColor="@color/blue"
app:qmui_backgroundColor="@color/blue"
app:qmui_radius="@dimen/d_5" />
</androidx.appcompat.widget.LinearLayoutCompat>


</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
</FrameLayout>

+ 189
- 5
app/src/main/res/layout/fragment_home.xml Ver fichero

@@ -67,8 +67,8 @@

<EditText
android:id="@+id/keywordInput"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_width="200dp"
android:layout_height="50dp"
android:background="@color/transparent"
android:hint="输入学生姓名"
android:imeOptions="actionSearch"
@@ -91,7 +91,7 @@
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/allBtn"
style="@style/home_status_btn"
android:layout_marginStart="50dp"
android:layout_marginStart="30dp"
android:text="全部"
android:textColor="@color/s_app_color_status_text"
app:qmui_backgroundColor="@color/s_app_color_status_bg"
@@ -126,21 +126,108 @@
android:layout_height="1px"
android:layout_weight="1" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/hideType0"
style="@style/home_status_btn"
android:text="未放行"
android:textColor="@color/s_app_color_status_text"
app:qmui_backgroundColor="@color/s_app_color_status_bg"
app:qmui_borderColor="@color/s_app_color_status_border" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/hideType1"
style="@style/home_status_btn"
android:text="已放行"
android:textColor="@color/s_app_color_status_text"
app:qmui_backgroundColor="@color/s_app_color_status_bg"
app:qmui_borderColor="@color/s_app_color_status_border" />

<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_weight="1" />

<TextView
android:id="@+id/filterBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 筛选"
android:drawableLeft="@mipmap/ic_filter"
android:layout_marginEnd="30dp"
android:layout_marginEnd="20dp"
android:textColor="#3c7ef6"
android:textSize="16dp"/>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/listType1Btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/d_20"
android:layout_height="@dimen/d_20"
android:src="@mipmap/icon_list"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/green2"
android:includeFontPadding="false"
android:layout_marginLeft="@dimen/d_6"
android:text="列表模式"/>
</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/listType2Btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="gone"
android:gravity="center"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/d_20"
android:layout_height="@dimen/d_20"
android:src="@mipmap/icon_grid"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/green2"
android:includeFontPadding="false"
android:layout_marginLeft="@dimen/d_6"
android:text="网格模式"/>
</androidx.appcompat.widget.LinearLayoutCompat>

<!-- <Switch-->
<!-- android:id="@+id/switchBtn2"-->
<!-- android:layout_width="48dp"-->
<!-- android:layout_height="@dimen/d_28"-->
<!-- android:checked="true"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:thumb="@drawable/switch_ios_thumb"-->
<!-- android:track="@drawable/switch_ios_track_selector"-->
<!-- tools:ignore="UseSwitchCompatOrMaterialXml" />-->

<!-- <TextView-->
<!-- android:id="@+id/switchBtnTxt2"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/d_28"-->
<!-- android:layout_gravity="center_vertical"-->
<!-- android:layout_marginStart="@dimen/d_10"-->
<!-- android:gravity="center"-->
<!-- android:text="仅看在校"-->
<!-- android:includeFontPadding="false"-->
<!-- android:layout_marginEnd="@dimen/d_10"-->
<!-- android:textColor="#53a051" />-->

<Switch
android:id="@+id/switchBtn"
android:layout_width="48dp"
android:layout_height="@dimen/d_28"
android:checked="true"
android:layout_gravity="center_vertical"
android:thumb="@drawable/switch_ios_thumb"
android:track="@drawable/switch_ios_track_selector"
tools:ignore="UseSwitchCompatOrMaterialXml" />
@@ -152,15 +239,18 @@
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/d_10"
android:gravity="center"
android:text="自动弹出请假单"
android:text="自动弹出"
android:includeFontPadding="false"
android:textColor="#53a051" />

</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/listTypeLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone"
android:background="@color/white"
android:orientation="vertical"
android:paddingStart="@dimen/dp_10"
@@ -303,6 +393,100 @@
android:textSize="@dimen/sp18" />


</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/listTypeLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10">


<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:itemCount="20"
app:spanCount="5"
tools:listitem="@layout/layout_leave_table2" />

<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/backgroundColor" />

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="@dimen/dp_40"
android:paddingVertical="@dimen/d_20">

<TextView
android:id="@+id/totalTv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="共0条数据"
android:textSize="@dimen/sp18" />

<TextView
android:id="@+id/btnRefresh2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/d_20"
android:text="刷新数据"
android:textColor="@color/s_app_color_blue"
android:textSize="@dimen/sp18" />

<View
android:layout_width="0dp"
android:layout_height="1px"
android:layout_weight="1" />

<TextView
android:id="@+id/goPageOne2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="回首页"
android:textColor="@color/s_app_color_blue"
android:textSize="@dimen/sp18"
android:layout_marginEnd="@dimen/d_20"
android:visibility="gone"/>

<TextView
android:id="@+id/preTxtBtn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上一页"
android:textColor="#3ca0e9"
android:textSize="@dimen/sp18" />

<TextView
android:id="@+id/pageTv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/d_20"
android:paddingEnd="@dimen/d_20"
android:text="0/0"
android:textColor="#333"
android:textSize="@dimen/sp18" />

<TextView
android:id="@+id/nextTxtBtn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下一页"
android:textColor="#3ca0e9"
android:textSize="@dimen/sp18" />


</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>


+ 3
- 3
app/src/main/res/layout/fragment_visitor.xml Ver fichero

@@ -67,8 +67,8 @@

<EditText
android:id="@+id/keywordInput"
android:layout_width="300dp"
android:layout_height="60dp"
android:layout_width="200dp"
android:layout_height="50dp"
android:background="@color/transparent"
android:hint="输入访客姓名"
android:imeOptions="actionSearch"
@@ -91,7 +91,7 @@
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/allBtn"
style="@style/home_status_btn"
android:layout_marginStart="50dp"
android:layout_marginStart="30dp"
android:text="全部"
android:textColor="@color/s_app_color_status_text"
app:qmui_backgroundColor="@color/s_app_color_status_bg"


+ 89
- 0
app/src/main/res/layout/layout_leave_table2.xml Ver fichero

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:clickable="true"
android:padding="10dp">

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="@drawable/shape_leave_item"
android:padding="1dp">


<FrameLayout
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:text="人脸">

<ImageView
android:id="@+id/faceImg"
android:layout_width="132dp"
android:layout_height="151dp"
app:qmui_border_color="@color/white"
app:qmui_radius="0dp"/>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/faceEmpty"
android:layout_width="132dp"
android:layout_height="151dp"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:text="未设置"
android:textColor="@color/white"
app:qmui_backgroundColor="#ccc"
app:qmui_borderColor="#ccc"
app:qmui_radius="1px" />
</FrameLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="20dp"
android:orientation="vertical"
android:paddingBottom="@dimen/d_10"
android:paddingTop="10dp">
<TextView
android:id="@+id/studentName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="20dp"
android:includeFontPadding="false"
android:text="李晓晓"/>
<TextView
android:id="@+id/className"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16dp"
android:layout_marginTop="@dimen/d_10"
android:text="高中三年级一班"/>
<TextView
android:id="@+id/applyTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16dp"
android:text="2024-1-4 15:57"/>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/statusName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/d_20"
android:paddingVertical="@dimen/d_6"
android:textColor="#fff"
app:qmui_backgroundColor="#ff4040"
android:text="已确认"
app:qmui_radius="@dimen/d_20" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

</LinearLayout>

BIN
app/src/main/res/mipmap-xhdpi/icon_grid.png Ver fichero

Antes Después
Anchura: 64  |  Altura: 64  |  Tamaño: 705 B

BIN
app/src/main/res/mipmap-xhdpi/icon_list.png Ver fichero

Antes Después
Anchura: 64  |  Altura: 64  |  Tamaño: 713 B

+ 3
- 3
app/src/main/res/values/styles.xml Ver fichero

@@ -205,9 +205,9 @@
</style>

<style name="home_status_btn">
<item name="android:layout_width">160dp</item>
<item name="android:layout_height">60dp</item>
<item name="android:layout_marginLeft">@dimen/d_30</item>
<item name="android:layout_width">140dp</item>
<item name="android:layout_height">50dp</item>
<item name="android:layout_marginLeft">@dimen/d_20</item>
<item name="android:paddingTop">@dimen/d_5</item>
<item name="android:paddingBottom">@dimen/d_5</item>
<item name="android:textSize">@dimen/sp20</item>


Cargando…
Cancelar
Guardar