leiyun пре 3 година
родитељ
комит
3a4d7cf0b5
28 измењених фајлова са 1899 додато и 179 уклоњено
  1. +5
    -0
      .idea/misc.xml
  2. +4
    -2
      app/build.gradle
  3. +1
    -1
      app/src/main/AndroidManifest.xml
  4. +48
    -5
      app/src/main/java/com/yzx/escreen/MainActivity.kt
  5. +49
    -0
      app/src/main/java/com/yzx/escreen/adapter/VisitorDialogStepAdapter.kt
  6. +78
    -0
      app/src/main/java/com/yzx/escreen/adapter/VisitorListAdapter.kt
  7. +5
    -0
      app/src/main/java/com/yzx/escreen/config/YzxInterface.kt
  8. +14
    -94
      app/src/main/java/com/yzx/escreen/fragment/ChangeFragment.kt
  9. +14
    -69
      app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt
  10. +404
    -0
      app/src/main/java/com/yzx/escreen/fragment/VisitorFragment.kt
  11. +7
    -0
      app/src/main/java/com/yzx/escreen/model/ViewImage.kt
  12. +71
    -0
      app/src/main/java/com/yzx/escreen/model/Visitor.kt
  13. +84
    -0
      app/src/main/java/com/yzx/escreen/presenter/VisitorPresenter.kt
  14. +0
    -2
      app/src/main/java/com/yzx/escreen/utils/KotlinX.kt
  15. +5
    -5
      app/src/main/java/com/yzx/escreen/widget/ChangeDialog.kt
  16. +5
    -0
      app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt
  17. +56
    -0
      app/src/main/java/com/yzx/escreen/widget/ViewImageDialog.kt
  18. +142
    -0
      app/src/main/java/com/yzx/escreen/widget/VisitorDialog.kt
  19. +16
    -0
      app/src/main/res/layout/dialog_view_img.xml
  20. +378
    -0
      app/src/main/res/layout/dialog_visitor.xml
  21. +10
    -1
      app/src/main/res/layout/fragment_change.xml
  22. +9
    -0
      app/src/main/res/layout/fragment_home.xml
  23. +290
    -0
      app/src/main/res/layout/fragment_visitor.xml
  24. +74
    -0
      app/src/main/res/layout/layout_visitor_step.xml
  25. +126
    -0
      app/src/main/res/layout/layout_visitor_table.xml
  26. BIN
      app/src/main/res/mipmap-mdpi/visitor_select.png
  27. BIN
      app/src/main/res/mipmap-mdpi/visitor_unselect.png
  28. +4
    -0
      app/src/main/res/values/styles.xml

+ 5
- 0
.idea/misc.xml Прегледај датотеку

@@ -23,15 +23,20 @@
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_test.xml" value="0.29827742520398914" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_vacation.xml" value="0.10822707953855495" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_view_img.xml" value="0.1" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_visitor.xml" value="0.11302083333333333" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_change.xml" value="0.10822707953855495" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_home.xml" value="0.10822707953855495" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_my.xml" value="0.10822707953855495" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_visitor.xml" value="0.22" />
<entry key="..\:/work/escreen/app/src/main/res/layout/item_home.xml" value="0.12378472222222223" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_change_table.xml" value="0.12378472222222223" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_empty.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_step.xml" value="0.1" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_table.xml" value="0.21462163317657118" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_loading.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_visitor_step.xml" value="0.11302083333333333" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_visitor_table.xml" value="0.19660493827160494" />
<entry key="..\:/work/escreen/app/src/main/res/layout/leave_dialog_title.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/version_dialog.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/view_time.xml" value="0.12378472222222223" />


+ 4
- 2
app/build.gradle Прегледај датотеку

@@ -19,8 +19,8 @@ android {
// minSdkVersion 26
minSdkVersion 21
targetSdkVersion 25
versionCode 11
versionName "2.0.9"
versionCode 14
versionName "2.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// ndk {
@@ -192,4 +192,6 @@ dependencies {
implementation 'com.github.HuanTanSheng:EasyPhotos:3.1.5'

implementation("org.greenrobot:eventbus:3.3.1")

implementation 'com.github.chrisbanes:PhotoView:2.0.0'
}

+ 1
- 1
app/src/main/AndroidManifest.xml Прегледај датотеку

@@ -70,7 +70,7 @@
<service
android:name="com.tencent.smtt.export.external.DexClassLoaderProviderService"
android:label="dexopt"
android:process=":dexopt"></service>
android:process=":dexopt"/>

<receiver
android:name=".receiver.BootReceiver"


+ 48
- 5
app/src/main/java/com/yzx/escreen/MainActivity.kt Прегледај датотеку

@@ -37,13 +37,12 @@ import com.yzx.escreen.config.RefreshToken
import com.yzx.escreen.fragment.ChangeFragment
import com.yzx.escreen.fragment.HomeFragment
import com.yzx.escreen.fragment.MyFragment
import com.yzx.escreen.fragment.VisitorFragment
import com.yzx.escreen.model.*
import com.yzx.escreen.presenter.MainPresenter
import com.yzx.escreen.presenter.MainView
import com.yzx.escreen.utils.hideNavigationBar
import com.yzx.escreen.widget.BaseDialog
import com.yzx.escreen.widget.ChangeDialog
import com.yzx.escreen.widget.LeaveDialog
import com.yzx.escreen.widget.*
import kotlinx.android.synthetic.main.activity_main.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
@@ -132,11 +131,12 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
val tabData = arrayListOf<CustomTabEntity>()
tabData.add(TabEntity("学生请假", R.mipmap.leave_select, R.mipmap.leave_unselect))
tabData.add(TabEntity("学籍异动", R.mipmap.change_select, R.mipmap.change_unselect))
tabData.add(TabEntity("访客管理", R.mipmap.visitor_select, R.mipmap.visitor_unselect))
tabData.add(TabEntity("我的", R.mipmap.my_select, R.mipmap.my_unselect))
tabLayout.setTabData(tabData)

viewPager2.adapter = HomePagerAdapter(this)
viewPager2.offscreenPageLimit = 2
viewPager2.offscreenPageLimit = 3
viewPager2.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
@@ -219,6 +219,46 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
dialogList.add(dialog)
}

//接收访客消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(detail: Visitor) {
removeOld(detail.id,2)
val dialog = VisitorDialog(this)
dialog.layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
dialog.setData(detail)
dialog.setTag(R.id.tag_dialog_name,detail.id)
dialog.setTag(R.id.tag_dialog_type,2)
dialog.onCloseClick = {
dialogLayout.removeView(it)
dialogList.remove(it)
}
dialogLayout.addView(dialog,0) //请假权限更高,访客插入到最底层
dialogList.add(dialog)
}

//接收访客消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(detail: ViewImage) {
removeOld(detail.id,3)
val dialog = ViewImageDialog(this)
dialog.layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
dialog.setData(detail)
dialog.setTag(R.id.tag_dialog_name,detail.id)
dialog.setTag(R.id.tag_dialog_type,3)
dialog.onCloseClick = {
dialogLayout.removeView(it)
dialogList.remove(it)
}
dialogLayout.addView(dialog)
dialogList.add(dialog)
}

