作者 杨谦

1.人脸识别等

正在显示 55 个修改的文件 包含 1285 行增加441 行删除
... ... @@ -59,6 +59,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(path: ':Library')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
... ...
... ... @@ -9,8 +9,8 @@ import java.io.File
* Description: 初见时你很迷人
*/
object Constant {
// const val BASE_URL = "https://admin.anqixing.com"
const val BASE_URL = "https://security.brofirst.cn"
const val BASE_URL = "https://admin.anqixing.com"
// const val BASE_URL = "https://security.brofirst.cn"
// const val BASE_URL = "https://test.admin.anqixing.com"
const val USERNAME_KEY = "username"
const val USERID_KEY = "userid"
... ... @@ -67,6 +67,8 @@ object Constant {
val ACCOUNT_DIR: String =
Environment.getExternalStorageDirectory().toString() + File.separator.toString() + "images/"
val ACCOUNT_DIR_PIC: String =
Environment.getExternalStorageDirectory().toString() + File.separator.toString() + "Pictures/"
/** Milliseconds used for UI animations */
const val ANIMATION_FAST_MILLIS = 50L
... ...
package com.wjx.android.wanandroidmvvm.network
import android.util.Log
import com.br_technology.securitytrain_master.util.token
import com.br_technology.securitytrain_master.base.common.Constant
import com.br_technology.securitytrain_master.util.token
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
... ... @@ -59,7 +59,7 @@ class RetrofitFactory private constructor() {
Log.e("request-----", request.toString())
Log.e("response-----", requestUrl+""+getResponseInfo(response))
// Log.e("requestUrl-----", requestUrl)
Log.e("requestUrl-----", requestUrl)
//只保存登录或者注册
... ...
... ... @@ -349,4 +349,24 @@ interface ApiService {
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<CommonDataList<CommonPage<ScoreLog>>>>
/**
* 删除人脸
*/
@POST("api/check_face/deletePerson")
fun deleteFace(): Observable<BaseResponse<Void>>
/**
* 检测人脸
*/
@FormUrlEncoded
@POST("/api/check_face/checkFace")
fun checkFace(@Field("url") url: String): Observable<BaseResponse<Void>>
/**
* 上传人脸
*/
@FormUrlEncoded
@POST("/api/check_face/createPerson")
fun setFace(@Field("url") url: String): Observable<BaseResponse<Void>>
}
\ No newline at end of file
... ...
... ... @@ -4,8 +4,8 @@ import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.Constant
import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.common.StateType
import com.br_technology.securitytrain_master.base.repository.BaseRepository
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.BaseRepository
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable
import retrofit2.HttpException
... ... @@ -35,7 +35,6 @@ class BaseObserver<T : BaseResponse<*>>(
}
Constant.NOT_LOGIN -> {
// UserInfo.instance.logoutSuccess()
loadState.postValue(State(StateType.ERROR, message = "请重新登录"))
// BaseApplication.instance.applicationContext.startActivity(Intent(BaseApplication.instance.applicationContext,AccountLoginActivity::class.java).setFlags(InT))
}
... ...
... ... @@ -10,6 +10,13 @@ import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonDetailBean
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
/**
* Author by YSir
... ... @@ -17,7 +24,7 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
* description
* PS: Not easy to write code, please indicate.
*/
class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState) {
class LessonRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
fun workType(
liveData: MutableLiveData<BaseResponse<WorkTypeBean>>
... ... @@ -191,4 +198,36 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
) {
addRequest(lessonService.collect(type, favorite_id), liveData)
}
fun uploadFile(
path: String,
liveData: MutableLiveData<BaseResponse<UploadFileData>>
) {
val file = File(path)
if (file.exists()) {
MultipartBody.Part.createFormData(
"file", file.name, RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
apiService.uploadFile(
MultipartBody.Part.createFormData(
"file",
file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
BaseObserver(
liveData,
loadState,
this
)
)
}
}
fun checkFace(url: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.checkFace(url), liveData)
}
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,13 @@ import com.br_technology.securitytrain_master.base.common.State
import com.br_technology.securitytrain_master.base.network.response.*
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
/**
* Author by YSir
... ... @@ -12,7 +19,7 @@ import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
* description
* PS: Not easy to write code, please indicate.
*/
class TrainRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState) {
class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
fun getTrainLessonList(
type: Int,
... ... @@ -115,4 +122,36 @@ class TrainRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSta
) {
addRequest(itemService.scoreLog(page, page_num), liveData)
}
fun uploadFile(
path: String,
liveData: MutableLiveData<BaseResponse<UploadFileData>>
) {
val file = File(path)
if (file.exists()) {
MultipartBody.Part.createFormData(
"file", file.name, RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
apiService.uploadFile(
MultipartBody.Part.createFormData(
"file",
file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
BaseObserver(
liveData,
loadState,
this
)
)
}
}
fun checkFace(url: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.checkFace(url), liveData)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.expand
import android.R.attr
import android.content.Context
import android.graphics.Point
import android.graphics.Rect
import android.text.Spannable
import android.text.SpannableString
import android.text.style.AbsoluteSizeSpan
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
... ... @@ -66,12 +64,13 @@ fun RecyclerView.addItemDecoration3(spanCount: Int, spacing: Int, top: Int) {
else -> {
outRect.top = top
outRect.left = spacing
outRect.right=0
outRect.right = 0
}
}
}
})
}
fun RecyclerView.addItemDecoration2(spanCount: Int, spacing: Int, top: Int) {
this.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(
... ... @@ -92,21 +91,46 @@ fun RecyclerView.addItemDecoration2(spanCount: Int, spacing: Int, top: Int) {
else -> {
outRect.top = top
outRect.left = spacing
outRect.right=0
outRect.right = 0
}
}
}
})
}
fun RecyclerView.addItemDecorationCustom(spacing: Int) {
this.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
super.getItemOffsets(outRect, view, parent, state)
//这里是关键,需要根据你有几列来判断
val position: Int = parent.getChildAdapterPosition(view) // item position
outRect.top = 0
outRect.left = 0
outRect.right = 0
outRect.bottom = spacing
}
})
}
fun TextView.percentage() {
val text = this.text
val span=SpannableString(text)
span.setSpan(AbsoluteSizeSpan(20.dp2px()),0,text.length-1,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
this.text=span
val span = SpannableString(text)
span.setSpan(
AbsoluteSizeSpan(20.dp2px()),
0,
text.length - 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
this.text = span
}
fun View.hideSoftInputFromWindow() {
val inputMethodManager=this.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(this.windowToken,0)
val inputMethodManager =
this.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(this.windowToken, 0)
}
... ...
package com.br_technology.securitytrain_master.ui.view.bank.activity
import android.app.Activity
import android.content.Intent
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantType
import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter
... ... @@ -13,7 +10,6 @@ import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeVie
import com.br_technology.securitytrain_master.view.DialogDetermine
import com.br_technology.securitytrain_master.view.DialogTitle
import com.br_technology.securitytrain_master.view.listener.DialogListener
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
/**
... ... @@ -68,24 +64,6 @@ class PracticeActivity :
binding.toolBar.setTitle(ConstantType.getTestType(contentType))
mViewModel.itemStart(contentId, contentType)
binding.apply {
toolBar.setRightText("答题卡")
toolBar.setRightTextDrawable(
ContextCompat.getDrawable(
baseContext,
R.mipmap.answer_sheet
)
)
// 答题卡点击事件
toolBar.addRightListener(object : ToolBarClickListener {
override fun onClick(view: View) {
val intent = Intent(this@PracticeActivity, AnswerSheetActivity::class.java)
.putStringArrayListExtra("resultData", mPagerAdapter.getArrayList())
.putExtra("showCorrect", mPagerAdapter.showCorrect)
.putExtra("title", binding.toolBar.getTitle())
startForResult.launch(intent)
}
})
// 显示交卷
finishJob.visibility = View.VISIBLE
// 上一题
... ... @@ -164,6 +142,4 @@ class PracticeActivity :
}
}
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.bank.fragment
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantType
... ... @@ -11,16 +9,14 @@ import com.br_technology.securitytrain_master.ui.view.bank.activity.*
import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeAdapter
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.BankViewModel
import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEvent
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.util.TYPE_All
import com.br_technology.securitytrain_master.util.TYPE_HOME
import com.br_technology.securitytrain_master.util.sp_job_name
import com.br_technology.securitytrain_master.util.sp_job_id_select
import com.br_technology.securitytrain_master.util.sp_job_name_select
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.DialogStar
import com.br_technology.securitytrain_master.view.listener.DialogListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/**
* createTime:2021/7/27 15:47
... ... @@ -39,24 +35,25 @@ class BankFragment :
DialogStar(requireActivity())
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
EventBus.getDefault().register(this)
}
override fun onDestroyView() {
super.onDestroyView()
EventBus.getDefault().unregister(this)
}
private var posId: Int = sp_job_id_select
override fun initData() {
super.initData()
classifyPop.setIClickListener(object : ClassifyPop.IClickListener {
override fun work(data: WorkTypeBean.ListBean) {
data.let {
posId = it.id
binding.type.text = (it.name)
refresh()
}
}
})
practiceList = mutableListOf()
mViewModel.practiceList(page, 20)
refresh()
mViewModel.getAbout()
binding.apply {
// 标题栏类型
type.text = sp_job_name
type.text = sp_job_name_select
type.setOnClickListener {
if (mViewModel.beanData().value == null) {
mViewModel.workType()
... ... @@ -66,6 +63,14 @@ class BankFragment :
}
}
}
change.setOnClickListener {
if (it.isPressed) {
refresh()
}
}
refreshLayout.setOnLoadMoreListener {
initLoadMore()
}
// 模拟考试
mockExam.setOnClickListener {
startActivity(MockExamActivity::class.java)
... ... @@ -102,12 +107,6 @@ class BankFragment :
}
initLoadMore()
swipeRefreshlayout.setOnRefreshListener {
practiceAdapter?.loadMoreModule?.isEnableLoadMore = false
page = 1
mViewModel.practiceList(page, 20)
}
}
// 挑战答题弹框
... ... @@ -119,13 +118,18 @@ class BankFragment :
})
}
private fun refresh() {
page = 1
mViewModel.practiceList(page, 20, posId)
binding.refreshLayout.setEnableRefresh(false)
binding.refreshLayout.setEnableLoadMore(false)
}
private fun initLoadMore() {
practiceAdapter?.loadMoreModule?.setOnLoadMoreListener {
page++
binding.swipeRefreshlayout.isRefreshing = false
practiceAdapter?.loadMoreModule?.isEnableLoadMore = true
mViewModel.practiceList(page, 20)
}
mViewModel.practiceList(page, 20, posId)
binding.refreshLayout.setEnableRefresh(false)
binding.refreshLayout.setEnableLoadMore(false)
practiceAdapter?.loadMoreModule?.isAutoLoadMore = true
practiceAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
}
... ... @@ -143,27 +147,14 @@ class BankFragment :
})
//专项练习列表
mViewModel.mPracticeBean.observe(this, {
binding.swipeRefreshlayout.isRefreshing = false
practiceAdapter?.loadMoreModule?.isEnableLoadMore = true
binding.refreshLayout.finishLoadMore()
binding.refreshLayout.finishRefresh()
binding.refreshLayout.setEnableLoadMore(it.data.list.size == 20)
if (page == 1) {
practiceAdapter?.setList(it.data.list)
} else {
practiceAdapter?.addData(it.data.list)
}
if (it.data.list.size <= 20) {
practiceAdapter?.loadMoreModule?.loadMoreEnd()
} else {
practiceAdapter?.loadMoreModule?.loadMoreComplete()
}
})
}
@Subscribe
fun eventGet(data: GetWorkTypeEvent) {
if (data.type == TYPE_HOME || data.type == TYPE_All) {
binding.type.text = (data.name)
}
}
}
\ No newline at end of file
... ...
... ... @@ -9,7 +9,6 @@ import com.br_technology.securitytrain_master.ui.bean.AnswerAbout
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.bank.repository.BankRepository
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.util.sp_job_id
/**
* createTime:2021/7/27 15:48
... ... @@ -36,8 +35,9 @@ class BankViewModel : BaseViewModel<BankRepository>() {
var mPracticeBean: MutableLiveData<BaseResponse<CommonList<PracticeBean>>> = MutableLiveData()
fun practiceList(
page: Int,
page_num: Int
page_num: Int,
pos_id: Int
) {
mRepository.practiceList(sp_job_id, page, page_num, mPracticeBean)
mRepository.practiceList(pos_id, page, page_num, mPracticeBean)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityLiveCourseBinding
import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.BankViewModel
... ... @@ -9,7 +12,9 @@ import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEven
import com.br_technology.securitytrain_master.ui.view.home.fragment.OnLiveCourseFragment
import com.br_technology.securitytrain_master.util.TYPE_All
import com.br_technology.securitytrain_master.util.TYPE_LIVE
import com.br_technology.securitytrain_master.util.sp_job_name
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.google.android.material.tabs.TabLayout
import com.gyf.immersionbar.ImmersionBar
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -57,24 +62,24 @@ class LiveCourseActivity
override fun initData() {
super.initData()
binding.apply {
// toolBar.setRightText(sp_job_name)
// toolBar.setRightTextDrawable(
// ContextCompat.getDrawable(
// baseContext,
// R.mipmap.down_arrow
// )
// )
// toolBar.addRightListener(object : ToolBarClickListener {
// override fun onClick(view: View) {
// if (mViewModel.beanData().value == null) {
// mViewModel.workType()
// } else {
// mViewModel.beanData().value?.apply {
// classifyPop.showAsDropDown(binding.toolBar)
// }
// }
// }
// })
toolBar.setRightText(sp_job_name)
toolBar.setRightTextDrawable(
ContextCompat.getDrawable(
baseContext,
R.mipmap.down_arrow
)
)
toolBar.addRightListener(object : ToolBarClickListener {
override fun onClick(view: View) {
if (mViewModel.beanData().value == null) {
mViewModel.workType()
} else {
mViewModel.beanData().value?.apply {
classifyPop.showAsDropDown(binding.toolBar)
}
}
}
})
val searchResultAdapter = BasePagerAdapter(
supportFragmentManager,
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
... ...
... ... @@ -2,6 +2,8 @@ package com.br_technology.securitytrain_master.ui.view.home.activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.ActivityOnlineBinding
... ... @@ -11,7 +13,13 @@ import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItemType
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineViewModel
import com.br_technology.securitytrain_master.util.TYPE_All
import com.br_technology.securitytrain_master.util.sp_job_id_select
import com.br_technology.securitytrain_master.util.sp_job_name_select
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.chad.library.adapter.base.listener.OnLoadMoreListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -24,13 +32,41 @@ class OnlineActivity :
BaseLifeCycleActivity<OnlineViewModel, ActivityOnlineBinding>(ActivityOnlineBinding::inflate) {
private var videoLessonList: MutableList<VideoLessonBean.ListBean.DataBean>? = null
private var page = 1
var videoCourseAdapter: VideoCourseAdapter? = null
private val classifyPop by lazy {
ClassifyPop(this, TYPE_All)
}
private var posId: Int = sp_job_id_select
var videoCourseAdapter: VideoCourseAdapter? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
classifyPop.setIClickListener(object : ClassifyPop.IClickListener {
override fun work(data: WorkTypeBean.ListBean) {
data.let {
posId = it.id
binding.toolBar.setRightText(it.name)
page = 1
loadData()
}
}
})
videoLessonList = mutableListOf()
mViewModel.videoLessons(1, "", page)
loadData()
binding.apply {
toolBar.setRightText(sp_job_name_select)
toolBar.setRightTextDrawable(
ContextCompat.getDrawable(
baseContext,
R.mipmap.down_arrow
)
)
toolBar.addRightListener(object : ToolBarClickListener {
override fun onClick(view: View) {
mViewModel.workType()
}
})
onlineRecycler.addItemDecoration2(2, 15, 24)
videoCourseAdapter =
VideoCourseAdapter(R.layout.adapter_video_course, videoLessonList)
... ... @@ -54,11 +90,12 @@ class OnlineActivity :
swipeRefreshlayout.setOnRefreshListener {
videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = false
page = 1
mViewModel.videoLessons(1, "", page)
loadData()
}
}
}
override fun initDataObserver() {
mViewModel.mVideoLessonBean.observe(this, {
binding.swipeRefreshlayout.isRefreshing = false
... ... @@ -72,26 +109,26 @@ class OnlineActivity :
} else {
videoLessonList?.let { it1 -> videoCourseAdapter?.addData(it1) }
}
// if (it.data.list.data != null) {
// if (it.data.list.data.size < 10) {
// videoCourseAdapter?.loadMoreModule?.loadMoreEnd()
// } else {
// videoCourseAdapter?.loadMoreModule?.loadMoreComplete()
// }
// }
++page
})
mViewModel.mWorkTypeBean.observe(this, {
classifyPop.setList(it.data.list)
if (!classifyPop.isShowing) {
classifyPop.showAsDropDown(binding.toolBar)
}
})
}
private fun loadData() {
mViewModel.videoLessons(1, "", page, posId)
}
fun initLoadMore() {
videoCourseAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
override fun onLoadMore() {
binding.swipeRefreshlayout.isRefreshing = false
// videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true
mViewModel.videoLessons(1, "", page)
loadData()
}
})
videoCourseAdapter?.loadMoreModule?.isAutoLoadMore = true
videoCourseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
... ...
... ... @@ -32,6 +32,7 @@ class SearchActivity :
// 清空历史记录
clear.setOnClickListener {
if (it.isPressed) {
DialogSureCancel(this@SearchActivity).setListener(object : DialogListener {
override fun determine() {
// 清空记录
... ... @@ -39,6 +40,7 @@ class SearchActivity :
}
}).show()
}
}
clearEdit.setOnClickListener {
searchEdit.setText("")
... ... @@ -75,8 +77,8 @@ class SearchActivity :
}
}
override fun initData() {
super.initData()
override fun onResume() {
super.onResume()
mViewModel.searchLog()
}
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity
import android.content.Intent
import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
... ... @@ -9,7 +11,13 @@ import com.br_technology.securitytrain_master.ui.bean.CourseParam
import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.TextLessonsAdapter
import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextCourseViewModel
import com.br_technology.securitytrain_master.util.TYPE_All
import com.br_technology.securitytrain_master.util.sp_job_id_select
import com.br_technology.securitytrain_master.util.sp_job_name_select
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -23,23 +31,52 @@ class TextCourseActivity :
private var textLessonList: MutableList<TextLessonBean.ListBean.DataBean>? = null
private var textLessonsAdapter: TextLessonsAdapter? = null
private var page = 1
private val classifyPop by lazy {
ClassifyPop(this, TYPE_All)
}
private var posId: Int = sp_job_id_select
private fun loadData() {
mViewModel.textLessons("", page, posId)
}
override fun initData() {
super.initData()
mViewModel.textLessons("", page)
loadData()
binding.apply {
initAdapter()
initLoadMore()
swipeRefreshlayout.setOnRefreshListener {
page = 1
mViewModel.textLessons("", page)
loadData()
}
swipeRefreshlayout.setOnLoadMoreListener {
page++
mViewModel.textLessons("", page)
loadData()
}
toolBar.setRightText(sp_job_name_select)
toolBar.setRightTextDrawable(
ContextCompat.getDrawable(
baseContext,
R.mipmap.down_arrow
)
)
toolBar.addRightListener(object : ToolBarClickListener {
override fun onClick(view: View) {
mViewModel.workType()
}
})
}
classifyPop.setIClickListener(object : ClassifyPop.IClickListener {
override fun work(data: WorkTypeBean.ListBean) {
data.let {
posId = it.id
binding.toolBar.setRightText(it.name)
page = 1
loadData()
}
}
})
}
private fun initAdapter() {
... ... @@ -62,19 +99,16 @@ class TextCourseActivity :
}
fun initLoadMore() {
// textLessonsAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
// override fun onLoadMore() {
// binding.swipeRefreshlayout.finishLoadMore()
// binding.swipeRefreshlayout.finishRefresh()
//
// }
// })
// textLessonsAdapter?.loadMoreModule?.isAutoLoadMore = true
// textLessonsAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
}
override fun initDataObserver() {
mViewModel.mWorkTypeBean.observe(this, {
classifyPop.setList(it.data.list)
if (!classifyPop.isShowing) {
classifyPop.showAsDropDown(binding.toolBar)
}
})
mViewModel.mTextLessonBean.observe(this, {
binding.swipeRefreshlayout.finishLoadMore()
binding.swipeRefreshlayout.finishRefresh()
... ...
package com.br_technology.securitytrain_master.ui.view.home.activity.course
import android.Manifest
import android.content.Intent
import android.text.TextUtils
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityOnlineDetailBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_LIVE
import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_NORMAL
... ... @@ -14,8 +18,13 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.fragment.CourseListFragment
import com.br_technology.securitytrain_master.ui.view.home.fragment.OnlineDetailFragment
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseDetailViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.bumptech.glide.Glide
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import java.io.File
/**
... ... @@ -33,6 +42,64 @@ class CourseDetailActivity
private var mWorkBean: WorkTypeBean? = null
private var mapWork = mutableMapOf<Int, WorkTypeBean.ListBean>()
private var dialogId: DialogCheckIDCard? = null
private var permissionCount = 0
private var fileUploadTemp: File? = null
private val faceUtil = FaceUtil()
private var dialogLoading: DialogTrainLoading? = null
private fun showDialogId() {
if (dialogId == null) {
dialogId = DialogCheckIDCard(this)
dialogId!!.setListener({
dialogId!!.dismiss()
finish()
}, {
initPermissions(
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onGranted = {
if (permissionCount == 0) {
permissionCount++
if (CameraUtil.isSupportFrontCamera()) {
faceUtil.startCaptureFace(this, object : FaceUtil.ICapture {
override fun capture(file: File) {
fileUploadTemp = file
}
})
}
}
},
onDenied = {
}, onDeniedNever = {
})
})
}
dialogId!!.show()
}
private fun dialogLoading() {
if (dialogLoading == null) {
dialogLoading = DialogTrainLoading(this)
}
dialogLoading!!.show()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == FaceUtil.FRONT_CAPTURE_CODE) {
permissionCount = 0
fileUploadTemp?.let {
faceUtil.compressFile(this, fileUploadTemp!!, object : FaceUtil.ICompress {
override fun compress(file: File) {
dialogLoading()
mViewModel.uploadFace(file.path)
}
})
}
}
}
override fun initDataObserver() {
// 培训视频课程
mViewModel.mVideoLesson.observe(this, {
... ... @@ -80,7 +147,8 @@ class CourseDetailActivity
)
searchResultAdapter?.addData(list.toMutableList())
}
else -> {}
else -> {
}
}
}
val titles = listOf("课程详情", "课程列表")
... ... @@ -143,6 +211,35 @@ class CourseDetailActivity
tabLayout.setupWithViewPager(viewPager)
}
})
mViewModel.mFaceFile.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
mViewModel.checkFace(it.data.fullurl)
} else {
showTip(it.msg)
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
}
}
})
mViewModel.mFaceCheck.observe(this, {
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
it.let {
if (it.code == 1) {
if (dialogId != null) {
dialogId!!.dismiss()
}
} else {
finish()
showTip(it.msg)
}
}
})
}
private fun setPosName(posIds: String): String {
... ... @@ -190,6 +287,9 @@ class CourseDetailActivity
mViewModel.offLessonDetail(it.mLessonId.toInt())
}
}
if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF) {
showDialogId()
}
}
})
}
... ...
... ... @@ -203,7 +203,7 @@ class CoursePractiseActivity :
} else {
ToastUtils.s(baseContext, it.msg)
}
countDown(it.data.over_second)
// countDown(it.data.over_second)
}
mViewModel.subSingleData.observe(this) {
... ...
... ... @@ -10,3 +10,5 @@ class GetWorkTypeEvent(var id: Int, var name: String, var type: Int)
class StatusTypeEvent(var id: Int, var name: String)
class TransType(var id: Int)
class CheckFace()
\ No newline at end of file
... ...
... ... @@ -7,7 +7,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.FragmentResultBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.expand.addItemDecorationCustom
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.activity.DatabaseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
... ... @@ -18,7 +18,6 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.ResultViewModel
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.br_technology.securitytrain_master.util.TranslateUnit
import com.br_technology.securitytrain_master.view.VerticalDecoration
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
... ... @@ -56,16 +55,11 @@ class ResultFragment(val type: Int) :
binding.apply {
when (type) {
0 -> {
result.addItemDecoration2(2, 15, 16)
result.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
result.layoutManager = GridLayoutManager(requireActivity(), 2)
}
else -> {
result.addItemDecoration(
VerticalDecoration(
TranslateUnit.dp2px(context, 16f),
0
)
)
result.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
result.layoutManager = LinearLayoutManager(requireActivity())
}
}
... ...
... ... @@ -5,10 +5,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.network.response.CommonDetail
import com.br_technology.securitytrain_master.base.repository.LessonRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.LessonClassDetail
import com.br_technology.securitytrain_master.ui.bean.LessonLive
import com.br_technology.securitytrain_master.ui.bean.LessonOfflineDetail
import com.br_technology.securitytrain_master.ui.bean.LessonTrainVideoDetail
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
/**
... ... @@ -23,6 +20,9 @@ class CourseDetailViewModel : BaseViewModel<LessonRepository>() {
var mLessonOff = MutableLiveData<BaseResponse<CommonDetail<LessonOfflineDetail>>>()
var mWorkBean = MutableLiveData<BaseResponse<WorkTypeBean>>()
var mFaceFile = MutableLiveData<BaseResponse<UploadFileData>>()
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun videoLessonsDetail(
id: Int
) {
... ... @@ -44,4 +44,12 @@ class CourseDetailViewModel : BaseViewModel<LessonRepository>() {
fun workType() {
mRepository.workType(mWorkBean)
}
fun uploadFace(filePath: String) {
mRepository.uploadFile(filePath, mFaceFile)
}
fun checkFace(url: String) {
mRepository.checkFace(url, mFaceCheck)
}
}
\ No newline at end of file
... ...
... ... @@ -4,8 +4,8 @@ import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.repository.OnlineRepository
import com.br_technology.securitytrain_master.util.sp_job_id
/**
* createTime:2021/7/27 15:48
... ... @@ -18,8 +18,14 @@ class OnlineViewModel : BaseViewModel<OnlineRepository>() {
fun videoLessons(
is_rec: Int,
keyword: String,
page: Int
page: Int,
pos_id: Int
) {
mRepository.videoLessons(is_rec, keyword, sp_job_id, page, 10, mVideoLessonBean)
mRepository.videoLessons(is_rec, keyword, pos_id, page, 10, mVideoLessonBean)
}
var mWorkTypeBean: MutableLiveData<BaseResponse<WorkTypeBean>> = MutableLiveData()
fun workType() {
mRepository.workType(mWorkTypeBean)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.home.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.repository.TextCourseRepository
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
/**
* createTime:2021/7/27 15:48
... ... @@ -19,8 +18,9 @@ class TextCourseViewModel : BaseViewModel<TextCourseRepository>() {
fun textLessons(
keyword: String,
page: Int,
pos_id: Int
) {
mRepository.textLessons(keyword, sp_job_id, page, 10, mTextLessonBean)
mRepository.textLessons(keyword, pos_id, page, 10, mTextLessonBean)
}
... ...
package com.br_technology.securitytrain_master.ui.view.mine.activity
import android.Manifest
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentPagerAdapter
... ... @@ -10,15 +13,21 @@ import com.br_technology.securitytrain_master.base.common.ConstantType.TYPE_CLAS
import com.br_technology.securitytrain_master.base.common.ConstantType.TYPE_CLASS_PRACTICE
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityClassDutyBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.view.home.adapter.StatusName
import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
import com.br_technology.securitytrain_master.ui.view.mine.fragment.ClassDutyCourseFragment
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.view.DialogCheckIDCard
import com.br_technology.securitytrain_master.view.DialogTrainLoading
import com.br_technology.securitytrain_master.view.StatusPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.io.File
/**
* Time: 8/3/2021 11:15
... ... @@ -28,7 +37,61 @@ import org.greenrobot.eventbus.Subscribe
*/
class ClassDutyActivity :
BaseLifeCycleActivity<ClassDutyViewModel, ActivityClassDutyBinding>(ActivityClassDutyBinding::inflate) {
private var dialogId: DialogCheckIDCard? = null
private var permissionCount = 0
private var fileUploadTemp: File? = null
private val faceUtil = FaceUtil()
private var dialogLoading: DialogTrainLoading? = null
private var isChecked = false
fun showDialogId() {
if (dialogId == null) {
dialogId = DialogCheckIDCard(this)
dialogId!!.setListener({ dialogId!!.dismiss() }, {
initPermissions(
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onGranted = {
if (permissionCount == 0) {
permissionCount++
if (CameraUtil.isSupportFrontCamera()) {
faceUtil.startCaptureFace(this, object : FaceUtil.ICapture {
override fun capture(file: File) {
fileUploadTemp = file
}
})
}
}
},
onDenied = {
}, onDeniedNever = {
})
})
}
dialogId!!.show()
}
private fun dialogLoading() {
if (dialogLoading == null) {
dialogLoading = DialogTrainLoading(this)
}
dialogLoading!!.show()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == FaceUtil.FRONT_CAPTURE_CODE) {
permissionCount = 0
fileUploadTemp?.let {
faceUtil.compressFile(this, fileUploadTemp!!, object : FaceUtil.ICompress {
override fun compress(file: File) {
dialogLoading()
mViewModel.uploadFace(file.path)
}
})
}
}
}
private val classifyPop by lazy {
//type 状态0=全部1=已完成2=未完成
... ... @@ -53,6 +116,34 @@ class ClassDutyActivity :
}
override fun initDataObserver() {
mViewModel.mFaceFile.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
mViewModel.checkFace(it.data.fullurl)
} else {
showTip(it.msg)
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
}
}
})
mViewModel.mFaceCheck.observe(this, {
if (dialogLoading != null) {
dialogLoading!!.dismiss()
}
it.let {
if (it.code == 1) {
if (dialogId != null) {
dialogId!!.dismiss()
}
isChecked = true
} else {
showTip(it.msg)
}
}
})
}
override fun initData() {
... ... @@ -93,4 +184,8 @@ class ClassDutyActivity :
tabLayout.setupWithViewPager(viewPager)
}
}
fun isChecked(): Boolean {
return isChecked
}
}
\ No newline at end of file
... ...
... ... @@ -103,6 +103,7 @@ class CredentialsUpLoadActivity :
binding.apply {
// 上传照片
tvUpload.setOnClickListener {
if (it.isPressed) {
tvUpload.isClickable = false
if (path.isEmpty()) {
showTip("请选择证件照片")
... ... @@ -121,6 +122,7 @@ class CredentialsUpLoadActivity :
}
mViewModel.certAdd(id, typeId, path, dateTime, endTime)
}
}
// 选择图片
uploadPic.setOnClickListener {
... ...
package com.br_technology.securitytrain_master.ui.view.mine.activity
import android.Manifest
import android.content.Intent
import android.text.TextUtils
import android.view.View
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.ActivityEditPersonalInfoBinding
import com.br_technology.securitytrain_master.ext.initPermissions
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.EditPersonalInfoViewModel
import com.br_technology.securitytrain_master.util.CameraUtil
import com.br_technology.securitytrain_master.util.FaceUtil
import com.br_technology.securitytrain_master.util.GlideEnginePic
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.bumptech.glide.Glide
... ... @@ -16,6 +19,7 @@ import com.luck.picture.lib.config.PictureMimeType
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.listener.OnResultCallbackListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import java.io.File
/**
* Time: 7/31/2021 14:32
... ... @@ -28,6 +32,8 @@ class EditPersonalInfoActivity :
), View.OnClickListener {
private var avatar: String? = null
private var permissionCount = 0
override fun initDataObserver() {
//显示我的信息
mViewModel.mMineInfoBean.observe(this, {
... ... @@ -39,7 +45,11 @@ class EditPersonalInfoActivity :
avatar = it.data.info.avatar
Glide.with(this).load(avatar)
.placeholder(R.mipmap.placeholder_head).into(binding.ivIcon)
binding.tvPhoneFace.text = if (it.data.info.is_check_face.equals("1")) {
"可重置"
} else {
"去设置"
}
})
//图片上传成功
mViewModel.mUploadFileData.observe(this, {
... ... @@ -51,12 +61,29 @@ class EditPersonalInfoActivity :
}
})
//保存修改
mViewModel.mCommonBean.observe(this,{
mViewModel.mCommonBean.observe(this, {
it.let {
showTip("修改成功")
finish()
}
})
//
mViewModel.mUploadFaceFileData.observe(this, {
it.let {
if (!TextUtils.isEmpty(it.data.fullurl)) {
mViewModel.changeFace(it.data.fullurl)
} else {
showTip(it.msg)
}
}
})
mViewModel.deleteResponse.observe(this, {
showTip(it.msg)
refresh()
})
mViewModel.changeResponse.observe(this, {
refresh()
})
}
override fun initView() {
... ... @@ -66,29 +93,77 @@ class EditPersonalInfoActivity :
override fun initData() {
super.initData()
refresh()
ImmersionBar.with(this@EditPersonalInfoActivity).statusBarDarkFont(true).init()
binding.apply {
llChangePwd.setOnClickListener(this@EditPersonalInfoActivity)
llChangeFace.setOnClickListener(this@EditPersonalInfoActivity)
llChangePhone.setOnClickListener(this@EditPersonalInfoActivity)
rlUpLoadImage.setOnClickListener(this@EditPersonalInfoActivity)
toolBar.addLeftListener(object : ToolBarClickListener {
override fun onClick(view: View) {
//退出时保存
avatar?.let { mViewModel.changePersonalInfo(it,binding.tvName.text.toString(),"") }
avatar?.let {
mViewModel.changePersonalInfo(
it,
binding.tvName.text.toString(),
""
)
}
}
})
}
}
override fun onResume() {
super.onResume()
//获取我的数据
fun refresh() {
mViewModel.getMineInfo()
}
var fileUploadTemp: File? = null
private val faceUtil = FaceUtil()
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == FaceUtil.FRONT_CAPTURE_CODE) {
permissionCount = 0
fileUploadTemp?.let {
faceUtil.compressFile(this, fileUploadTemp!!, object : FaceUtil.ICompress {
override fun compress(file: File) {
mViewModel.uploadFaceFile(file)
}
})
}
}
}
override fun onClick(v: View?) {
when (v!!.id) {
R.id.ll_change_face -> {
val status = binding.tvPhoneFace.text.toString() == "可重置"
if (status) {
mViewModel.deleteFace()
} else {
initPermissions(Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
onGranted = {
if (permissionCount == 0) {
permissionCount++
if (CameraUtil.isSupportFrontCamera()) {
faceUtil.startCaptureFace(this, object : FaceUtil.ICapture {
override fun capture(file: File) {
fileUploadTemp = file
}
})
}
}
},
onDenied = {
}, onDeniedNever = {
})
}
}
R.id.ll_change_pwd -> {
//修改密码
startActivity(ChangePwdActivity::class.java)
... ... @@ -124,9 +199,7 @@ class EditPersonalInfoActivity :
}
override fun onCancel() {
}
})
},
onDenied = {
... ... @@ -137,7 +210,6 @@ class EditPersonalInfoActivity :
}
//上传图片
fun uploadFile(path: String) {
mViewModel.uploadFile(path)
}
... ...
package com.br_technology.securitytrain_master.ui.view.mine.activity
import android.content.Intent
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.ActivityMyCredentialsBinding
import com.br_technology.securitytrain_master.expand.addItemDecoration2
import com.br_technology.securitytrain_master.expand.dp2px
import com.br_technology.securitytrain_master.ui.bean.UserCert
import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData
import com.br_technology.securitytrain_master.ui.view.mine.adapter.MyCredentialsAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyCredentialsViewModel
import com.br_technology.securitytrain_master.view.CenterToast
import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -43,7 +40,6 @@ class MyCredentialsActivity :
override fun initData() {
super.initData()
binding.apply {
smartRefresh.setOnRefreshListener {
smartRefresh.setNoMoreData(false)
... ...
... ... @@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.ui.view.mine.activity
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityQuestionRecordBinding
import com.br_technology.securitytrain_master.ui.view.mine.fragment.MockExaminationFragment
import com.br_technology.securitytrain_master.ui.view.mine.fragment.SpecialExercisesFragment
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.QuestionRecordViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -40,6 +39,7 @@ class QuestionRecordActivity :
searchResultAdapter.addTitle(titles)
viewPager.adapter = searchResultAdapter
tabLayout.setupWithViewPager(viewPager)
viewPager.offscreenPageLimit = 3
}
}
... ...
... ... @@ -4,14 +4,11 @@ import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.view.BaseMultiAdapter
import com.br_technology.securitytrain_master.databinding.ItemMyCredentialsUploadBinding
import com.br_technology.securitytrain_master.databinding.ItemMycredentialsShowBinding
import com.br_technology.securitytrain_master.expand.glideRound
import com.br_technology.securitytrain_master.expand.loadPic
import com.br_technology.securitytrain_master.ui.bean.UserCert
import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData
/**
* Time: 8/2/2021 9:06
... ... @@ -39,6 +36,7 @@ class MyCredentialsAdapter : BaseMultiAdapter<UserCert, ViewBinding>() {
val userCert = getData(position)
certPicIv.loadPic(userCert?.image_text?:"")
certValidityPeriod.text="有效期:${userCert?.end_time}"
certValidityPeriodName.text="${userCert?.credentials_name}"
}
holder.root.setOnClickListener {
listener?.onClick(position, list[position])
... ...
... ... @@ -36,6 +36,24 @@ public class MineInfoBean {
private Integer expires_in;
private String company_name;
private String department_name;
private String company_check_face;
private String is_check_face;
public String getIs_check_face() {
return is_check_face;
}
public void setIs_check_face(String is_check_face) {
this.is_check_face = is_check_face;
}
public String getCompany_check_face() {
return company_check_face;
}
public void setCompany_check_face(String company_check_face) {
this.company_check_face = company_check_face;
}
public Integer getId() {
return id;
... ...
... ... @@ -4,21 +4,23 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.common.ConstantType
import com.br_technology.securitytrain_master.databinding.FragmentClassDutyCourseBinding
import com.br_technology.securitytrain_master.expand.addItemDecorationCustom
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CoursePractiseActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
import com.br_technology.securitytrain_master.ui.view.mine.activity.ClassDutyActivity
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter
import com.br_technology.securitytrain_master.ui.view.mine.adapter.TrainTestAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel
import com.br_technology.securitytrain_master.util.TranslateUnit
import com.br_technology.securitytrain_master.view.DialogMention
import com.br_technology.securitytrain_master.view.VerticalDecoration
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
... ... @@ -104,7 +106,7 @@ class ClassDutyCourseFragment(val type: Int) :
if (page == 1) {
trainTestAdapter = TrainTestAdapter()
trainTestAdapter?.setListener(this)
trainTestAdapter?.addData(transPracticeData(list))
trainTestAdapter?.setList(transPracticeData(list))
binding.recyclerview.adapter = trainTestAdapter
boolData(list.isNotEmpty())
} else {
... ... @@ -119,7 +121,7 @@ class ClassDutyCourseFragment(val type: Int) :
if (page == 1) {
trainTestAdapter = TrainTestAdapter()
trainTestAdapter?.setListener(this)
trainTestAdapter?.addData(transExamData(list))
trainTestAdapter?.setList(transExamData(list))
binding.recyclerview.adapter = trainTestAdapter
boolData(list.isNotEmpty())
} else {
... ... @@ -169,7 +171,6 @@ class ClassDutyCourseFragment(val type: Int) :
} else {
View.GONE
}
ll.visibility = vsi
}
}
... ... @@ -186,12 +187,14 @@ class ClassDutyCourseFragment(val type: Int) :
override fun initView() {
super.initView()
binding.recyclerview.addItemDecoration(
VerticalDecoration(
TranslateUnit.dp2px(context, 16f),
0
)
)
if (type == ConstantType.TYPE_CLASS_COURSE) {
val param = binding.recyclerview.layoutParams as ViewGroup.MarginLayoutParams
param.bottomMargin = TranslateUnit.dp2px(context, 32f)
param.topMargin = TranslateUnit.dp2px(context, 16f)
} else {
binding.ll.visibility = View.GONE
}
binding.recyclerview.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
binding.smartRefresh.setOnRefreshListener {
refreshData()
}
... ... @@ -239,13 +242,16 @@ class ClassDutyCourseFragment(val type: Int) :
}
}
//todo 时间校验限制等
fun checkTime(exam: ExamBean) {
}
override fun itemClick(item: TrainTestData) {
var bool = true
if (!item.isTest) {
if (activity is ClassDutyActivity) {
val classDutyActivity = activity as ClassDutyActivity
if (!classDutyActivity.isChecked()) {
classDutyActivity.showDialogId()
return
}
}
try {
val simple = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA)
val start = simple.parse(item.exam?.exam_start_time ?: "0").time
... ...
... ... @@ -4,10 +4,12 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import com.br_technology.securitytrain_master.databinding.FragmentSpecialExercisesBinding
import com.br_technology.securitytrain_master.expand.addItemDecorationCustom
import com.br_technology.securitytrain_master.ui.bean.AnswerRecord
import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerRecordDetailsActivity
import com.br_technology.securitytrain_master.ui.view.mine.adapter.SpecialExercisesAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SpecialExercisesFragmentViewModel
import com.br_technology.securitytrain_master.util.TranslateUnit
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import kotlin.properties.Delegates
... ... @@ -32,6 +34,9 @@ class SpecialExercisesFragment
private val map = hashMapOf(1 to true, 2 to true, 3 to true, 4 to true)
override fun initDataObserver() {
mViewModel.liveData.observe(this) {
binding.smartRefresh.finishRefresh()
binding.smartRefresh.finishLoadMore()
binding.smartRefresh.setEnableRefresh(true)
if (it.data.list.data.size <= 20) {
binding.smartRefresh.setNoMoreData(true)
}
... ... @@ -58,15 +63,10 @@ class SpecialExercisesFragment
binding.apply {
smartRefresh.setOnRefreshListener {
page = 1
smartRefresh.setNoMoreData(false)
mViewModel.errorSubList(type, page)
smartRefresh.finishRefresh()
refresh()
}
smartRefresh.setOnLoadMoreListener {
++page
mViewModel.errorSubList(type, page)
smartRefresh.finishLoadMore()
loadMore()
}
recyclerview.adapter = exercisesAdapter
exercisesAdapter.setOnItemClickListener { adapter, view, position ->
... ... @@ -74,15 +74,27 @@ class SpecialExercisesFragment
intent.putExtra("id", exercisesAdapter.data[position].id)
startActivity(intent)
}
recyclerview.addItemDecorationCustom(TranslateUnit.dp2px(context, 16f))
}
}
private fun refresh() {
page = 1
mViewModel.errorSubList(type, page)
binding.smartRefresh.setEnableRefresh(false)
binding.smartRefresh.setEnableLoadMore(false)
}
private fun loadMore(){
++page
mViewModel.errorSubList(type, page)
binding.smartRefresh.setEnableRefresh(false)
binding.smartRefresh.setEnableLoadMore(false)
}
override fun onResume() {
super.onResume()
if (map[type] == true) {
map[type] = false
binding.smartRefresh.autoRefresh()
}
refresh()
}
companion object {
... ...
... ... @@ -13,14 +13,13 @@ import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
import java.net.URLEncoder
/**
* Time: 7/31/2021 14:33
* Author: Captain
* Description: 初见时你很迷人
*/
class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepository(loadState) {
class EditPersonalInfoRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
fun getMineInfo(
liveData: MutableLiveData<BaseResponse<MineInfoBean>>
... ... @@ -42,19 +41,18 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo
path: String,
liveData: MutableLiveData<BaseResponse<UploadFileData>>
) {
val imageRequestFile: RequestBody?
var imageBody: MultipartBody.Part? = null
val file = File(path)
if (file.exists()) {
imageRequestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file)
imageBody = MultipartBody.Part.createFormData(
MultipartBody.Part.createFormData(
"file", file.name, RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
apiService.uploadFile(
MultipartBody.Part.createFormData(
"file",
URLEncoder.encode(file.name, "UTF-8"), imageRequestFile!!
file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
}
apiService.uploadFile(imageBody!!)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
... ... @@ -65,6 +63,7 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo
)
)
}
}
fun changePersonalInfo(
avatar: String,
... ... @@ -72,7 +71,7 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo
bio: String,
liveData: MutableLiveData<BaseResponse<Void>>
) {
apiService.changePersonalInfo(avatar,nickname,bio)
apiService.changePersonalInfo(avatar, nickname, bio)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
... ... @@ -82,6 +81,13 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo
this
)
)
}
fun deleteFace(liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.deleteFace(), liveData)
}
fun setFace(url: String, liveData: MutableLiveData<BaseResponse<Void>>) {
addRequest(apiService.setFace(url), liveData)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.repository.TrainRepository
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
/**
* Time: 8/3/2021 11:16
... ... @@ -9,4 +12,14 @@ import com.br_technology.securitytrain_master.base.view.BaseViewModel
* Description: 初见时你很迷人
*/
class ClassDutyViewModel : BaseViewModel<TrainRepository>() {
var mFaceFile = MutableLiveData<BaseResponse<UploadFileData>>()
var mFaceCheck = MutableLiveData<BaseResponse<Void>>()
fun uploadFace(filePath: String) {
mRepository.uploadFile(filePath, mFaceFile)
}
fun checkFace(url: String) {
mRepository.checkFace(url, mFaceCheck)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import com.br_technology.securitytrain_master.base.view.BaseViewModel
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
import com.br_technology.securitytrain_master.ui.view.mine.repository.EditPersonalInfoRepository
import com.br_technology.securitytrain_master.base.network.response.BaseResponse
import java.io.File
/**
* Time: 7/31/2021 14:38
... ... @@ -14,20 +15,35 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
*/
class EditPersonalInfoViewModel : BaseViewModel<EditPersonalInfoRepository>() {
var mUploadFileData: MutableLiveData<BaseResponse<UploadFileData>> = MutableLiveData()
var mUploadFaceFileData: MutableLiveData<BaseResponse<UploadFileData>> = MutableLiveData()
var deleteResponse: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
var changeResponse: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
fun uploadFile(path: String) {
mRepository.uploadFile(path, mUploadFileData)
}
fun uploadFaceFile(file: File) {
mRepository.uploadFile(file.path, mUploadFaceFileData)
}
var mMineInfoBean: MutableLiveData<BaseResponse<MineInfoBean>> = MutableLiveData()
fun getMineInfo() {
mRepository.getMineInfo( mMineInfoBean)
mRepository.getMineInfo(mMineInfoBean)
}
var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
fun changePersonalInfo(avatar: String,nickname: String,bio: String) {
mRepository.changePersonalInfo(avatar, nickname,bio,mCommonBean)
fun changePersonalInfo(avatar: String, nickname: String, bio: String) {
mRepository.changePersonalInfo(avatar, nickname, bio, mCommonBean)
}
fun deleteFace() {
mRepository.deleteFace(deleteResponse)
}
fun changeFace(url: String) {
mRepository.setFace(url, changeResponse)
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.util
import android.hardware.Camera
import android.hardware.Camera.getNumberOfCameras
import android.os.Build
/**
* Author by YSir
* Date on 2022/3/24.
* description
* PS: Not easy to write code, please indicate.
*/
object CameraUtil {
fun isSupportFrontCamera(): Boolean {
if (!hasGingerBread()) {
return false
}
val numberOfCameras = getNumberOfCameras()
val cameraInfo = Camera.CameraInfo()
for (i in 0..numberOfCameras) {
Camera.getCameraInfo(i, cameraInfo)
if (1 == cameraInfo.facing) {
return true
}
}
return false
}
private fun hasGingerBread(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.util
import android.app.Activity
import android.content.ContentValues
import android.content.Intent
import android.hardware.camera2.CameraCharacteristics
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
import androidx.core.content.FileProvider
import com.br_technology.securitytrain_master.base.common.Constant
import com.netease.image.library.config.CompressConfig
import com.netease.image.library.core.CompressImageUtil
import com.netease.image.library.listener.CompressResultListener
import java.io.File
/**
* Author by YSir
* Date on 2022/3/26.
* description
* PS: Not easy to write code, please indicate.
*/
class FaceUtil {
companion object{
const val FRONT_CAPTURE_CODE = 998
}
private val photoUtils = PhotoUtils()
private var fileUploadTemp: File? = null
private var compressImageUtil: CompressImageUtil? = null
interface ICapture {
fun capture(file: File)
}
interface ICompress{
fun compress(file: File)
}
fun startCaptureFace(activity: Activity, iCapture: ICapture) {
val intent: Intent
val pictureUri: Uri
//也就是我之前创建的存放头像的文件夹(目录)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
photoUtils.createDirs()
fileUploadTemp =
File(Constant.ACCOUNT_DIR_PIC, "person_face_${System.currentTimeMillis()}.jpeg")
} else {
photoUtils.createPicDirs()
fileUploadTemp =
File(Constant.ACCOUNT_DIR, "person_face_${System.currentTimeMillis()}.jpeg")
}
// 判断当前系统
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
//这一句非常重要
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
val strPackageName = activity.packageName
intent.putExtra(
"android.intent.extras.CAMERA_FACING",
CameraCharacteristics.LENS_FACING_BACK
)
intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1)
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
intent.putExtra("camerafacing", "front");
intent.putExtra("previous_mode", "front");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// 通过 MediaStore API 插入file 为了拿到系统裁剪要保存到的uri(因为App没有权限不能访问公共存储空间,需要通过 MediaStore API来操作)
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
val values = ContentValues()
values.put(MediaStore.Images.Media.DATA, fileUploadTemp!!.absolutePath)
values.put(MediaStore.Images.Media.DISPLAY_NAME, fileUploadTemp!!.name)
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
pictureUri =
activity.contentResolver.insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
values
)!!
} else {
//""中的内容是随意的,但最好用package名.provider名的形式,清晰明了
pictureUri =
FileProvider.getUriForFile(
activity,
"$strPackageName.provider",
fileUploadTemp!!
)
}
} else {
intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
pictureUri = Uri.fromFile(fileUploadTemp)
}
// 去拍照,拍照的结果存到pictureUri对应的路径中
intent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri)
activity.startActivityForResult(intent, FRONT_CAPTURE_CODE)
iCapture.capture(fileUploadTemp!!)
}
fun compressFile(activity: Activity,file: File,iCompress: ICompress) {
if (compressImageUtil == null) {
val compressConfig: CompressConfig = CompressConfig.builder()
.setUnCompressMinPixel(1000) // 最小像素不压缩,默认值:1000
.setUnCompressNormalPixel(2000) // 标准像素不压缩,默认值:2000
// .setMaxPixel(1000) // 长或宽不超过的最大像素 (单位px),默认值:1200
.setMaxSize(3 * 1024 * 1024) // 压缩到的最大大小 (单位B),默认值:200 * 1024 = 200KB
.enablePixelCompress(true) // 是否启用像素压缩,默认值:true
.enableQualityCompress(true) // 是否启用质量压缩,默认值:true
.enableReserveRaw(true) // 是否保留源文件,默认值:true
.setCacheDir(activity.cacheDir.path) // 压缩后缓存图片路径,默认值:Constants.COMPRESS_CACHE
.setShowCompressDialog(false) // 是否显示压缩进度条,默认值:false
.create()
compressImageUtil = CompressImageUtil(activity, compressConfig)
}
compressImageUtil!!.compress(file.path, object : CompressResultListener {
override fun onCompressSuccess(imgPath: String) {
iCompress.compress(File(imgPath))
}
override fun onCompressFailed(imgPath: String, error: String) {
iCompress.compress(File(imgPath))
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -39,17 +39,18 @@ class PhotoUtils {
var CUTTING_IMAGE_NAME = "PhotoCopy.jpg"
private var mCallBack: PhotoCallBack? = null
private var isFront: Boolean = false
companion object {
private var instance:PhotoUtils ? = null
private var instance: PhotoUtils? = null
get() {
if (field == null){
if (field == null) {
field = PhotoUtils()
}
return field
}
fun get(): PhotoUtils{
fun get(): PhotoUtils {
return instance!!
}
}
... ... @@ -61,21 +62,14 @@ class PhotoUtils {
* @return
*/
private fun checkCameraPermission(context: Activity): Boolean {
var isPermission = false
isPermission = if (ContextCompat.checkSelfPermission(
return (ContextCompat.checkSelfPermission(
context,
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
&& ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) == PackageManager.PERMISSION_GRANTED
) {
true
} else {
false
}
return isPermission
) == PackageManager.PERMISSION_GRANTED)
}
/**
... ... @@ -98,17 +92,10 @@ class PhotoUtils {
* @return
*/
private fun checkAlbumPermission(context: Activity): Boolean {
var isPermission = false
isPermission = if (ContextCompat.checkSelfPermission(
return ContextCompat.checkSelfPermission(
context,
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
) {
true
} else {
false
}
return isPermission
}
/**
... ... @@ -119,7 +106,7 @@ class PhotoUtils {
*/
private fun requestAlbumPermissions(context: Activity) {
// 权限还没有授予,进行申请
val permissions = arrayOf<String>(Manifest.permission.WRITE_EXTERNAL_STORAGE)
val permissions = arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE)
ActivityCompat.requestPermissions(context, permissions, REQUEST_ALBUM_PERMISSIONS)
}
... ... @@ -176,37 +163,6 @@ class PhotoUtils {
}
REQUEST_IMAGE_CAMERA -> {
val pictureFile = File(Constant.ACCOUNT_DIR, IMAGE_NAME)
// //鲁班压缩图片
// Luban.with(context)
// .load(pictureFile)
// .ignoreBy(100)
// .filter(new CompressionPredicate() {
// @Override
// public boolean apply(String path) {
// return !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"));
// }
// })
// .setCompressListener(new OnCompressListener() {
// @Override
// public void onStart() {
// // TODO 压缩开始前调用,可以在方法内启动 loading UI
//// ProgressUtils.showProgressDialog(context);
// }
//
// @Override
// public void onSuccess(File file) {
// // TODO 压缩成功后调用,返回压缩后的图片文件
// String newPath = file.getAbsolutePath();
// if (mCallBack != null)
// mCallBack.onSuccessListener(newPath);
//// ProgressUtils.dismissProgressDialog();
// }
//
// @Override
// public void onError(Throwable e) {
// // TODO 当压缩过程出现问题时调用
// }
// }).launch();
val cameraUri: Uri
cameraUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
val strPackageName = context.packageName
... ... @@ -239,7 +195,7 @@ class PhotoUtils {
}
REQUEST_IMAGE_CUTTING -> {
val pictureFile1 = File(Constant.ACCOUNT_DIR, IMAGE_NAME)
if (mCallBack != null) mCallBack!!.onSuccessListener(Constant.ACCOUNT_DIR.toString() + CUTTING_IMAGE_NAME)
if (mCallBack != null) mCallBack!!.onSuccessListener(Constant.ACCOUNT_DIR + CUTTING_IMAGE_NAME)
//保存照片到系统相册中
try {
MediaStore.Images.Media.insertImage(
... ... @@ -270,7 +226,7 @@ class PhotoUtils {
*
* @param context
*/
fun startAlbum(context: Activity, fileName: String, callBack: PhotoCallBack?) {
private fun startAlbum(context: Activity, fileName: String, callBack: PhotoCallBack?) {
// createDirs();
CUTTING_IMAGE_NAME = fileName
mCallBack = callBack
... ... @@ -291,12 +247,16 @@ class PhotoUtils {
startCamera(context, CUTTING_IMAGE_NAME, mCallBack)
}
private fun startFrontCamera(context: Activity) {
startFrontCamera(context, CUTTING_IMAGE_NAME, mCallBack)
}
/**
* 启动系统相机
*
* @param context
*/
fun startCamera(context: Activity, fileName: String, callBack: PhotoCallBack?) {
private fun startCamera(context: Activity, fileName: String, callBack: PhotoCallBack?) {
CUTTING_IMAGE_NAME = fileName
mCallBack = callBack
createDirs()
... ... @@ -322,6 +282,32 @@ class PhotoUtils {
context.startActivityForResult(intent, REQUEST_IMAGE_CAMERA)
}
fun startFrontCamera(context: Activity, fileName: String, callBack: PhotoCallBack?) {
CUTTING_IMAGE_NAME = fileName
mCallBack = callBack
createDirs()
val intent: Intent
val pictureUri: Uri
//也就是我之前创建的存放头像的文件夹(目录)
val pictureFile = File(Constant.ACCOUNT_DIR, IMAGE_NAME)
// 判断当前系统
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
//这一句非常重要
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
val strPackageName = context.packageName
//""中的内容是随意的,但最好用package名.provider名的形式,清晰明了
pictureUri = FileProvider.getUriForFile(context, "$strPackageName.provider", pictureFile)
} else {
intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
pictureUri = Uri.fromFile(pictureFile)
}
// 去拍照,拍照的结果存到pictureUri对应的路径中
intent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri)
intent.putExtra("android.intent.extras.CAMERA_FACING", 1)
context.startActivityForResult(intent, REQUEST_IMAGE_CAMERA)
}
/**
* 启动系统裁剪
*
... ... @@ -425,13 +411,13 @@ class PhotoUtils {
val view: View =
LayoutInflater.from(activity).inflate(R.layout.dialog_photo, null) //获取自定义布局
val tvCancel: TextView = view.findViewById(R.id.tv_photo_cancel)
tvCancel.setOnClickListener(object : View.OnClickListener{
tvCancel.setOnClickListener(object : View.OnClickListener {
override fun onClick(view: View?) {
DialogBottomUtils.get().dismissDialog()
}
})
val tvAlbum: TextView = view.findViewById(R.id.tv_photo_from_album)
tvAlbum.setOnClickListener(object : View.OnClickListener{
tvAlbum.setOnClickListener(object : View.OnClickListener {
override fun onClick(view: View?) {
if (checkAlbumPermission(activity)) {
startAlbum(activity)
... ... @@ -442,7 +428,7 @@ class PhotoUtils {
}
})
val tvCamera: TextView = view.findViewById(R.id.tv_photo_from_camera)
tvCamera.setOnClickListener(object : View.OnClickListener{
tvCamera.setOnClickListener(object : View.OnClickListener {
override fun onClick(view: View?) {
if (checkCameraPermission(activity)) {
startCamera(activity)
... ... @@ -455,13 +441,20 @@ class PhotoUtils {
DialogBottomUtils.get().showDialogBottom(activity, view)
}
private fun createDirs() {
fun createDirs() {
val fileDir = File(Constant.ACCOUNT_DIR)
if (!fileDir.exists()) {
fileDir.mkdirs()
}
}
fun createPicDirs() {
val fileDir = File(Constant.ACCOUNT_DIR_PIC)
if (!fileDir.exists()) {
fileDir.mkdirs()
}
}
fun dismissDialog() {
DialogBottomUtils.get().dismissDialog()
}
... ...
... ... @@ -15,7 +15,9 @@ const val USERID = "userId"
const val PHONE_NUMBER = "phone_number"
const val IS_LOGIN = "is_login"
const val POI_ID = "pos_id"
const val POI_ID_ = "pos_id_"
const val POI_NAME = "pos_name"
const val POI_NAME_ = "pos_name_"
var token by SpUtil(TOKEN, "")
... ... @@ -23,7 +25,9 @@ var userId by SpUtil(USERID, 0)
var phone_number by SpUtil(PHONE_NUMBER, "")
var is_login by SpUtil(IS_LOGIN, false)
var sp_job_id by SpUtil(POI_ID, 0)
var sp_job_name by SpUtil(POI_NAME, "")
var sp_job_id_select by SpUtil(POI_ID_, 0)
var sp_job_name by SpUtil(POI_NAME_, "")
var sp_job_name_select by SpUtil(POI_NAME_, "工种")
const val TYPE_LIVE = 0
const val TYPE_HOME = 1
... ...
... ... @@ -11,8 +11,8 @@ import com.br_technology.securitytrain_master.expand.screenWidth
import com.br_technology.securitytrain_master.ui.view.home.adapter.TextCourseTypeAdapter
import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEvent
import com.br_technology.securitytrain_master.util.sp_job_id
import com.br_technology.securitytrain_master.util.sp_job_name
import com.br_technology.securitytrain_master.util.sp_job_id_select
import com.br_technology.securitytrain_master.util.sp_job_name_select
import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
import org.greenrobot.eventbus.EventBus
... ... @@ -30,13 +30,22 @@ class ClassifyPop(context: Activity, type: Int) : PopupWindow(context) {
PopClassifyBinding.inflate(LayoutInflater.from(context))
}
interface IClickListener {
fun work(data: WorkTypeBean.ListBean)
}
private var iClickListener: IClickListener? = null
fun setIClickListener(iClickListener: IClickListener) {
this.iClickListener = iClickListener
}
fun setList(workTypeList: MutableList<WorkTypeBean.ListBean>) {
mWorkTypeList = workTypeList
mWorkTypeList?.let { textCourseTypeAdapter?.addList(it) }
}
init {
contentView = binding.root
width = contentView.screenWidth()
height = contentView.screenHeight()
... ... @@ -61,12 +70,16 @@ class ClassifyPop(context: Activity, type: Int) : PopupWindow(context) {
val index: Int = (mWorkTypeList?.size ?: mWorkTypeList?.size) as Int
if (index > pos) {
mWorkTypeList?.get(pos)!!.let {
sp_job_id = it.id
sp_job_name = it.name
sp_job_id_select = it.id
sp_job_name_select = it.name
}
if (iClickListener == null) {
EventBus.getDefault().post(
mWorkTypeList?.get(pos)!!
.let { it1 -> GetWorkTypeEvent(it1.id, it1.name, type) })
} else {
iClickListener?.work(mWorkTypeList?.get(pos)!!)
}
}
dismiss()
}
... ...
package com.br_technology.securitytrain_master.view
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.DialogCheckIdBinding
import com.br_technology.securitytrain_master.expand.dp2px
import com.br_technology.securitytrain_master.expand.screenWidth
/**
* Author by YSir
* Date on 2022/3/26.
* description
* PS: Not easy to write code, please indicate.
*/
class DialogCheckIDCard(context: Context) : Dialog(context, R.style.UserDefaultDialog) {
private val binding by lazy {
DialogCheckIdBinding.inflate(LayoutInflater.from(context))
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
val attributes = window?.attributes
attributes?.width = binding.root.screenWidth() - 32.dp2px()
// 点击区域外取消
setCanceledOnTouchOutside(false)
setCancelable(false)
}
fun setListener(listenerLeft: View.OnClickListener, listenerRight: View.OnClickListener): DialogCheckIDCard {
binding.apply {
btnLeft.setOnClickListener { listenerLeft.onClick(it) }
btnRight.setOnClickListener { listenerRight.onClick(it) }
}
return this
}
}
\ No newline at end of file
... ...
... ... @@ -5,12 +5,8 @@ import android.content.Context
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableString
import android.text.style.AbsoluteSizeSpan
import android.text.style.ForegroundColorSpan
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.DialogTitleBinding
... ... @@ -62,18 +58,18 @@ class DialogTitle(context: Context) : Dialog(context, R.style.UserDefaultDialog)
fun setTitleSpan(title: String): DialogTitle {
val span: Spannable = SpannableString(title)
span.setSpan(
AbsoluteSizeSpan(36.dp2px()),
2,
title.length - 2,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
span.setSpan(
ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_25)),
2,
title.length - 2,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
// span.setSpan(
// AbsoluteSizeSpan(36.dp2px()),
// 2,
// title.length - 2,
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
// )
// span.setSpan(
// ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_25)),
// 2,
// title.length - 2,
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
// );
binding.title.text = span
return this
}
... ... @@ -116,7 +112,7 @@ class DialogTitle(context: Context) : Dialog(context, R.style.UserDefaultDialog)
fun setInfo(title: String): DialogTitle {
binding.info.text = title
binding.info.gravity = Gravity.START
// binding.info.gravity = Gravity.START
binding.info.visibility = View.VISIBLE
return this
}
... ...
... ... @@ -97,7 +97,6 @@
android:layout_weight="1"
android:orientation="vertical" />
<TextView
android:id="@+id/tv_upload"
android:layout_width="match_parent"
... ...
... ... @@ -22,8 +22,12 @@
android:padding="12dp"
android:src="@mipmap/ic_back" />
<View
<TextView
android:layout_width="0dp"
android:text="资料库"
android:gravity="center"
android:textColor="@color/black"
android:textSize="18sp"
android:layout_height="match_parent"
android:layout_weight="1" />
... ...
... ... @@ -24,277 +24,318 @@
<com.br_technology.securitytrain_master.util.CircleImageView
android:id="@+id/iv_icon"
android:layout_width="72dp"
android:layout_height="72dp"/>
android:layout_height="72dp" />
<ImageView
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:src="@mipmap/edit_camera" />
</RelativeLayout>
<LinearLayout
android:layout_marginTop="40dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="姓名:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text="赵丽静"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:visibility="invisible"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:visibility="invisible" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7"
android:background="@color/color_f7"/>
<LinearLayout
android:id="@+id/ll_change_face"
android:layout_width="match_parent"
android:layout_height="1dp">
android:layout_height="48dp"
android:orientation="horizontal">
</View>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:text="人脸识别:"
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_phone_face"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:text="未设置"
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:contentDescription="@null"
android:src="@mipmap/ic_arrow" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7"/>
<LinearLayout
android:id="@+id/ll_change_phone"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="手机号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text="15435643667"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow" />
</LinearLayout>
<View
android:layout_marginStart="16dp"
android:background="@color/color_f7"
android:layout_width="match_parent"
android:layout_height="1dp">
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7">
</View>
<LinearLayout
android:id="@+id/ll_change_pwd"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="密码:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text=""
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow" />
</LinearLayout>
<View
android:background="@color/color_f7"
android:layout_width="match_parent"
android:layout_height="8dp">
android:layout_height="8dp"
android:background="@color/color_f7">
</View>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="身份证号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_identity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text="154356436675475467567435"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:visibility="invisible"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:visibility="invisible" />
</LinearLayout>
<View
android:layout_marginStart="16dp"
android:background="@color/color_f7"
android:layout_width="match_parent"
android:layout_height="1dp">
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7">
</View>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="部门:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_department_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text="工程部"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:visibility="invisible"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:visibility="invisible" />
</LinearLayout>
<View
android:layout_marginStart="16dp"
android:background="@color/color_f7"
android:layout_width="match_parent"
android:layout_height="1dp">
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7">
</View>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:textColor="@color/color_32"
android:textSize="14sp"
android:text="岗位:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_pos_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:gravity="end"
android:layout_gravity="center_vertical"
android:textColor="@color/color_96"
android:textSize="14sp"
android:text="设备工程师"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:textColor="@color/color_96"
android:textSize="14sp" />
<ImageView
android:visibility="invisible"
android:layout_marginEnd="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:src="@mipmap/ic_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:visibility="invisible" />
</LinearLayout>
<View
android:layout_marginStart="16dp"
android:background="@color/color_f7"
android:layout_width="match_parent"
android:layout_height="1dp">
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:background="@color/color_f7">
</View>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -31,8 +31,7 @@
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_below="@id/toolbar"
app:toolTitle="每日一练" />
android:layout_below="@id/toolbar" />
</RelativeLayout>
... ...
... ... @@ -22,10 +22,14 @@
android:padding="12dp"
android:src="@mipmap/ic_back" />
<View
<TextView
android:text="课程详情"
android:layout_width="0dp"
android:gravity="center"
android:textColor="@color/black"
android:textSize="18sp"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1"/>
<ImageView
android:id="@+id/start"
... ...
... ... @@ -12,6 +12,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="12dp"
android:drawableStart="@mipmap/pdf"
android:drawablePadding="8dp"
android:gravity="center_vertical"
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:background="@drawable/solid_ff_8"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:textSize="16sp"
android:textColor="@color/black"
android:gravity="center"
android:text="身份信息验证" />
<TextView
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:gravity="top|center_horizontal"
android:text="设置人脸识别照片为本人学习"
android:textColor="@color/color_96"
android:textSize="14sp"
android:visibility="visible" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_left"
android:layout_width="118dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/solid_ce_4"
android:gravity="center"
android:text="取消"
android:textColor="@color/exo_black_opacity_60"
android:textSize="15sp" />
<View
android:id="@+id/space"
android:layout_width="@dimen/dp_40"
android:layout_height="40dp" />
<TextView
android:id="@+id/btn_right"
android:layout_width="118dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/solid_25_4"
android:gravity="center"
android:text="人脸识别"
android:textColor="@color/white"
android:textSize="15sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -28,6 +28,8 @@
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:textSize="16sp"
android:textColor="@color/black"
android:gravity="center"
android:text="答对6道题" />
... ... @@ -42,7 +44,7 @@
android:gravity="top|center_horizontal"
android:text="共9道题"
android:textColor="@color/color_96"
android:textSize="12sp"
android:textSize="14sp"
android:visibility="visible" />
<androidx.appcompat.widget.LinearLayoutCompat
... ...
... ... @@ -47,7 +47,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
... ... @@ -154,8 +155,8 @@
android:textColor="@color/color_32"
android:textSize="18sp" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshlayout"
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
... ... @@ -165,14 +166,16 @@
android:id="@+id/practice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:paddingHorizontal="16dp"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
... ...
... ... @@ -14,7 +14,6 @@
android:gravity="center"
android:visibility="gone" />
<LinearLayout
android:id="@+id/lay_data"
android:layout_width="match_parent"
... ... @@ -30,22 +29,20 @@
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="32dp"
android:layout_marginTop="16dp"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<LinearLayout
... ... @@ -58,7 +55,6 @@
android:layout_marginBottom="16dp"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/pr_upload_value"
style="@android:style/Widget.ProgressBar.Horizontal"
... ...
... ... @@ -6,18 +6,22 @@
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo"
android:scaleType="fitXY"
android:src="@mipmap/my_credentials_upload_bg" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="26dp"
android:layout_marginTop="12dp"
android:gravity="center"
android:layout_gravity="center"
android:textSize="@dimen/sp_14"
android:textColor="@color/black"
android:layout_marginBottom="32dp"
android:text="上传证"/>
android:text="上传证"/>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -15,6 +15,7 @@
android:src="@mipmap/card_back" />
<TextView
android:id="@+id/cert_validity_period_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
... ...
... ... @@ -4,7 +4,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical">
... ...
include ':app'
rootProject.name = "SecurityTrain-Master"
include ':Library'
... ...