作者 zhangji

我的证件未写完

正在显示 18 个修改的文件 包含 232 行增加77 行删除
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
26 android:icon="@mipmap/ic_launcher" 26 android:icon="@mipmap/ic_launcher"
27 android:label="@string/app_name" 27 android:label="@string/app_name"
28 android:networkSecurityConfig="@xml/network_security_config" 28 android:networkSecurityConfig="@xml/network_security_config"
  29 + android:requestLegacyExternalStorage="true"
29 android:roundIcon="@mipmap/ic_launcher_round" 30 android:roundIcon="@mipmap/ic_launcher_round"
30 android:supportsRtl="true" 31 android:supportsRtl="true"
31 android:theme="@style/Theme.SecurityTrainMaster" 32 android:theme="@style/Theme.SecurityTrainMaster"
@@ -193,8 +194,9 @@ @@ -193,8 +194,9 @@
193 <activity 194 <activity
194 android:name=".ui.view.home.activity.course.LocationSignActivity" 195 android:name=".ui.view.home.activity.course.LocationSignActivity"
195 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" /> 196 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" />
196 - <activity android:name=".ui.view.home.activity.course.CoursePractiseActivity"  
197 - android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"/> 197 + <activity
  198 + android:name=".ui.view.home.activity.course.CoursePractiseActivity"
  199 + android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" />