private fun removeOld(id:Int, type:Int){
val view = dialogList.find {
val tagId: Int = it.getTag(R.id.tag_dialog_name) as Int
@@ -458,7 +498,7 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
}

class HomePagerAdapter(act: AppCompatActivity) : FragmentStateAdapter(act) {
override fun getItemCount(): Int = 3
override fun getItemCount(): Int = 4

override fun createFragment(position: Int): Fragment {
when (position) {
@@ -469,6 +509,9 @@ class HomePagerAdapter(act: AppCompatActivity) : FragmentStateAdapter(act) {
return ChangeFragment.getNewInstance()
}
2 -> {
return VisitorFragment.getNewInstance()
}
3 -> {
return MyFragment.getNewInstance()
}
}


+ 49
- 0
app/src/main/java/com/yzx/escreen/adapter/VisitorDialogStepAdapter.kt Прегледај датотеку

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

import android.annotation.SuppressLint
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.AuditRecordOut
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.layout_visitor_step.view.*
import org.jetbrains.anko.dip
import org.jetbrains.anko.textColor

class VisitorDialogStepAdapter(list: MutableList<AuditRecordOut>) :
BaseQuickAdapter<AuditRecordOut, BaseViewHolder>(R.layout.layout_visitor_step, list) {

@SuppressLint("SetTextI18n")
override fun convert(holder: BaseViewHolder, item: AuditRecordOut) {

holder.itemView.visibility = View.VISIBLE
holder.itemView.addUserName.text = item.getTitle()
holder.itemView.approvalComments.visibility = if(item.audit_user_name.isNotEmpty()){
holder.itemView.approvalComments.text = "审批人:${item.audit_user_name}。${item.audit_remark}"
holder.itemView.approvalComments.textColor = when (item.audit_status) {
0 -> Color.parseColor("#ff4040")
1 -> Color.parseColor("#3c7ef6")
2 -> Color.parseColor("#ff4040")
-1 -> Color.parseColor("#999999")
else -> Color.parseColor("#333333")
}
View.VISIBLE
}else{
View.GONE
}
holder.itemView.approvalTime.text = item.add_time.toTime()
if (holder.adapterPosition == 0) {
holder.itemView.line1.setBackgroundResource(R.color.transparent)
} else {
holder.itemView.line1.setBackgroundResource(R.color.gray_1)
}

if (holder.adapterPosition == data.size - 1) {
holder.itemView.contentLayout.setPadding(0, 0, 0, 0)
} else {
holder.itemView.contentLayout.setPadding(0, 0, 0, holder.itemView.contentLayout.dip(20))
}
}
}

+ 78
- 0
app/src/main/java/com/yzx/escreen/adapter/VisitorListAdapter.kt Прегледај датотеку

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

import android.annotation.SuppressLint
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.Visitor
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.layout_visitor_table.view.*
import org.jetbrains.anko.textColor

class VisitorListAdapter(list: MutableList<Visitor>) :
BaseQuickAdapter<Visitor, BaseViewHolder>(R.layout.layout_visitor_table, list) {

init {
addChildClickViewIds(R.id.cancelBtn)
}

@SuppressLint("SetTextI18n")
override fun convert(holder: BaseViewHolder, item: Visitor) {
holder.itemView.userName.text = item.user_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)
}
if (item.health_code_key.isNullOrBlank()) {
holder.itemView.healthCodeEmpty.visibility = View.VISIBLE
holder.itemView.healthCodeImg.visibility = View.GONE
} else {
holder.itemView.healthCodeImg.visibility = View.VISIBLE
holder.itemView.healthCodeEmpty.visibility = View.GONE
holder.itemView.healthCodeImg.setSrc(item.health_code_identity, item.health_code_key)
}
if (item.trip_code_key.isNullOrBlank()) {
holder.itemView.tripCodeEmpty.visibility = View.VISIBLE
holder.itemView.tripCodeImg.visibility = View.GONE
} else {
holder.itemView.tripCodeImg.visibility = View.VISIBLE
holder.itemView.tripCodeEmpty.visibility = View.GONE
holder.itemView.tripCodeImg.setSrc(item.trip_code_identity, item.trip_code_key)
}
holder.itemView.isDrive.text = if (item.is_drive == 1) {
"是"
} else {
"否"
}
holder.itemView.receptionUser.text = item.reception_user
holder.itemView.statusName.text = when (item.audit_status) {
0 -> "待审核"
1 -> "可通行"
2 -> "审核拒绝"
-1 -> "已失效"
else -> "--"
}
holder.itemView.statusName.textColor = when (item.audit_status) {
0 -> Color.parseColor("#333333")
1 -> Color.parseColor("#3c7ef6")
2 -> Color.parseColor("#ff4040")
-1 -> Color.parseColor("#999999")
else -> Color.parseColor("#333333")
}

holder.itemView.applyTime.text = item.add_time.toTime()

holder.itemView.bottomLine.visibility = if (holder.adapterPosition == data.size - 1) {
View.GONE
} else {
View.VISIBLE
}
}
}

+ 5
- 0
app/src/main/java/com/yzx/escreen/config/YzxInterface.kt Прегледај датотеку

@@ -20,4 +20,9 @@ object YzxInterface {

const val INTERFACE_STUDENT_GET_CHANGE_LIST= "/edu/attendance/teacher/listStudentStatusChange"//学籍异动列表
const val INTERFACE_STUDENT_GET_CHANGE_DETAIL= "/edu/attendance/getStudentStatusChangeDetail"//学籍异动详情
/**
* 访客管理
*/
const val INTERFACE_ACCESS_CONTROL_GET_FACE_LIST= "/parent/entranceGuard/getEntranceGuardFaceList" // 获取访客人脸信息列表
const val INTERFACE_ACCESS_CONTROL_GET_FACE_INFO_DETAIL= "/parent/entranceGuard/getEntranceGuardFaceById" // 访客信息
}

+ 14
- 94
app/src/main/java/com/yzx/escreen/fragment/ChangeFragment.kt Прегледај датотеку

@@ -9,32 +9,24 @@ import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.util.*
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
import com.yzx.escreen.R
import com.yzx.escreen.adapter.ChangeDialogStepAdapter
import com.yzx.escreen.adapter.ChangeListAdapter
import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.*
import com.yzx.escreen.presenter.ChangePresenter
import com.yzx.escreen.presenter.ChangeView
import com.yzx.escreen.utils.FileUploadCallBack
import com.yzx.escreen.utils.hideNavigationBar
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toDay
import com.yzx.escreen.widget.BaseDialog
import kotlinx.android.synthetic.main.fragment_change.*
import kotlinx.android.synthetic.main.layout_loading.view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.jetbrains.anko.find
import org.jetbrains.anko.support.v4.act
import org.jetbrains.anko.support.v4.ctx
import org.jetbrains.anko.support.v4.toast
import org.jetbrains.anko.textColor


@@ -63,6 +55,7 @@ class ChangeFragment : BaseFragment<ChangePresenter>(), ChangeView,
private var isLoading = false
private val mShowList = mutableListOf<StuChange>()
private val mShowDialogList = mutableListOf<BaseDialog>()
private var isRefresh = false

private val refreshRun = Runnable {
refreshData()
@@ -155,6 +148,10 @@ class ChangeFragment : BaseFragment<ChangePresenter>(), ChangeView,
filterLayout.setOnClickListener {
KeyboardUtils.hideSoftInput(keywordInput)
}
btnRefresh.setOnClickListener {
isRefresh = true
initData()
}
}


@@ -169,91 +166,6 @@ class ChangeFragment : BaseFragment<ChangePresenter>(), ChangeView,
@SuppressLint("SetTextI18n")
private fun showLeaveDialog(detail: StuChange) {
EventBus.getDefault().post(detail)
return
val adapter = ChangeDialogStepAdapter(mutableListOf())
val dialog = BaseDialog(act, R.style.BaseDialog, R.layout.dialog_change)
//处理弹窗显示
dialog.find<TextView>(R.id.leave_student_name).text = detail.status_change_student_name
if (detail.face_key.isNotEmpty()) {
val img = dialog.find<ImageView>(R.id.face_img)
img.setSrc(detail.face_identity, detail.face_key)
img.visibility = View.VISIBLE
dialog.find<View>(R.id.face_empty).visibility = View.GONE
} else {
dialog.find<View>(R.id.face_empty).visibility = View.VISIBLE
dialog.find<View>(R.id.face_img).visibility = View.GONE
}
dialog.find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
dialog.find<TextView>(R.id.leave_request_type_name).text = detail.status_change_type_name
dialog.find<TextView>(R.id.statusName).text = when (detail.status) {
1 -> "待处理"
2 -> "已确认"
3 -> "已拒绝"
else -> "--"
}
dialog.find<TextView>(R.id.statusName).textColor = when (detail.status) {
1 -> Color.parseColor("#333333")
2 -> Color.parseColor("#3c7ef6")
3 -> Color.parseColor("#ff4040")
else -> Color.parseColor("#333333")
}
if (detail.getSubStatusName().isNotEmpty()) {
dialog.find<TextView>(R.id.subStatusName).text = "(${detail.getSubStatusName()})"
dialog.find<TextView>(R.id.subStatusName).textColor = when (detail.sub_status) {
0, 2 -> Color.parseColor("#ff4040")
1, 3 -> Color.parseColor("#07c160")
else -> Color.parseColor("#333333")
}
} else {
dialog.find<TextView>(R.id.subStatusName).text = ""
}
var time = "--"
if (detail.start_time > 0) {
time = detail.start_time.toDay()
}
if (detail.end_time > 0) {
time = "$time -- ${detail.end_time.toDay()}"
}
dialog.find<TextView>(R.id.add_time).text = time
if (detail.status_change_reason.isNotEmpty()) {
dialog.find<View>(R.id.remarkLayout).visibility = View.VISIBLE
dialog.find<TextView>(R.id.leave_request_reason).text = detail.status_change_reason
} else {
dialog.find<View>(R.id.remarkLayout).visibility = View.GONE
}
dialog.find<ImageView>(R.id.statusImg).setSrc(detail.getStatusImg())

dialog.find<RecyclerView>(R.id.stepRecycler)
val recyclerView = dialog.find<RecyclerView>(R.id.stepRecycler)
recyclerView.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
recyclerView.adapter = adapter
adapter.setList(detail.getStep())

dialog.find<View>(R.id.closeBtn).setOnClickListener {
dialog.hide()
val index = mShowList.indexOfFirst { it.id == detail.id }
if (index >= 0) {
mShowList.removeAt(index)
}
val dialogIndex = mShowDialogList.indexOfFirst { it.getLeaveId() == detail.id }
if (index >= 0) {
mShowDialogList.removeAt(dialogIndex)
}
val showItem = mShowDialogList.find { !it.showed }
showItem?.apply {
show()
}

}
val showList = mShowDialogList.filter { it.showed }
if (showList.isEmpty()) {
dialog.show()
dialog.showed = true
}
dialog.hideNavigationBar()
dialog.setLeaveId(detail.id)
mShowDialogList.add(dialog)
}

private fun changeStatusBtn(idx: Int) {
@@ -361,6 +273,10 @@ class ChangeFragment : BaseFragment<ChangePresenter>(), ChangeView,
@SuppressLint("SetTextI18n")
override fun onListSuccess(list: MutableList<StuChange>, pager: Pager) {
pageTv?.apply {
if(isRefresh){
toast("刷新成功!")
isRefresh = false
}
mAdapter.setList(list)
mPager = pager
pageTv.text = "${pager.page_no} / ${pager.total_pages}"
@@ -401,6 +317,10 @@ class ChangeFragment : BaseFragment<ChangePresenter>(), ChangeView,

override fun onListError(error: String) {
isLoading = false
if(isRefresh){
toast("刷新失败,请重试!")
isRefresh = false
}
showEmpty(3)
}



+ 14
- 69
app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt Прегледај датотеку

@@ -14,7 +14,6 @@ import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.util.*
import com.huantansheng.easyphotos.EasyPhotos
import com.huantansheng.easyphotos.models.album.entity.Photo
@@ -22,7 +21,6 @@ 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.HomeDialogStepAdapter
import com.yzx.escreen.adapter.HomeListAdapter
import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.*
@@ -38,6 +36,7 @@ import org.greenrobot.eventbus.ThreadMode
import org.jetbrains.anko.find
import org.jetbrains.anko.support.v4.act
import org.jetbrains.anko.support.v4.ctx
import org.jetbrains.anko.support.v4.toast
import org.jetbrains.anko.textColor


@@ -71,7 +70,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
private var mDialogVacation: BaseDialog? = null
private val mVacation = Vacation()
private val mVacationAttachment = Attachment("", "", "")
private var isRefresh = false

private val refreshRun = Runnable {
refreshData()
@@ -176,7 +175,10 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
KeyboardUtils.hideSoftInput(keywordInput)
}


btnRefresh.setOnClickListener {
isRefresh = true
initData()
}
}

@SuppressLint("SetTextI18n")
@@ -264,71 +266,6 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
@SuppressLint("SetTextI18n")
private fun showLeaveDialog(detail: StuLeave) {
EventBus.getDefault().post(detail)
return
val adapter = HomeDialogStepAdapter(mutableListOf())
val dialog = BaseDialog(act, R.style.BaseDialog, R.layout.dialog_leave)
//处理弹窗显示
dialog.find<TextView>(R.id.leave_student_name).text = detail.leave_student_name
if (detail.face_key.isNotEmpty()) {
val img = dialog.find<ImageView>(R.id.face_img)
img.setSrc(detail.face_identity, detail.face_key)
img.visibility = View.VISIBLE
dialog.find<View>(R.id.face_empty).visibility = View.GONE
} else {
dialog.find<View>(R.id.face_empty).visibility = View.VISIBLE
dialog.find<View>(R.id.face_img).visibility = View.GONE
}
dialog.find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
dialog.find<TextView>(R.id.leave_request_type_name).text = detail.leave_request_type_name
dialog.find<TextView>(R.id.leave_duration_str).text =
(detail.end_time - detail.start_time).durationStr()
dialog.find<TextView>(R.id.add_time).text =
"${detail.start_time.toTime()} - ${detail.end_time.toTime()}"
dialog.find<TextView>(R.id.leave_request_reason).text = detail.leave_request_reason
dialog.find<ImageView>(R.id.statusImg).setSrc(
when (detail.status) {
1 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_wait.png"
2 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_pass.png"
3 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_nopass.png"
4 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/cancellation.png"
5 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/cancellation_overtime.png"
else -> ""
}
)

dialog.find<RecyclerView>(R.id.stepRecycler)
val recyclerView = dialog.find<RecyclerView>(R.id.stepRecycler)
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
// layoutManager.stackFromEnd = true
recyclerView.layoutManager = layoutManager

recyclerView.adapter = adapter
adapter.setList(detail.getStep())
recyclerView.scrollToPosition(adapter.itemCount - 1)
dialog.find<View>(R.id.closeBtn).setOnClickListener {
dialog.hide()
val index = mShowList.indexOfFirst { it.id == detail.id }
if (index >= 0) {
mShowList.removeAt(index)
}
val dialogIndex = mShowDialogList.indexOfFirst { it.getLeaveId() == detail.id }
if (index >= 0) {
mShowDialogList.removeAt(dialogIndex)
}
val showItem = mShowDialogList.find { !it.showed }
showItem?.apply {
show()
}

}
dialog.hideNavigationBar()
val showList = mShowDialogList.filter { it.showed }
if (showList.isEmpty()) {
dialog.show()
dialog.showed = true
}
dialog.setLeaveId(detail.id)
mShowDialogList.add(dialog)
}

private fun changeStatusBtn(idx: Int) {
@@ -436,6 +373,10 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
@SuppressLint("SetTextI18n")
override fun onLeaveListSuccess(list: MutableList<StuLeave>, pager: Pager) {
pageTv?.apply {
if(isRefresh){
toast("刷新成功!")
isRefresh = false
}
mAdapter.setList(list)
mPager = pager
pageTv.text = "${pager.page_no} / ${pager.total_pages}"
@@ -470,6 +411,10 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,

override fun onLeaveListError(error: String) {
isLoading = false
if(isRefresh){
toast("刷新失败,请重试!")
isRefresh = false
}
showEmpty(3)
}



+ 404
- 0
app/src/main/java/com/yzx/escreen/fragment/VisitorFragment.kt Прегледај датотеку

@@ -0,0 +1,404 @@
package com.yzx.escreen.fragment

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.blankj.utilcode.util.*
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
import com.yzx.escreen.R
import com.yzx.escreen.adapter.VisitorListAdapter
import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.*
import com.yzx.escreen.presenter.VisitorPresenter
import com.yzx.escreen.presenter.VisitorView
import com.yzx.escreen.utils.FileUploadCallBack
import com.yzx.escreen.widget.BaseDialog
import kotlinx.android.synthetic.main.fragment_visitor.*
import kotlinx.android.synthetic.main.layout_loading.view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.jetbrains.anko.support.v4.ctx
import org.jetbrains.anko.support.v4.toast
import org.jetbrains.anko.textColor


class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView,
NetworkUtils.OnNetworkStatusChangedListener, FileUploadCallBack {

companion object {

val CAMER_REQUEST_CODE = 0x01

@JvmStatic
fun getNewInstance() =
VisitorFragment()
}

private val mAdapter: VisitorListAdapter by lazy {
val list = mutableListOf<Visitor>()
VisitorListAdapter(list)
}

private var mPager = Pager()
var list = mutableListOf<Visitor>()
private val statusBtnList = mutableListOf<QMUIRoundButton>()
var keyword: String = ""
var status: String = "10"
private var isLoading = false
private val mShowList = mutableListOf<Visitor>()
private val mShowDialogList = mutableListOf<BaseDialog>()
private var isRefresh = false

private val refreshRun = Runnable {
refreshData()
}

override val inflateId: Int
get() = R.layout.fragment_visitor

override fun initView() {
NetworkUtils.registerNetworkStatusChangedListener(this)
recyclerView.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
recyclerView.adapter = mAdapter

preTxtBtn.setOnClickListener { pre() }
nextTxtBtn.setOnClickListener { next() }
allBtn.setOnClickListener { changeStatus(10,0) }
status1Btn.setOnClickListener { changeStatus(0,1) }
status2Btn.setOnClickListener { changeStatus(1,2) }
status3Btn.setOnClickListener { changeStatus(2,3) }
status4Btn.setOnClickListener { changeStatus(-1,4) }
statusBtnList.add(allBtn)
statusBtnList.add(status1Btn)
statusBtnList.add(status2Btn)
statusBtnList.add(status3Btn)
statusBtnList.add(status4Btn)
keywordInput.setOnKeyListener { _, keyCode, _ ->
if (!isLoading) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
keyword = keywordInput.text.toString()
initData()
KeyboardUtils.hideSoftInput(keywordInput)
}
}
false
}
clearBtn.setOnClickListener {
keyword = ""
keywordInput.setText("")
KeyboardUtils.hideSoftInput(keywordInput)
initData()
}
var lastClickTime = TimeUtils.getNowMills()
mAdapter.setOnItemClickListener { adapter, view, position ->
val curr = TimeUtils.getNowMills()
if(curr - lastClickTime > 500){
lastClickTime = curr
mPresenter?.getDetail(mAdapter.getItem(position).id)
}
}

mAdapter.setOnItemChildClickListener { adapter, view, position ->
LogUtils.d("setOnItemChildClickListener", position)
when (view.id) {
R.id.cancelBtn -> {

}
}
}
btnRefresh.setOnClickListener {
isRefresh = true
initData()
}


switchBtn.setOnCheckedChangeListener { buttonView, isChecked ->
SPUtils.getInstance().put("auto_show_visitor", isChecked)
changeSwitchBtnTxt(isChecked)
EventBus.getDefault().post(AutoSwitchChange(2))
}
val isAutoShowLeave = SPUtils.getInstance().getBoolean("auto_show_visitor", false)
switchBtn.isChecked = isAutoShowLeave
changeSwitchBtnTxt(isAutoShowLeave)

switchBtnTxt.setOnClickListener {
switchBtn.isChecked = !switchBtn.isChecked
}

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

}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s != null && s.isNotEmpty()) {
clearBtn.visibility = View.VISIBLE
} else {
clearBtn.visibility = View.INVISIBLE
}
}

override fun afterTextChanged(s: Editable?) {

}

})
filterLayout.setOnClickListener {
KeyboardUtils.hideSoftInput(keywordInput)
}
}


