| @@ -19,8 +19,8 @@ android { | |||
| // minSdkVersion 26 | |||
| minSdkVersion 21 | |||
| targetSdkVersion 25 | |||
| versionCode 30005 | |||
| versionName "3.0.5" | |||
| versionCode 30007 | |||
| versionName "3.0.7" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| // ndk { | |||
| @@ -87,11 +87,11 @@ android { | |||
| shrinkResources false | |||
| // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | |||
| // buildConfigField "String", "M_URL", '"http://192.168.69.112:8098"' | |||
| buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"' | |||
| // buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"' | |||
| buildConfigField "String", "OA_URL", '"https://oa.live.educlouddata.com"' | |||
| // buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"' | |||
| buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"' | |||
| // buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | |||
| buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | |||
| buildConfigField "String", "APP_NAME", '"一体化平台(开发)"' | |||
| buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | |||
| // buildConfigField "String", "WS_URL", '"ws://192.168.69.114:9801/"' | |||
| @@ -36,7 +36,7 @@ import com.yzx.escreen.config.Config | |||
| 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.SettingFragment | |||
| import com.yzx.escreen.fragment.VisitorFragment | |||
| import com.yzx.escreen.model.* | |||
| import com.yzx.escreen.presenter.MainPresenter | |||
| @@ -146,7 +146,8 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||
| 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)) | |||
| // tabData.add(TabEntity("我的", R.mipmap.my_select, R.mipmap.my_unselect)) | |||
| tabData.add(TabEntity("设置", R.mipmap.setting_select, R.mipmap.setting)) | |||
| tabLayout.setTabData(tabData) | |||
| viewPager2.adapter = HomePagerAdapter(this) | |||
| @@ -398,6 +399,13 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||
| mPresenter?.getLeaveShowIds("${detail.ids}") | |||
| } | |||
| //请假消息 | |||
| @Subscribe(threadMode = ThreadMode.MAIN) | |||
| fun onMessageEvent(detail: UserVersionCheck) { | |||
| LogUtils.d("WebSocketClient--onMessageEvent",detail) | |||
| checkVersion(true) | |||
| } | |||
| private fun wsHeart() { | |||
| @@ -651,7 +659,7 @@ class HomePagerAdapter(act: AppCompatActivity) : FragmentStateAdapter(act) { | |||
| } | |||
| 3 -> { | |||
| return MyFragment.getNewInstance() | |||
| return SettingFragment.getNewInstance() | |||
| } | |||
| } | |||
| return HomeFragment() | |||
| @@ -39,6 +39,7 @@ class LoginActivity : BaseActivity<LoginPresenter>(), LoginView { | |||
| } | |||
| private var mTicket = "" | |||
| private var isPageShow = true | |||
| override val inflateId: Int | |||
| get() = R.layout.activity_login | |||
| @@ -164,14 +165,30 @@ class LoginActivity : BaseActivity<LoginPresenter>(), LoginView { | |||
| override fun onDestroy() { | |||
| qrCodeImg?.apply { | |||
| removeCallbacks(null) | |||
| removeCallbacks(mRun) | |||
| } | |||
| super.onDestroy() | |||
| } | |||
| override fun onResume() { | |||
| super.onResume() | |||
| this.isPageShow = true | |||
| } | |||
| override fun onStop() { | |||
| super.onStop() | |||
| this.isPageShow = false | |||
| } | |||
| private var mBindDialog: QMUIDialog? = null | |||
| private var mOverTimeDialog: QMUIDialog? = null | |||
| private var mRun = Runnable { | |||
| if(isPageShow){ | |||
| mPresenter?.loginQuery(mTicket) | |||
| } | |||
| } | |||
| override fun onLoginQuerySuccess(user: BaseUser, code: Int) { | |||
| when (code) { | |||
| 0 -> { | |||
| @@ -196,15 +213,11 @@ class LoginActivity : BaseActivity<LoginPresenter>(), LoginView { | |||
| } else if (!mBindDialog!!.isShowing) { | |||
| mBindDialog?.show() | |||
| } | |||
| qrCodeImg.postDelayed({ | |||
| mPresenter?.loginQuery(mTicket) | |||
| }, 1000) | |||
| qrCodeImg.postDelayed(mRun, 1000) | |||
| } | |||
| 452 -> { | |||
| qrCodeImg.postDelayed({ | |||
| mPresenter?.loginQuery(mTicket) | |||
| }, 1000) | |||
| qrCodeImg.postDelayed(mRun, 1000) | |||
| } | |||
| else -> { | |||
| @@ -0,0 +1,40 @@ | |||
| package com.yzx.escreen.adapter | |||
| import android.annotation.SuppressLint | |||
| 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.Device | |||
| import kotlinx.android.synthetic.main.layout_device_item.view.* | |||
| class DeviceListAdapter(list: MutableList<Device>) : | |||
| BaseQuickAdapter<Device, BaseViewHolder>(R.layout.layout_device_item, list) { | |||
| init { | |||
| addChildClickViewIds(R.id.actionOpen, R.id.actionNormal) | |||
| } | |||
| @SuppressLint("SetTextI18n") | |||
| override fun convert(holder: BaseViewHolder, item: Device) { | |||
| holder.itemView.deviceName.text = item.name | |||
| holder.itemView.deviceTypeName.text = "进出校考勤设备" | |||
| holder.itemView.deviceTagName.text = if (item.type == 1) { | |||
| "进闸设备" | |||
| } else { | |||
| "出闸设备" | |||
| } | |||
| holder.itemView.deviceName.isChecked = item.isChecked | |||
| holder.itemView.deviceName.setOnCheckedChangeListener { _, isChecked -> | |||
| item.isChecked = isChecked | |||
| } | |||
| holder.itemView.bottomLine.visibility = if (holder.adapterPosition == data.size - 1) { | |||
| View.GONE | |||
| } else { | |||
| View.VISIBLE | |||
| } | |||
| } | |||
| } | |||
| @@ -39,4 +39,10 @@ object YzxInterface { | |||
| */ | |||
| const val INTERFACE_ACCESS_CONTROL_GET_FACE_LIST= "/parent/entranceGuard/getEntranceGuardFaceList" // 获取访客人脸信息列表 | |||
| const val INTERFACE_ACCESS_CONTROL_GET_FACE_INFO_DETAIL= "/parent/entranceGuard/getEntranceGuardFaceById" // 访客信息 | |||
| /** | |||
| * 设置门禁 | |||
| */ | |||
| const val INTERFACE_ACCESS_CONTROL_GET_FACE_DEVICE_LIST= "/parent/entranceGuard/getAccessSchoolFaceDeviceList" // 门禁管理-门禁设备列表 | |||
| const val INTERFACE_ACCESS_CONTROL_POST_DOOR_RELAY_MODE= "/parent/entranceGuard/setDoorRelayMode" // 门禁管理-设置门禁模式 | |||
| } | |||
| @@ -0,0 +1,403 @@ | |||
| package com.yzx.escreen.fragment | |||
| import android.graphics.Color | |||
| import android.text.InputType | |||
| import android.view.View | |||
| import androidx.recyclerview.widget.LinearLayoutManager | |||
| import com.blankj.utilcode.util.KeyboardUtils | |||
| import com.blankj.utilcode.util.LogUtils | |||
| import com.blankj.utilcode.util.NetworkUtils | |||
| import com.qmuiteam.qmui.widget.dialog.QMUIDialog | |||
| import com.qmuiteam.qmui.widget.dialog.QMUITipDialog | |||
| import com.qmuiteam.qmui.widget.dialog.QMUITipDialog.Builder.ICON_TYPE_FAIL | |||
| import com.yzx.escreen.R | |||
| import com.yzx.escreen.activity.LoginActivity | |||
| import com.yzx.escreen.adapter.DeviceListAdapter | |||
| import com.yzx.escreen.fragment.base.BaseFragment | |||
| import com.yzx.escreen.model.Device | |||
| import com.yzx.escreen.model.Pager | |||
| import com.yzx.escreen.model.TeacherInfo | |||
| import com.yzx.escreen.model.TimeShow | |||
| import com.yzx.escreen.model.User | |||
| import com.yzx.escreen.model.UserVersionCheck | |||
| import com.yzx.escreen.presenter.SettingPresenter | |||
| import com.yzx.escreen.presenter.SettingView | |||
| import com.yzx.escreen.utils.hideNavigationBar | |||
| import kotlinx.android.synthetic.main.fragment_setting.btnNormal | |||
| import kotlinx.android.synthetic.main.fragment_setting.btnOpen | |||
| import kotlinx.android.synthetic.main.fragment_setting.btnRefresh | |||
| import kotlinx.android.synthetic.main.fragment_setting.checkAll | |||
| import kotlinx.android.synthetic.main.fragment_setting.checkVersion | |||
| import kotlinx.android.synthetic.main.fragment_setting.goPageOne | |||
| import kotlinx.android.synthetic.main.fragment_setting.loadingLayout | |||
| import kotlinx.android.synthetic.main.fragment_setting.nextTxtBtn | |||
| import kotlinx.android.synthetic.main.fragment_setting.pageTv | |||
| import kotlinx.android.synthetic.main.fragment_setting.preTxtBtn | |||
| import kotlinx.android.synthetic.main.fragment_setting.recyclerView | |||
| import kotlinx.android.synthetic.main.fragment_setting.sysExitBtn | |||
| import kotlinx.android.synthetic.main.fragment_setting.totalTv | |||
| import kotlinx.android.synthetic.main.fragment_setting.userNameBox | |||
| import kotlinx.android.synthetic.main.fragment_setting.userNameTv | |||
| import kotlinx.android.synthetic.main.layout_loading.view.QMUIEmptyView | |||
| import org.greenrobot.eventbus.EventBus | |||
| import org.greenrobot.eventbus.Subscribe | |||
| import org.greenrobot.eventbus.ThreadMode | |||
| import org.jetbrains.anko.support.v4.toast | |||
| import org.jetbrains.anko.textColor | |||
| import kotlin.system.exitProcess | |||
| class SettingFragment : BaseFragment<SettingPresenter>(), SettingView { | |||
| companion object { | |||
| @JvmStatic | |||
| fun getNewInstance() = | |||
| SettingFragment() | |||
| } | |||
| private var count = 0 | |||
| private val run = Runnable { | |||
| count = 0 | |||
| } | |||
| private var isLoading = false | |||
| private var mPager = Pager() | |||
| var list = mutableListOf<Device>() | |||
| private var isRefresh = false | |||
| private val mAdapter: DeviceListAdapter by lazy { | |||
| val list = mutableListOf<Device>() | |||
| DeviceListAdapter(list) | |||
| } | |||
| override val inflateId: Int | |||
| get() = R.layout.fragment_setting | |||
| override fun initView() { | |||
| sysExitBtn.setOnClickListener { | |||
| count++ | |||
| sysExitBtn.removeCallbacks(run) | |||
| sysExitBtn.postDelayed(run, 1000) | |||
| if (count >= 5) { | |||
| showExitDialog() | |||
| } | |||
| } | |||
| recyclerView.layoutManager = | |||
| LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) | |||
| recyclerView.adapter = mAdapter | |||
| mAdapter.setOnItemChildClickListener { adapter, view, position -> | |||
| val item = mAdapter.getItem(position) | |||
| val idList = mutableListOf<Int>() | |||
| idList.add(item.id) | |||
| LogUtils.d("deviceids",idList.joinToString(",") ) | |||
| when (view.id) { | |||
| R.id.actionNormal -> { | |||
| showActionDialog(idList, 0) | |||
| } | |||
| R.id.actionOpen -> { | |||
| showActionDialog(idList, 1) | |||
| } | |||
| } | |||
| } | |||
| preTxtBtn.setOnClickListener { pre() } | |||
| nextTxtBtn.setOnClickListener { next() } | |||
| btnRefresh.setOnClickListener { | |||
| isRefresh = true | |||
| showLayoutLoading() | |||
| initData() | |||
| } | |||
| btnOpen.setOnClickListener { | |||
| val newList = mAdapter.data.filter { it.isChecked } | |||
| if(newList.isEmpty()){ | |||
| showDialogToast("请先选择设备", icon = ICON_TYPE_FAIL) | |||
| return@setOnClickListener | |||
| } | |||
| val idList = newList.map { it.id } | |||
| showActionDialog(idList.toMutableList(),1) | |||
| } | |||
| btnNormal.setOnClickListener { | |||
| val newList = mAdapter.data.filter { it.isChecked } | |||
| if(newList.isEmpty()){ | |||
| showDialogToast("请先选择设备", icon = ICON_TYPE_FAIL) | |||
| return@setOnClickListener | |||
| } | |||
| val idList = newList.map { it.id } | |||
| showActionDialog(idList.toMutableList(),0) | |||
| } | |||
| checkAll.setOnCheckedChangeListener { _, isChecked -> | |||
| if(isChecked){ | |||
| mAdapter.data.forEach { it.isChecked = true } | |||
| mAdapter.notifyDataSetChanged() | |||
| }else{ | |||
| mAdapter.data.forEach { it.isChecked = false } | |||
| mAdapter.notifyDataSetChanged() | |||
| } | |||
| } | |||
| userNameBox.setOnClickListener { | |||
| logoutDialog() | |||
| } | |||
| checkVersion.setOnClickListener { | |||
| EventBus.getDefault().post(UserVersionCheck()) | |||
| } | |||
| } | |||
| private fun logoutDialog(){ | |||
| val tipDialog = QMUIDialog.MessageDialogBuilder(activity) | |||
| .setTitle("温馨提示") | |||
| .setMessage("是否确定退出登录?") | |||
| .addAction("取消") { dialog, index -> | |||
| dialog.dismiss() | |||
| } | |||
| .addAction("确定") { dialog, index -> | |||
| dialog.dismiss() | |||
| activity?.apply { | |||
| User.clearUserInfo() | |||
| LoginActivity.active(this) | |||
| finish() | |||
| } | |||
| } | |||
| .create() | |||
| tipDialog.show() | |||
| } | |||
| private fun showActionDialog(idList: MutableList<Int>, mode: Int) { | |||
| val tipDialog = QMUIDialog.MessageDialogBuilder(activity) | |||
| .setTitle("温馨提示") | |||
| .setMessage( | |||
| if (mode == 1) { | |||
| "是否确定将设备设置为常开?" | |||
| } else { | |||
| "是否确定将设备设置为标准状态?" | |||
| } | |||
| ) | |||
| .addAction("取消") { dialog, index -> | |||
| dialog.dismiss() | |||
| } | |||
| .addAction("确定") { dialog, index -> | |||
| dialog.dismiss() | |||
| showLoading("操作中...") | |||
| mPresenter?.setDoorRelayMode(idList,mode) | |||
| } | |||
| .create() | |||
| tipDialog.show() | |||
| } | |||
| private fun showLayoutLoading() { | |||
| loadingLayout.visibility = View.VISIBLE | |||
| } | |||
| private fun hideLayoutLoading() { | |||
| loadingLayout.visibility = View.GONE | |||
| } | |||
| private fun refreshData() { | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| isLoading = true | |||
| mPresenter?.getDeviceList(mPager.page_no) | |||
| } | |||
| private fun pre() { | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| if (mPager.page_no <= 1) { | |||
| } else { | |||
| isLoading = true | |||
| showLayoutLoading() | |||
| mPresenter?.getDeviceList(mPager.page_no - 1) | |||
| } | |||
| } | |||
| private fun next() { | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| if (mPager.page_no >= mPager.total_pages) { | |||
| } else { | |||
| isLoading = true | |||
| showLayoutLoading() | |||
| mPresenter?.getDeviceList(mPager.page_no + 1) | |||
| } | |||
| } | |||
| private fun showExitDialog() { | |||
| val builder = QMUIDialog.EditTextDialogBuilder(activity) | |||
| builder.setPlaceholder("输入密码") | |||
| .setTitle("请输入密码") | |||
| .setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD or InputType.TYPE_CLASS_NUMBER) | |||
| .addAction( | |||
| "取消" | |||
| ) { dialog, index -> | |||
| KeyboardUtils.hideSoftInput(builder.editText) | |||
| dialog?.dismiss() | |||
| } | |||
| .addAction( | |||
| "确定" | |||
| ) { dialog, index -> | |||
| val text = builder.editText.text | |||
| LogUtils.d(text) | |||
| LogUtils.d("112233".equals(text)) | |||
| if ("112233" == text.toString()) { | |||
| activity?.finish() | |||
| exitProcess(0) | |||
| } else { | |||
| // ToastUtils.showShort("密码不正确") | |||
| showPwdErrorTip() | |||
| } | |||
| } | |||
| .setCancelable(false) | |||
| .setCanceledOnTouchOutside(false) | |||
| val dialog = builder.show() | |||
| dialog.hideNavigationBar() | |||
| } | |||
| private fun showPwdErrorTip() { | |||
| val tipDialog = QMUITipDialog.Builder(activity) | |||
| .setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL) | |||
| .setTipWord("密码错误") | |||
| .create() | |||
| tipDialog.show() | |||
| tipDialog.hideNavigationBar() | |||
| sysExitBtn.postDelayed({ | |||
| tipDialog.dismiss() | |||
| }, 1500) | |||
| } | |||
| override fun initData() { | |||
| mPresenter?.getDeviceList(1) | |||
| mPager.page_no = 1 | |||
| if (NetworkUtils.isConnected()) { | |||
| showEmpty(1) | |||
| isLoading = true | |||
| mPresenter?.getDeviceList(mPager.page_no) | |||
| } else { | |||
| showEmpty(2) | |||
| } | |||
| } | |||
| override fun onResume() { | |||
| super.onResume() | |||
| mPresenter?.getTeacherInfo(User.getUser().user_id) | |||
| } | |||
| override fun initPresenter(): SettingPresenter = SettingPresenter(this) | |||
| override fun onSetSuccess() { | |||
| hideLoading() | |||
| showDialogToast("设置成功!") | |||
| } | |||
| override fun onSetError(error: String) { | |||
| hideLoading() | |||
| showDialogToast(error,icon = QMUITipDialog.Builder.ICON_TYPE_FAIL) | |||
| } | |||
| override fun onStop() { | |||
| super.onStop() | |||
| EventBus.getDefault().unregister(this) | |||
| } | |||
| override fun onStart() { | |||
| super.onStart() | |||
| EventBus.getDefault().register(this) | |||
| } | |||
| //接收消息 | |||
| @Subscribe(threadMode = ThreadMode.MAIN) | |||
| fun onMessageEvent(event: TimeShow) { | |||
| // timeView.setTime(event) | |||
| } | |||
| override fun onDeviceListSuccess(list: MutableList<Device>, 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 | |||
| goPageOne.visibility = View.GONE | |||
| } else { | |||
| preTxtBtn.textColor = resources.getColor(R.color.s_app_color_blue) | |||
| goPageOne.visibility = View.VISIBLE | |||
| } | |||
| if (pager.page_no >= pager.total_pages) { | |||
| nextTxtBtn.textColor = disabledColor | |||
| } else { | |||
| nextTxtBtn.textColor = resources.getColor(R.color.s_app_color_blue) | |||
| } | |||
| isLoading = false | |||
| showEmpty(3) | |||
| hideLayoutLoading() | |||
| } | |||
| } | |||
| override fun onDeviceListError(error: String) { | |||
| } | |||
| /** | |||
| * 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) | |||
| } | |||
| } | |||
| } | |||
| override fun onUserInfoError(error: String) { | |||
| } | |||
| override fun onUserInfoSuccess(info: TeacherInfo) { | |||
| userNameTv.text = info.teacher_name | |||
| } | |||
| } | |||
| @@ -0,0 +1,9 @@ | |||
| package com.yzx.escreen.model | |||
| data class Device ( | |||
| val id: Int = 0, | |||
| val name:String = "", | |||
| val type:Int = 0, | |||
| val device_category:Int = 0, | |||
| var isChecked:Boolean = false | |||
| ) | |||
| @@ -3,4 +3,6 @@ package com.yzx.escreen.model | |||
| class EventBugBean { | |||
| } | |||
| data class EventLeaveIds(var ids:String="") | |||
| data class EventLeaveIds(var ids:String="") | |||
| data class UserVersionCheck(var userCheck:Boolean = true) | |||
| @@ -0,0 +1,111 @@ | |||
| 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.Device | |||
| import com.yzx.escreen.model.Pager | |||
| import com.yzx.escreen.model.TeacherInfo | |||
| import com.yzx.escreen.model.User | |||
| 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 SettingPresenter(view: SettingView) : BasePresenter<SettingView>(view) { | |||
| fun getTeacherInfo(user_id: Int) { | |||
| if(User.getUser().token.isEmpty()){ | |||
| return | |||
| } | |||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_GET_TEACHER_INFO}" | |||
| OkGo.post<YzxResponse<TeacherInfo>>(url) | |||
| .tag(this) | |||
| .params("user_id", user_id) | |||
| .execute(object : JsonCallBack<YzxResponse<TeacherInfo>>() { | |||
| override fun onSuccess(response: Response<YzxResponse<TeacherInfo>>?) { | |||
| LogUtils.d(response) | |||
| if (response?.isSuccessful == true) { | |||
| mView?.onUserInfoSuccess(response.body().data) | |||
| } | |||
| } | |||
| override fun onError(response: Response<YzxResponse<TeacherInfo>>?) { | |||
| super.onError(response) | |||
| LogUtils.d(response) | |||
| mView?.onUserInfoError(response?.body()?.msg ?: "") | |||
| } | |||
| }) | |||
| } | |||
| fun getDeviceList(pageNo: Int) { | |||
| if(User.getUser().token.isEmpty()){ | |||
| return | |||
| } | |||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_ACCESS_CONTROL_GET_FACE_DEVICE_LIST}" | |||
| OkGo.post<YzxResponse<Device>>(url) | |||
| .tag(this) | |||
| .params("page_size", 10) | |||
| .params("page_no", pageNo) | |||
| .execute(object : JsonCallBack<YzxResponse<Device>>() { | |||
| override fun onSuccess(response: Response<YzxResponse<Device>>?) { | |||
| LogUtils.d(response) | |||
| if (response?.isSuccessful == true) { | |||
| mView?.onDeviceListSuccess(response.body().list, response.body().pager) | |||
| } | |||
| } | |||
| override fun onError(response: Response<YzxResponse<Device>>?) { | |||
| super.onError(response) | |||
| LogUtils.d(response) | |||
| mView?.onDeviceListError(response?.body()?.msg ?: "") | |||
| } | |||
| }) | |||
| } | |||
| fun setDoorRelayMode(deviceIdList: MutableList<Int>,mode:Int = 0) { | |||
| if(User.getUser().token.isEmpty()){ | |||
| return | |||
| } | |||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_ACCESS_CONTROL_POST_DOOR_RELAY_MODE}" | |||
| OkGo.post<YzxResponse<*>>(url) | |||
| .tag(this) | |||
| .params("device_ids", deviceIdList.joinToString(",")) | |||
| .params("mode", mode) | |||
| .execute(object : JsonCallBack<YzxResponse<*>>() { | |||
| override fun onSuccess(response: Response<YzxResponse<*>>?) { | |||
| LogUtils.d(response) | |||
| if (response?.isSuccessful == true) { | |||
| mView?.onSetSuccess() | |||
| } | |||
| } | |||
| override fun onError(response: Response<YzxResponse<*>>?) { | |||
| super.onError(response) | |||
| LogUtils.d(response) | |||
| mView?.onSetError(response?.body()?.msg ?: "") | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| interface SettingView : IView { | |||
| fun onSetSuccess() | |||
| fun onSetError(error:String) | |||
| fun onDeviceListSuccess(list:MutableList<Device>, pager: Pager) | |||
| fun onDeviceListError(error:String) | |||
| fun onUserInfoSuccess(info: TeacherInfo) | |||
| fun onUserInfoError(error:String) | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <solid android:color="#fff"/> | |||
| <stroke android:color="@color/colorAccent" android:width="1dp"/> | |||
| <corners android:radius="@dimen/dp_40"/> | |||
| </shape> | |||
| @@ -0,0 +1,260 @@ | |||
| <?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" | |||
| tools:context=".fragment.SettingFragment"> | |||
| <LinearLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:background="@color/backgroundColor" | |||
| android:orientation="vertical"> | |||
| <RelativeLayout | |||
| android:id="@+id/sysExitBtn" | |||
| 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" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_centerInParent="true" | |||
| android:text="用户信息" | |||
| android:textColor="@color/colorPrimary" | |||
| android:textSize="@dimen/sp20" | |||
| android:textStyle="bold" | |||
| android:visibility="gone" /> | |||
| <TextView | |||
| android:id="@+id/checkVersion" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="检查更新" | |||
| android:textColor="@color/colorPrimary" | |||
| android:layout_toStartOf="@id/userNameBox" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="40dp" | |||
| android:textSize="@dimen/sp18"/> | |||
| <LinearLayout | |||
| android:id="@+id/userNameBox" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:gravity="center" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:orientation="horizontal"> | |||
| <ImageView | |||
| android:layout_width="@dimen/dp_40" | |||
| android:layout_height="@dimen/dp_40" | |||
| android:src="@mipmap/icon_user" /> | |||
| <TextView | |||
| android:id="@+id/userNameTv" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="--" | |||
| android:textColor="#000" | |||
| android:layout_marginStart="10dp" | |||
| android:textSize="@dimen/sp18" /> | |||
| </LinearLayout> | |||
| </RelativeLayout> | |||
| <androidx.appcompat.widget.LinearLayoutCompat | |||
| android:layout_width="match_parent" | |||
| android:layout_height="0dp" | |||
| android:layout_marginTop="@dimen/d_20" | |||
| android:layout_weight="1" | |||
| android:background="@color/white" | |||
| android:gravity="center_horizontal" | |||
| android:orientation="vertical"> | |||
| <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"> | |||
| <androidx.appcompat.widget.AppCompatCheckBox | |||
| android:id="@+id/checkAll" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="40dp" | |||
| android:text="全选" | |||
| android:textSize="@dimen/sp18" /> | |||
| <TextView | |||
| android:id="@+id/btnOpen" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="@dimen/dp_40" | |||
| android:background="@drawable/shape_open_btn" | |||
| android:paddingHorizontal="20dp" | |||
| android:paddingVertical="5dp" | |||
| android:text="常开" | |||
| android:textColor="@color/colorPrimary" | |||
| android:textSize="@dimen/sp18" /> | |||
| <TextView | |||
| android:id="@+id/btnNormal" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="@dimen/dp_40" | |||
| android:background="@drawable/shape_open_btn" | |||
| android:paddingHorizontal="20dp" | |||
| android:paddingVertical="5dp" | |||
| android:text="标准" | |||
| android:textColor="@color/colorPrimary" | |||
| android:textSize="@dimen/sp18" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="@dimen/dp_40" | |||
| android:text="说明:常开按钮,点击后,闸机一直开着,不用刷脸可进出。标准按钮,点击后,闸机需要刷脸才可进出。" | |||
| android:textColor="#666" /> | |||
| </androidx.appcompat.widget.LinearLayoutCompat> | |||
| <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" | |||
| 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="操作" /> | |||
| </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_leave_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: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/goPageOne" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="@dimen/d_20" | |||
| android:text="回首页" | |||
| android:textColor="@color/s_app_color_blue" | |||
| android:textSize="@dimen/sp18" | |||
| android:visibility="gone" /> | |||
| <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> | |||
| <include | |||
| android:id="@+id/loadingLayout" | |||
| layout="@layout/layout_loading" | |||
| android:visibility="gone" /> | |||
| </FrameLayout> | |||
| @@ -0,0 +1,75 @@ | |||
| <?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:background="@drawable/ripple_water" | |||
| android:clickable="true" | |||
| 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"> | |||
| <LinearLayout | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:paddingStart="@dimen/dp_40"> | |||
| <androidx.appcompat.widget.AppCompatCheckBox | |||
| android:id="@+id/deviceName" | |||
| style="@style/table_cell" | |||
| android:layout_weight="1" | |||
| android:text="设备类型" /> | |||
| </LinearLayout> | |||
| <TextView | |||
| android:id="@+id/deviceTypeName" | |||
| style="@style/table_cell" | |||
| android:layout_weight="1" | |||
| android:text="设备类型" /> | |||
| <TextView | |||
| android:id="@+id/deviceTagName" | |||
| style="@style/table_cell" | |||
| android:layout_weight="1" | |||
| android:text="设备标识" /> | |||
| <LinearLayout | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:orientation="horizontal"> | |||
| <TextView | |||
| android:id="@+id/actionOpen" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="常开" | |||
| android:textColor="#3ca0e9" | |||
| android:textSize="@dimen/sp18" /> | |||
| <TextView | |||
| android:id="@+id/actionNormal" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="标准" | |||
| android:layout_marginLeft="40dp" | |||
| android:textColor="#3ca0e9" | |||
| android:textSize="@dimen/sp18" /> | |||
| </LinearLayout> | |||
| </androidx.appcompat.widget.LinearLayoutCompat> | |||
| <View | |||
| android:id="@+id/bottomLine" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="1px" | |||
| android:background="@color/backgroundColor" /> | |||
| </LinearLayout> | |||