198 <activity android:name=".ui.view.bank.activity.AnswerRecordDetailsActivity" /> 200 <activity android:name=".ui.view.bank.activity.AnswerRecordDetailsActivity" />
199 <activity android:name=".ui.view.bank.activity.WrongQuestionsActivity" /> 201 <activity android:name=".ui.view.bank.activity.WrongQuestionsActivity" />
200 202
1 package com.br_technology.securitytrain_master.base.network.api 1 package com.br_technology.securitytrain_master.base.network.api
2 2
3 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
4 -import com.br_technology.securitytrain_master.base.network.response.CommonDetail  
5 -import com.br_technology.securitytrain_master.base.network.response.CommonList  
6 -import com.br_technology.securitytrain_master.base.network.response.CommonPage 3 +import com.br_technology.securitytrain_master.base.network.response.*
7 import com.br_technology.securitytrain_master.ui.bean.* 4 import com.br_technology.securitytrain_master.ui.bean.*
8 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean 5 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
9 import io.reactivex.rxjava3.core.Observable 6 import io.reactivex.rxjava3.core.Observable
@@ -197,7 +194,7 @@ interface UserApi : ApiService { @@ -197,7 +194,7 @@ interface UserApi : ApiService {
197 fun certList( 194 fun certList(
198 @Field("page") page: Int, 195 @Field("page") page: Int,
199 @Field("page_num") page_num: String 196 @Field("page_num") page_num: String
200 - ): Observable<BaseResponse<CommonPage<UserCert>>> 197 + ): Observable<BaseResponse<CommonDataList<CommonPage<UserCert>>>>
201 198
202 /** 199 /**
203 * 证件详情 200 * 证件详情
@@ -2,10 +2,7 @@ package com.br_technology.securitytrain_master.base.repository @@ -2,10 +2,7 @@ package com.br_technology.securitytrain_master.base.repository
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
4 import com.br_technology.securitytrain_master.base.common.State 4 import com.br_technology.securitytrain_master.base.common.State
5 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
6 -import com.br_technology.securitytrain_master.base.network.response.CommonDetail  
7 -import com.br_technology.securitytrain_master.base.network.response.CommonList  
8 -import com.br_technology.securitytrain_master.base.network.response.CommonPage 5 +import com.br_technology.securitytrain_master.base.network.response.*
9 import com.br_technology.securitytrain_master.ui.bean.* 6 import com.br_technology.securitytrain_master.ui.bean.*
10 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean 7 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
11 8
@@ -108,7 +105,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat @@ -108,7 +105,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
108 fun certList( 105 fun certList(
109 page: Int, 106 page: Int,
110 page_num: String, 107 page_num: String,
111 - liveData: MutableLiveData<BaseResponse<CommonPage<UserCert>>> 108 + liveData: MutableLiveData<BaseResponse<CommonDataList<CommonPage<UserCert>>>>
112 ) { 109 ) {
113 addRequest(userService.certList(page, page_num), liveData) 110 addRequest(userService.certList(page, page_num), liveData)
114 } 111 }
@@ -45,6 +45,9 @@ abstract class BaseMultiAdapter<T, VB : ViewBinding> : RecyclerView.Adapter<Base @@ -45,6 +45,9 @@ abstract class BaseMultiAdapter<T, VB : ViewBinding> : RecyclerView.Adapter<Base
45 45
46 abstract fun onBind(holder: VB, position: Int) 46 abstract fun onBind(holder: VB, position: Int)
47 47
  48 + fun getData(position: Int):T?{
  49 + return list?.get(position)
  50 + }
48 51
49 override fun getItemCount(): Int { 52 override fun getItemCount(): Int {
50 return if (list.isEmpty()) { 53 return if (list.isEmpty()) {
@@ -81,6 +84,11 @@ abstract class BaseMultiAdapter<T, VB : ViewBinding> : RecyclerView.Adapter<Base @@ -81,6 +84,11 @@ abstract class BaseMultiAdapter<T, VB : ViewBinding> : RecyclerView.Adapter<Base
81 notifyItemChanged(position, list.size) 84 notifyItemChanged(position, list.size)
82 } 85 }
83 86
  87 + fun addListClear(t: List<T>) {
  88 + list.clear()
  89 + list.addAll(t)
  90 + notifyDataSetChanged()
  91 + }
84 protected fun startActivity(context: Context, cls: Class<out Activity>) { 92 protected fun startActivity(context: Context, cls: Class<out Activity>) {
85 startActivity(context, cls, null) 93 startActivity(context, cls, null)
86 } 94 }
@@ -38,7 +38,14 @@ fun ImageView.courseHead(pic: String) { @@ -38,7 +38,14 @@ fun ImageView.courseHead(pic: String) {
38 fun ImageView.loadPic(pic: String) { 38 fun ImageView.loadPic(pic: String) {
39 Glide.with(this) 39 Glide.with(this)
40 .load(pic) 40 .load(pic)
41 - .placeholder(R.mipmap.placeholder_head) 41 + .apply(RequestOptions().centerCrop())
  42 + .into(this)
  43 +}
  44 +
  45 +fun ImageView.loadPicNoCrop(pic: String,width:Int,height:Int) {
  46 + Glide.with(this)
  47 + .load(pic)
  48 + .override(width,height)
42 .into(this) 49 .into(this)
43 } 50 }
44 51
@@ -77,6 +77,7 @@ open class UserCertDetail( @@ -77,6 +77,7 @@ open class UserCertDetail(
77 var mobile: String, // 手机号 77 var mobile: String, // 手机号
78 var valid: Int, // 有效期 78 var valid: Int, // 有效期
79 var start_time: String, // 生效时间 79 var start_time: String, // 生效时间
  80 + var update_time: String, // 生效时间
80 var end_time: String, // 失效时间 81 var end_time: String, // 失效时间
81 var status: String, // 审核状态1=待审核2=审核通过3=审核驳回 82 var status: String, // 审核状态1=待审核2=审核通过3=审核驳回
82 var cert: UserCertData, 83 var cert: UserCertData,
1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
3 import android.view.View 3 import android.view.View
  4 +import android.widget.TimePicker
  5 +import com.bigkoo.pickerview.builder.TimePickerBuilder
  6 +import com.bigkoo.pickerview.configure.PickerOptions
  7 +import com.bigkoo.pickerview.listener.OnTimeSelectListener
  8 +import com.bigkoo.pickerview.view.TimePickerView
4 import com.br_technology.securitytrain_master.R 9 import com.br_technology.securitytrain_master.R
5 import com.br_technology.securitytrain_master.databinding.ActivityCredentialsUploadBinding 10 import com.br_technology.securitytrain_master.databinding.ActivityCredentialsUploadBinding
  11 +import com.br_technology.securitytrain_master.expand.dp2px
  12 +import com.br_technology.securitytrain_master.expand.loadPicNoCrop
  13 +import com.br_technology.securitytrain_master.expand.screenWidth
6 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.CredentialsUpLoadViewModel 14 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.CredentialsUpLoadViewModel
  15 +import com.br_technology.securitytrain_master.util.GlideEnginePic
  16 +import com.luck.picture.lib.PictureSelector
  17 +import com.luck.picture.lib.config.PictureMimeType
  18 +import com.luck.picture.lib.entity.LocalMedia
  19 +import com.luck.picture.lib.listener.OnResultCallbackListener
7 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 20 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
  21 +import java.util.*
8 22
9 /** 23 /**
10 * Time: 8/2/2021 13:55 24 * Time: 8/2/2021 13:55
@@ -15,6 +29,9 @@ class CredentialsUpLoadActivity : @@ -15,6 +29,9 @@ class CredentialsUpLoadActivity :
15 BaseLifeCycleActivity<CredentialsUpLoadViewModel, ActivityCredentialsUploadBinding>( 29 BaseLifeCycleActivity<CredentialsUpLoadViewModel, ActivityCredentialsUploadBinding>(
16 ActivityCredentialsUploadBinding::inflate 30 ActivityCredentialsUploadBinding::inflate
17 ), View.OnClickListener { 31 ), View.OnClickListener {
  32 +
  33 + private var path: String = ""
  34 +
18 override fun initDataObserver() { 35 override fun initDataObserver() {
19 36
20 } 37 }
@@ -23,14 +40,55 @@ class CredentialsUpLoadActivity : @@ -23,14 +40,55 @@ class CredentialsUpLoadActivity :
23 super.initData() 40 super.initData()
24 binding.apply { 41 binding.apply {
25 tvUpload.setOnClickListener(this@CredentialsUpLoadActivity) 42 tvUpload.setOnClickListener(this@CredentialsUpLoadActivity)
  43 +
  44 + uploadPic.setOnClickListener {
  45 +
  46 + selectPicture()
  47 +// PictureSelector.create(this@CredentialsUpLoadActivity)
  48 + }
  49 + selectionPeriod.setOnClickListener {
  50 + selectTime()
  51 + }
26 } 52 }
  53 +
  54 +
  55 + // // 根据类型跳转
  56 +// CenterToast(this@MyCredentialsActivity).setTitle("上传成功").show()
27 } 57 }
28 58
29 override fun onClick(v: View?) { 59 override fun onClick(v: View?) {
30 - when (v!!.id) { 60 + when (v?.id) {
31 R.id.tv_upload -> { 61 R.id.tv_upload -> {
32 62
33 } 63 }
34 } 64 }
35 } 65 }
  66 +
  67 + private fun selectPicture() {
  68 + val width = mRootView.screenWidth() - 64.dp2px()
  69 + PictureSelector.create(this)
  70 + .openGallery(PictureMimeType.ofImage())
  71 + .imageEngine(GlideEnginePic.createGlideEngine())
  72 + .forResult(object : OnResultCallbackListener<LocalMedia> {
  73 + override fun onResult(result: MutableList<LocalMedia>?) {
  74 + path = result?.get(0)?.realPath ?: ""
  75 + if (path.isNotEmpty()) {
  76 + binding.uploadPic.loadPicNoCrop(path, width, 208.dp2px())
  77 + }
  78 + }
  79 +
  80 + override fun onCancel() {
  81 + }
  82 + })
  83 + }
  84 +
  85 + private fun selectTime() {
  86 + TimePickerBuilder(baseContext, object : OnTimeSelectListener {
  87 + override fun onTimeSelect(date: Date?, v: View?) {
  88 +
  89 + }
  90 + }).build().show()
  91 + }
  92 +
  93 +
36 } 94 }
1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
  3 +import android.content.Intent
3 import com.br_technology.securitytrain_master.R 4 import com.br_technology.securitytrain_master.R
4 import com.br_technology.securitytrain_master.databinding.ActivityMyCredentialsBinding 5 import com.br_technology.securitytrain_master.databinding.ActivityMyCredentialsBinding
5 import com.br_technology.securitytrain_master.expand.addItemDecoration2 6 import com.br_technology.securitytrain_master.expand.addItemDecoration2
6 import com.br_technology.securitytrain_master.expand.dp2px 7 import com.br_technology.securitytrain_master.expand.dp2px
  8 +import com.br_technology.securitytrain_master.ui.bean.UserCert
7 import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData 9 import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData
8 import com.br_technology.securitytrain_master.ui.view.mine.adapter.MyCredentialsAdapter 10 import com.br_technology.securitytrain_master.ui.view.mine.adapter.MyCredentialsAdapter
9 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyCredentialsViewModel 11 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyCredentialsViewModel
@@ -21,43 +23,59 @@ class MyCredentialsActivity : @@ -21,43 +23,59 @@ class MyCredentialsActivity :
21 BaseLifeCycleActivity<MyCredentialsViewModel, ActivityMyCredentialsBinding>( 23 BaseLifeCycleActivity<MyCredentialsViewModel, ActivityMyCredentialsBinding>(
22 ActivityMyCredentialsBinding::inflate 24 ActivityMyCredentialsBinding::inflate
23 ) { 25 ) {
  26 + private val adapter: MyCredentialsAdapter by lazy {
  27 + MyCredentialsAdapter()
  28 + }
  29 + private var page: Int = 1
24 override fun initDataObserver() { 30 override fun initDataObserver() {
25 - 31 + mViewModel.liveData.observe(this) {
  32 + if (it.data.list.data.size < 10) {
  33 + binding.smartRefresh.setNoMoreData(true)
  34 + }
  35 + if (page == 1) {
  36 + adapter.addListClear(it.data.list.data)
  37 + } else {
  38 + adapter.addList(it.data.list.data)
  39 + }
  40 + }
26 } 41 }
27 42
28 override fun initData() { 43 override fun initData() {
29 super.initData() 44 super.initData()
  45 +
  46 +
30 binding.apply { 47 binding.apply {
31 - recyclerview.addItemDecoration2(2, 8.dp2px(), 16.dp2px())  
32 - val recommendList = mutableListOf(  
33 - RecommendData(  
34 - R.mipmap.card_back,  
35 - "思维",  
36 - "从这个角度"  
37 - ),  
38 - RecommendData(  
39 - R.mipmap.card_back,  
40 - "思维",  
41 - "从这个角度"  
42 - ),  
43 - RecommendData(  
44 - R.mipmap.card_back,  
45 - "思维",  
46 - "从这个角度"  
47 - ),  
48 - )  
49 - val myCredentialsAdapter = MyCredentialsAdapter()  
50 - myCredentialsAdapter.addListener(object : OnItemClickListener<RecommendData> {  
51 - override fun onClick(position: Int, data: RecommendData) {  
52 - // 根据类型跳转  
53 - CenterToast(this@MyCredentialsActivity).setTitle("上传成功").show() 48 + smartRefresh.setOnRefreshListener {
  49 + smartRefresh.setNoMoreData(false)
  50 + page = 1
  51 + mViewModel.certList(page)
  52 + smartRefresh.finishRefresh()
  53 + }
  54 + smartRefresh.setOnLoadMoreListener {
  55 + ++page
  56 + mViewModel.certList(page)
  57 + smartRefresh.finishLoadMore()
  58 + }
54 59
  60 + recyclerview.addItemDecoration2(2, 8.dp2px(), 16.dp2px())
  61 + adapter.addListener(object : OnItemClickListener<UserCert> {
  62 + override fun onClick(position: Int, data: UserCert) {
  63 + val intent = Intent(baseContext, MyCredentialsDetailActivity::class.java)
  64 + intent.putExtra("id", data.id)
  65 + startActivity(intent)
55 } 66 }
56 }) 67 })
57 68
58 -  
59 - recyclerview.adapter = myCredentialsAdapter  
60 - myCredentialsAdapter.addList(recommendList) 69 + adapter.setAddCertListener {
  70 + // 添加
  71 + startActivity(CredentialsUpLoadActivity::class.java)
  72 + }
  73 + recyclerview.adapter = adapter
61 } 74 }
62 } 75 }
  76 +
  77 + override fun onResume() {
  78 + super.onResume()
  79 + binding.smartRefresh.autoRefresh()
  80 + }
63 } 81 }
1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
3 import com.br_technology.securitytrain_master.databinding.ActivityMyCredentialsDetailBinding 3 import com.br_technology.securitytrain_master.databinding.ActivityMyCredentialsDetailBinding
  4 +import com.br_technology.securitytrain_master.expand.loadPic
4 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyCredentialDetailViewModel 5 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.MyCredentialDetailViewModel
5 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 6 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
6 7
@@ -14,7 +15,15 @@ class MyCredentialsDetailActivity : @@ -14,7 +15,15 @@ class MyCredentialsDetailActivity :
14 ActivityMyCredentialsDetailBinding::inflate 15 ActivityMyCredentialsDetailBinding::inflate
15 ) { 16 ) {
16 override fun initDataObserver() { 17 override fun initDataObserver() {
17 - 18 + mViewModel.liveData.observe(this) {
  19 + binding.apply {
  20 + pictureIv.loadPic(it.data.detail.image_text)
  21 + certName.text = it.data.detail.cert.name
  22 + certDeadline.text = it.data.detail.end_time
  23 + certStartTime.text = it.data.detail.start_time
  24 + certUpTime.text = it.data.detail.update_time
  25 + }
  26 + }
18 } 27 }
19 28
20 override fun initData() { 29 override fun initData() {
@@ -26,4 +35,10 @@ class MyCredentialsDetailActivity : @@ -26,4 +35,10 @@ class MyCredentialsDetailActivity :
26 } 35 }
27 } 36 }
28 } 37 }
  38 +
  39 + override fun onResume() {
  40 + super.onResume()
  41 + val id = intent.getIntExtra("id", -1)
  42 + mViewModel.certDetail(id)
  43 + }
29 } 44 }
@@ -8,6 +8,9 @@ import com.br_technology.securitytrain_master.R @@ -8,6 +8,9 @@ import com.br_technology.securitytrain_master.R
8 import com.br_technology.securitytrain_master.base.view.BaseMultiAdapter 8 import com.br_technology.securitytrain_master.base.view.BaseMultiAdapter
9 import com.br_technology.securitytrain_master.databinding.ItemMyCredentialsUploadBinding 9 import com.br_technology.securitytrain_master.databinding.ItemMyCredentialsUploadBinding
10 import com.br_technology.securitytrain_master.databinding.ItemMycredentialsShowBinding 10 import com.br_technology.securitytrain_master.databinding.ItemMycredentialsShowBinding
  11 +import com.br_technology.securitytrain_master.expand.glideRound
  12 +import com.br_technology.securitytrain_master.expand.loadPic
  13 +import com.br_technology.securitytrain_master.ui.bean.UserCert
11 import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData 14 import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData
12 15
13 /** 16 /**
@@ -15,7 +18,8 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData @@ -15,7 +18,8 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendData
15 * Author: Captain 18 * Author: Captain
16 * Description: 初见时你很迷人 19 * Description: 初见时你很迷人
17 */ 20 */
18 -class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() { 21 +class MyCredentialsAdapter : BaseMultiAdapter<UserCert, ViewBinding>() {
  22 + private lateinit var addCertListener:()->Unit
19 override fun getViewBinding( 23 override fun getViewBinding(
20 context: Context, 24 context: Context,
21 parent: ViewGroup, 25 parent: ViewGroup,
@@ -31,6 +35,11 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() { @@ -31,6 +35,11 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() {
31 35
32 override fun onBind(holder: ViewBinding, position: Int) { 36 override fun onBind(holder: ViewBinding, position: Int) {
33 if (holder is ItemMycredentialsShowBinding) { 37 if (holder is ItemMycredentialsShowBinding) {
  38 + holder.apply {
  39 + val userCert = getData(position)
  40 + certPicIv.loadPic(userCert?.image_text?:"")
  41 + certValidityPeriod.text="有效期:${userCert?.end_time}"
  42 + }
34 holder.root.setOnClickListener { 43 holder.root.setOnClickListener {
35 listener?.onClick(position, list[position]) 44 listener?.onClick(position, list[position])
36 } 45 }
@@ -38,7 +47,9 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() { @@ -38,7 +47,9 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() {
38 47
39 if (holder is ItemMyCredentialsUploadBinding) { 48 if (holder is ItemMyCredentialsUploadBinding) {
40 holder.root.setOnClickListener { 49 holder.root.setOnClickListener {
41 - listener?.onClick(position, RecommendData(R.mipmap.card_back, "", "")) 50 + if (::addCertListener.isInitialized) {
  51 + addCertListener.invoke()
  52 + }
42 } 53 }
43 } 54 }
44 } 55 }
@@ -59,4 +70,7 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() { @@ -59,4 +70,7 @@ class MyCredentialsAdapter : BaseMultiAdapter<RecommendData, ViewBinding>() {
59 } 70 }
60 } 71 }
61 72
  73 + fun setAddCertListener(callBack:()->Unit){
  74 + this.addCertListener=callBack
  75 + }
62 } 76 }
@@ -30,7 +30,7 @@ class MyErrorQuestionFragment : @@ -30,7 +30,7 @@ class MyErrorQuestionFragment :
30 override fun initDataObserver() { 30 override fun initDataObserver() {
31 mViewModel.liveData.observe(this) { 31 mViewModel.liveData.observe(this) {
32 map[type] = false 32 map[type] = false
33 - if (it.data.list.data.size <= 20) { 33 + if (it.data.list.data.size < 20) {
34 binding.smartRefresh.setNoMoreData(true) 34 binding.smartRefresh.setNoMoreData(true)
35 } 35 }
36 if (page == 1) { 36 if (page == 1) {
@@ -10,4 +10,7 @@ import com.br_technology.securitytrain_master.base.repository.ApiRepository @@ -10,4 +10,7 @@ import com.br_technology.securitytrain_master.base.repository.ApiRepository
10 * Description: 初见时你很迷人 10 * Description: 初见时你很迷人
11 */ 11 */
12 class MyCredentialsRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) { 12 class MyCredentialsRepository(val loadState: MutableLiveData<State>) : ApiRepository(loadState) {
  13 +
  14 +
  15 +
13 } 16 }
1 package com.br_technology.securitytrain_master.ui.view.mine.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
2 2
  3 +import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
  5 +import com.br_technology.securitytrain_master.base.network.response.CommonDetail
  6 +import com.br_technology.securitytrain_master.base.repository.UserRepository
3 import com.br_technology.securitytrain_master.base.view.BaseViewModel 7 import com.br_technology.securitytrain_master.base.view.BaseViewModel
  8 +import com.br_technology.securitytrain_master.ui.bean.UserCertDetail
4 import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredentialsDetailRepository 9 import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredentialsDetailRepository
5 10
6 /** 11 /**
@@ -8,5 +13,9 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredenti @@ -8,5 +13,9 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredenti
8 * Author: Captain 13 * Author: Captain
9 * Description: 初见时你很迷人 14 * Description: 初见时你很迷人
10 */ 15 */
11 -class MyCredentialDetailViewModel : BaseViewModel<MyCredentialsDetailRepository>() { 16 +class MyCredentialDetailViewModel : BaseViewModel<UserRepository>() {
  17 + val liveData: MutableLiveData<BaseResponse<CommonDetail<UserCertDetail>>> = MutableLiveData()
  18 + fun certDetail(id:Int){
  19 + mRepository.certDetail(id,liveData)
  20 + }
12 } 21 }
1 package com.br_technology.securitytrain_master.ui.view.mine.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
2 2
  3 +import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
  5 +import com.br_technology.securitytrain_master.base.network.response.CommonDataList
  6 +import com.br_technology.securitytrain_master.base.network.response.CommonList
  7 +import com.br_technology.securitytrain_master.base.network.response.CommonPage
  8 +import com.br_technology.securitytrain_master.base.repository.UserRepository
3 import com.br_technology.securitytrain_master.base.view.BaseViewModel 9 import com.br_technology.securitytrain_master.base.view.BaseViewModel
  10 +import com.br_technology.securitytrain_master.ui.bean.UserCert
4 import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredentialsRepository 11 import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredentialsRepository
5 12
6 /** 13 /**
@@ -8,5 +15,11 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredenti @@ -8,5 +15,11 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MyCredenti
8 * Author: Captain 15 * Author: Captain
9 * Description: 初见时你很迷人 16 * Description: 初见时你很迷人
10 */ 17 */
11 -class MyCredentialsViewModel : BaseViewModel<MyCredentialsRepository>() { 18 +class MyCredentialsViewModel : BaseViewModel<UserRepository>() {
  19 +
  20 + val liveData: MutableLiveData<BaseResponse<CommonDataList<CommonPage<UserCert>>>> = MutableLiveData()
  21 +
  22 + fun certList(page:Int){
  23 + mRepository.certList(page,"10",liveData)
  24 + }
12 } 25 }
@@ -15,22 +15,27 @@ @@ -15,22 +15,27 @@
15 15
16 16
17 <ImageView 17 <ImageView
18 - android:layout_width="311dp" 18 + android:id="@+id/upload_pic"
  19 + android:layout_width="match_parent"
19 android:layout_height="208dp" 20 android:layout_height="208dp"
20 android:layout_gravity="center_horizontal" 21 android:layout_gravity="center_horizontal"
  22 + android:layout_marginHorizontal="32dp"
21 android:layout_marginTop="33dp" 23 android:layout_marginTop="33dp"
  24 + android:scaleType="fitXY"
22 android:src="@mipmap/upload_credentials_bg" /> 25 android:src="@mipmap/upload_credentials_bg" />
23 26
24 <LinearLayout 27 <LinearLayout
25 - android:layout_width="311dp" 28 + android:id="@+id/select_type"
  29 + android:layout_width="match_parent"
26 android:layout_height="48dp" 30 android:layout_height="48dp"
27 android:layout_gravity="center_horizontal" 31 android:layout_gravity="center_horizontal"
  32 + android:layout_marginHorizontal="32dp"
28 android:layout_marginTop="24dp" 33 android:layout_marginTop="24dp"
29 android:background="@drawable/solid_eff2_8" 34 android:background="@drawable/solid_eff2_8"
30 android:orientation="horizontal"> 35 android:orientation="horizontal">
31 36
32 <TextView 37 <TextView
33 - android:layout_width="wrap_content" 38 + android:layout_width="0dp"
34 android:layout_height="wrap_content" 39 android:layout_height="wrap_content"
35 android:layout_gravity="center_vertical" 40 android:layout_gravity="center_vertical"
36 android:layout_marginStart="16dp" 41 android:layout_marginStart="16dp"
@@ -49,15 +54,17 @@ @@ -49,15 +54,17 @@
49 </LinearLayout> 54 </LinearLayout>
50 55
51 <LinearLayout 56 <LinearLayout
52 - android:layout_width="311dp" 57 + android:id="@+id/selection_period"
  58 + android:layout_width="match_parent"
53 android:layout_height="48dp" 59 android:layout_height="48dp"
54 android:layout_gravity="center_horizontal" 60 android:layout_gravity="center_horizontal"
  61 + android:layout_marginHorizontal="32dp"
55 android:layout_marginTop="24dp" 62 android:layout_marginTop="24dp"
56 android:background="@drawable/solid_eff2_8" 63 android:background="@drawable/solid_eff2_8"
57 android:orientation="horizontal"> 64 android:orientation="horizontal">
58 65
59 <TextView 66 <TextView
60 - android:layout_width="wrap_content" 67 + android:layout_width="0dp"
61 android:layout_height="wrap_content" 68 android:layout_height="wrap_content"
62 android:layout_gravity="center_vertical" 69 android:layout_gravity="center_vertical"
63 android:layout_marginStart="16dp" 70 android:layout_marginStart="16dp"
@@ -67,13 +74,13 @@ @@ -67,13 +74,13 @@
67 android:textSize="14sp" /> 74 android:textSize="14sp" />
68 75
69 76
70 - <EditText 77 + <TextView
71 android:layout_width="wrap_content" 78 android:layout_width="wrap_content"
72 android:layout_height="wrap_content" 79 android:layout_height="wrap_content"
73 android:layout_gravity="center_vertical" 80 android:layout_gravity="center_vertical"
74 android:layout_marginEnd="16dp" 81 android:layout_marginEnd="16dp"
75 android:background="@null" 82 android:background="@null"
76 - android:hint="请输入" 83 + android:hint="请选择初始取证时间"
77 android:textColor="@color/color_32" 84 android:textColor="@color/color_32"
78 android:textColorHint="@color/color_96" 85 android:textColorHint="@color/color_96"
79 android:textSize="14sp" /> 86 android:textSize="14sp" />
@@ -91,9 +98,10 @@ @@ -91,9 +98,10 @@
91 98
92 <TextView 99 <TextView
93 android:id="@+id/tv_upload" 100 android:id="@+id/tv_upload"
94 - android:layout_width="343dp" 101 + android:layout_width="match_parent"
95 android:layout_height="44dp" 102 android:layout_height="44dp"
96 android:layout_gravity="center_horizontal" 103 android:layout_gravity="center_horizontal"
  104 + android:layout_marginHorizontal="32dp"
97 android:layout_marginTop="40dp" 105 android:layout_marginTop="40dp"
98 android:layout_marginBottom="42dp" 106 android:layout_marginBottom="42dp"
99 android:background="@drawable/solid_25_4" 107 android:background="@drawable/solid_25_4"
@@ -13,16 +13,21 @@ @@ -13,16 +13,21 @@
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 app:toolTitle="我的证书" /> 14 app:toolTitle="我的证书" />
15 15
16 - <androidx.recyclerview.widget.RecyclerView  
17 - android:id="@+id/recyclerview" 16 + <com.scwang.smart.refresh.layout.SmartRefreshLayout
  17 + android:id="@+id/smart_refresh"
18 android:layout_width="match_parent" 18 android:layout_width="match_parent"
19 - android:layout_height="wrap_content"  
20 - android:layout_marginStart="20dp"  
21 - android:layout_marginEnd="20dp"  
22 - android:overScrollMode="never"  
23 - app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"  
24 - android:paddingBottom="16dp"  
25 - app:spanCount="2" /> 19 + android:layout_height="match_parent">
  20 + <androidx.recyclerview.widget.RecyclerView
  21 + android:id="@+id/recyclerview"
  22 + android:layout_width="match_parent"
  23 + android:layout_height="wrap_content"
  24 + android:layout_marginStart="20dp"
  25 + android:layout_marginEnd="20dp"
  26 + android:overScrollMode="never"
  27 + app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
  28 + android:paddingBottom="16dp"
  29 + app:spanCount="2" />
  30 + </com.scwang.smart.refresh.layout.SmartRefreshLayout>
26 31
27 32
28 </LinearLayout> 33 </LinearLayout>
@@ -14,12 +14,12 @@ @@ -14,12 +14,12 @@
14 app:toolTitle="我的证书" /> 14 app:toolTitle="我的证书" />
15 15
16 <ImageView 16 <ImageView
  17 + android:id="@+id/picture_iv"
17 android:layout_width="311dp" 18 android:layout_width="311dp"
18 android:layout_height="208dp" 19 android:layout_height="208dp"
19 android:layout_gravity="center_horizontal" 20 android:layout_gravity="center_horizontal"
20 android:layout_marginTop="33dp" 21 android:layout_marginTop="33dp"
21 - android:scaleType="fitXY"  
22 - android:src="@mipmap/ic_launcher" /> 22 + android:scaleType="fitXY" />
23 23
24 <LinearLayout 24 <LinearLayout
25 android:layout_width="311dp" 25 android:layout_width="311dp"
@@ -30,13 +30,13 @@ @@ -30,13 +30,13 @@
30 android:orientation="vertical"> 30 android:orientation="vertical">
31 31
32 <TextView 32 <TextView
  33 + android:id="@+id/cert_name"
33 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
34 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
35 android:layout_marginStart="16dp" 36 android:layout_marginStart="16dp"
36 android:layout_marginTop="20dp" 37 android:layout_marginTop="20dp"
37 android:drawableStart="@mipmap/credentials_icon" 38 android:drawableStart="@mipmap/credentials_icon"
38 android:drawablePadding="9dp" 39 android:drawablePadding="9dp"
39 - android:text="三级电焊工证"  
40 android:textColor="@color/color_32" 40 android:textColor="@color/color_32"
41 android:textSize="16sp" 41 android:textSize="16sp"
42 android:textStyle="bold" /> 42 android:textStyle="bold" />
@@ -56,14 +56,14 @@ @@ -56,14 +56,14 @@
56 android:textSize="12sp" /> 56 android:textSize="12sp" />
57 57
58 <TextView 58 <TextView
59 - android:layout_width="wrap_content" 59 + android:id="@+id/cert_deadline"
  60 + android:layout_width="0dp"
60 android:layout_height="wrap_content" 61 android:layout_height="wrap_content"
61 android:layout_marginStart="41dp" 62 android:layout_marginStart="41dp"
62 android:layout_marginTop="16dp" 63 android:layout_marginTop="16dp"
63 android:layout_marginEnd="16dp" 64 android:layout_marginEnd="16dp"
64 android:layout_weight="1" 65 android:layout_weight="1"
65 android:gravity="end" 66 android:gravity="end"
66 - android:text="2020-02-02"  
67 android:textColor="@color/color_96" 67 android:textColor="@color/color_96"
68 android:textSize="12sp" /> 68 android:textSize="12sp" />
69 69
@@ -84,14 +84,14 @@ @@ -84,14 +84,14 @@
84 android:textSize="12sp" /> 84 android:textSize="12sp" />
85 85
86 <TextView 86 <TextView
87 - android:layout_width="wrap_content" 87 + android:id="@+id/cert_up_time"
  88 + android:layout_width="0dp"
88 android:layout_height="wrap_content" 89 android:layout_height="wrap_content"
89 android:layout_marginStart="41dp" 90 android:layout_marginStart="41dp"
90 android:layout_marginTop="12dp" 91 android:layout_marginTop="12dp"
91 android:layout_marginEnd="16dp" 92 android:layout_marginEnd="16dp"
92 android:layout_weight="1" 93 android:layout_weight="1"
93 android:gravity="end" 94 android:gravity="end"
94 - android:text="2020-02-02"  
95 android:textColor="@color/color_96" 95 android:textColor="@color/color_96"
96 android:textSize="12sp" /> 96 android:textSize="12sp" />
97 97
@@ -112,14 +112,14 @@ @@ -112,14 +112,14 @@
112 android:textSize="12sp" /> 112 android:textSize="12sp" />
113 113
114 <TextView 114 <TextView
115 - android:layout_width="wrap_content" 115 + android:id="@+id/cert_start_time"
  116 + android:layout_width="0dp"
116 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
117 android:layout_marginStart="41dp" 118 android:layout_marginStart="41dp"
118 android:layout_marginTop="12dp" 119 android:layout_marginTop="12dp"
119 android:layout_marginEnd="16dp" 120 android:layout_marginEnd="16dp"
120 android:layout_weight="1" 121 android:layout_weight="1"
121 android:gravity="end" 122 android:gravity="end"
122 - android:text="2020-02-02"  
123 android:textColor="@color/color_96" 123 android:textColor="@color/color_96"
124 android:textSize="12sp" /> 124 android:textSize="12sp" />
125 125
@@ -6,8 +6,9 @@ @@ -6,8 +6,9 @@
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 <ImageView 8 <ImageView
9 - android:layout_width="wrap_content"  
10 - android:layout_height="wrap_content" 9 + android:id="@+id/cert_pic_iv"
  10 + android:layout_width="128dp"
  11 + android:layout_height="128dp"
11 android:layout_gravity="center_horizontal" 12 android:layout_gravity="center_horizontal"
12 android:layout_marginTop="16dp" 13 android:layout_marginTop="16dp"
13 android:contentDescription="@string/logo" 14 android:contentDescription="@string/logo"
@@ -20,18 +21,17 @@ @@ -20,18 +21,17 @@
20 android:layout_marginTop="12dp" 21 android:layout_marginTop="12dp"
21 android:gravity="center_vertical" 22 android:gravity="center_vertical"
22 android:minHeight="26dp" 23 android:minHeight="26dp"
23 - android:text="三级电焊证"  
24 android:textColor="@color/color_32" 24 android:textColor="@color/color_32"
25 android:textSize="14sp" /> 25 android:textSize="14sp" />
26 26
27 <TextView 27 <TextView
  28 + android:id="@+id/cert_validity_period"
28 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
29 android:layout_height="wrap_content" 30 android:layout_height="wrap_content"
30 android:layout_gravity="center_horizontal" 31 android:layout_gravity="center_horizontal"
31 android:layout_marginTop="8dp" 32 android:layout_marginTop="8dp"
32 android:layout_marginBottom="16dp" 33 android:layout_marginBottom="16dp"
33 android:gravity="center_vertical" 34 android:gravity="center_vertical"
34 - android:text="有效期:2020-09-10"  
35 android:textColor="@color/color_96" 35 android:textColor="@color/color_96"
36 android:textSize="12sp" /> 36 android:textSize="12sp" />
37 </LinearLayout> 37 </LinearLayout>