private fun changeSwitchBtnTxt(isChecked: Boolean) {
if (isChecked) {
switchBtnTxt.setTextColor(ctx.resources.getColor(R.color.green2))
} else {
switchBtnTxt.setTextColor(ctx.resources.getColor(R.color.black_3))
}
}

@SuppressLint("SetTextI18n")
private fun showLeaveDialog(detail: Visitor) {
EventBus.getDefault().post(detail)
}

private fun changeStatusBtn(idx: Int) {
statusBtnList.forEachIndexed { index, button ->
if (index == idx) {
button.textColor = Color.parseColor("#ffffff")
button.setBackgroundColor(Color.parseColor("#3ca0e9"))
button.setStrokeColors(ColorStateList.valueOf(Color.parseColor("#3ca0e9")))
} else {
button.textColor = Color.parseColor("#808080")
button.setBackgroundColor(Color.parseColor("#ffffff"))
button.setStrokeColors(ColorStateList.valueOf(Color.parseColor("#dcdee0")))
}
}
}

private fun changeStatus(status: Int,index:Int) {
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) {
return
}
changeStatusBtn(index)
this.status = "${status}"
initData()
}

override fun initData() {

mPager.page_no = 1
if (NetworkUtils.isConnected()) {
showEmpty(1)
isLoading = true
mPresenter?.getList(mPager.page_no, keyword, status)
} else {
showEmpty(2)
}

}

