正在显示
15 个修改的文件
包含
115 行增加
和
25 行删除
@@ -4,13 +4,18 @@ | @@ -4,13 +4,18 @@ | ||
4 | <option name="filePathToZoomLevelMap"> | 4 | <option name="filePathToZoomLevelMap"> |
5 | <map> | 5 | <map> |
6 | <entry key="../../../../../Applications/Android Studio.app/Contents/caches/transforms-2/files-2.1/054febce6621ffe68244bdc38929a80b/jetified-gsyVideoPlayer-java-v8.3.3-release-jitpack/res/drawable/video_seek_progress.xml" value="0.1361111111111111" /> | 6 | <entry key="../../../../../Applications/Android Studio.app/Contents/caches/transforms-2/files-2.1/054febce6621ffe68244bdc38929a80b/jetified-gsyVideoPlayer-java-v8.3.3-release-jitpack/res/drawable/video_seek_progress.xml" value="0.1361111111111111" /> |
7 | + <entry key="../../../../../Applications/Android Studio.app/Contents/caches/transforms-2/files-2.1/054febce6621ffe68244bdc38929a80b/jetified-gsyVideoPlayer-java-v8.3.3-release-jitpack/res/layout/video_layout_standard.xml" value="0.24537037037037038" /> | ||
7 | <entry key="../../../../../layout/custom_preview.xml" value="0.2890625" /> | 8 | <entry key="../../../../../layout/custom_preview.xml" value="0.2890625" /> |
8 | <entry key="../../../Library/Android/sdk/platforms/android-30/data/res/layout/auto_complete_list.xml" value="0.2671875" /> | 9 | <entry key="../../../Library/Android/sdk/platforms/android-30/data/res/layout/auto_complete_list.xml" value="0.2671875" /> |
9 | <entry key="app/src/main/res/layout/activity_account_login.xml" value="0.2671875" /> | 10 | <entry key="app/src/main/res/layout/activity_account_login.xml" value="0.2671875" /> |
10 | <entry key="app/src/main/res/layout/activity_answer_record_details.xml" value="0.2671875" /> | 11 | <entry key="app/src/main/res/layout/activity_answer_record_details.xml" value="0.2671875" /> |
11 | <entry key="app/src/main/res/layout/activity_answer_sheet.xml" value="0.2671875" /> | 12 | <entry key="app/src/main/res/layout/activity_answer_sheet.xml" value="0.2671875" /> |
13 | + <entry key="app/src/main/res/layout/activity_chat.xml" value="0.29794871794871797" /> | ||
12 | <entry key="app/src/main/res/layout/activity_class_duty.xml" value="0.2671875" /> | 14 | <entry key="app/src/main/res/layout/activity_class_duty.xml" value="0.2671875" /> |
15 | + <entry key="app/src/main/res/layout/activity_common_file_read.xml" value="0.2671875" /> | ||
13 | <entry key="app/src/main/res/layout/activity_database_detail.xml" value="0.2671875" /> | 16 | <entry key="app/src/main/res/layout/activity_database_detail.xml" value="0.2671875" /> |
17 | + <entry key="app/src/main/res/layout/activity_edit_personal_info.xml" value="0.2671875" /> | ||
18 | + <entry key="app/src/main/res/layout/activity_exam_type.xml" value="0.22314814814814815" /> | ||
14 | <entry key="app/src/main/res/layout/activity_main.xml" value="0.2671875" /> | 19 | <entry key="app/src/main/res/layout/activity_main.xml" value="0.2671875" /> |
15 | <entry key="app/src/main/res/layout/activity_mobile_login.xml" value="0.2462962962962963" /> | 20 | <entry key="app/src/main/res/layout/activity_mobile_login.xml" value="0.2462962962962963" /> |
16 | <entry key="app/src/main/res/layout/activity_offline_exercise.xml" value="0.2671875" /> | 21 | <entry key="app/src/main/res/layout/activity_offline_exercise.xml" value="0.2671875" /> |
@@ -18,16 +23,22 @@ | @@ -18,16 +23,22 @@ | ||
18 | <entry key="app/src/main/res/layout/activity_online_detail.xml" value="0.2671875" /> | 23 | <entry key="app/src/main/res/layout/activity_online_detail.xml" value="0.2671875" /> |
19 | <entry key="app/src/main/res/layout/activity_practice.xml" value="0.2671875" /> | 24 | <entry key="app/src/main/res/layout/activity_practice.xml" value="0.2671875" /> |
20 | <entry key="app/src/main/res/layout/activity_splash.xml" value="0.2671875" /> | 25 | <entry key="app/src/main/res/layout/activity_splash.xml" value="0.2671875" /> |
26 | + <entry key="app/src/main/res/layout/activity_text_detail.xml" value="0.2671875" /> | ||
21 | <entry key="app/src/main/res/layout/activity_video_detail.xml" value="0.2671875" /> | 27 | <entry key="app/src/main/res/layout/activity_video_detail.xml" value="0.2671875" /> |
22 | <entry key="app/src/main/res/layout/activity_web.xml" value="0.2671875" /> | 28 | <entry key="app/src/main/res/layout/activity_web.xml" value="0.2671875" /> |
23 | <entry key="app/src/main/res/layout/adapter_content_practice_item.xml" value="0.2671875" /> | 29 | <entry key="app/src/main/res/layout/adapter_content_practice_item.xml" value="0.2671875" /> |
24 | <entry key="app/src/main/res/layout/adapter_topic.xml" value="0.2671875" /> | 30 | <entry key="app/src/main/res/layout/adapter_topic.xml" value="0.2671875" /> |
25 | <entry key="app/src/main/res/layout/adapter_video_course.xml" value="0.2671875" /> | 31 | <entry key="app/src/main/res/layout/adapter_video_course.xml" value="0.2671875" /> |
32 | + <entry key="app/src/main/res/layout/chat_life_adapter.xml" value="0.29794871794871797" /> | ||
33 | + <entry key="app/src/main/res/layout/chat_right_adapter.xml" value="0.29794871794871797" /> | ||
26 | <entry key="app/src/main/res/layout/dialog_check_id.xml" value="0.33" /> | 34 | <entry key="app/src/main/res/layout/dialog_check_id.xml" value="0.33" /> |
27 | <entry key="app/src/main/res/layout/dialog_class_list.xml" value="0.2671875" /> | 35 | <entry key="app/src/main/res/layout/dialog_class_list.xml" value="0.2671875" /> |
28 | <entry key="app/src/main/res/layout/fragment_bank.xml" value="0.33" /> | 36 | <entry key="app/src/main/res/layout/fragment_bank.xml" value="0.33" /> |
29 | <entry key="app/src/main/res/layout/fragment_class_duty_course.xml" value="0.2671875" /> | 37 | <entry key="app/src/main/res/layout/fragment_class_duty_course.xml" value="0.2671875" /> |
30 | <entry key="app/src/main/res/layout/fragment_course_list.xml" value="0.2671875" /> | 38 | <entry key="app/src/main/res/layout/fragment_course_list.xml" value="0.2671875" /> |
39 | + <entry key="app/src/main/res/layout/fragment_home.xml" value="0.20925925925925926" /> | ||
40 | + <entry key="app/src/main/res/layout/fragment_mine.xml" value="0.41770401106500693" /> | ||
41 | + <entry key="app/src/main/res/layout/fragment_online_detail.xml" value="0.2671875" /> | ||
31 | <entry key="app/src/main/res/layout/item_course.xml" value="0.22552083333333334" /> | 42 | <entry key="app/src/main/res/layout/item_course.xml" value="0.22552083333333334" /> |
32 | <entry key="app/src/main/res/layout/item_course_off.xml" value="0.2671875" /> | 43 | <entry key="app/src/main/res/layout/item_course_off.xml" value="0.2671875" /> |
33 | <entry key="app/src/main/res/layout/item_course_section.xml" value="0.2671875" /> | 44 | <entry key="app/src/main/res/layout/item_course_section.xml" value="0.2671875" /> |
@@ -38,6 +49,7 @@ | @@ -38,6 +49,7 @@ | ||
38 | <entry key="app/src/main/res/layout/layout_tool_bar.xml" value="0.2671875" /> | 49 | <entry key="app/src/main/res/layout/layout_tool_bar.xml" value="0.2671875" /> |
39 | <entry key="app/src/main/res/layout/layout_video_player.xml" value="0.13645833333333332" /> | 50 | <entry key="app/src/main/res/layout/layout_video_player.xml" value="0.13645833333333332" /> |
40 | <entry key="app/src/main/res/layout/pop_classify.xml" value="0.3609375" /> | 51 | <entry key="app/src/main/res/layout/pop_classify.xml" value="0.3609375" /> |
52 | + <entry key="app/src/main/res/layout/pop_database_list.xml" value="0.2351851851851852" /> | ||
41 | </map> | 53 | </map> |
42 | </option> | 54 | </option> |
43 | </component> | 55 | </component> |
@@ -178,4 +178,6 @@ dependencies { | @@ -178,4 +178,6 @@ dependencies { | ||
178 | implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' //核心必须依赖 | 178 | implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' //核心必须依赖 |
179 | implementation 'com.scwang.smart:refresh-header-classics:2.0.3' //经典刷新头 | 179 | implementation 'com.scwang.smart:refresh-header-classics:2.0.3' //经典刷新头 |
180 | implementation 'com.scwang.smart:refresh-footer-classics:2.0.3' //经典加载 | 180 | implementation 'com.scwang.smart:refresh-footer-classics:2.0.3' //经典加载 |
181 | + //红点 | ||
182 | + implementation 'cn.yc:YCRedDotViewLib:1.0.3' | ||
181 | } | 183 | } |
@@ -68,6 +68,7 @@ | @@ -68,6 +68,7 @@ | ||
68 | 68 | ||
69 | <activity | 69 | <activity |
70 | android:name="com.br_technology.securitytrain_master.ui.view.splash.SplashActivity" | 70 | android:name="com.br_technology.securitytrain_master.ui.view.splash.SplashActivity" |
71 | + android:exported="true" | ||
71 | android:screenOrientation="portrait" | 72 | android:screenOrientation="portrait" |
72 | android:theme="@style/Theme.SecurityTrainMaster.Launcher"> | 73 | android:theme="@style/Theme.SecurityTrainMaster.Launcher"> |
73 | <intent-filter> | 74 | <intent-filter> |
@@ -136,6 +136,14 @@ interface ApiService { | @@ -136,6 +136,14 @@ interface ApiService { | ||
136 | fun workType( | 136 | fun workType( |
137 | ): Observable<BaseResponse<WorkTypeBean>> | 137 | ): Observable<BaseResponse<WorkTypeBean>> |
138 | 138 | ||
139 | + | ||
140 | + /** | ||
141 | + * 未读消息 | ||
142 | + */ | ||
143 | + @POST("/api/message/msg_unread_count") | ||
144 | + fun unMessage( | ||
145 | + ): Observable<BaseResponse<UnMessageBean>> | ||
146 | + | ||
139 | /** | 147 | /** |
140 | * 文本课程详情 | 148 | * 文本课程详情 |
141 | */ | 149 | */ |
@@ -65,7 +65,8 @@ class ChallengeActivity : | @@ -65,7 +65,8 @@ class ChallengeActivity : | ||
65 | // 下一题 | 65 | // 下一题 |
66 | next.setOnClickListener { | 66 | next.setOnClickListener { |
67 | if (mPagerAdapter.getCount() <= 0) { | 67 | if (mPagerAdapter.getCount() <= 0) { |
68 | - ToastUtils.s(baseContext, "暂无数据") | 68 | +// ToastUtils.s(baseContext, "暂无数据") |
69 | + ToastUtils.s(baseContext, "请选择") | ||
69 | return@setOnClickListener | 70 | return@setOnClickListener |
70 | } | 71 | } |
71 | next.isClickable = false | 72 | next.isClickable = false |
@@ -157,6 +157,10 @@ class QuestionsActivity : | @@ -157,6 +157,10 @@ class QuestionsActivity : | ||
157 | userItemId = it.data.user_item_id | 157 | userItemId = it.data.user_item_id |
158 | mPagerAdapter.addList(it.data.list) | 158 | mPagerAdapter.addList(it.data.list) |
159 | binding.practicePager.adapter = mPagerAdapter | 159 | binding.practicePager.adapter = mPagerAdapter |
160 | + if(it.data.list.size<=1){ | ||
161 | + binding.next.visibility=View.GONE | ||
162 | + binding.finishJob.visibility=View.VISIBLE | ||
163 | + } | ||
160 | } else { | 164 | } else { |
161 | ToastUtils.s(baseContext, it.msg) | 165 | ToastUtils.s(baseContext, it.msg) |
162 | } | 166 | } |
@@ -108,10 +108,14 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | @@ -108,10 +108,14 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | ||
108 | } | 108 | } |
109 | 109 | ||
110 | override fun onDestroy() { | 110 | override fun onDestroy() { |
111 | - super.onDestroy() | ||
112 | if(isFinishs){ | 111 | if(isFinishs){ |
113 | EventBus.getDefault() | 112 | EventBus.getDefault() |
114 | .post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true)) | 113 | .post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true)) |
115 | } | 114 | } |
115 | + super.onDestroy() | ||
116 | +// if(isFinishs){ | ||
117 | +// EventBus.getDefault() | ||
118 | +// .post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true)) | ||
119 | +// } | ||
116 | } | 120 | } |
117 | } | 121 | } |
@@ -203,9 +203,9 @@ class HomeFragment : | @@ -203,9 +203,9 @@ class HomeFragment : | ||
203 | videoLessonList = mutableListOf() | 203 | videoLessonList = mutableListOf() |
204 | videoCourse.adapter = videoCourseAdapter | 204 | videoCourse.adapter = videoCourseAdapter |
205 | 205 | ||
206 | - videoCourseAdapter?.setOnItemClickListener { _, _, position -> | 206 | + videoCourseAdapter?.setOnClick { data-> |
207 | val course = CourseParam() | 207 | val course = CourseParam() |
208 | - val data = videoLessonList!![position] | 208 | +// val data = videoLessonList!![position] |
209 | course.mLessonId = "${data.id}" | 209 | course.mLessonId = "${data.id}" |
210 | course.isTrainClass = false | 210 | course.isTrainClass = false |
211 | course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO | 211 | course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO |
@@ -58,14 +58,21 @@ class EditPersonalInfoActivity : | @@ -58,14 +58,21 @@ class EditPersonalInfoActivity : | ||
58 | avatar = it.data.fullurl | 58 | avatar = it.data.fullurl |
59 | Glide.with(this).load(avatar).placeholder(R.mipmap.placeholder_head) | 59 | Glide.with(this).load(avatar).placeholder(R.mipmap.placeholder_head) |
60 | .into(binding.ivIcon) | 60 | .into(binding.ivIcon) |
61 | + avatar?.let { | ||
62 | + mViewModel.changePersonalInfo( | ||
63 | + it, | ||
64 | + binding.tvName.text.toString(), | ||
65 | + "" | ||
66 | + ) | ||
67 | + } | ||
61 | } | 68 | } |
62 | }) | 69 | }) |
63 | //保存修改 | 70 | //保存修改 |
64 | mViewModel.mCommonBean.observe(this, { | 71 | mViewModel.mCommonBean.observe(this, { |
65 | - it.let { | ||
66 | - showTip("修改成功") | ||
67 | - finish() | ||
68 | - } | 72 | +// it.let { |
73 | +// showTip("修改成功") | ||
74 | +// finish() | ||
75 | +// } | ||
69 | }) | 76 | }) |
70 | // | 77 | // |
71 | mViewModel.mUploadFaceFileData.observe(this, { | 78 | mViewModel.mUploadFaceFileData.observe(this, { |
@@ -102,14 +109,15 @@ class EditPersonalInfoActivity : | @@ -102,14 +109,15 @@ class EditPersonalInfoActivity : | ||
102 | rlUpLoadImage.setOnClickListener(this@EditPersonalInfoActivity) | 109 | rlUpLoadImage.setOnClickListener(this@EditPersonalInfoActivity) |
103 | toolBar.addLeftListener(object : ToolBarClickListener { | 110 | toolBar.addLeftListener(object : ToolBarClickListener { |
104 | override fun onClick(view: View) { | 111 | override fun onClick(view: View) { |
112 | + finish() | ||
105 | //退出时保存 | 113 | //退出时保存 |
106 | - avatar?.let { | ||
107 | - mViewModel.changePersonalInfo( | ||
108 | - it, | ||
109 | - binding.tvName.text.toString(), | ||
110 | - "" | ||
111 | - ) | ||
112 | - } | 114 | +// avatar?.let { |
115 | +// mViewModel.changePersonalInfo( | ||
116 | +// it, | ||
117 | +// binding.tvName.text.toString(), | ||
118 | +// "" | ||
119 | +// ) | ||
120 | +// } | ||
113 | } | 121 | } |
114 | 122 | ||
115 | }) | 123 | }) |
@@ -308,11 +308,11 @@ class ClassDutyCourseFragment(val type: Int) : | @@ -308,11 +308,11 @@ class ClassDutyCourseFragment(val type: Int) : | ||
308 | // Toast.makeText(activity, "学员未完成培训课程,无法考试", Toast.LENGTH_SHORT).show() | 308 | // Toast.makeText(activity, "学员未完成培训课程,无法考试", Toast.LENGTH_SHORT).show() |
309 | // return | 309 | // return |
310 | // } | 310 | // } |
311 | - if (item.isTest && item.exam?.count!! <= 0) { | 311 | + if (item.isTest && item.exam?.count?:0 <= 0) { |
312 | Toast.makeText(activity, "该考试暂无题目", Toast.LENGTH_SHORT).show() | 312 | Toast.makeText(activity, "该考试暂无题目", Toast.LENGTH_SHORT).show() |
313 | return | 313 | return |
314 | } | 314 | } |
315 | - if (item.isTest && (item.practice?.count!! <= 0)) { | 315 | + if (item.isTest && (item.practice?.count?:0 <= 0)) { |
316 | Toast.makeText(activity, "该练习暂无题目", Toast.LENGTH_SHORT).show() | 316 | Toast.makeText(activity, "该练习暂无题目", Toast.LENGTH_SHORT).show() |
317 | return | 317 | return |
318 | } | 318 | } |
1 | package com.br_technology.securitytrain_master.ui.view.mine.fragment | 1 | package com.br_technology.securitytrain_master.ui.view.mine.fragment |
2 | 2 | ||
3 | import android.content.Intent | 3 | import android.content.Intent |
4 | +import android.view.Gravity | ||
4 | import android.view.View | 5 | import android.view.View |
6 | +import com.alibaba.fastjson.JSON | ||
5 | import com.br_technology.securitytrain_master.R | 7 | import com.br_technology.securitytrain_master.R |
6 | import com.br_technology.securitytrain_master.databinding.FragmentMineBinding | 8 | import com.br_technology.securitytrain_master.databinding.FragmentMineBinding |
7 | import com.br_technology.securitytrain_master.ui.view.home.viewmodel.MineViewModel | 9 | import com.br_technology.securitytrain_master.ui.view.home.viewmodel.MineViewModel |
@@ -14,6 +16,7 @@ import com.br_technology.securitytrain_master.view.DialogSureCancel | @@ -14,6 +16,7 @@ import com.br_technology.securitytrain_master.view.DialogSureCancel | ||
14 | import com.br_technology.securitytrain_master.view.listener.DialogListener | 16 | import com.br_technology.securitytrain_master.view.listener.DialogListener |
15 | import com.bumptech.glide.Glide | 17 | import com.bumptech.glide.Glide |
16 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment | 18 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment |
19 | +import com.ycbjie.ycreddotviewlib.YCRedDotView | ||
17 | 20 | ||
18 | /** | 21 | /** |
19 | * createTime:2021/7/27 15:47 | 22 | * createTime:2021/7/27 15:47 |
@@ -25,6 +28,7 @@ class MineFragment | @@ -25,6 +28,7 @@ class MineFragment | ||
25 | View.OnClickListener { | 28 | View.OnClickListener { |
26 | private var identity: String? = null | 29 | private var identity: String? = null |
27 | 30 | ||
31 | + private var ycRedDotView: YCRedDotView? = null | ||
28 | private val logoutDialog by lazy { | 32 | private val logoutDialog by lazy { |
29 | DialogSureCancel(requireContext()) | 33 | DialogSureCancel(requireContext()) |
30 | } | 34 | } |
@@ -37,27 +41,36 @@ class MineFragment | @@ -37,27 +41,36 @@ class MineFragment | ||
37 | Glide.with(requireActivity()).load(it.data.info.avatar) | 41 | Glide.with(requireActivity()).load(it.data.info.avatar) |
38 | .placeholder(R.mipmap.placeholder_head).into(binding.ivIcon) | 42 | .placeholder(R.mipmap.placeholder_head).into(binding.ivIcon) |
39 | identity = it.data.info.identity | 43 | identity = it.data.info.identity |
40 | - binding.departmentName.text = it.data.info.department_name.plus(" - ").plus(it.data.info.pos_name) | 44 | + binding.departmentName.text = |
45 | + it.data.info.department_name.plus(" - ").plus(it.data.info.pos_name) | ||
41 | company_is_check = it.data.info.company_check_face.equals("0") // 0为关闭人脸检测 | 46 | company_is_check = it.data.info.company_check_face.equals("0") // 0为关闭人脸检测 |
42 | is_set_face = it.data.info.is_check_face.equals("1"); | 47 | is_set_face = it.data.info.is_check_face.equals("1"); |
43 | }) | 48 | }) |
44 | 49 | ||
45 | - mViewModel.mCommonBean.observe(this,{ | 50 | + mViewModel.mCommonBean.observe(this, { |
46 | token = "" | 51 | token = "" |
47 | showTip("退出登录成功") | 52 | showTip("退出登录成功") |
48 | logoutDialog.dismiss() | 53 | logoutDialog.dismiss() |
49 | startActivity(Intent(requireContext(), AccountLoginActivity::class.java)) | 54 | startActivity(Intent(requireContext(), AccountLoginActivity::class.java)) |
50 | activity?.finish() | 55 | activity?.finish() |
51 | }) | 56 | }) |
57 | + mViewModel.unMessageBean.observe(this, { | ||
58 | + ycRedDotView?.badgeCount = it.data.count | ||
59 | + }) | ||
52 | } | 60 | } |
53 | 61 | ||
54 | override fun onResume() { | 62 | override fun onResume() { |
55 | super.onResume() | 63 | super.onResume() |
56 | mViewModel.getMineInfo() | 64 | mViewModel.getMineInfo() |
65 | + mViewModel.getUnMessage() | ||
57 | } | 66 | } |
58 | 67 | ||
59 | override fun initData() { | 68 | override fun initData() { |
60 | super.initData() | 69 | super.initData() |
70 | + ycRedDotView = YCRedDotView(context) | ||
71 | + ycRedDotView?.setTargetView(binding.liMessage) | ||
72 | + ycRedDotView?.setRedHotViewGravity(Gravity.END) | ||
73 | + ycRedDotView?.setBadgeMargin(0, 0, 0, 0) | ||
61 | binding.apply { | 74 | binding.apply { |
62 | ivEditInfo.setOnClickListener(this@MineFragment) | 75 | ivEditInfo.setOnClickListener(this@MineFragment) |
63 | rlMineCuoti.setOnClickListener(this@MineFragment) | 76 | rlMineCuoti.setOnClickListener(this@MineFragment) |
@@ -5,6 +5,7 @@ import com.br_technology.securitytrain_master.base.common.State | @@ -5,6 +5,7 @@ import com.br_technology.securitytrain_master.base.common.State | ||
5 | import com.br_technology.securitytrain_master.base.network.response.BaseResponse | 5 | import com.br_technology.securitytrain_master.base.network.response.BaseResponse |
6 | import com.br_technology.securitytrain_master.base.repository.ApiRepository | 6 | import com.br_technology.securitytrain_master.base.repository.ApiRepository |
7 | import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean | 7 | import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean |
8 | +import com.br_technology.securitytrain_master.ui.view.mine.bean.UnMessageBean | ||
8 | import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver | 9 | import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver |
9 | import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers | 10 | import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers |
10 | import io.reactivex.rxjava3.schedulers.Schedulers | 11 | import io.reactivex.rxjava3.schedulers.Schedulers |
@@ -47,5 +48,19 @@ class MineRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS | @@ -47,5 +48,19 @@ class MineRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS | ||
47 | 48 | ||
48 | } | 49 | } |
49 | 50 | ||
51 | + fun getUnMessage( | ||
52 | + liveData: MutableLiveData<BaseResponse<UnMessageBean>> | ||
53 | + ) { | ||
54 | + apiService.unMessage() | ||
55 | + .subscribeOn(Schedulers.io()) | ||
56 | + .observeOn(AndroidSchedulers.mainThread()) | ||
57 | + .subscribe( | ||
58 | + BaseObserver( | ||
59 | + liveData, | ||
60 | + loadState, | ||
61 | + this | ||
62 | + ) | ||
63 | + ) | ||
50 | 64 | ||
65 | + } | ||
51 | } | 66 | } |
@@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData | @@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData | ||
4 | import com.br_technology.securitytrain_master.base.network.response.BaseResponse | 4 | import com.br_technology.securitytrain_master.base.network.response.BaseResponse |
5 | import com.br_technology.securitytrain_master.base.view.BaseViewModel | 5 | import com.br_technology.securitytrain_master.base.view.BaseViewModel |
6 | import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean | 6 | import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean |
7 | +import com.br_technology.securitytrain_master.ui.view.mine.bean.UnMessageBean | ||
7 | import com.br_technology.securitytrain_master.ui.view.mine.repository.MineRepository | 8 | import com.br_technology.securitytrain_master.ui.view.mine.repository.MineRepository |
8 | 9 | ||
9 | /** | 10 | /** |
@@ -13,7 +14,7 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MineReposi | @@ -13,7 +14,7 @@ import com.br_technology.securitytrain_master.ui.view.mine.repository.MineReposi | ||
13 | */ | 14 | */ |
14 | class MineViewModel : BaseViewModel<MineRepository>() { | 15 | class MineViewModel : BaseViewModel<MineRepository>() { |
15 | var mMineInfoBean: MutableLiveData<BaseResponse<MineInfoBean>> = MutableLiveData() | 16 | var mMineInfoBean: MutableLiveData<BaseResponse<MineInfoBean>> = MutableLiveData() |
16 | - | 17 | + var unMessageBean: MutableLiveData<BaseResponse<UnMessageBean>> = MutableLiveData() |
17 | fun getMineInfo() { | 18 | fun getMineInfo() { |
18 | mRepository.getMineInfo(mMineInfoBean) | 19 | mRepository.getMineInfo(mMineInfoBean) |
19 | } | 20 | } |
@@ -23,4 +24,7 @@ class MineViewModel : BaseViewModel<MineRepository>() { | @@ -23,4 +24,7 @@ class MineViewModel : BaseViewModel<MineRepository>() { | ||
23 | fun logout() { | 24 | fun logout() { |
24 | mRepository.logout(mCommonBean) | 25 | mRepository.logout(mCommonBean) |
25 | } | 26 | } |
27 | + fun getUnMessage() { | ||
28 | + mRepository.getUnMessage(unMessageBean) | ||
29 | + } | ||
26 | } | 30 | } |
@@ -34,13 +34,23 @@ | @@ -34,13 +34,23 @@ | ||
34 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
35 | android:layout_weight="1" /> | 35 | android:layout_weight="1" /> |
36 | 36 | ||
37 | - <ImageView | ||
38 | - android:id="@+id/iv_message" | ||
39 | - android:layout_width="wrap_content" | ||
40 | - android:layout_height="wrap_content" | 37 | + <LinearLayout |
38 | + android:id="@+id/li_message" | ||
39 | + android:layout_width="35dp" | ||
41 | android:layout_marginTop="37dp" | 40 | android:layout_marginTop="37dp" |
42 | android:layout_marginEnd="16dp" | 41 | android:layout_marginEnd="16dp" |
43 | - android:src="@mipmap/mine_message" /> | 42 | + android:gravity="center" |
43 | + android:layout_height="37dp"> | ||
44 | + | ||
45 | + | ||
46 | + <ImageView | ||
47 | + android:id="@+id/iv_message" | ||
48 | + android:layout_gravity="center" | ||
49 | + android:layout_width="wrap_content" | ||
50 | + android:layout_height="wrap_content" | ||
51 | + android:src="@mipmap/mine_message" /> | ||
52 | + | ||
53 | + </LinearLayout> | ||
44 | 54 | ||
45 | </LinearLayout> | 55 | </LinearLayout> |
46 | 56 |
-
请 注册 或 登录 后发表评论