/**
* type 1 loading 2 neterror 3 empty
*/
private fun showEmpty(type: Int) {
when (type) {
1 -> {
mAdapter.setEmptyView(R.layout.layout_loading)
mAdapter.emptyLayout?.apply {
this.QMUIEmptyView.setLoadingShowing(true)
this.QMUIEmptyView.setTitleText("数据加载中")
}
}
2 -> {
mAdapter.setEmptyView(R.layout.layout_loading)
mAdapter.emptyLayout?.apply {
this.QMUIEmptyView.show(false, null, "网络连接异常,请检查", "去设置") {
NetworkUtils.openWirelessSettings()
}
}
}
3 -> {
mAdapter.setEmptyView(R.layout.layout_empty)
}
}

}

private fun refreshData() {
if (isLoading) {
return
}
isLoading = true
mPresenter?.getList(mPager.page_no, keyword, status)
}

private fun pre() {
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) {
return
}
if (mPager.page_no <= 1) {
} else {
isLoading = true
mPresenter?.getList(mPager.page_no - 1, keyword, status)
}
}

private fun next() {
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) {
return
}
if (mPager.page_no >= mPager.total_pages) {
} else {
isLoading = true
mPresenter?.getList(mPager.page_no + 1, keyword, status)
}
}

override fun initPresenter(): VisitorPresenter = VisitorPresenter(this)

@SuppressLint("SetTextI18n")
override fun onListSuccess(list: MutableList<Visitor>, pager: Pager) {
pageTv?.apply {
if(isRefresh){
toast("刷新成功!")
isRefresh = false
}
mAdapter.setList(list)
mPager = pager
pageTv.text = "${pager.page_no} / ${pager.total_pages}"
totalTv.text = "共${pager.total_count}条"

val disabledColor = Color.parseColor("#666666")
val color = Color.parseColor("#3ca0e9")
if (pager.page_no <= 1) {
preTxtBtn.textColor = disabledColor
} else {
preTxtBtn.textColor = color
}

if (pager.page_no >= pager.total_pages) {
nextTxtBtn.textColor = disabledColor
} else {
nextTxtBtn.textColor = color
}
isLoading = false
showEmpty(3)
pageTv.postDelayed({
refreshData()
}, 30 * 1000)
}
}

override fun onStop() {
pageTv.removeCallbacks(refreshRun)
super.onStop()
EventBus.getDefault().unregister(this)
}


override fun onStart() {
super.onStart()
EventBus.getDefault().register(this)
}

override fun onListError(error: String) {
isLoading = false
if(isRefresh){
toast("刷新失败,请重试!")
isRefresh = false
}
showEmpty(3)
}

override fun onDetailSuccess(detail: Visitor) {
pageTv?.apply {
val item = mShowList.find { it.id == detail.id }
if (item != null) {
//替换新的数据
val index = mShowList.indexOf(item)
mShowList[index] = detail

//移除原本的dialog
val dialogIndex = mShowDialogList.indexOfFirst { it.getLeaveId() == item.id }
if (dialogIndex > -1) {
mShowDialogList[dialogIndex].hide()
mShowDialogList.removeAt(dialogIndex)
}

} else {
mShowList.add(detail)
}
showLeaveDialog(detail)
}
}

override fun onDetailError(error: String) {

}

override fun onDisconnected() {

}

override fun onConnected(networkType: NetworkUtils.NetworkType?) {
refreshData()
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK) {


}
super.onActivityResult(requestCode, resultCode, data)
}

override fun onSuccess(identity: String, key: String) {
LogUtils.d(identity, key)

}

override fun onError(msg: String) {
LogUtils.d(msg)


}

//接收消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(event: MessageEventAuto) {
val list = event.list.filter { it.type == 1 }.toMutableList()
if (list.isNotEmpty() && switchBtn.isChecked) {
list.forEachIndexed { index, leaveID ->
pageTv.postDelayed({
mPresenter?.getDetail(leaveID.id)
}, 500L * index)
}
}
}

//接收消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageRefreshEvent(event: RefreshTokenEvent) {
refreshData()
}

//接收消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(event: TimeShow) {
timeView.setTime(event)
}
}


+ 7
- 0
app/src/main/java/com/yzx/escreen/model/ViewImage.kt Прегледај датотеку

@@ -0,0 +1,7 @@
package com.yzx.escreen.model

data class ViewImage(
val id: Int = 0,
val identity: String = "",
val key: String = ""
)

+ 71
- 0
app/src/main/java/com/yzx/escreen/model/Visitor.kt Прегледај датотеку

@@ -0,0 +1,71 @@
package com.yzx.escreen.model

data class Visitor(
val add_time: Int = 0,
val auditRecordOuts: MutableList<AuditRecordOut> = mutableListOf(),
val audit_status: Int = 0,
val car_in_time: Int = 0,
val car_out_time: Int = 0,
val card_no: String = "",
val end_time: Int = 0,
val face_identity: String = "",
val face_key: String = "",
val health_code_identity: String = "",
val health_code_key: String = "",
val history_num: Int = 0,
val id: Int = 0,
val in_out_num: Int = 0,
val is_drive: Int = 0,
val license_plate: String = "",
val positionNums: List<Any> = mutableListOf(),
val position_id: Int = 0,
val reception_user: String = "",
val reception_user_id: Int = 0,
val start_time: Int = 0,
val trip_code_identity: String = "",
val trip_code_key: String = "",
val user_id: Int = 0,
val user_name: String = "",
val user_phone: String = "",
val user_type: Int = 0,
val visit_reason: String = ""
){
fun getStatusImg(): String {
return when (audit_status) {
0 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/v_status_0.png"
1 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/v_status_1.png"
2 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/v_status_2.png"
-1 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/v_status_-1.png"
else -> "--"
}
}

fun getStep():MutableList<AuditRecordOut>{
val list = mutableListOf<AuditRecordOut>()
list.add(AuditRecordOut(add_time=add_time, typeTxt = "发起申请"))
auditRecordOuts.forEach {
list.add(it.getCopyItem())
}
return list
}
}

data class AuditRecordOut(
val add_time: Int = 0,
val audit_remark: String = "",
val audit_status: Int = 0,
val audit_user_name: String = "",
val typeTxt: String = "",
val id: Int = 0
){
fun getTitle():String{
if(typeTxt.isNotEmpty()){
return typeTxt
}
return "接待人审批"
}

fun getCopyItem():AuditRecordOut{
return AuditRecordOut(add_time,audit_remark,audit_status, audit_user_name, typeTxt, id)
}
}

+ 84
- 0
app/src/main/java/com/yzx/escreen/presenter/VisitorPresenter.kt Прегледај датотеку

@@ -0,0 +1,84 @@
package com.yzx.escreen.presenter

import com.blankj.utilcode.util.LogUtils
import com.lzy.okgo.OkGo
import com.lzy.okgo.model.Response
import com.yzx.escreen.config.Config
import com.yzx.escreen.config.YzxInterface
import com.yzx.escreen.model.Pager
import com.yzx.escreen.model.User
import com.yzx.escreen.model.Visitor
import com.yzx.escreen.presenter.base.BasePresenter
import com.yzx.escreen.presenter.base.IView
import com.yzx.escreen.presenter.base.JsonCallBack
import com.yzx.escreen.presenter.base.YzxResponse

class VisitorPresenter(view: VisitorView) : BasePresenter<VisitorView>(view) {


fun getList(pageNo: Int, keyword: String, status: String) {
if(User.getUser().token.isEmpty()){
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_ACCESS_CONTROL_GET_FACE_LIST}"
OkGo.post<YzxResponse<Visitor>>(url)
.tag(this)
.params("keyword", keyword)
.params("audit_status", status)
.params("user_type", 3)
.params("page_size", 6)
.params("page_no", pageNo)
.execute(object : JsonCallBack<YzxResponse<Visitor>>() {


override fun onSuccess(response: Response<YzxResponse<Visitor>>?) {
LogUtils.d(response)
if (response?.isSuccessful == true) {
mView?.onListSuccess(response.body().list, response.body().pager)
}
}

override fun onError(response: Response<YzxResponse<Visitor>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onListError(response?.body()?.msg ?: "")
}
})
}
fun getDetail(id: Int) {
if(User.getUser().token.isEmpty()){
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_ACCESS_CONTROL_GET_FACE_INFO_DETAIL}"
OkGo.post<YzxResponse<Visitor>>(url)
.tag(this)
.params("id", id)
.params("user_type", 3)
.execute(object : JsonCallBack<YzxResponse<Visitor>>() {


override fun onSuccess(response: Response<YzxResponse<Visitor>>?) {
LogUtils.d(response)
if (response?.isSuccessful == true) {
mView?.onDetailSuccess(response.body().data)
}
}

override fun onError(response: Response<YzxResponse<Visitor>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onDetailError(response?.body()?.msg ?: "")
}
})
}


}

interface VisitorView : IView {
fun onListSuccess(list: MutableList<Visitor>, pager: Pager)
fun onListError(error: String)
fun onDetailSuccess(detail: Visitor)
fun onDetailError(error: String)
}

+ 0
- 2
app/src/main/java/com/yzx/escreen/utils/KotlinX.kt Прегледај датотеку

@@ -2,7 +2,6 @@ package com.yzx.escreen.utils

import android.app.Dialog
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import com.blankj.utilcode.util.TimeUtils
import com.bumptech.glide.Glide
@@ -106,6 +105,5 @@ fun SimpleDateFormat.zhCn():SimpleDateFormat{







+ 5
- 5
app/src/main/java/com/yzx/escreen/widget/ChangeDialog.kt Прегледај датотеку

@@ -14,14 +14,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yzx.escreen.R
import com.yzx.escreen.adapter.ChangeDialogStepAdapter
import com.yzx.escreen.adapter.HomeDialogStepAdapter
import com.yzx.escreen.model.StuChange
import com.yzx.escreen.model.StuLeave
import com.yzx.escreen.utils.durationStr
import com.yzx.escreen.model.ViewImage
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toDay
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.dialog_leave.view.*
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.find
import org.jetbrains.anko.textColor

@@ -68,6 +65,9 @@ class ChangeDialog(
find<View>(R.id.face_empty).visibility = View.VISIBLE
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))
}
find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
find<TextView>(R.id.leave_request_type_name).text = detail.status_change_type_name
find<TextView>(R.id.statusName).text = when (detail.status) {


+ 5
- 0
app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt Прегледај датотеку

@@ -14,10 +14,12 @@ import androidx.recyclerview.widget.RecyclerView
import com.yzx.escreen.R
import com.yzx.escreen.adapter.HomeDialogStepAdapter
import com.yzx.escreen.model.StuLeave
import com.yzx.escreen.model.ViewImage
import com.yzx.escreen.utils.durationStr
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.dialog_leave.view.*
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.find

/**
@@ -62,6 +64,9 @@ class LeaveDialog(
find<View>(R.id.face_empty).visibility = View.VISIBLE
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))
}
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
find<TextView>(R.id.leave_duration_str).text =


+ 56
- 0
app/src/main/java/com/yzx/escreen/widget/ViewImageDialog.kt Прегледај датотеку

@@ -0,0 +1,56 @@
package com.yzx.escreen.widget

import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.yzx.escreen.R
import com.yzx.escreen.model.ViewImage
import com.yzx.escreen.utils.setSrc
import kotlinx.android.synthetic.main.dialog_view_img.view.*
import org.jetbrains.anko.find

/**
* 展示大图
*/
class ViewImageDialog(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0
) :
ConstraintLayout(context, attrs, defStyleAttr, defStyleRes) {

var onCloseClick: (view: View) -> Unit = {}
init {
val view = LayoutInflater.from(context).inflate(R.layout.dialog_view_img, null)
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
layoutParams.matchConstraintPercentWidth = 0.8f
layoutParams.topToTop = LayoutParams.PARENT_ID
layoutParams.startToStart = LayoutParams.PARENT_ID
layoutParams.endToEnd = LayoutParams.PARENT_ID
layoutParams.bottomToBottom = LayoutParams.PARENT_ID
view.layoutParams = layoutParams
addView(view)
background = ContextCompat.getDrawable(context, R.color.dialog_bg)
setOnClickListener { } //阻止事件冒泡


}

@SuppressLint("SetTextI18n")
fun setData(viewImg: ViewImage) {
// photo_view.setSrc(viewImg.identity,viewImg.key)
// photo_view.setImageResource(R.mipmap.empty)
val img = find<ImageView>(R.id.photo_view)
img.setSrc(viewImg.identity,viewImg.key)
// img.setSrc("https://fileb.oa.qbjjyyun.net/edufile/imageView?uniqueKey=125a4c591c91fbb9f186da8e54cd31aa")
photo_view.setOnClickListener {
onCloseClick(this)
}
}
}

+ 142
- 0
app/src/main/java/com/yzx/escreen/widget/VisitorDialog.kt Прегледај датотеку

@@ -0,0 +1,142 @@
package com.yzx.escreen.widget

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yzx.escreen.R
import com.yzx.escreen.adapter.VisitorDialogStepAdapter
import com.yzx.escreen.model.ViewImage
import com.yzx.escreen.model.Visitor
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toDay
import com.yzx.escreen.utils.toTime
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.find
import org.jetbrains.anko.textColor

/**
* 展示访客信息
*/
class VisitorDialog(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0
) :
ConstraintLayout(context, attrs, defStyleAttr, defStyleRes) {

val adapter: VisitorDialogStepAdapter by lazy {
VisitorDialogStepAdapter(mutableListOf())
}
var onCloseClick: (view:View) -> Unit = {}

init {
val view = LayoutInflater.from(context).inflate(R.layout.dialog_visitor, null)
val layoutParams = LayoutParams(0, LayoutParams.WRAP_CONTENT)
layoutParams.matchConstraintPercentWidth = 0.8f
layoutParams.topToTop = LayoutParams.PARENT_ID
layoutParams.startToStart = LayoutParams.PARENT_ID
layoutParams.endToEnd = LayoutParams.PARENT_ID
layoutParams.bottomToBottom = LayoutParams.PARENT_ID
view.layoutParams = layoutParams
addView(view)
background = ContextCompat.getDrawable(context, R.color.dialog_bg)
setOnClickListener { } //阻止事件冒泡
}

@SuppressLint("SetTextI18n")
fun setData(detail: Visitor) {
//处理弹窗显示
find<TextView>(R.id.userName).text = "${detail.user_name} ${detail.user_phone}"
find<TextView>(R.id.id_card_num).text = "${detail.card_no}"
if (detail.face_key.isNotEmpty()) {
val img = find<ImageView>(R.id.face_img)
img.setSrc(detail.face_identity, detail.face_key)
img.visibility = View.VISIBLE
find<View>(R.id.face_empty).visibility = View.GONE
} else {
find<View>(R.id.face_empty).visibility = View.VISIBLE
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))
}
if (detail.health_code_key.isNotEmpty()) {
val img = find<ImageView>(R.id.health_img)
img.setSrc(detail.health_code_identity, detail.health_code_key)
img.visibility = View.VISIBLE
find<View>(R.id.health_empty).visibility = View.GONE
} else {
find<View>(R.id.health_empty).visibility = View.VISIBLE
find<View>(R.id.health_img).visibility = View.GONE
}
find<ImageView>(R.id.health_img).setOnClickListener {
EventBus.getDefault().post(ViewImage(detail.id,detail.health_code_identity,detail.health_code_key))
}
if (detail.trip_code_key.isNotEmpty()) {
val img = find<ImageView>(R.id.trip_img)
img.setSrc(detail.trip_code_identity, detail.trip_code_key)
img.visibility = View.VISIBLE
find<View>(R.id.trip_empty).visibility = View.GONE
} else {
find<View>(R.id.trip_empty).visibility = View.VISIBLE
find<View>(R.id.trip_img).visibility = View.GONE
}
find<ImageView>(R.id.trip_img).setOnClickListener {
EventBus.getDefault().post(ViewImage(detail.id,detail.trip_code_identity,detail.trip_code_key))
}
find<TextView>(R.id.reception_user).text = "${detail.reception_user}"
find<TextView>(R.id.visit_reason).text = "${detail.visit_reason}"
find<TextView>(R.id.is_drive).text = when (detail.is_drive) {
1 -> "是"
0 -> "否"
else -> "--"
}
if(detail.is_drive==1){
find<View>(R.id.carLayout).visibility = View.VISIBLE
find<View>(R.id.doorLayout).visibility = View.GONE
find<TextView>(R.id.license_plate).text = "${detail.license_plate}"
find<TextView>(R.id.car_in_time).text = "${detail.car_in_time.toTime()} - ${detail.car_out_time.toTime()}"
}else{
find<View>(R.id.carLayout).visibility = View.GONE
find<View>(R.id.doorLayout).visibility = View.VISIBLE
find<TextView>(R.id.audit_status_str).text = when (detail.audit_status) {
0 -> "待审核"
1 -> "可通行"
2 -> "审核拒绝"
-1 -> "已失效"
else -> "--"
}
find<TextView>(R.id.audit_status_str).textColor = when (detail.audit_status) {
0 -> Color.parseColor("#333333")
1 -> Color.parseColor("#3c7ef6")
2 -> Color.parseColor("#ff4040")
-1 -> Color.parseColor("#999999")
else -> Color.parseColor("#333333")
}
find<TextView>(R.id.start_time).text = "${detail.start_time.toDay()} - ${detail.end_time.toDay()} 可进出${detail.in_out_num}次"
}

find<ImageView>(R.id.statusImg).setSrc(detail.getStatusImg())

find<RecyclerView>(R.id.stepRecycler)
val recyclerView = find<RecyclerView>(R.id.stepRecycler)
recyclerView.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
recyclerView.adapter = adapter
adapter.setList(detail.getStep())

find<View>(R.id.closeBtn).setOnClickListener {
onCloseClick(this)
}
}
}

+ 16
- 0
app/src/main/res/layout/dialog_view_img.xml Прегледај датотеку

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/photo_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"/>

</FrameLayout>

+ 378
- 0
app/src/main/res/layout/dialog_visitor.xml Прегледај датотеку

@@ -0,0 +1,378 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="1400dp"
android:orientation="vertical"
app:qmui_backgroundColor="@color/white"
app:qmui_radius="@dimen/d_15">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:qmui_backgroundColor="@color/colorPrimary"
app:qmui_radiusTopLeft="@dimen/d_15"
app:qmui_radiusTopRight="@dimen/d_15">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/d_28"
android:text="访客详情"
android:textColor="@color/white"
android:textSize="@dimen/sp20"
android:textStyle="bold" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/d_20"
android:orientation="horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<ImageView
android:id="@+id/statusImg"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="40dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout style="@style/visitor_dialog_row"
android:gravity="center_vertical">

<View
android:layout_width="90dp"
android:layout_height="@dimen/d_20"/>

<View
android:layout_width="4dp"
android:layout_height="@dimen/d_20"
android:background="@color/colorPrimary"/>

<TextView
style="@style/leave_dialog_title"
android:paddingStart="6dp"
android:text="访客信息" />

</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="姓名电话" />

<TextView
android:id="@+id/userName"
style="@style/leave_dialog_left_content"
android:text="颜小华 18780170404" />
</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="身份信息" />

<TextView
android:id="@+id/id_card_num"
style="@style/leave_dialog_left_content"
android:text="颜小华 18780170404" />
</LinearLayout>

<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:layout_width="100dp"
android:text="" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="人脸"
android:textSize="@dimen/sp20"/>
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/face_img"
android:layout_width="180dp"
android:layout_height="222dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />
<TextView
android:id="@+id/face_empty"
android:layout_width="180dp"
android:layout_height="222dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未设置"
android:textColor="@color/white"
app:qmui_corner_radius="@dimen/d_5"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="@dimen/d_20">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="健康码"
android:textSize="@dimen/sp20"/>
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/health_img"
android:layout_width="180dp"
android:layout_height="222dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />
<TextView
android:id="@+id/health_empty"
android:layout_width="180dp"
android:layout_height="222dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未上传"
android:textColor="@color/white"
app:qmui_corner_radius="@dimen/d_5"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="@dimen/d_20">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="行程码"
android:textSize="@dimen/sp20"/>
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/trip_img"
android:layout_width="180dp"
android:layout_height="222dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />
<TextView
android:id="@+id/trip_empty"
android:layout_width="180dp"
android:layout_height="222dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未上传"
android:textColor="@color/white"
app:qmui_corner_radius="@dimen/d_5"
android:visibility="gone"/>
</LinearLayout>


</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row"
android:gravity="center_vertical">

<View
android:layout_width="90dp"
android:layout_height="@dimen/d_20"/>

<View
android:layout_width="4dp"
android:layout_height="@dimen/d_20"
android:background="@color/colorPrimary"/>

<TextView
style="@style/leave_dialog_title"
android:paddingStart="6dp"
android:text="来访信息" />

</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="接待人" />

<TextView
android:id="@+id/reception_user"
style="@style/leave_dialog_left_content"
android:text="颜小华" />
</LinearLayout>

<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="是否驾车" />

<TextView
android:id="@+id/is_drive"
style="@style/leave_dialog_left_content"
android:text="颜小华" />
</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="来访事宜" />

<TextView
android:id="@+id/visit_reason"
style="@style/leave_dialog_left_content"
android:text="颜小华" />
</LinearLayout>
<LinearLayout
android:id="@+id/carLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout style="@style/visitor_dialog_row"
android:gravity="center_vertical">

<View
android:layout_width="90dp"
android:layout_height="@dimen/d_20"/>

<View
android:layout_width="4dp"
android:layout_height="@dimen/d_20"
android:background="@color/colorPrimary"/>

<TextView
style="@style/leave_dialog_title"
android:paddingStart="6dp"
android:text="车辆信息" />

</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="车牌号" />

<TextView
android:id="@+id/license_plate"
style="@style/leave_dialog_left_content"
android:textColor="@color/colorPrimary"
tools:text="2022年4月21日15:38:15" />
</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="进出时间" />

<TextView
android:id="@+id/car_in_time"
style="@style/leave_dialog_left_content"
android:textColor="@color/colorPrimary"
tools:text="2022年4月21日15:38:15" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/doorLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout style="@style/visitor_dialog_row"
android:gravity="center_vertical">

<View
android:layout_width="90dp"
android:layout_height="@dimen/d_20"/>

<View
android:layout_width="4dp"
android:layout_height="@dimen/d_20"
android:background="@color/colorPrimary"/>

<TextView
style="@style/leave_dialog_title"
android:paddingStart="6dp"
android:text="进出信息" />

</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="门禁状态" />

<TextView
android:id="@+id/audit_status_str"
style="@style/leave_dialog_left_content"
android:textColor="@color/colorPrimary"
tools:text="2022年4月21日15:38:15" />
</LinearLayout>
<LinearLayout style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="可进出时间" />

<TextView
android:id="@+id/start_time"
style="@style/leave_dialog_left_content"
android:textColor="@color/colorPrimary"
tools:text="2022年4月21日15:38:15" />
</LinearLayout>
</LinearLayout>

</LinearLayout>
</RelativeLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="700dp"
android:layout_marginStart="50dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="@dimen/dp_40">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/stepRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:itemCount="4"
tools:listitem="@layout/layout_visitor_step" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

<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:layout_marginBottom="@dimen/d_20"
android:padding="@dimen/d_10"
android:text="关闭"
android:textColor="@color/black"
android:textSize="@dimen/sp20"
app:qmui_borderColor="@color/gray"
app:qmui_radius="@dimen/d_5" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
</FrameLayout>

+ 10
- 1
app/src/main/res/layout/fragment_change.xml Прегледај датотеку

@@ -137,7 +137,7 @@
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/d_10"
android:gravity="center"
android:text="自动弹出请假单"
android:text="自动弹出异动单"
android:textColor="#53a051" />
</androidx.appcompat.widget.LinearLayoutCompat>

@@ -231,6 +231,15 @@
android:text="共0条数据"
android:textSize="@dimen/sp18" />

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

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


+ 9
- 0
app/src/main/res/layout/fragment_home.xml Прегледај датотеку

@@ -258,6 +258,15 @@
android:text="共0条数据"
android:textSize="@dimen/sp18" />

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

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


+ 290
- 0
app/src/main/res/layout/fragment_visitor.xml Прегледај датотеку

@@ -0,0 +1,290 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/backgroundColor"
android:orientation="vertical"
tools:context=".fragment.ChangeFragment">

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

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="访客管理"
android:textColor="@color/black"
android:textSize="@dimen/d_28"
android:textStyle="bold" />

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

<com.yzx.escreen.widget.TimeView
android:id="@+id/timeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.appcompat.widget.LinearLayoutCompat>


<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/filterLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/dp_40"
android:paddingVertical="30dp">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/d_10"
android:paddingEnd="@dimen/dp_10"
app:qmui_backgroundColor="@color/white"
app:qmui_borderColor="#dcdee0"
app:qmui_borderWidth="1px"
app:qmui_radius="@dimen/d_30">

<androidx.appcompat.widget.AppCompatImageView
android:layout_width="@dimen/d_25"
android:layout_height="@dimen/d_25"
android:src="@mipmap/search" />

<EditText
android:id="@+id/keywordInput"
android:layout_width="300dp"
android:layout_height="60dp"
android:background="@color/transparent"
android:hint="输入访客姓名"
android:imeOptions="actionSearch"
android:maxLength="5"
android:padding="@dimen/d_5"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:singleLine="true"
android:textColorHint="#8e8e8e"
android:textSize="@dimen/sp20" />

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/clearBtn"
android:layout_width="@dimen/d_25"
android:layout_height="@dimen/d_25"
android:src="@mipmap/ic_clear"
android:visibility="invisible" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/allBtn"
style="@style/home_status_btn"
android:layout_marginStart="50dp"
android:text="全部"
android:textColor="@color/white"
app:qmui_backgroundColor="#3ca0e9"
app:qmui_borderColor="@color/colorPrimary" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status1Btn"
style="@style/home_status_btn"
android:text="待审核"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status2Btn"
style="@style/home_status_btn"
android:text="可通行"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status3Btn"
style="@style/home_status_btn"
android:text="审核拒绝"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status4Btn"
style="@style/home_status_btn"
android:text="已失效"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

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

<Switch
android:id="@+id/switchBtn"
android:layout_width="48dp"
android:layout_height="@dimen/d_28"
android:checked="true"
android:thumb="@drawable/switch_ios_thumb"
android:track="@drawable/switch_ios_track_selector"
tools:ignore="UseSwitchCompatOrMaterialXml"
android:visibility="gone"/>

<TextView
android:id="@+id/switchBtnTxt"
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:textColor="#53a051"
android:visibility="gone"/>
</androidx.appcompat.widget.LinearLayoutCompat>

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

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/d_20"
android:paddingBottom="@dimen/d_20">

<TextView
style="@style/table_header"
android:layout_weight="1.5"
android:paddingStart="@dimen/dp_40"
android:text="姓名" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="人脸" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="健康码" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="行程码" />


<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="是否驾车" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="接待人" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="状态" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="申请时间" />
</androidx.appcompat.widget.LinearLayoutCompat>

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

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="5"
tools:listitem="@layout/layout_visitor_table" />

<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/totalTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="共0条数据"
android:textSize="@dimen/sp18" />

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

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

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

<TextView
android:id="@+id/pageTv"
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/nextTxtBtn"
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>
</LinearLayout>

+ 74
- 0
app/src/main/res/layout/layout_visitor_step.xml Прегледај датотеку

@@ -0,0 +1,74 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">

<View
android:id="@+id/line1"
android:layout_width="1px"
android:layout_height="8dp"
android:background="@color/gray_1" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout
android:layout_width="@dimen/d_6"
android:layout_height="@dimen/d_6"
app:qmui_backgroundColor="#3ca0e9"
app:qmui_radius="@dimen/d_3" />

<View
android:id="@+id/line2"
android:layout_width="1px"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/gray_1" />
</LinearLayout>

<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/d_20"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_40">

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/addUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp20"
android:textStyle="bold"
tools:text="王大仙" />
</androidx.appcompat.widget.LinearLayoutCompat>

<TextView
android:id="@+id/approvalComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/sp20"
tools:text="审批人:颜小华。允许出校,请放行" />
<TextView
android:id="@+id/approvalTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/sp20"
tools:text="审批人:颜小华。允许出校,请放行" />

</LinearLayout>
</LinearLayout>

+ 126
- 0
app/src/main/res/layout/layout_visitor_table.xml Прегледај датотеку

@@ -0,0 +1,126 @@
<?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="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/d_12"
android:paddingBottom="@dimen/d_12">

<TextView
android:id="@+id/userName"
style="@style/table_cell"
android:layout_weight="1.5"
android:paddingStart="@dimen/dp_40"
android:text="请假学生" />

<FrameLayout
style="@style/table_cell"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/faceImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/faceEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
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="@dimen/d_5" />
</FrameLayout>


<FrameLayout
style="@style/table_cell"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/healthCodeImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/healthCodeEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
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="@dimen/d_5" />
</FrameLayout>

<FrameLayout
style="@style/table_cell"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/tripCodeImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/tripCodeEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
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="@dimen/d_5" />
</FrameLayout>

<TextView
android:id="@+id/isDrive"
style="@style/table_cell"
android:layout_weight="1"
android:text="是否驾车" />

<TextView
android:id="@+id/receptionUser"
style="@style/table_cell"
android:layout_weight="1"
android:text="接待人"/>

<TextView
android:id="@+id/statusName"
style="@style/table_cell"
android:layout_weight="1"
android:text="状态" />
<TextView
android:id="@+id/applyTime"
style="@style/table_cell"
android:layout_weight="1"
android:text="申请时间" />

</androidx.appcompat.widget.LinearLayoutCompat>

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

BIN
app/src/main/res/mipmap-mdpi/visitor_select.png Прегледај датотеку

Before After
Width: 53  |  Height: 57  |  Size: 1.8 KiB

BIN
app/src/main/res/mipmap-mdpi/visitor_unselect.png Прегледај датотеку

Before After
Width: 50  |  Height: 53  |  Size: 1.6 KiB

+ 4
- 0
app/src/main/res/values/styles.xml Прегледај датотеку

@@ -186,6 +186,10 @@
<item name="android:textSize">@dimen/sp20</item>
</style>

<style name="visitor_dialog_row" parent="leave_dialog_row">
<item name="android:layout_marginTop">@dimen/d_20</item>
</style>

<style name="my_info_title">
<item name="android:layout_width">200dp</item>
<item name="android:layout_height">wrap_content</item>


Loading…
Откажи
Сачувај