作者 杨谦

1.课程相关接口对接

2.腾讯地图接入,x5文件浏览服务接入
3.todo:班级任务数据填充,页面逻辑完善,公用详情页数据列表等
正在显示 100 个修改的文件 包含 2001 行增加792 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

@@ -89,8 +89,6 @@ dependencies { @@ -89,8 +89,6 @@ dependencies {
89 //recyclerview适配器 89 //recyclerview适配器
90 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4' 90 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
91 91
92 -  
93 -  
94 //今日头条屏幕适配 92 //今日头条屏幕适配
95 implementation 'me.jessyan:autosize:1.2.1' 93 implementation 'me.jessyan:autosize:1.2.1'
96 94
@@ -131,5 +129,10 @@ dependencies { @@ -131,5 +129,10 @@ dependencies {
131 implementation 'com.contrarywind:Android-PickerView:4.1.9' 129 implementation 'com.contrarywind:Android-PickerView:4.1.9'
132 130
133 implementation 'org.greenrobot:eventbus:3.2.0' 131 implementation 'org.greenrobot:eventbus:3.2.0'
134 - 132 + api 'com.tencent.tbs:tbssdk:44136'
  133 + // 地图库
  134 + implementation 'com.tencent.map:tencent-map-vector-sdk:4.4.7'
  135 + // 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
  136 + implementation 'com.tencent.map:sdk-utilities:1.0.6'
  137 + implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0'
135 } 138 }
@@ -18,4 +18,39 @@ @@ -18,4 +18,39 @@
18 18
19 # If you keep the line number information, uncomment this to 19 # If you keep the line number information, uncomment this to
20 # hide the original source file name. 20 # hide the original source file name.
21 -#-renamesourcefileattribute SourceFile  
  21 +#-renamesourcefileattribute SourceFile
  22 +
  23 +#######################webx5##############################
  24 +-dontwarn dalvik.**
  25 +-dontwarn com.tencent.smtt.**
  26 +
  27 +-keep class com.tencent.smtt.** {
  28 + *;
  29 +}
  30 +
  31 +-keep class com.tencent.tbs.** {
  32 + *;
  33 +}
  34 +######################tencent map##########################
  35 +-keep class com.tencent.map.**{*;}
  36 +-keep class com.tencent.beacontmap.**{*;}
  37 +-keep class navsns.**{*;}
  38 +-dontwarn com.qq.**
  39 +-dontwarn com.tencent.**
  40 +-keepclassmembers class ** {
  41 + public void on*Event(...);
  42 +}
  43 +
  44 +-keep class c.t.**{*;}
  45 +-keep class com.tencent.map.geolocation.**{*;}
  46 +
  47 +-keep public class com.tencent.location.**{
  48 + public protected *;
  49 +}
  50 +-keepclasseswithmembernames class * {
  51 + native <methods>;
  52 +}
  53 +
  54 +-dontwarn org.eclipse.jdt.annotation.**
  55 +-dontwarn c.t.**
  56 +##########################################################
@@ -8,9 +8,16 @@ @@ -8,9 +8,16 @@
8 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 8 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
10 <uses-permission android:name="android.permission.CAMERA" /> 10 <uses-permission android:name="android.permission.CAMERA" />
11 - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 11 + <uses-permission
  12 + android:name="android.permission.WRITE_EXTERNAL_STORAGE"
12 tools:ignore="ScopedStorage" /> 13 tools:ignore="ScopedStorage" />
13 - <uses-permission android:name="android.permission.CALL_PHONE"/> 14 + <uses-permission android:name="android.permission.CALL_PHONE" />
  15 + <uses-permission
  16 + android:name="android.permission.WRITE_SETTINGS"
  17 + tools:ignore="ProtectedPermissions" />
  18 + <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  19 + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  20 + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
14 21
15 <application 22 <application
16 android:name=".base.view.BaseApplication" 23 android:name=".base.view.BaseApplication"
@@ -18,11 +25,15 @@ @@ -18,11 +25,15 @@
18 android:hardwareAccelerated="true" 25 android:hardwareAccelerated="true"
19 android:icon="@mipmap/ic_launcher" 26 android:icon="@mipmap/ic_launcher"
20 android:label="@string/app_name" 27 android:label="@string/app_name"
  28 + android:networkSecurityConfig="@xml/network_security_config"
21 android:roundIcon="@mipmap/ic_launcher_round" 29 android:roundIcon="@mipmap/ic_launcher_round"
22 android:supportsRtl="true" 30 android:supportsRtl="true"
23 android:theme="@style/Theme.SecurityTrainMaster" 31 android:theme="@style/Theme.SecurityTrainMaster"
24 android:usesCleartextTraffic="true"> 32 android:usesCleartextTraffic="true">
25 <meta-data 33 <meta-data
  34 + android:name="TencentMapSDK"
  35 + android:value="6DXBZ-K2PWP-6ARD4-LFF3M-RLLQH-EQBMJ" />
  36 + <meta-data
26 android:name="design_width_in_dp" 37 android:name="design_width_in_dp"
27 android:value="375" /> 38 android:value="375" />
28 <meta-data 39 <meta-data
@@ -54,9 +65,9 @@ @@ -54,9 +65,9 @@
54 65
55 66
56 <activity 67 <activity
57 - android:theme="@style/Theme.SecurityTrainMaster.Launcher"  
58 android:name="com.br_technology.securitytrain_master.ui.view.splash.SplashActivity" 68 android:name="com.br_technology.securitytrain_master.ui.view.splash.SplashActivity"
59 - android:screenOrientation="portrait"> 69 + android:screenOrientation="portrait"
  70 + android:theme="@style/Theme.SecurityTrainMaster.Launcher">
60 <intent-filter> 71 <intent-filter>
61 <action android:name="android.intent.action.MAIN" /> 72 <action android:name="android.intent.action.MAIN" />
62 73
@@ -92,7 +103,7 @@ @@ -92,7 +103,7 @@
92 android:name="com.br_technology.securitytrain_master.ui.view.home.activity.TextCourseActivity" 103 android:name="com.br_technology.securitytrain_master.ui.view.home.activity.TextCourseActivity"
93 android:screenOrientation="portrait" /> 104 android:screenOrientation="portrait" />
94 <activity 105 <activity
95 - android:name="com.br_technology.securitytrain_master.ui.view.home.activity.TextDetailActivity" 106 + android:name="com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity"
96 android:screenOrientation="portrait" /> 107 android:screenOrientation="portrait" />
97 <activity 108 <activity
98 android:name="com.br_technology.securitytrain_master.ui.view.home.activity.OnlineActivity" 109 android:name="com.br_technology.securitytrain_master.ui.view.home.activity.OnlineActivity"
@@ -122,7 +133,7 @@ @@ -122,7 +133,7 @@
122 android:name="com.br_technology.securitytrain_master.ui.view.bank.activity.ExamCardActivity" 133 android:name="com.br_technology.securitytrain_master.ui.view.bank.activity.ExamCardActivity"
123 android:screenOrientation="portrait" /> 134 android:screenOrientation="portrait" />
124 <activity 135 <activity
125 - android:name="com.br_technology.securitytrain_master.ui.view.home.activity.OnlineDetailActivity" 136 + android:name="com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity"
126 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" 137 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
127 android:screenOrientation="portrait" /> 138 android:screenOrientation="portrait" />
128 <activity 139 <activity
@@ -149,7 +160,8 @@ @@ -149,7 +160,8 @@
149 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.AcademicFeedbackActivity" /> 160 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.AcademicFeedbackActivity" />
150 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.CredentialsUpLoadActivity" /> 161 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.CredentialsUpLoadActivity" />
151 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.MyCredentialsDetailActivity" /> 162 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.MyCredentialsDetailActivity" />
152 - <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.OfflineExerciseActivity" 163 + <activity
  164 + android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.OfflineExerciseActivity"
153 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" 165 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
154 android:screenOrientation="portrait" /> 166 android:screenOrientation="portrait" />
155 167
@@ -160,18 +172,25 @@ @@ -160,18 +172,25 @@
160 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ComplaintsAndSuggestionsActivity" /> 172 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ComplaintsAndSuggestionsActivity" />
161 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ComplaintsAndSuggestionsSuccessActivity" /> 173 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ComplaintsAndSuggestionsSuccessActivity" />
162 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ClassDutyActivity" /> 174 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ClassDutyActivity" />
163 - <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.SignInActivity" />  
164 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.CollectActivity" /> 175 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.CollectActivity" />
165 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ServiceActivity" /> 176 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.ServiceActivity" />
166 - <activity android:name="com.br_technology.securitytrain_master.ui.view.home.activity.VerifyCameraActivity"/>  
167 - <activity android:name="com.br_technology.securitytrain_master.ui.view.home.activity.VerifyCameraCompleteActivity"/> 177 + <activity android:name="com.br_technology.securitytrain_master.ui.view.home.activity.VerifyCameraActivity" />
  178 + <activity android:name="com.br_technology.securitytrain_master.ui.view.home.activity.VerifyCameraCompleteActivity" />
168 <activity android:name="com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity" /> 179 <activity android:name="com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity" />
169 - <activity android:name=".ui.view.home.activity.VideoDetailActivity" 180 + <activity
  181 + android:name=".ui.view.home.activity.course.VideoDetailActivity"
170 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" 182 android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
171 - android:screenOrientation="portrait"/> 183 + android:screenOrientation="portrait" />
172 <activity android:name=".ui.view.bank.activity.QuestionsActivity" /> 184 <activity android:name=".ui.view.bank.activity.QuestionsActivity" />
173 <activity android:name=".ui.view.bank.activity.PracticeListActivity" /> 185 <activity android:name=".ui.view.bank.activity.PracticeListActivity" />
174 186
  187 + <activity
  188 + android:name=".ui.view.common.FileReadActivity"
  189 + android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
  190 + android:theme="@style/Theme.SecurityTrainMaster.Trans" />
  191 + <activity
  192 + android:name=".ui.view.home.activity.course.LocationSignActivity"
  193 + android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" />
175 </application> 194 </application>
176 195
177 </manifest> 196 </manifest>
  1 +package com.br_technology.securitytrain_master.base.common
  2 +
  3 +/**
  4 + * Author by YSir
  5 + * Date on 2022/1/13.
  6 + * description
  7 + * PS: Not easy to write code, please indicate.
  8 + */
  9 +object ConstantParamKey {
  10 + // 视频/线下培训课节id
  11 + const val COURSE_BEAN = "course_bean"
  12 + // 课程描述
  13 + const val COURSE_DES = "course_des"
  14 +
  15 + // 课节id
  16 + const val CLASS_ID = "class_id"
  17 +
  18 + // 课程id
  19 + const val LESSON_ID = "lesson_id"
  20 +
  21 + // lessonType
  22 + const val LESSON_TYPE = "lesson_type"
  23 +
  24 + // url
  25 + const val COMMON_URL = "url"
  26 +
  27 + // 培训计划班级id
  28 + const val TRAIN_CLASS_ID = "train_class_id"
  29 +
  30 + // 当前观看视频/文本课程时长
  31 + const val VIEW_LEN = "view_len"
  32 + const val ADDRESS_LAT = "lat"
  33 + const val ADDRESS_LNG = "lng"
  34 +// type integer 是 课程类型:1=视频课,2=直播课,3=线下培训课,4=文本课
  35 +// lesson_id integer 是 课程id
  36 +// class_id integer 否 视频/线下培训课节id
  37 +// train_class_id integer 是 培训计划班级id(获取数据有这个字段的必传
  38 +// view_len integer 是 当前观看视频/文本课程时长
  39 +// lat string 否 纬度
  40 +// lng string 否 经度
  41 +}
1 -package com.br_technology.securitytrain_master.ext 1 +package com.br_technology.securitytrain_master.base.common
2 2
3 /** 3 /**
4 * Author by YSir 4 * Author by YSir
@@ -5,7 +5,6 @@ import com.br_technology.securitytrain_master.ui.bean.* @@ -5,7 +5,6 @@ import com.br_technology.securitytrain_master.ui.bean.*
5 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean 5 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
6 import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData 6 import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
7 import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject 7 import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
8 -import com.wjx.android.wanandroidmvvm.network.ApiService  
9 import com.br_technology.securitytrain_master.ui.view.bank.bean.StartItemBean 8 import com.br_technology.securitytrain_master.ui.view.bank.bean.StartItemBean
10 import io.reactivex.rxjava3.core.Observable 9 import io.reactivex.rxjava3.core.Observable
11 import retrofit2.http.Field 10 import retrofit2.http.Field
1 -package com.wjx.android.wanandroidmvvm.network 1 +package com.br_technology.securitytrain_master.base.network.api
2 2
3 -import com.br_technology.securitytrain_master.ui.bean.CommonBean 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.ui.bean.MaterialDetail
4 import com.br_technology.securitytrain_master.ui.bean.UploadFileData 7 import com.br_technology.securitytrain_master.ui.bean.UploadFileData
5 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean 8 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
6 import com.br_technology.securitytrain_master.ui.view.bank.bean.RankListBean 9 import com.br_technology.securitytrain_master.ui.view.bank.bean.RankListBean
@@ -8,8 +11,6 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.* @@ -8,8 +11,6 @@ import com.br_technology.securitytrain_master.ui.view.home.bean.*
8 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean 11 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
9 import com.br_technology.securitytrain_master.ui.view.login.bean.TokenBean 12 import com.br_technology.securitytrain_master.ui.view.login.bean.TokenBean
10 import com.br_technology.securitytrain_master.ui.view.mine.bean.* 13 import com.br_technology.securitytrain_master.ui.view.mine.bean.*
11 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
12 -import com.br_technology.securitytrain_master.base.network.response.CommonList  
13 import io.reactivex.rxjava3.core.Observable 14 import io.reactivex.rxjava3.core.Observable
14 import okhttp3.MultipartBody 15 import okhttp3.MultipartBody
15 import retrofit2.http.* 16 import retrofit2.http.*
@@ -27,7 +28,7 @@ interface ApiService { @@ -27,7 +28,7 @@ interface ApiService {
27 fun getVerifyCode( 28 fun getVerifyCode(
28 @Field("mobile") mobile: String, 29 @Field("mobile") mobile: String,
29 @Field("event") event: String 30 @Field("event") event: String
30 - ): Observable<BaseResponse<CommonBean>> 31 + ): Observable<BaseResponse<Void>>
31 32
32 //手机验证码登录 33 //手机验证码登录
33 @FormUrlEncoded 34 @FormUrlEncoded
@@ -53,7 +54,7 @@ interface ApiService { @@ -53,7 +54,7 @@ interface ApiService {
53 @Field("captcha") captcha: String, 54 @Field("captcha") captcha: String,
54 @Field("newpassword") newpassword: String, 55 @Field("newpassword") newpassword: String,
55 @Field("confirmpassword") confirmpassword: String 56 @Field("confirmpassword") confirmpassword: String
56 - ): Observable<BaseResponse<CommonBean>> 57 + ): Observable<BaseResponse<Void>>
57 58
58 //检测token是否过期 59 //检测token是否过期
59 @GET("/api/token/check") 60 @GET("/api/token/check")
@@ -177,7 +178,7 @@ interface ApiService { @@ -177,7 +178,7 @@ interface ApiService {
177 //退出登录 178 //退出登录
178 @POST("/api/user/logout") 179 @POST("/api/user/logout")
179 fun logout( 180 fun logout(
180 - ): Observable<BaseResponse<CommonBean>> 181 + ): Observable<BaseResponse<Void>>
181 182
182 /** 183 /**
183 * 上传文件 184 * 上传文件
@@ -193,7 +194,7 @@ interface ApiService { @@ -193,7 +194,7 @@ interface ApiService {
193 @Field("avatar") avatar: String, 194 @Field("avatar") avatar: String,
194 @Field("nickname") nickname: String, 195 @Field("nickname") nickname: String,
195 @Field("bio") bio: String, 196 @Field("bio") bio: String,
196 - ): Observable<BaseResponse<CommonBean>> 197 + ): Observable<BaseResponse<Void>>
197 198
198 //修改手机号 199 //修改手机号
199 @FormUrlEncoded 200 @FormUrlEncoded
@@ -201,7 +202,7 @@ interface ApiService { @@ -201,7 +202,7 @@ interface ApiService {
201 fun changePhoneNumber( 202 fun changePhoneNumber(
202 @Field("mobile") mobile: String, 203 @Field("mobile") mobile: String,
203 @Field("captcha") captcha: String 204 @Field("captcha") captcha: String
204 - ): Observable<BaseResponse<CommonBean>> 205 + ): Observable<BaseResponse<Void>>
205 206
206 //修改密码 207 //修改密码
207 @FormUrlEncoded 208 @FormUrlEncoded
@@ -212,7 +213,7 @@ interface ApiService { @@ -212,7 +213,7 @@ interface ApiService {
212 @Field("oldpassword") oldpassword: String, 213 @Field("oldpassword") oldpassword: String,
213 @Field("newpassword") newpassword: String, 214 @Field("newpassword") newpassword: String,
214 @Field("confirmpassword") confirmpassword: String, 215 @Field("confirmpassword") confirmpassword: String,
215 - ): Observable<BaseResponse<CommonBean>> 216 + ): Observable<BaseResponse<Void>>
216 217
217 //联系客服 218 //联系客服
218 @POST("/api/user/contact") 219 @POST("/api/user/contact")
@@ -255,4 +256,15 @@ interface ApiService { @@ -255,4 +256,15 @@ interface ApiService {
255 fun academicFeedbackDetail( 256 fun academicFeedbackDetail(
256 @Field("train_class_id") train_class_id: Int, 257 @Field("train_class_id") train_class_id: Int,
257 ): Observable<BaseResponse<AcademicFeedbackDetailBean>> 258 ): Observable<BaseResponse<AcademicFeedbackDetailBean>>
  259 +
  260 + /**
  261 + * 资料库详情
  262 + * @param id 资料库id
  263 + */
  264 + @FormUrlEncoded
  265 + @POST("/api/material/material_detail")
  266 + fun getDocDetail(
  267 + @Field("id") id: Int
  268 + ): Observable<BaseResponse<CommonDetail<MaterialDetail>>>
  269 +
258 } 270 }
@@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api @@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api
3 import com.br_technology.securitytrain_master.ui.bean.RegisterCompany 3 import com.br_technology.securitytrain_master.ui.bean.RegisterCompany
4 import com.br_technology.securitytrain_master.ui.bean.SearchLog 4 import com.br_technology.securitytrain_master.ui.bean.SearchLog
5 import com.br_technology.securitytrain_master.ui.bean.UserRule 5 import com.br_technology.securitytrain_master.ui.bean.UserRule
6 -import com.wjx.android.wanandroidmvvm.network.ApiService  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 6 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
9 import io.reactivex.rxjava3.core.Observable 8 import io.reactivex.rxjava3.core.Observable
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.ui.bean.MaterialClassify  
4 -import com.br_technology.securitytrain_master.ui.bean.MaterialDetail  
5 -import com.br_technology.securitytrain_master.ui.bean.MaterialListItem  
6 -import com.wjx.android.wanandroidmvvm.network.ApiService  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 3 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 -import com.br_technology.securitytrain_master.base.network.response.CommonDetail  
9 import com.br_technology.securitytrain_master.base.network.response.CommonList 4 import com.br_technology.securitytrain_master.base.network.response.CommonList
10 import com.br_technology.securitytrain_master.base.network.response.CommonPage 5 import com.br_technology.securitytrain_master.base.network.response.CommonPage
  6 +import com.br_technology.securitytrain_master.ui.bean.MaterialClassify
  7 +import com.br_technology.securitytrain_master.ui.bean.MaterialListItem
11 import io.reactivex.rxjava3.core.Observable 8 import io.reactivex.rxjava3.core.Observable
12 import retrofit2.http.Field 9 import retrofit2.http.Field
13 import retrofit2.http.FormUrlEncoded 10 import retrofit2.http.FormUrlEncoded
@@ -47,14 +44,4 @@ interface DocApi : ApiService { @@ -47,14 +44,4 @@ interface DocApi : ApiService {
47 @Field("page") page: Int, 44 @Field("page") page: Int,
48 @Field("page_num") page_num: Int 45 @Field("page_num") page_num: Int
49 ): Observable<BaseResponse<CommonPage<MaterialListItem>>> 46 ): Observable<BaseResponse<CommonPage<MaterialListItem>>>
50 -  
51 - /**  
52 - * 资料库详情  
53 - * @param id 资料库id  
54 - */  
55 - @FormUrlEncoded  
56 - @POST("/api/material/material_detail")  
57 - fun getDocDetail(  
58 - @Field("id") id: Int  
59 - ): Observable<BaseResponse<CommonDetail<MaterialDetail>>>  
60 } 47 }
@@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api @@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api
3 import com.br_technology.securitytrain_master.ui.bean.HomeBanner 3 import com.br_technology.securitytrain_master.ui.bean.HomeBanner
4 import com.br_technology.securitytrain_master.ui.bean.HomeMaterialRec 4 import com.br_technology.securitytrain_master.ui.bean.HomeMaterialRec
5 import com.br_technology.securitytrain_master.ui.bean.HomeNotice 5 import com.br_technology.securitytrain_master.ui.bean.HomeNotice
6 -import com.wjx.android.wanandroidmvvm.network.ApiService  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 6 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 import io.reactivex.rxjava3.core.Observable 7 import io.reactivex.rxjava3.core.Observable
9 import retrofit2.http.FormUrlEncoded 8 import retrofit2.http.FormUrlEncoded
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.ui.bean.*  
4 -import com.wjx.android.wanandroidmvvm.network.ApiService  
5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 3 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
6 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 4 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
7 import com.br_technology.securitytrain_master.base.network.response.CommonList 5 import com.br_technology.securitytrain_master.base.network.response.CommonList
  6 +import com.br_technology.securitytrain_master.ui.bean.*
8 import io.reactivex.rxjava3.core.Observable 7 import io.reactivex.rxjava3.core.Observable
9 import retrofit2.http.Field 8 import retrofit2.http.Field
10 import retrofit2.http.FieldMap 9 import retrofit2.http.FieldMap
@@ -72,9 +71,9 @@ interface LessonApi : ApiService { @@ -72,9 +71,9 @@ interface LessonApi : ApiService {
72 @FormUrlEncoded 71 @FormUrlEncoded
73 @POST("/api/lesson/lesson_detail") 72 @POST("/api/lesson/lesson_detail")
74 fun lessonVideoDetail( 73 fun lessonVideoDetail(
75 - @Field("id") id: Int,  
76 - @Field("train_class_id") train_class_id: Int  
77 - ): Observable<BaseResponse<CommonDetail<LessonVideoDetail>>> 74 + @Field("id") id: Int
  75 +// , @Field("train_class_id") train_class_id: Int
  76 + ): Observable<BaseResponse<LessonTrainVideoDetail>>
78 77
79 /** 78 /**
80 * 视频详情 79 * 视频详情
@@ -84,8 +83,8 @@ interface LessonApi : ApiService { @@ -84,8 +83,8 @@ interface LessonApi : ApiService {
84 @FormUrlEncoded 83 @FormUrlEncoded
85 @POST("/api/lesson/lesson_class_detail") 84 @POST("/api/lesson/lesson_class_detail")
86 fun videoDetail( 85 fun videoDetail(
87 - @Field("id") id: Int,  
88 - @Field("train_class_id") train_class_id: Int 86 + @Field("id") id: Int
  87 +// , @Field("train_class_id") train_class_id: Int
89 ): Observable<BaseResponse<CommonDetail<LessonClassDetail>>> 88 ): Observable<BaseResponse<CommonDetail<LessonClassDetail>>>
90 89
91 /** 90 /**
@@ -145,7 +144,7 @@ interface LessonApi : ApiService { @@ -145,7 +144,7 @@ interface LessonApi : ApiService {
145 @FormUrlEncoded 144 @FormUrlEncoded
146 @POST("/api/lesson/lesson_offline_signup") 145 @POST("/api/lesson/lesson_offline_signup")
147 fun lessonOffSignup( 146 fun lessonOffSignup(
148 - @Field("lesson_id") lesson_id: Int, 147 + @Field("lesson_id") lesson_id: String,
149 @Field("lat") lat: String, 148 @Field("lat") lat: String,
150 @Field("lng") lng: String 149 @Field("lng") lng: String
151 ): Observable<BaseResponse<Void>> 150 ): Observable<BaseResponse<Void>>
@@ -154,26 +153,51 @@ interface LessonApi : ApiService { @@ -154,26 +153,51 @@ interface LessonApi : ApiService {
154 * 课程进度记录 153 * 课程进度记录
155 * @param type 课程类型:1=视频课,2=直播课,3=线下培训课,4=文本课 154 * @param type 课程类型:1=视频课,2=直播课,3=线下培训课,4=文本课
156 * @param view_len 当前观看视频/文本课程时长 155 * @param view_len 当前观看视频/文本课程时长
  156 + * @param lesson_id: String // 课程id
  157 + * @param class_id: String // 课节id
  158 + * @param train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传
  159 + */
  160 + @FormUrlEncoded
  161 + @POST("/api/lesson/lesson_log_record")
  162 + fun recordNormalLesson(
  163 + @Field("type") type: Int,
  164 + @Field("lesson_id") lesson_id: String,
  165 + @FieldMap map: HashMap<String, String>
  166 +// @Field("lesson_id") lesson_id: String // 课程id
  167 +// @Field("class_id") class_id: String // 课节id
  168 +// @Field("train_class_id") train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传
  169 +// @Field("view_len") train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传
  170 + ): Observable<BaseResponse<Void>>
  171 +
  172 + /**
  173 + * 班级任务记录课程进度
  174 + * @param type 课程类型:1=视频课,2=直播课,3=线下培训课,4=文本课
  175 + * @param view_len 当前观看视频/文本课程时长
157 * @param lng: String, // 纬度 176 * @param lng: String, // 纬度
158 * @param lat: String // 经度 177 * @param lat: String // 经度
159 * @param lesson_id: String // 课程id 178 * @param lesson_id: String // 课程id
160 - * @param class_id: String // 视频id  
161 - * @param train_id: String // 培训计划id 179 + * @param class_id: String // 课节id
162 * @param train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传 180 * @param train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传
163 */ 181 */
164 @FormUrlEncoded 182 @FormUrlEncoded
165 @POST("/api/lesson/user_class_log") 183 @POST("/api/lesson/user_class_log")
166 - fun lessonLog( 184 + fun recordTrainLesson(
167 @Field("type") type: Int, 185 @Field("type") type: Int,
  186 + @Field("lesson_id") lesson_id: String,
  187 + @Field("train_class_id") train_class_id: String,
168 @Field("view_len") view_len: String, 188 @Field("view_len") view_len: String,
169 @FieldMap fieldMap: HashMap<String, String> 189 @FieldMap fieldMap: HashMap<String, String>
170 -// @Field("lng") lng: String, // 纬度  
171 -// @Field("lat") lat: String // 经度  
172 -// @Field("lesson_id") lesson_id: String // 课程id  
173 -// @Field("class_id") class_id: String // 视频id  
174 -// @Field("train_id") train_id: String // 培训计划id  
175 -// @Field("train_class_id") train_class_id: String // 培训计划班级课程id(获取数据有这个字段的必传  
176 ): Observable<BaseResponse<Void>> 190 ): Observable<BaseResponse<Void>>
177 191
178 - 192 + /**
  193 + * 收藏/取消收藏
  194 + * @param type 收藏类型:1=资料库2=文本课程
  195 + * @param favorite_id 收藏id
  196 + */
  197 + @FormUrlEncoded
  198 + @POST("/api/user/favorite")
  199 + fun favorite(
  200 + @Field("type") type: String,
  201 + @Field("favorite_id") favorite_id: String
  202 + ): Observable<BaseResponse<Void>>
179 } 203 }
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.ui.bean.CommonBean  
4 -import com.wjx.android.wanandroidmvvm.network.ApiService  
5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 3 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
6 import io.reactivex.rxjava3.core.Observable 4 import io.reactivex.rxjava3.core.Observable
7 import retrofit2.http.Field 5 import retrofit2.http.Field
@@ -25,7 +23,7 @@ interface MsgApi : ApiService { @@ -25,7 +23,7 @@ interface MsgApi : ApiService {
25 fun smsSend( 23 fun smsSend(
26 @Field("mobile") mobile: String, 24 @Field("mobile") mobile: String,
27 @Field("event") event: String 25 @Field("event") event: String
28 - ): Observable<BaseResponse<CommonBean>> 26 + ): Observable<BaseResponse<Void>>
29 27
30 /** 28 /**
31 * 发送验证码 29 * 发送验证码
@@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api @@ -3,7 +3,6 @@ package com.br_technology.securitytrain_master.base.network.api
3 import com.br_technology.securitytrain_master.ui.bean.NoticeDetail 3 import com.br_technology.securitytrain_master.ui.bean.NoticeDetail
4 import com.br_technology.securitytrain_master.ui.bean.NoticeItem 4 import com.br_technology.securitytrain_master.ui.bean.NoticeItem
5 import com.br_technology.securitytrain_master.ui.bean.NoticeUnread 5 import com.br_technology.securitytrain_master.ui.bean.NoticeUnread
6 -import com.wjx.android.wanandroidmvvm.network.ApiService  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 6 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 7 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
9 import com.br_technology.securitytrain_master.base.network.response.CommonList 8 import com.br_technology.securitytrain_master.base.network.response.CommonList
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.ui.view.login.bean.TokenBean 3 import com.br_technology.securitytrain_master.ui.view.login.bean.TokenBean
4 -import com.wjx.android.wanandroidmvvm.network.ApiService  
5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 4 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
6 import io.reactivex.rxjava3.core.Observable 5 import io.reactivex.rxjava3.core.Observable
7 import retrofit2.http.GET 6 import retrofit2.http.GET
@@ -2,7 +2,6 @@ package com.br_technology.securitytrain_master.base.network.api @@ -2,7 +2,6 @@ package com.br_technology.securitytrain_master.base.network.api
2 2
3 import com.br_technology.securitytrain_master.ui.bean.* 3 import com.br_technology.securitytrain_master.ui.bean.*
4 import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData 4 import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
5 -import com.wjx.android.wanandroidmvvm.network.ApiService  
6 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
7 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 6 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
8 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
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.ui.bean.*  
4 -import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean  
5 -import com.wjx.android.wanandroidmvvm.network.ApiService  
6 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 3 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
7 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 4 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
8 import com.br_technology.securitytrain_master.base.network.response.CommonList 5 import com.br_technology.securitytrain_master.base.network.response.CommonList
9 import com.br_technology.securitytrain_master.base.network.response.CommonPage 6 import com.br_technology.securitytrain_master.base.network.response.CommonPage
  7 +import com.br_technology.securitytrain_master.ui.bean.*
  8 +import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
10 import io.reactivex.rxjava3.core.Observable 9 import io.reactivex.rxjava3.core.Observable
11 import retrofit2.http.* 10 import retrofit2.http.*
12 11
@@ -68,7 +67,7 @@ interface UserApi : ApiService { @@ -68,7 +67,7 @@ interface UserApi : ApiService {
68 fun changeMobile( 67 fun changeMobile(
69 @Field("mobile") mobile: String, 68 @Field("mobile") mobile: String,
70 @Field("captcha") captcha: String 69 @Field("captcha") captcha: String
71 - ): Observable<BaseResponse<CommonBean>> 70 + ): Observable<BaseResponse<Void>>
72 71
73 /** 72 /**
74 * 获取图片验证码 73 * 获取图片验证码
@@ -82,7 +81,7 @@ interface UserApi : ApiService { @@ -82,7 +81,7 @@ interface UserApi : ApiService {
82 // */ 81 // */
83 // @FormUrlEncoded 82 // @FormUrlEncoded
84 // @POST("/api/user/logout") 83 // @POST("/api/user/logout")
85 -// fun logout(): Observable<BaseResponse<CommonBean>> 84 +// fun logout(): Observable<BaseResponse<Void>>
86 85
87 /** 86 /**
88 * 修改会员个人信息 87 * 修改会员个人信息
@@ -96,7 +95,7 @@ interface UserApi : ApiService { @@ -96,7 +95,7 @@ interface UserApi : ApiService {
96 @Field("avatar") avatar: String, 95 @Field("avatar") avatar: String,
97 @Field("nickname") nickname: String, 96 @Field("nickname") nickname: String,
98 @Field("bio") bio: String 97 @Field("bio") bio: String
99 - ): Observable<BaseResponse<CommonBean>> 98 + ): Observable<BaseResponse<Void>>
100 99
101 /** 100 /**
102 * 联系客服 101 * 联系客服
@@ -137,7 +136,7 @@ interface UserApi : ApiService { @@ -137,7 +136,7 @@ interface UserApi : ApiService {
137 // @Field("captcha") captcha: String, // 验证码 136 // @Field("captcha") captcha: String, // 验证码
138 // @Field("newpassword") newpassword: String, // 新密码 137 // @Field("newpassword") newpassword: String, // 新密码
139 // @Field("confirmpassword") confirmpassword: String // 确认密码 138 // @Field("confirmpassword") confirmpassword: String // 确认密码
140 -// ): Observable<BaseResponse<CommonBean>> 139 +// ): Observable<BaseResponse<Void>>
141 140
142 // /** 141 // /**
143 // * 修改密码 142 // * 修改密码
@@ -150,7 +149,7 @@ interface UserApi : ApiService { @@ -150,7 +149,7 @@ interface UserApi : ApiService {
150 // @Field("oldpassword") oldpassword: String, // 原密码 149 // @Field("oldpassword") oldpassword: String, // 原密码
151 // @Field("newpassword") newpassword: String, // 新密码 150 // @Field("newpassword") newpassword: String, // 新密码
152 // @Field("confirmpassword") confirmpassword: String // 确认密码 151 // @Field("confirmpassword") confirmpassword: String // 确认密码
153 -// ): Observable<BaseResponse<CommonBean>> 152 +// ): Observable<BaseResponse<Void>>
154 153
155 /** 154 /**
156 * 收藏/取消收藏 155 * 收藏/取消收藏
1 -package com.wjx.android.wanandroidmvvm.network.response  
2 -  
3 -/**  
4 - * Time: 7/26/2021 10:11  
5 - * Author: Captain  
6 - * Description: 初见时你很迷人  
7 - */  
8 -class EmptyResponse  
@@ -3,10 +3,9 @@ package com.br_technology.securitytrain_master.base.repository @@ -3,10 +3,9 @@ package com.br_technology.securitytrain_master.base.repository
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.api.* 5 import com.br_technology.securitytrain_master.base.network.api.*
  6 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
6 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
7 -import com.wjx.android.wanandroidmvvm.network.ApiService  
8 import com.wjx.android.wanandroidmvvm.network.RetrofitFactory 8 import com.wjx.android.wanandroidmvvm.network.RetrofitFactory
9 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
10 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
11 import io.reactivex.rxjava3.core.Observable 10 import io.reactivex.rxjava3.core.Observable
12 import io.reactivex.rxjava3.schedulers.Schedulers 11 import io.reactivex.rxjava3.schedulers.Schedulers
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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.CommonList
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 7 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 import com.br_technology.securitytrain_master.ui.bean.RegisterCompany 8 import com.br_technology.securitytrain_master.ui.bean.RegisterCompany
7 import com.br_technology.securitytrain_master.ui.bean.SearchLog 9 import com.br_technology.securitytrain_master.ui.bean.SearchLog
8 import com.br_technology.securitytrain_master.ui.bean.UserRule 10 import com.br_technology.securitytrain_master.ui.bean.UserRule
9 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
10 -import com.br_technology.securitytrain_master.base.network.response.CommonList  
11 11
12 /** 12 /**
13 * Author by YSir 13 * Author by YSir
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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.repository.ApiRepository  
6 -import com.br_technology.securitytrain_master.ui.bean.MaterialClassify  
7 -import com.br_technology.securitytrain_master.ui.bean.MaterialDetail  
8 -import com.br_technology.securitytrain_master.ui.bean.MaterialListItem  
9 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
10 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 6 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
11 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
12 import com.br_technology.securitytrain_master.base.network.response.CommonPage 8 import com.br_technology.securitytrain_master.base.network.response.CommonPage
  9 +import com.br_technology.securitytrain_master.ui.bean.MaterialClassify
  10 +import com.br_technology.securitytrain_master.ui.bean.MaterialDetail
  11 +import com.br_technology.securitytrain_master.ui.bean.MaterialListItem
13 12
14 /** 13 /**
15 * Author by YSir 14 * Author by YSir
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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.repository.ApiRepository  
6 -import com.br_technology.securitytrain_master.ui.bean.*  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 6 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
9 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
  8 +import com.br_technology.securitytrain_master.ui.bean.*
  9 +import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonDetailBean
  10 +import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
10 11
11 /** 12 /**
12 * Author by YSir 13 * Author by YSir
@@ -16,6 +17,12 @@ import com.br_technology.securitytrain_master.base.network.response.CommonList @@ -16,6 +17,12 @@ import com.br_technology.securitytrain_master.base.network.response.CommonList
16 */ 17 */
17 class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState) { 18 class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState) {
18 19
  20 + fun workType(
  21 + liveData: MutableLiveData<BaseResponse<WorkTypeBean>>
  22 + ) {
  23 + addRequest(apiService.workType(), liveData)
  24 + }
  25 +
19 fun lessonTxtList( 26 fun lessonTxtList(
20 keyword: String, 27 keyword: String,
21 pos_id: Int, 28 pos_id: Int,
@@ -25,6 +32,13 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt @@ -25,6 +32,13 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
25 addRequest(lessonService.lessonTxtList(keyword, pos_id, page, page_num), liveData) 32 addRequest(lessonService.lessonTxtList(keyword, pos_id, page, page_num), liveData)
26 } 33 }
27 34
  35 + fun materialDetail(
  36 + id: Int,
  37 + liveData: MutableLiveData<BaseResponse<CommonDetail<MaterialDetail>>>
  38 + ) {
  39 + addRequest(lessonService.getDocDetail(id), liveData)
  40 + }
  41 +
28 fun lessonTxtDetail( 42 fun lessonTxtDetail(
29 id: String, 43 id: String,
30 train_class_id: String, liveData: MutableLiveData<BaseResponse<LessonWordDetail>> 44 train_class_id: String, liveData: MutableLiveData<BaseResponse<LessonWordDetail>>
@@ -45,18 +59,16 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt @@ -45,18 +59,16 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
45 59
46 fun lessonVideoDetail( 60 fun lessonVideoDetail(
47 id: Int, 61 id: Int,
48 - train_class_id: Int,  
49 - liveData: MutableLiveData<BaseResponse<CommonDetail<LessonVideoDetail>>> 62 + liveData: MutableLiveData<BaseResponse<LessonTrainVideoDetail>>
50 ) { 63 ) {
51 - addRequest(lessonService.lessonVideoDetail(id, train_class_id), liveData) 64 + addRequest(lessonService.lessonVideoDetail(id), liveData)
52 } 65 }
53 66
54 fun videoDetail( 67 fun videoDetail(
55 id: Int, 68 id: Int,
56 - train_class_id: Int,  
57 liveData: MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>> 69 liveData: MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>>
58 ) { 70 ) {
59 - addRequest(lessonService.videoDetail(id, train_class_id), liveData) 71 + addRequest(lessonService.videoDetail(id), liveData)
60 } 72 }
61 73
62 fun lessonLiveList( 74 fun lessonLiveList(
@@ -92,7 +104,7 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt @@ -92,7 +104,7 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
92 } 104 }
93 105
94 fun lessonOffSignup( 106 fun lessonOffSignup(
95 - lesson_id: Int, 107 + lesson_id: String,
96 lat: String, 108 lat: String,
97 lng: String, 109 lng: String,
98 liveData: MutableLiveData<BaseResponse<Void>> 110 liveData: MutableLiveData<BaseResponse<Void>>
@@ -100,13 +112,45 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt @@ -100,13 +112,45 @@ class LessonRepository(loadState: MutableLiveData<State>) : ApiRepository(loadSt
100 addRequest(lessonService.lessonOffSignup(lesson_id, lat, lng), liveData) 112 addRequest(lessonService.lessonOffSignup(lesson_id, lat, lng), liveData)
101 } 113 }
102 114
103 - fun lessonLog( 115 + fun recordTrainLesson(
104 type: Int, 116 type: Int,
  117 + lesson_id: String,
  118 + train_class_id: String,
105 view_len: String, 119 view_len: String,
106 map: HashMap<String, String>, 120 map: HashMap<String, String>,
107 liveData: MutableLiveData<BaseResponse<Void>> 121 liveData: MutableLiveData<BaseResponse<Void>>
108 ) { 122 ) {
109 - addRequest(lessonService.lessonLog(type, view_len, map), liveData) 123 + addRequest(
  124 + lessonService.recordTrainLesson(type, lesson_id, train_class_id, view_len, map),
  125 + liveData
  126 + )
  127 + }
  128 +
  129 + fun recordNormalLesson(
  130 + type: Int,
  131 + lesson_id: String,
  132 + map: HashMap<String, String>,
  133 + liveData: MutableLiveData<BaseResponse<Void>>
  134 + ) {
  135 + addRequest(
  136 + lessonService.recordNormalLesson(type, lesson_id, map),
  137 + liveData
  138 + )
  139 + }
  140 +
  141 + fun txtLessonDetail(
  142 + id: Int,
  143 + liveData: MutableLiveData<BaseResponse<TextLessonDetailBean>>
  144 + ) {
  145 + addRequest(lessonService.textLessonsDetail(id), liveData)
  146 + }
  147 +
  148 + fun favorite(
  149 + type: String,
  150 + favorite_id: String,
  151 + liveData: MutableLiveData<BaseResponse<Void>>
  152 + ) {
  153 + addRequest(lessonService.favorite(type, favorite_id), liveData)
110 } 154 }
111 155
112 } 156 }
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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.repository.ApiRepository  
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
8 6
9 /** 7 /**
@@ -16,7 +14,7 @@ class MsgRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState @@ -16,7 +14,7 @@ class MsgRepository(loadState: MutableLiveData<State>) : ApiRepository(loadState
16 14
17 fun smsSend( 15 fun smsSend(
18 mobile: String, 16 mobile: String,
19 - event: String, liveData: MutableLiveData<BaseResponse<CommonBean>> 17 + event: String, liveData: MutableLiveData<BaseResponse<Void>>
20 ) { 18 ) {
21 addRequest(msgService.smsSend(mobile, event), liveData) 19 addRequest(msgService.smsSend(mobile, event), liveData)
22 } 20 }
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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
1 -package com.br_technology.securitytrain_master.base.network.repository 1 +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.repository.ApiRepository  
6 -import com.br_technology.securitytrain_master.ui.bean.*  
7 -import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean  
8 import com.br_technology.securitytrain_master.base.network.response.BaseResponse 5 import com.br_technology.securitytrain_master.base.network.response.BaseResponse
9 import com.br_technology.securitytrain_master.base.network.response.CommonDetail 6 import com.br_technology.securitytrain_master.base.network.response.CommonDetail
10 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
11 import com.br_technology.securitytrain_master.base.network.response.CommonPage 8 import com.br_technology.securitytrain_master.base.network.response.CommonPage
  9 +import com.br_technology.securitytrain_master.ui.bean.*
  10 +import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
12 11
13 /** 12 /**
14 * Author by YSir 13 * Author by YSir
@@ -48,7 +47,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat @@ -48,7 +47,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
48 fun changeMobile( 47 fun changeMobile(
49 mobile: String, 48 mobile: String,
50 captcha: String, 49 captcha: String,
51 - liveData: MutableLiveData<BaseResponse<CommonBean>> 50 + liveData: MutableLiveData<BaseResponse<Void>>
52 ) { 51 ) {
53 addRequest(userService.changeMobile(mobile, captcha), liveData) 52 addRequest(userService.changeMobile(mobile, captcha), liveData)
54 } 53 }
@@ -61,7 +60,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat @@ -61,7 +60,7 @@ class UserRepository(loadState: MutableLiveData<State>) : ApiRepository(loadStat
61 avatar: String, 60 avatar: String,
62 nickname: String, 61 nickname: String,
63 bio: String, 62 bio: String,
64 - liveData: MutableLiveData<BaseResponse<CommonBean>> 63 + liveData: MutableLiveData<BaseResponse<Void>>
65 ) { 64 ) {
66 addRequest(userService.setUserProfile(avatar, nickname, bio), liveData) 65 addRequest(userService.setUserProfile(avatar, nickname, bio), liveData)
67 } 66 }
@@ -3,17 +3,15 @@ package com.wjx.android.wanandroidmvvm.base.view @@ -3,17 +3,15 @@ package com.wjx.android.wanandroidmvvm.base.view
3 import android.app.Activity 3 import android.app.Activity
4 import android.content.Context 4 import android.content.Context
5 import android.content.Intent 5 import android.content.Intent
6 -import android.graphics.Color  
7 import android.os.Build 6 import android.os.Build
8 import android.os.Bundle 7 import android.os.Bundle
  8 +import android.text.TextUtils
9 import android.util.AttributeSet 9 import android.util.AttributeSet
10 -import android.view.MenuItem  
11 import android.view.View 10 import android.view.View
12 import android.view.ViewGroup 11 import android.view.ViewGroup
  12 +import android.widget.Toast
13 import androidx.annotation.RequiresApi 13 import androidx.annotation.RequiresApi
14 import androidx.appcompat.app.AppCompatActivity 14 import androidx.appcompat.app.AppCompatActivity
15 -import androidx.core.graphics.ColorUtils  
16 -import com.br_technology.securitytrain_master.R  
17 import com.br_technology.securitytrain_master.util.AppManager 15 import com.br_technology.securitytrain_master.util.AppManager
18 import com.br_technology.securitytrain_master.util.RevealUtil.setReveal 16 import com.br_technology.securitytrain_master.util.RevealUtil.setReveal
19 import com.gyf.immersionbar.ImmersionBar 17 import com.gyf.immersionbar.ImmersionBar
@@ -110,6 +108,15 @@ abstract class BaseActivity : AppCompatActivity() { @@ -110,6 +108,15 @@ abstract class BaseActivity : AppCompatActivity() {
110 108
111 open fun reLoad() {} 109 open fun reLoad() {}
112 110
  111 + open fun toast(str: String) {
  112 + if (TextUtils.isEmpty(str)) {
  113 + return
  114 + }
  115 + runOnUiThread {
  116 + Toast.makeText(this, str, Toast.LENGTH_SHORT).show()
  117 + }
  118 + }
  119 +
113 // override fun onBackPressed() { 120 // override fun onBackPressed() {
114 // val time = System.currentTimeMillis() 121 // val time = System.currentTimeMillis()
115 // 122 //
1 package com.br_technology.securitytrain_master.base.view 1 package com.br_technology.securitytrain_master.base.view
2 2
3 import android.app.Application 3 import android.app.Application
  4 +import android.util.Log
4 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
5 import com.br_technology.securitytrain_master.base.common.callback.EmptyCallBack 6 import com.br_technology.securitytrain_master.base.common.callback.EmptyCallBack
6 import com.br_technology.securitytrain_master.base.common.callback.ErrorCallBack 7 import com.br_technology.securitytrain_master.base.common.callback.ErrorCallBack
@@ -9,6 +10,9 @@ import com.kingja.loadsir.core.LoadSir @@ -9,6 +10,9 @@ import com.kingja.loadsir.core.LoadSir
9 import com.scwang.smart.refresh.footer.ClassicsFooter 10 import com.scwang.smart.refresh.footer.ClassicsFooter
10 import com.scwang.smart.refresh.header.ClassicsHeader 11 import com.scwang.smart.refresh.header.ClassicsHeader
11 import com.scwang.smart.refresh.layout.SmartRefreshLayout 12 import com.scwang.smart.refresh.layout.SmartRefreshLayout
  13 +import com.tencent.map.geolocation.TencentLocationManager
  14 +import com.tencent.smtt.sdk.QbSdk
  15 +import com.tencent.smtt.sdk.TbsDownloader
12 import kotlin.properties.Delegates 16 import kotlin.properties.Delegates
13 17
14 /** 18 /**
@@ -19,6 +23,12 @@ import kotlin.properties.Delegates @@ -19,6 +23,12 @@ import kotlin.properties.Delegates
19 * Time: 14:27 23 * Time: 14:27
20 */ 24 */
21 open class BaseApplication : Application() { 25 open class BaseApplication : Application() {
  26 + /**
  27 + * 全局定义,用于定位请求
  28 + */
  29 + val mLocationManager: TencentLocationManager by lazy {
  30 + TencentLocationManager.getInstance(this)
  31 + }
22 32
23 override fun onCreate() { 33 override fun onCreate() {
24 super.onCreate() 34 super.onCreate()
@@ -28,8 +38,22 @@ open class BaseApplication : Application() { @@ -28,8 +38,22 @@ open class BaseApplication : Application() {
28 .addCallback(LoadingCallBack()) 38 .addCallback(LoadingCallBack())
29 .addCallback(EmptyCallBack()) 39 .addCallback(EmptyCallBack())
30 .commit() 40 .commit()
  41 +
  42 + QbSdk.initX5Environment(this, object : QbSdk.PreInitCallback {
  43 + override fun onCoreInitFinished() {
  44 + }
  45 + override fun onViewInitFinished(b: Boolean) {
  46 + Log.e("BaseApplication", "dsadasda$b")
  47 + }
  48 + })
  49 + val needDownload = TbsDownloader.needDownload(this, TbsDownloader.DOWNLOAD_OVERSEA_TBS);
  50 + if (needDownload) {
  51 + TbsDownloader.startDownload(this);
  52 + }
31 } 53 }
32 54
  55 +
  56 +
33 companion object { 57 companion object {
34 var instance: BaseApplication by Delegates.notNull() 58 var instance: BaseApplication by Delegates.notNull()
35 init { 59 init {
1 package com.br_technology.securitytrain_master.ui.bean 1 package com.br_technology.securitytrain_master.ui.bean
2 2
  3 +import java.io.Serializable
  4 +
3 /** 5 /**
4 * Author by YSir 6 * Author by YSir
5 * Date on 2022/1/8. 7 * Date on 2022/1/8.
@@ -14,6 +16,8 @@ open class LessonWord( @@ -14,6 +16,8 @@ open class LessonWord(
14 var intro: String // 简介信息 16 var intro: String // 简介信息
15 ) 17 )
16 18
  19 +open class LessonTrainVideoDetail(var detail: LessonVideoDetail, var class_list: List<LessonClazz>)
  20 +
17 open class LessonWordDetail( 21 open class LessonWordDetail(
18 var id: Int, 22 var id: Int,
19 var name: String, // 课程名称 23 var name: String, // 课程名称
@@ -41,7 +45,7 @@ open class LessonClazz( @@ -41,7 +45,7 @@ open class LessonClazz(
41 var id: Int, 45 var id: Int,
42 var name: String, 46 var name: String,
43 var lessonclassdetail: List<LessonClassDetail> 47 var lessonclassdetail: List<LessonClassDetail>
44 -) 48 +) : Serializable
45 49
46 open class LessonClassDetail( 50 open class LessonClassDetail(
47 var id: Int, 51 var id: Int,
@@ -49,7 +53,7 @@ open class LessonClassDetail( @@ -49,7 +53,7 @@ open class LessonClassDetail(
49 var video: String,//"/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4", 53 var video: String,//"/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4",
50 var video_url: String,//"http://security.cn/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4" // 视频播放地址 54 var video_url: String,//"http://security.cn/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4" // 视频播放地址
51 var video_length: String//"10.006", // 视频时长(s) 55 var video_length: String//"10.006", // 视频时长(s)
52 -) 56 +) : Serializable
53 57
54 open class LessonLive( 58 open class LessonLive(
55 var id: Int, 59 var id: Int,
@@ -60,7 +64,7 @@ open class LessonLive( @@ -60,7 +64,7 @@ open class LessonLive(
60 var webrtc_url: String,//"rtmp://153382.livepush.myqcloud.com/live/123456?txSecret=0c761f4fdf14b04ef745d2fb9182429d&txTime=6262D100", // web直播地址 64 var webrtc_url: String,//"rtmp://153382.livepush.myqcloud.com/live/123456?txSecret=0c761f4fdf14b04ef745d2fb9182429d&txTime=6262D100", // web直播地址
61 var live_status: String, // 直播间状态:1=正在直播,2=回放,3=即将开播 65 var live_status: String, // 直播间状态:1=正在直播,2=回放,3=即将开播
62 var teacher: Teacher 66 var teacher: Teacher
63 -) 67 +) : Serializable
64 68
65 open class LessonOffline( 69 open class LessonOffline(
66 var class_name: String, 70 var class_name: String,
@@ -71,12 +75,12 @@ open class LessonOffline( @@ -71,12 +75,12 @@ open class LessonOffline(
71 var train_class: TrainClass, 75 var train_class: TrainClass,
72 var list: List<LessonOfflineItem>, 76 var list: List<LessonOfflineItem>,
73 var is_settle: Int 77 var is_settle: Int
74 -) 78 +) : Serializable
75 79
76 open class TrainClass( 80 open class TrainClass(
77 var train_id: Int, 81 var train_id: Int,
78 var class_id: Int 82 var class_id: Int
79 -) 83 +) : Serializable
80 84
81 open class LessonOfflineItem( 85 open class LessonOfflineItem(
82 var id: Int, 86 var id: Int,
@@ -94,7 +98,7 @@ open class LessonOfflineItem( @@ -94,7 +98,7 @@ open class LessonOfflineItem(
94 var lat: String, 98 var lat: String,
95 var lng: String, 99 var lng: String,
96 var lessonofflineclass: List<LessonOfflineClazz> 100 var lessonofflineclass: List<LessonOfflineClazz>
97 -) 101 +) : Serializable
98 102
99 open class LessonOfflineClazz( 103 open class LessonOfflineClazz(
100 var id: Int, 104 var id: Int,
@@ -104,15 +108,18 @@ open class LessonOfflineClazz( @@ -104,15 +108,18 @@ open class LessonOfflineClazz(
104 var end_time: String, 108 var end_time: String,
105 var create_time: String, 109 var create_time: String,
106 var is_sign: Int 110 var is_sign: Int
107 -) 111 +) : Serializable
108 112
109 open class LessonOfflineDetail( 113 open class LessonOfflineDetail(
110 var id: Int, 114 var id: Int,
  115 + var image: String, // 课程名称
111 var name: String, // 课程名称 116 var name: String, // 课程名称
112 var content: String, 117 var content: String,
113 var address: String, // 地址 118 var address: String, // 地址
114 var lat: String, // 纬度 119 var lat: String, // 纬度
115 var lng: String, // 经度 120 var lng: String, // 经度
  121 + var is_open: String, // 经度
  122 + var pos_ids: String, // 经度
116 var is_pos: Int, // 是否开启定位打卡0=否1=是 123 var is_pos: Int, // 是否开启定位打卡0=否1=是
117 - var lessonofflineclass: LessonOfflineClazz  
118 -) 124 + var lessonofflineclass: List<LessonOfflineClazz>
  125 +) : Serializable
@@ -34,11 +34,7 @@ open class LessonBean( @@ -34,11 +34,7 @@ open class LessonBean(
34 var create_time_text: String // 时间 34 var create_time_text: String // 时间
35 ) : MultiItemEntity { 35 ) : MultiItemEntity {
36 override val itemType: Int 36 override val itemType: Int
37 - get() = when (sort_id.toInt()) {  
38 - 1, 2 -> 0  
39 - 3, 4 -> 1  
40 - else -> 0  
41 - } 37 + get() = sort_id.toInt()
42 } 38 }
43 39
44 /** 40 /**
@@ -46,6 +42,13 @@ open class LessonBean( @@ -46,6 +42,13 @@ open class LessonBean(
46 */ 42 */
47 open class PractiseBean( 43 open class PractiseBean(
48 var id: Int, 44 var id: Int,
  45 + var company_id: Int,
  46 + var train_id: Int,
  47 + var train_class_id: Int,
  48 + var paper_id: Int,
  49 + var times: Int,
  50 + var score: Int,
  51 + var pass: Int,
49 var name: String, // 练习名称 52 var name: String, // 练习名称
50 var is_complete: String, // 答题状态0=未完成1=已完成 53 var is_complete: String, // 答题状态0=未完成1=已完成
51 var count: Int, // 题目数量 54 var count: Int, // 题目数量
@@ -61,6 +64,13 @@ open class PractiseBean( @@ -61,6 +64,13 @@ open class PractiseBean(
61 */ 64 */
62 open class ExamBean( 65 open class ExamBean(
63 var id: Int, 66 var id: Int,
  67 + var company_id: Int,
  68 + var train_id: Int,
  69 + var train_class_id: Int,
  70 + var paper_id: Int,
  71 + var times: Int,
  72 + var score: Int,
  73 + var pass: Int,
64 var name: String, // 考试名称 74 var name: String, // 考试名称
65 var pos_name: String, // 工种 75 var pos_name: String, // 工种
66 var answer_count: Int, // 做过的人数 76 var answer_count: Int, // 做过的人数
1 -package com.br_technology.securitytrain_master.ui.bean;  
2 -  
3 -/**  
4 - * Time: 11/10/2021 9:34  
5 - * Author: Captain  
6 - * Description: 初见时你很迷人  
7 - */  
8 -public class CommonBean {  
9 -  
10 -}  
  1 +package com.br_technology.securitytrain_master.ui.bean
  2 +
  3 +import android.os.Parcel
  4 +import android.os.Parcelable
  5 +import com.chad.library.adapter.base.entity.MultiItemEntity
  6 +
  7 +/**
  8 + * Author by YSir
  9 + * Date on 2022/1/17.
  10 + * description
  11 + * PS: Not easy to write code, please indicate.
  12 + */
  13 +open class CourseParam() : Parcelable {
  14 + // 是否为班级任务类型
  15 + var isTrainClass = false
  16 +
  17 + // 类型 课程类型:1=视频课,2=直播课,3=线下培训课,4=文本课
  18 + var type: Int = 0
  19 +
  20 + // 课程id
  21 + var mLessonId: String = ""
  22 +
  23 + // 课节id
  24 + var mClassId: String = ""
  25 +
  26 + // 培训计划班级id(获取数据有这个字段的必传
  27 + var mTrainClassId: String = ""
  28 +
  29 + // 位置latitude
  30 + var lat: String = ""
  31 +
  32 + // 位置longtitude
  33 + var lng: String = ""
  34 +
  35 + // 观看进度
  36 + var mViewLen: Int = 0
  37 +
  38 + constructor(parcel: Parcel) : this() {
  39 + isTrainClass = parcel.readByte() != 0.toByte()
  40 + type = parcel.readInt()
  41 + mLessonId = parcel.readString().toString()
  42 + mClassId = parcel.readString().toString()
  43 + mTrainClassId = parcel.readString().toString()
  44 + lat = parcel.readString().toString()
  45 + lng = parcel.readString().toString()
  46 + mViewLen = parcel.readInt()
  47 + }
  48 +
  49 + override fun writeToParcel(parcel: Parcel, flags: Int) {
  50 + parcel.writeByte(if (isTrainClass) 1 else 0)
  51 + parcel.writeInt(type)
  52 + parcel.writeString(mLessonId)
  53 + parcel.writeString(mClassId)
  54 + parcel.writeString(mTrainClassId)
  55 + parcel.writeString(lat)
  56 + parcel.writeString(lng)
  57 + parcel.writeInt(mViewLen)
  58 + }
  59 +
  60 + override fun describeContents(): Int {
  61 + return 0
  62 + }
  63 +
  64 + companion object CREATOR : Parcelable.Creator<CourseParam> {
  65 + override fun createFromParcel(parcel: Parcel): CourseParam {
  66 + return CourseParam(parcel)
  67 + }
  68 +
  69 + override fun newArray(size: Int): Array<CourseParam?> {
  70 + return arrayOfNulls(size)
  71 + }
  72 + }
  73 +}
  74 +
  75 +//todo 班级任务ui数据
  76 +open class TrainTestData(var isTest: Boolean, var practice: PractiseBean, var exam: ExamBean) :
  77 + MultiItemEntity {
  78 + override val itemType: Int
  79 + get() = if (isTest) {
  80 + practice.is_complete.toInt()
  81 + } else {
  82 + exam.is_complete.toInt()
  83 + }
  84 +}
@@ -6,16 +6,12 @@ import android.view.View @@ -6,16 +6,12 @@ import android.view.View
6 import androidx.activity.result.contract.ActivityResultContracts 6 import androidx.activity.result.contract.ActivityResultContracts
7 import androidx.core.content.ContextCompat 7 import androidx.core.content.ContextCompat
8 import com.br_technology.securitytrain_master.R 8 import com.br_technology.securitytrain_master.R
9 -import com.br_technology.securitytrain_master.databinding.ActivityChallengeBinding  
10 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding 9 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
11 -import com.br_technology.securitytrain_master.ext.ConstantType  
12 -import com.br_technology.securitytrain_master.ui.view.bank.adapter.ChallengeAdapter 10 +import com.br_technology.securitytrain_master.base.common.ConstantType
13 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter 11 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter
14 -import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.ChallengeViewModel  
15 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel 12 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
16 import com.br_technology.securitytrain_master.view.DialogTitle 13 import com.br_technology.securitytrain_master.view.DialogTitle
17 import com.br_technology.securitytrain_master.view.listener.DialogListener 14 import com.br_technology.securitytrain_master.view.listener.DialogListener
18 -import com.br_technology.securitytrain_master.view.listener.OnItemClickListener  
19 import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener 15 import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
20 import com.luck.picture.lib.tools.ToastUtils 16 import com.luck.picture.lib.tools.ToastUtils
21 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 17 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
@@ -3,10 +3,9 @@ package com.br_technology.securitytrain_master.ui.view.bank.activity @@ -3,10 +3,9 @@ package com.br_technology.securitytrain_master.ui.view.bank.activity
3 import android.annotation.SuppressLint 3 import android.annotation.SuppressLint
4 import android.content.Intent 4 import android.content.Intent
5 import androidx.core.content.ContextCompat 5 import androidx.core.content.ContextCompat
6 -import com.alibaba.fastjson.JSON  
7 import com.br_technology.securitytrain_master.R 6 import com.br_technology.securitytrain_master.R
8 import com.br_technology.securitytrain_master.databinding.ActivityExamTypeBinding 7 import com.br_technology.securitytrain_master.databinding.ActivityExamTypeBinding
9 -import com.br_technology.securitytrain_master.ext.ConstantType 8 +import com.br_technology.securitytrain_master.base.common.ConstantType
10 import com.br_technology.securitytrain_master.ui.bean.PaperListDetail 9 import com.br_technology.securitytrain_master.ui.bean.PaperListDetail
11 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.ExamTypeViewModel 10 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.ExamTypeViewModel
12 import com.google.gson.Gson 11 import com.google.gson.Gson
@@ -7,15 +7,13 @@ import androidx.activity.result.contract.ActivityResultContracts @@ -7,15 +7,13 @@ import androidx.activity.result.contract.ActivityResultContracts
7 import androidx.core.content.ContextCompat 7 import androidx.core.content.ContextCompat
8 import com.br_technology.securitytrain_master.R 8 import com.br_technology.securitytrain_master.R
9 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding 9 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
10 -import com.br_technology.securitytrain_master.ext.ConstantType 10 +import com.br_technology.securitytrain_master.base.common.ConstantType
11 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter 11 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter
12 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel 12 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
13 import com.br_technology.securitytrain_master.view.DialogDetermine 13 import com.br_technology.securitytrain_master.view.DialogDetermine
14 -import com.br_technology.securitytrain_master.view.DialogSureCancel  
15 import com.br_technology.securitytrain_master.view.DialogTitle 14 import com.br_technology.securitytrain_master.view.DialogTitle
16 import com.br_technology.securitytrain_master.view.listener.DialogListener 15 import com.br_technology.securitytrain_master.view.listener.DialogListener
17 import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener 16 import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
18 -import com.luck.picture.lib.tools.ToastUtils  
19 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 17 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
20 18
21 /** 19 /**
@@ -2,7 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.activity @@ -2,7 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.activity
2 2
3 import android.content.Intent 3 import android.content.Intent
4 import com.br_technology.securitytrain_master.databinding.ActivityPracticeListBinding 4 import com.br_technology.securitytrain_master.databinding.ActivityPracticeListBinding
5 -import com.br_technology.securitytrain_master.ext.ConstantType 5 +import com.br_technology.securitytrain_master.base.common.ConstantType
6 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeListAdapter 6 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeListAdapter
7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel 7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
8 import com.br_technology.securitytrain_master.util.sp_job_name 8 import com.br_technology.securitytrain_master.util.sp_job_name
@@ -7,7 +7,7 @@ import androidx.activity.result.contract.ActivityResultContracts @@ -7,7 +7,7 @@ import androidx.activity.result.contract.ActivityResultContracts
7 import androidx.core.content.ContextCompat 7 import androidx.core.content.ContextCompat
8 import com.br_technology.securitytrain_master.R 8 import com.br_technology.securitytrain_master.R
9 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding 9 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
10 -import com.br_technology.securitytrain_master.ext.ConstantType 10 +import com.br_technology.securitytrain_master.base.common.ConstantType
11 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter 11 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticePaperAdapter
12 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel 12 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
13 import com.br_technology.securitytrain_master.view.DialogTitle 13 import com.br_technology.securitytrain_master.view.DialogTitle
@@ -21,7 +21,7 @@ import com.br_technology.securitytrain_master.databinding.AdapterContentPractice @@ -21,7 +21,7 @@ import com.br_technology.securitytrain_master.databinding.AdapterContentPractice
21 import com.br_technology.securitytrain_master.databinding.AdapterPictureBinding 21 import com.br_technology.securitytrain_master.databinding.AdapterPictureBinding
22 import com.br_technology.securitytrain_master.databinding.AdapterTopicBinding 22 import com.br_technology.securitytrain_master.databinding.AdapterTopicBinding
23 import com.br_technology.securitytrain_master.expand.dp2px 23 import com.br_technology.securitytrain_master.expand.dp2px
24 -import com.br_technology.securitytrain_master.ext.ConstantType 24 +import com.br_technology.securitytrain_master.base.common.ConstantType
25 import com.br_technology.securitytrain_master.ui.bean.Answer 25 import com.br_technology.securitytrain_master.ui.bean.Answer
26 import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr 26 import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr
27 import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject 27 import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
@@ -3,8 +3,8 @@ package com.br_technology.securitytrain_master.ui.view.bank.fragment @@ -3,8 +3,8 @@ package com.br_technology.securitytrain_master.ui.view.bank.fragment
3 import android.content.Intent 3 import android.content.Intent
4 import androidx.recyclerview.widget.LinearLayoutManager 4 import androidx.recyclerview.widget.LinearLayoutManager
5 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
  6 +import com.br_technology.securitytrain_master.base.common.ConstantType
6 import com.br_technology.securitytrain_master.databinding.FragmentBankBinding 7 import com.br_technology.securitytrain_master.databinding.FragmentBankBinding
7 -import com.br_technology.securitytrain_master.ext.ConstantType  
8 import com.br_technology.securitytrain_master.ui.view.bank.activity.* 8 import com.br_technology.securitytrain_master.ui.view.bank.activity.*
9 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeAdapter 9 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeAdapter
10 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean 10 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
1 package com.br_technology.securitytrain_master.ui.view.bank.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.bank.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
4 -import com.br_technology.securitytrain_master.base.network.repository.ItemRepository 4 +import com.br_technology.securitytrain_master.base.repository.ItemRepository
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.network.response.CommonDetail  
7 import com.br_technology.securitytrain_master.base.network.response.CommonDetailList 6 import com.br_technology.securitytrain_master.base.network.response.CommonDetailList
8 import com.br_technology.securitytrain_master.base.network.response.CommonList 7 import com.br_technology.securitytrain_master.base.network.response.CommonList
9 import com.br_technology.securitytrain_master.base.view.BaseViewModel 8 import com.br_technology.securitytrain_master.base.view.BaseViewModel
10 import com.br_technology.securitytrain_master.ui.bean.PaperListDetail 9 import com.br_technology.securitytrain_master.ui.bean.PaperListDetail
11 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean 10 import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
12 -import com.br_technology.securitytrain_master.ui.view.bank.repository.MockExamRepository  
13 import com.br_technology.securitytrain_master.util.sp_job_id 11 import com.br_technology.securitytrain_master.util.sp_job_id
14 12
15 /** 13 /**
@@ -2,7 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.viewmodel @@ -2,7 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
4 import com.alibaba.fastjson.JSON 4 import com.alibaba.fastjson.JSON
5 -import com.br_technology.securitytrain_master.base.network.repository.ItemRepository 5 +import com.br_technology.securitytrain_master.base.repository.ItemRepository
6 import com.br_technology.securitytrain_master.base.network.response.* 6 import com.br_technology.securitytrain_master.base.network.response.*
7 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.* 8 import com.br_technology.securitytrain_master.ui.bean.*
  1 +package com.br_technology.securitytrain_master.ui.view.common
  2 +
  3 +import android.text.TextUtils
  4 +import com.br_technology.securitytrain_master.databinding.ActivityCommonFileReadBinding
  5 +import com.br_technology.securitytrain_master.util.SkinCompat
  6 +import com.br_technology.securitytrain_master.util.TrainFileUtil
  7 +import com.br_technology.securitytrain_master.view.DialogTrainLoading
  8 +import com.tencent.smtt.sdk.QbSdk
  9 +import com.tencent.smtt.sdk.TbsReaderView
  10 +import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
  11 +import kotlinx.coroutines.GlobalScope
  12 +import kotlinx.coroutines.launch
  13 +import org.json.JSONException
  14 +import org.json.JSONObject
  15 +import java.io.File
  16 +
  17 +
  18 +/**
  19 + * Author by YSir
  20 + * Date on 2022/1/15.
  21 + * description
  22 + * PS: Not easy to write code, please indicate.
  23 + */
  24 +class FileReadActivity :
  25 + BaseLifeCycleActivity<FileReadViewModel, ActivityCommonFileReadBinding>(
  26 + ActivityCommonFileReadBinding::inflate
  27 + ), TbsReaderView.ReaderCallback {
  28 +
  29 + private val mDialogLoading: DialogTrainLoading by lazy {
  30 + return@lazy DialogTrainLoading(this)
  31 + }
  32 +
  33 + override fun initDataObserver() {
  34 + }
  35 +
  36 + override fun onCallBackAction(p0: Int?, p1: Any?, p2: Any?) {
  37 + }
  38 +
  39 + override fun initView() {
  40 + super.initView()
  41 + SkinCompat.initSystemUiVisibilityTrans(this, true)
  42 + }
  43 +
  44 + val mClassId: String? = null
  45 +
  46 + override fun initData() {
  47 + super.initData()
  48 + if (intent.getStringExtra("url") != null) {
  49 + loadFile(intent.getStringExtra("url")!!)
  50 + } else {
  51 + showError("文件加载失败")
  52 + finish()
  53 + }
  54 + }
  55 +
  56 + private fun openFile(file: File) {
  57 + val obj = JSONObject()
  58 + try {
  59 + obj.put("pkgName", this.application.packageName)
  60 + } catch (e: JSONException) {
  61 + e.printStackTrace()
  62 + }
  63 + val param = HashMap<String, String>()
  64 + param["entryId"] = "2"
  65 + param["allowAutoDestory"] = "true"
  66 + param["menuData"] = obj.toString()
  67 + QbSdk.getMiniQBVersion(this)
  68 + QbSdk.openFileReader(this, file.path, param) {
  69 + val close = it.toString() == "fileReaderClosed"
  70 + if (close) {
  71 + finish()
  72 + }
  73 + }
  74 + }
  75 +
  76 + private fun loadFile(url: String) {
  77 + if (TextUtils.isEmpty(url)) {
  78 + return
  79 + }
  80 + mDialogLoading.show()
  81 + val file = File(TrainFileUtil.getTrainDocLoad(), TrainFileUtil.getFileName(url))
  82 + GlobalScope.launch {
  83 + TrainFileUtil.fileLoad(file, url, object : TrainFileUtil.ILoad {
  84 + override fun success(file: File) {
  85 + runOnUiThread {
  86 + mDialogLoading.dismiss()
  87 + openFile(file)
  88 + }
  89 + }
  90 +
  91 + override fun fail() {
  92 + runOnUiThread {
  93 + mDialogLoading.dismiss()
  94 + showError("文件加载失败")
  95 + }
  96 + }
  97 +
  98 + override fun progress(f: Float) {
  99 + }
  100 + })
  101 + }
  102 + }
  103 +
  104 + override fun onDestroy() {
  105 + super.onDestroy()
  106 + QbSdk.closeFileReader(this)
  107 + }
  108 +}
1 -package com.br_technology.securitytrain_master.ext 1 +package com.br_technology.securitytrain_master.ui.view.common
  2 +
  3 +import com.br_technology.securitytrain_master.base.repository.LessonRepository
  4 +import com.br_technology.securitytrain_master.base.view.BaseViewModel
2 5
3 /** 6 /**
4 * Author by YSir 7 * Author by YSir
5 - * Date on 2022/1/13. 8 + * Date on 2022/1/17.
6 * description 9 * description
7 * PS: Not easy to write code, please indicate. 10 * PS: Not easy to write code, please indicate.
8 */ 11 */
9 -object ConstantParamKey {  
10 - // 班级id  
11 - const val CLASS_ID = "class_id"  
12 -  
13 - // 课程id  
14 - const val LESSON_ID = "lesson_id" 12 +class FileReadViewModel : BaseViewModel<LessonRepository>() {
15 } 13 }
@@ -2,24 +2,18 @@ package com.br_technology.securitytrain_master.ui.view.home.activity @@ -2,24 +2,18 @@ package com.br_technology.securitytrain_master.ui.view.home.activity
2 2
3 import android.content.Intent 3 import android.content.Intent
4 import android.os.Bundle 4 import android.os.Bundle
5 -import android.view.View  
6 -import androidx.core.content.ContextCompat  
7 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout 5 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
8 import com.br_technology.securitytrain_master.R 6 import com.br_technology.securitytrain_master.R
  7 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey
9 import com.br_technology.securitytrain_master.databinding.ActivityOnlineBinding 8 import com.br_technology.securitytrain_master.databinding.ActivityOnlineBinding
10 import com.br_technology.securitytrain_master.expand.addItemDecoration2 9 import com.br_technology.securitytrain_master.expand.addItemDecoration2
11 -import com.br_technology.securitytrain_master.ext.ConstantParamKey.LESSON_ID 10 +import com.br_technology.securitytrain_master.ui.bean.CourseParam
  11 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
12 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter 12 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter
13 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean 13 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
14 -import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEvent  
15 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineViewModel 14 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineViewModel
16 -import com.br_technology.securitytrain_master.view.ClassifyPop  
17 -import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener  
18 import com.chad.library.adapter.base.listener.OnLoadMoreListener 15 import com.chad.library.adapter.base.listener.OnLoadMoreListener
19 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 16 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
20 -import org.greenrobot.eventbus.EventBus  
21 -import org.greenrobot.eventbus.Subscribe  
22 -import org.greenrobot.eventbus.ThreadMode  
23 17
24 /** 18 /**
25 * createTime:2021/7/30 8:53 19 * createTime:2021/7/30 8:53
@@ -31,52 +25,37 @@ class OnlineActivity : @@ -31,52 +25,37 @@ class OnlineActivity :
31 private var videoLessonList: MutableList<VideoLessonBean.ListBean.DataBean>? = null 25 private var videoLessonList: MutableList<VideoLessonBean.ListBean.DataBean>? = null
32 private var page = 1 26 private var page = 1
33 var videoCourseAdapter: VideoCourseAdapter? = null 27 var videoCourseAdapter: VideoCourseAdapter? = null
34 - private val classifyPop by lazy {  
35 - ClassifyPop(this)  
36 - }  
37 28
38 override fun onCreate(savedInstanceState: Bundle?) { 29 override fun onCreate(savedInstanceState: Bundle?) {
39 super.onCreate(savedInstanceState) 30 super.onCreate(savedInstanceState)
40 videoLessonList = mutableListOf() 31 videoLessonList = mutableListOf()
41 - mViewModel.videoLessons(1, "", 0, page, 10) 32 + mViewModel.videoLessons(1, "", page)
42 binding.apply { 33 binding.apply {
43 -  
44 - toolBar.setRightText("工种")  
45 - toolBar.setRightTextDrawable(  
46 - ContextCompat.getDrawable(  
47 - baseContext,  
48 - R.mipmap.down_arrow  
49 - )  
50 - )  
51 -  
52 - toolBar.addRightListener(object : ToolBarClickListener {  
53 - override fun onClick(view: View) {  
54 - mViewModel.workType()  
55 - }  
56 - })  
57 -  
58 onlineRecycler.addItemDecoration2(2, 15, 24) 34 onlineRecycler.addItemDecoration2(2, 15, 24)
59 videoCourseAdapter = 35 videoCourseAdapter =
60 VideoCourseAdapter(R.layout.adapter_video_course, videoLessonList) 36 VideoCourseAdapter(R.layout.adapter_video_course, videoLessonList)
61 videoLessonList = mutableListOf() 37 videoLessonList = mutableListOf()
62 onlineRecycler.adapter = videoCourseAdapter 38 onlineRecycler.adapter = videoCourseAdapter
63 videoCourseAdapter?.setOnItemClickListener { adapter, view, position -> 39 videoCourseAdapter?.setOnItemClickListener { adapter, view, position ->
  40 + val course = CourseParam()
  41 + val data = videoLessonList!![position]
  42 + course.mLessonId = "${data.id}"
  43 + course.isTrainClass = false
  44 + course.type = data.type.toInt()
64 startActivity( 45 startActivity(
65 Intent( 46 Intent(
66 this@OnlineActivity, 47 this@OnlineActivity,
67 - OnlineDetailActivity::class.java  
68 - ).putExtra(LESSON_ID, videoLessonList!![position].id) 48 + CourseDetailActivity::class.java
  49 + ).putExtra(ConstantParamKey.COURSE_BEAN, course)
69 ) 50 )
70 } 51 }
71 -  
72 initLoadMore() 52 initLoadMore()
73 swipeRefreshlayout.setOnRefreshListener(object : SwipeRefreshLayout.OnRefreshListener { 53 swipeRefreshlayout.setOnRefreshListener(object : SwipeRefreshLayout.OnRefreshListener {
74 override fun onRefresh() { 54 override fun onRefresh() {
75 videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = false 55 videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = false
76 page = 1 56 page = 1
77 - mViewModel.videoLessons(1, "", 0, page, 10) 57 + mViewModel.videoLessons(1, "", page)
78 } 58 }
79 -  
80 }) 59 })
81 } 60 }
82 } 61 }
@@ -104,13 +83,6 @@ class OnlineActivity : @@ -104,13 +83,6 @@ class OnlineActivity :
104 } 83 }
105 ++page 84 ++page
106 }) 85 })
107 -  
108 - mViewModel.mWorkTypeBean.observe(this, {  
109 - classifyPop.setList(it.data.list)  
110 - if (!classifyPop.isShowing) {  
111 - classifyPop.showAsDropDown(binding.toolBar)  
112 - }  
113 - })  
114 } 86 }
115 87
116 fun initLoadMore() { 88 fun initLoadMore() {
@@ -118,29 +90,11 @@ class OnlineActivity : @@ -118,29 +90,11 @@ class OnlineActivity :
118 override fun onLoadMore() { 90 override fun onLoadMore() {
119 binding.swipeRefreshlayout.isRefreshing = false 91 binding.swipeRefreshlayout.isRefreshing = false
120 videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true 92 videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true
121 - mViewModel.videoLessons(1, "", 0, page, 10) 93 + mViewModel.videoLessons(1, "", page)
122 } 94 }
123 95
124 }) 96 })
125 videoCourseAdapter?.loadMoreModule?.isAutoLoadMore = true 97 videoCourseAdapter?.loadMoreModule?.isAutoLoadMore = true
126 videoCourseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false 98 videoCourseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
127 } 99 }
128 -  
129 - @Subscribe(threadMode = ThreadMode.MAIN)  
130 - fun onMessageEvent(event: GetWorkTypeEvent?) { /* Do something */  
131 - val id = event?.id  
132 - val name = event?.name  
133 - id?.let { mViewModel.videoLessons(1, "", it, page, 10) }  
134 - name?.let { binding.toolBar.setRightText(it) }  
135 - }  
136 -  
137 - override fun onStart() {  
138 - super.onStart()  
139 - EventBus.getDefault().register(this)  
140 - }  
141 -  
142 - override fun onStop() {  
143 - super.onStop()  
144 - EventBus.getDefault().unregister(this)  
145 - }  
146 } 100 }
1 -package com.br_technology.securitytrain_master.ui.view.home.activity  
2 -  
3 -import androidx.fragment.app.FragmentPagerAdapter  
4 -import com.br_technology.securitytrain_master.base.view.BasePagerAdapter  
5 -import com.br_technology.securitytrain_master.databinding.ActivityOnlineDetailBinding  
6 -import com.br_technology.securitytrain_master.ext.ConstantParamKey.CLASS_ID  
7 -import com.br_technology.securitytrain_master.ext.ConstantParamKey.LESSON_ID  
8 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean  
9 -import com.br_technology.securitytrain_master.ui.view.home.fragment.CourseListFragment  
10 -import com.br_technology.securitytrain_master.ui.view.home.fragment.OnlineDetailFragment  
11 -import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineDetailViewModel  
12 -import com.bumptech.glide.Glide  
13 -import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity  
14 -  
15 -  
16 -/**  
17 - * Time: 7/30/2021 13:56  
18 - * Author: Captain  
19 - * Description: 初见时你很迷人  
20 - */  
21 -class OnlineDetailActivity  
22 - : BaseLifeCycleActivity<OnlineDetailViewModel, ActivityOnlineDetailBinding>(  
23 - ActivityOnlineDetailBinding::inflate  
24 -) {  
25 - private var dataBean: VideoLessonDetailBean? = null  
26 - private var searchResultAdapter: BasePagerAdapter? = null  
27 - override fun initDataObserver() {  
28 - mViewModel.mVideoLessonDetailBean.observe(this, {  
29 - binding.apply {  
30 -// videoPlayer.initVideoBuilderMode(  
31 -// it.data.detail.image,  
32 -//// it.data.detail.classX[0].lessonclassdetail[0].video_url  
33 -// "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4",  
34 -// this@OnlineDetailActivity,  
35 -// lifecycle  
36 -// )  
37 -// videoPlayer.titleTextView.visibility = View.GONE  
38 -// videoPlayer.backButton.visibility = View.GONE  
39 - dataBean = it.data  
40 - Glide.with(this@OnlineDetailActivity).load(it.data.detail.image).into(ivTop)  
41 -  
42 - searchResultAdapter = BasePagerAdapter(  
43 - supportFragmentManager,  
44 - FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT  
45 - )  
46 - val list =  
47 - mutableListOf(  
48 - OnlineDetailFragment().newInstance(dataBean!!),  
49 - CourseListFragment().newInstance(dataBean!!)  
50 - )  
51 - val titles = listOf("课程详情", "课程列表")  
52 - searchResultAdapter?.addData(list.toMutableList())  
53 - searchResultAdapter?.addTitle(titles)  
54 - viewPager.adapter = searchResultAdapter  
55 - tabLayout.setupWithViewPager(viewPager)  
56 - }  
57 - })  
58 - }  
59 -  
60 - var mClassId: String? = null  
61 -  
62 - override fun initData() {  
63 - super.initData()  
64 - dataBean = VideoLessonDetailBean()  
65 - val lessonId = intent.getIntExtra(LESSON_ID, 0)  
66 - mClassId = intent.getStringExtra(CLASS_ID)  
67 - mViewModel.videoLessonsDetail(lessonId)  
68 - binding.apply {  
69 -  
70 -  
71 - }  
72 -  
73 - }  
74 -  
75 -  
76 -// override fun onBackPressed() {  
77 -// binding.videoPlayer.onBackPressed()  
78 -// if (GSYVideoManager.backFromWindowFull(this)) {  
79 -// return  
80 -// }  
81 -// super.onBackPressed()  
82 -// }  
83 -//  
84 -// override fun onConfigurationChanged(newConfig: Configuration) {  
85 -// super.onConfigurationChanged(newConfig)  
86 -// //如果旋转了就全屏  
87 -// binding.videoPlayer.onConfigurationChanged(newConfig, this)  
88 -// }  
89 -  
90 -}  
@@ -4,6 +4,7 @@ import android.content.Intent @@ -4,6 +4,7 @@ import android.content.Intent
4 import androidx.recyclerview.widget.LinearLayoutManager 4 import androidx.recyclerview.widget.LinearLayoutManager
5 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
6 import com.br_technology.securitytrain_master.databinding.ActivityTextCourseBinding 6 import com.br_technology.securitytrain_master.databinding.ActivityTextCourseBinding
  7 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
7 import com.br_technology.securitytrain_master.ui.view.home.adapter.TextLessonsAdapter 8 import com.br_technology.securitytrain_master.ui.view.home.adapter.TextLessonsAdapter
8 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean 9 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean
9 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextCourseViewModel 10 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextCourseViewModel
1 -package com.br_technology.securitytrain_master.ui.view.home.activity  
2 -  
3 -import android.os.Bundle  
4 -import com.br_technology.securitytrain_master.databinding.ActivityTextDetailBinding  
5 -import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextDetailViewModel  
6 -import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity  
7 -  
8 -/**  
9 - * createTime:2021/7/29 17:50  
10 - * auth:张继  
11 - * des:H  
12 - */  
13 -class TextDetailActivity:BaseLifeCycleActivity<TextDetailViewModel,ActivityTextDetailBinding>(ActivityTextDetailBinding::inflate) {  
14 - override fun initData() {  
15 - super.initData()  
16 - val id = intent.getIntExtra("id",0)  
17 - mViewModel.textLessonsDetail(id)  
18 - binding.apply{  
19 -  
20 - }  
21 - }  
22 - override fun initDataObserver() {  
23 - mViewModel.mTextLessonDetailBean.observe(this,{  
24 - binding.content.loadData(it.data.detail.content)  
25 - binding.tvTitle.text = it.data.detail.name  
26 - })  
27 - }  
28 -}  
  1 +package com.br_technology.securitytrain_master.ui.view.home.activity.course
  2 +
  3 +import androidx.fragment.app.FragmentPagerAdapter
  4 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey
  5 +import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
  6 +import com.br_technology.securitytrain_master.databinding.ActivityOnlineDetailBinding
  7 +import com.br_technology.securitytrain_master.ui.bean.CourseParam
  8 +import com.br_technology.securitytrain_master.ui.bean.LessonOfflineDetail
  9 +import com.br_technology.securitytrain_master.ui.bean.LessonVideoDetail
  10 +import com.br_technology.securitytrain_master.ui.view.home.fragment.CourseListFragment
  11 +import com.br_technology.securitytrain_master.ui.view.home.fragment.OnlineDetailFragment
  12 +import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseDetailViewModel
  13 +import com.bumptech.glide.Glide
  14 +import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
  15 +
  16 +
  17 +/**
  18 + * Time: 7/30/2021 13:56
  19 + * Author: Captain
  20 + * Description: 初见时你很迷人
  21 + */
  22 +class CourseDetailActivity
  23 + : BaseLifeCycleActivity<CourseDetailViewModel, ActivityOnlineDetailBinding>(
  24 + ActivityOnlineDetailBinding::inflate
  25 +) {
  26 + private var searchResultAdapter: BasePagerAdapter? = null
  27 + private var courseBean: CourseParam? = null
  28 +
  29 +
  30 + override fun initDataObserver() {
  31 + mViewModel.mVideoLesson.observe(this, {
  32 + binding.apply {
  33 + Glide.with(this@CourseDetailActivity).load(it.data.detail.image).into(ivTop)
  34 + searchResultAdapter = BasePagerAdapter(
  35 + supportFragmentManager,
  36 + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
  37 + )
  38 + val list =
  39 + mutableListOf(
  40 + OnlineDetailFragment<String>().newInstance(it.data.detail.content),
  41 + CourseListFragment<LessonVideoDetail>().newInstance(it.data.detail)
  42 + )
  43 + val titles = listOf("课程详情", "课程列表")
  44 + searchResultAdapter?.addData(list.toMutableList())
  45 + searchResultAdapter?.addTitle(titles)
  46 + viewPager.adapter = searchResultAdapter
  47 + tabLayout.setupWithViewPager(viewPager)
  48 + }
  49 + })
  50 +
  51 + mViewModel.mVideoLessonNormal.observe(this, {
  52 + binding.apply {
  53 + Glide.with(this@CourseDetailActivity).load(it.data.detail.video).into(ivTop)
  54 + searchResultAdapter = BasePagerAdapter(
  55 + supportFragmentManager,
  56 + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
  57 + )
  58 + val list =
  59 + mutableListOf(
  60 + OnlineDetailFragment<String>().newInstance(it.data.detail.name)
  61 + )
  62 + val titles = listOf("课程详情")
  63 + searchResultAdapter?.addData(list.toMutableList())
  64 + searchResultAdapter?.addTitle(titles)
  65 + viewPager.adapter = searchResultAdapter
  66 + tabLayout.setupWithViewPager(viewPager)
  67 + }
  68 + })
  69 +
  70 + mViewModel.mLiveLesson.observe(this, {
  71 + binding.apply {
  72 + Glide.with(this@CourseDetailActivity).load(it.data.image).into(ivTop)
  73 + searchResultAdapter = BasePagerAdapter(
  74 + supportFragmentManager,
  75 + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
  76 + )
  77 + val list =
  78 + mutableListOf(
  79 + OnlineDetailFragment<String>().newInstance(it.data.name)
  80 + )
  81 + val titles = listOf("课程详情")
  82 + searchResultAdapter?.addData(list.toMutableList())
  83 + searchResultAdapter?.addTitle(titles)
  84 + viewPager.adapter = searchResultAdapter
  85 + tabLayout.setupWithViewPager(viewPager)
  86 + }
  87 + })
  88 +
  89 + mViewModel.mLessonOff.observe(this, {
  90 + binding.apply {
  91 +// Glide.with(this@CourseDetailActivity).load(it.data.detail.).into(ivTop)
  92 + searchResultAdapter = BasePagerAdapter(
  93 + supportFragmentManager,
  94 + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
  95 + )
  96 + val list =
  97 + mutableListOf(
  98 + OnlineDetailFragment<String>().newInstance(it.data.detail.content),
  99 + CourseListFragment<LessonOfflineDetail>().newInstance(it.data.detail)
  100 + )
  101 + val titles = listOf("课程详情", "课程列表")
  102 + searchResultAdapter?.addData(list.toMutableList())
  103 + searchResultAdapter?.addTitle(titles)
  104 + viewPager.adapter = searchResultAdapter
  105 + tabLayout.setupWithViewPager(viewPager)
  106 + }
  107 + })
  108 +
  109 + }
  110 +
  111 + override fun initData() {
  112 + super.initData()
  113 + courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN)
  114 + courseBean?.let {
  115 + //1=视频课,2=直播课,3=线下培训课,4=文本课
  116 + when (it.type) {
  117 + 1 -> {
  118 + if (courseBean?.isTrainClass == true) {
  119 + mViewModel.videoLessonsDetail(it.mLessonId.toInt())
  120 + } else {
  121 + mViewModel.videoLessonNormal(it.mLessonId.toInt())
  122 + }
  123 + }
  124 + 2 -> {
  125 + mViewModel.liveLessonDetail(it.mLessonId.toInt())
  126 + }
  127 + 3 -> {
  128 + mViewModel.offLessonDetail(it.mLessonId.toInt())
  129 + }
  130 + }
  131 + }
  132 + }
  133 +}
  1 +package com.br_technology.securitytrain_master.ui.view.home.activity.course
  2 +
  3 +import android.Manifest
  4 +import android.util.Log
  5 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.CLASS_ID
  6 +import com.br_technology.securitytrain_master.base.view.BaseApplication
  7 +import com.br_technology.securitytrain_master.databinding.ActivityLocationSignBinding
  8 +import com.br_technology.securitytrain_master.ext.initPermissions
  9 +import com.br_technology.securitytrain_master.ui.view.home.viewmodel.LocationSignViewModel
  10 +import com.tencent.map.geolocation.TencentLocation
  11 +import com.tencent.map.geolocation.TencentLocationListener
  12 +import com.tencent.map.geolocation.TencentLocationManager
  13 +import com.tencent.map.geolocation.TencentLocationRequest
  14 +import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory
  15 +import com.tencent.tencentmap.mapsdk.maps.model.LatLng
  16 +import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
  17 +
  18 +
  19 +/**
  20 + * Author by YSir
  21 + * Date on 2022/1/16.
  22 + * description
  23 + * PS: Not easy to write code, please indicate.
  24 + */
  25 +class LocationSignActivity :
  26 + BaseLifeCycleActivity<LocationSignViewModel, ActivityLocationSignBinding>(
  27 + ActivityLocationSignBinding::inflate
  28 + ), TencentLocationListener {
  29 +
  30 + val mClassId: String? = null
  31 + var mLocation: TencentLocation? = null
  32 +
  33 + override fun initView() {
  34 + super.initView()
  35 + val cameraUpdate = CameraUpdateFactory.zoomTo(16f)
  36 + binding.apply {
  37 + mapView.map.moveCamera(cameraUpdate)
  38 + BaseApplication.instance.mLocationManager.coordinateType =
  39 + TencentLocationManager.COORDINATE_TYPE_GCJ02;
  40 + rvSign.setOnClickListener {
  41 + if (mLocation != null && mClassId != null) {
  42 + mViewModel.sign(mClassId, "${mLocation?.latitude}", "${mLocation?.longitude}")
  43 + }
  44 + }
  45 + }
  46 + }
  47 +
  48 + override fun initData() {
  49 + super.initData()
  50 + intent.getStringExtra(CLASS_ID)
  51 + }
  52 +
  53 + override fun onStart() {
  54 + binding.mapView.onStart()
  55 + super.onStart()
  56 + }
  57 +
  58 + override fun onPause() {
  59 + binding.mapView.onPause()
  60 + super.onPause()
  61 + stopLocation()
  62 + }
  63 +
  64 + override fun onResume() {
  65 + binding.mapView.onResume()
  66 + super.onResume()
  67 + initPermissions(
  68 + Manifest.permission.ACCESS_FINE_LOCATION,
  69 + Manifest.permission.ACCESS_COARSE_LOCATION,
  70 + onGranted = {
  71 + startLocation()
  72 + },
  73 + onDenied = {
  74 + showError("未授权定位,无法打卡.")
  75 + }, onDeniedNever = {
  76 + })
  77 +
  78 + }
  79 +
  80 + override fun onDestroy() {
  81 + binding.mapView.onDestroy()
  82 + super.onDestroy()
  83 + }
  84 +
  85 + override fun onStop() {
  86 + binding.mapView.onStop()
  87 + super.onStop()
  88 + }
  89 +
  90 + override fun initDataObserver() {
  91 + }
  92 +
  93 + private fun startLocation() {
  94 + val request = TencentLocationRequest.create().apply {
  95 + isAllowGPS = true
  96 + }
  97 + BaseApplication.instance.mLocationManager.requestLocationUpdates(request, this)
  98 + }
  99 +
  100 + private fun stopLocation() {
  101 + BaseApplication.instance.mLocationManager.removeUpdates(this)
  102 + }
  103 +
  104 + override fun onLocationChanged(p0: TencentLocation?, p1: Int, p2: String?) {
  105 + Log.e("location", p0.toString())
  106 + mLocation = p0
  107 + mLocation?.let {
  108 + val cameraUpdate = CameraUpdateFactory.newLatLng(LatLng(it.latitude, it.longitude))
  109 + binding.mapView.map.moveCamera(cameraUpdate)
  110 + }
  111 + }
  112 +
  113 + override fun onStatusUpdate(p0: String?, p1: Int, p2: String?) {
  114 + Log.e("location", "status" + "")
  115 + }
  116 +
  117 +}
  1 +package com.br_technology.securitytrain_master.ui.view.home.activity.course
  2 +
  3 +import android.content.Intent
  4 +import android.webkit.WebChromeClient
  5 +import android.webkit.WebResourceRequest
  6 +import android.webkit.WebView
  7 +import android.webkit.WebViewClient
  8 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey
  9 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN
  10 +import com.br_technology.securitytrain_master.databinding.ActivityTextDetailBinding
  11 +import com.br_technology.securitytrain_master.ui.bean.CourseParam
  12 +import com.br_technology.securitytrain_master.ui.view.common.FileReadActivity
  13 +import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextDetailViewModel
  14 +import com.br_technology.securitytrain_master.util.TrainFileUtil
  15 +import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
  16 +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
  17 +import io.reactivex.rxjava3.core.Observable
  18 +import io.reactivex.rxjava3.core.Observer
  19 +import io.reactivex.rxjava3.disposables.Disposable
  20 +import io.reactivex.rxjava3.schedulers.Schedulers
  21 +import java.util.concurrent.TimeUnit
  22 +
  23 +/**
  24 + * createTime:2021/7/29 17:50
  25 + * auth:张继
  26 + * des:H
  27 + */
  28 +class TextDetailActivity :
  29 + BaseLifeCycleActivity<TextDetailViewModel, ActivityTextDetailBinding>(ActivityTextDetailBinding::inflate) {
  30 + var mDisposable: Disposable? = null
  31 + var courseBean: CourseParam? = null
  32 +
  33 + override fun initData() {
  34 + super.initData()
  35 + courseBean = intent.getParcelableExtra(COURSE_BEAN)
  36 + courseBean?.let {
  37 + if (it.isTrainClass) {
  38 + mViewModel.textLessonsDetail(it.mLessonId.toInt())
  39 + } else {
  40 + mViewModel.materialDetail(it.mLessonId.toInt())
  41 + }
  42 + }
  43 + binding.apply {
  44 + content.webViewClient = object : WebViewClient() {
  45 + override fun shouldOverrideUrlLoading(
  46 + view: WebView?,
  47 + request: WebResourceRequest?
  48 + ): Boolean {
  49 + request?.url?.let { url ->
  50 + if (TrainFileUtil.isOffice(url.toString())) {
  51 + startActivity(
  52 + Intent(
  53 + this@TextDetailActivity,
  54 + FileReadActivity::class.java
  55 + ).putExtra(ConstantParamKey.COMMON_URL, url.toString())
  56 + )
  57 + return true
  58 + }
  59 + }
  60 + return false
  61 + }
  62 + }
  63 + content.webChromeClient = WebChromeClient()
  64 + }
  65 + }
  66 +
  67 + override fun initDataObserver() {
  68 + mViewModel.mTextLessonDetailBean.observe(this, {
  69 + binding.content.loadData(it.data.detail.content)
  70 + binding.tvTitle.text = it.data.detail.name
  71 + })
  72 + mViewModel.mDetailMaterialNormal.observe(this, {
  73 + binding.content.loadData(it.data.detail.content)
  74 + binding.tvTitle.text = it.data.detail.name
  75 + })
  76 + }
  77 +
  78 + fun downLoadTime() {
  79 + val timer = Observable.interval(60, TimeUnit.SECONDS)
  80 + timer.subscribeOn(Schedulers.io())
  81 + .observeOn(AndroidSchedulers.mainThread())
  82 + .subscribe(object : Observer<Long> {
  83 + override fun onSubscribe(d: Disposable?) {
  84 + mDisposable = d
  85 + }
  86 +
  87 + override fun onNext(t: Long?) {
  88 + }
  89 +
  90 + override fun onError(e: Throwable?) {
  91 + }
  92 +
  93 + override fun onComplete() {
  94 + }
  95 + })
  96 + }
  97 +}
  98 +
1 -package com.br_technology.securitytrain_master.ui.view.home.activity 1 +package com.br_technology.securitytrain_master.ui.view.home.activity.course
2 2
3 -import android.content.res.Configuration  
4 -import android.view.View  
5 import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding 3 import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding
6 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.VideoDetailViewModel 4 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.VideoDetailViewModel
7 import com.shuyu.gsyvideoplayer.GSYVideoManager 5 import com.shuyu.gsyvideoplayer.GSYVideoManager
@@ -3,16 +3,12 @@ package com.br_technology.securitytrain_master.ui.view.home.adapter @@ -3,16 +3,12 @@ package com.br_technology.securitytrain_master.ui.view.home.adapter
3 import android.content.Intent 3 import android.content.Intent
4 import android.view.View 4 import android.view.View
5 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
6 -import com.br_technology.securitytrain_master.ui.view.home.activity.VideoDetailActivity  
7 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoCourseListFirstNode  
8 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoCourseListSecondNode 6 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.VideoDetailActivity
9 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean 7 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean
10 import com.br_technology.securitytrain_master.util.TimeFenMUtils 8 import com.br_technology.securitytrain_master.util.TimeFenMUtils
11 -import com.br_technology.securitytrain_master.util.ToolsUtil  
12 import com.chad.library.adapter.base.entity.node.BaseNode 9 import com.chad.library.adapter.base.entity.node.BaseNode
13 import com.chad.library.adapter.base.provider.BaseNodeProvider 10 import com.chad.library.adapter.base.provider.BaseNodeProvider
14 import com.chad.library.adapter.base.viewholder.BaseViewHolder 11 import com.chad.library.adapter.base.viewholder.BaseViewHolder
15 -import java.math.BigDecimal  
16 12
17 /** 13 /**
18 * Time: 12/8/2021 11:15 14 * Time: 12/8/2021 11:15
@@ -3,22 +3,20 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment @@ -3,22 +3,20 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment
3 import android.os.Bundle 3 import android.os.Bundle
4 import com.br_technology.securitytrain_master.databinding.FragmentCourseListBinding 4 import com.br_technology.securitytrain_master.databinding.FragmentCourseListBinding
5 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseListTreeAdapter 5 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseListTreeAdapter
6 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoCourseListFirstNode  
7 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoCourseListSecondNode  
8 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean 6 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean
9 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseListViewModel 7 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseListViewModel
10 -import com.chad.library.adapter.base.entity.node.BaseNode  
11 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment 8 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
  9 +import java.io.Serializable
12 10
13 /** 11 /**
14 * Time: 7/30/2021 16:08 12 * Time: 7/30/2021 16:08
15 * Author: Captain 13 * Author: Captain
16 * Description: 初见时你很迷人 14 * Description: 初见时你很迷人
17 */ 15 */
18 -class CourseListFragment 16 +class CourseListFragment<T : Serializable>
19 : 17 :
20 BaseLifeCycleFragment<CourseListViewModel, FragmentCourseListBinding>(FragmentCourseListBinding::inflate) { 18 BaseLifeCycleFragment<CourseListViewModel, FragmentCourseListBinding>(FragmentCourseListBinding::inflate) {
21 - private var dataBean: VideoLessonDetailBean? = null 19 + private var dataBean: Serializable? = null
22 override fun initDataObserver() { 20 override fun initDataObserver() {
23 21
24 } 22 }
@@ -27,11 +25,11 @@ class CourseListFragment @@ -27,11 +25,11 @@ class CourseListFragment
27 super.initData() 25 super.initData()
28 dataBean = VideoLessonDetailBean() 26 dataBean = VideoLessonDetailBean()
29 if (arguments != null) { 27 if (arguments != null) {
30 - dataBean = arguments?.getSerializable("dataBean") as VideoLessonDetailBean? 28 + dataBean = arguments?.getSerializable("dataBean")
31 binding.apply { 29 binding.apply {
32 val videoCourseListTreeAdapter = VideoCourseListTreeAdapter() 30 val videoCourseListTreeAdapter = VideoCourseListTreeAdapter()
33 - recyclerview.adapter = videoCourseListTreeAdapter  
34 - videoCourseListTreeAdapter.setList(getEntity()) 31 +// recyclerview.adapter = videoCourseListTreeAdapter
  32 +// videoCourseListTreeAdapter.setList(getEntity())
35 33
36 // val seNode = VideoCourseListSecondNode(ArrayList<BaseNode>(), "Second Node(This is added)") 34 // val seNode = VideoCourseListSecondNode(ArrayList<BaseNode>(), "Second Node(This is added)")
37 // val seNode2 = VideoCourseListSecondNode(ArrayList<BaseNode>(), "Second Node(This is added)") 35 // val seNode2 = VideoCourseListSecondNode(ArrayList<BaseNode>(), "Second Node(This is added)")
@@ -46,30 +44,30 @@ class CourseListFragment @@ -46,30 +44,30 @@ class CourseListFragment
46 44
47 } 45 }
48 46
49 - fun newInstance(dataBean: VideoLessonDetailBean): CourseListFragment { 47 + fun newInstance(dataBean: Serializable): CourseListFragment<Serializable> {
50 val args = Bundle() 48 val args = Bundle()
51 args.putSerializable("dataBean", dataBean) 49 args.putSerializable("dataBean", dataBean)
52 - val fragment = CourseListFragment() 50 + val fragment = CourseListFragment<Serializable>()
53 fragment.arguments = args 51 fragment.arguments = args
54 return fragment 52 return fragment
55 } 53 }
56 54
57 - private fun getEntity(): List<BaseNode> {  
58 - val classBeanList = dataBean?.detail?.classX  
59 - val list: MutableList<BaseNode> = ArrayList()  
60 -  
61 - for (i in classBeanList?.indices!!) {  
62 - val classBean = dataBean!!.detail.classX[i]  
63 - classBean.isExpanded = true  
64 - for (n in classBean.lessonclassdetail.indices) {  
65 - val lessonBean = classBean.lessonclassdetail[n]  
66 - lessonBean.isExpanded = true  
67 - classBean.addChildNode(lessonBean)  
68 - }  
69 - // 模拟 默认第0个是展开的  
70 - list.add(classBean)  
71 - }  
72 - return list  
73 - } 55 +// private fun getEntity(): List<BaseNode> {
  56 +// val classBeanList = dataBean?.detail?.classX
  57 +// val list: MutableList<BaseNode> = ArrayList()
  58 +//
  59 +// for (i in classBeanList?.indices!!) {
  60 +// val classBean = dataBean!!.detail.classX[i]
  61 +// classBean.isExpanded = true
  62 +// for (n in classBean.lessonclassdetail.indices) {
  63 +// val lessonBean = classBean.lessonclassdetail[n]
  64 +// lessonBean.isExpanded = true
  65 +// classBean.addChildNode(lessonBean)
  66 +// }
  67 +// // 模拟 默认第0个是展开的
  68 +// list.add(classBean)
  69 +// }
  70 +// return list
  71 +// }
74 72
75 } 73 }
@@ -3,13 +3,21 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment @@ -3,13 +3,21 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment
3 import android.content.Intent 3 import android.content.Intent
4 import android.view.View 4 import android.view.View
5 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
  6 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey
6 import com.br_technology.securitytrain_master.databinding.FragmentHomeBinding 7 import com.br_technology.securitytrain_master.databinding.FragmentHomeBinding
7 import com.br_technology.securitytrain_master.expand.addItemDecoration2 8 import com.br_technology.securitytrain_master.expand.addItemDecoration2
  9 +import com.br_technology.securitytrain_master.ui.bean.CourseParam
8 import com.br_technology.securitytrain_master.ui.view.home.activity.* 10 import com.br_technology.securitytrain_master.ui.view.home.activity.*
  11 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
  12 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
9 import com.br_technology.securitytrain_master.ui.view.home.adapter.RecommendDataAdapter 13 import com.br_technology.securitytrain_master.ui.view.home.adapter.RecommendDataAdapter
10 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter 14 import com.br_technology.securitytrain_master.ui.view.home.adapter.VideoCourseAdapter
11 -import com.br_technology.securitytrain_master.ui.view.home.bean.* 15 +import com.br_technology.securitytrain_master.ui.view.home.bean.BannerBean
  16 +import com.br_technology.securitytrain_master.ui.view.home.bean.NoticeBean
  17 +import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendBean
  18 +import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
12 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.HomeViewModel 19 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.HomeViewModel
  20 +import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
13 import com.bumptech.glide.Glide 21 import com.bumptech.glide.Glide
14 import com.bumptech.glide.load.resource.bitmap.RoundedCorners 22 import com.bumptech.glide.load.resource.bitmap.RoundedCorners
15 import com.bumptech.glide.request.RequestOptions 23 import com.bumptech.glide.request.RequestOptions
@@ -49,7 +57,7 @@ class HomeFragment : @@ -49,7 +57,7 @@ class HomeFragment :
49 mViewModel.mVideoLessonBean.observe(this, { 57 mViewModel.mVideoLessonBean.observe(this, {
50 videoLessonList?.clear() 58 videoLessonList?.clear()
51 videoLessonList?.addAll(it.data.list.data) 59 videoLessonList?.addAll(it.data.list.data)
52 - videoLessonList?.let { it1 -> videoCourseAdapter?.setList(it1)} 60 + videoLessonList?.let { it1 -> videoCourseAdapter?.setList(it1) }
53 }) 61 })
54 //获取推荐资料 62 //获取推荐资料
55 mViewModel.mRecommendBean.observe(this, { 63 mViewModel.mRecommendBean.observe(this, {
@@ -74,7 +82,7 @@ class HomeFragment : @@ -74,7 +82,7 @@ class HomeFragment :
74 //获取最新公告 82 //获取最新公告
75 mViewModel.getNotice() 83 mViewModel.getNotice()
76 //获取课程列表 84 //获取课程列表
77 - mViewModel.videoLessons(1,"", 0) 85 + mViewModel.videoLessons(1, "", 0)
78 //获取推荐资料 86 //获取推荐资料
79 mViewModel.getRecommend() 87 mViewModel.getRecommend()
80 88
@@ -125,30 +133,44 @@ class HomeFragment : @@ -125,30 +133,44 @@ class HomeFragment :
125 133
126 // 视频课程 134 // 视频课程
127 videoCourse.addItemDecoration2(2, 15, 24) 135 videoCourse.addItemDecoration2(2, 15, 24)
128 - videoCourseAdapter = VideoCourseAdapter(R.layout.adapter_video_course,videoLessonList) 136 + videoCourseAdapter = VideoCourseAdapter(R.layout.adapter_video_course, videoLessonList)
129 videoLessonList = mutableListOf() 137 videoLessonList = mutableListOf()
130 videoCourse.adapter = videoCourseAdapter 138 videoCourse.adapter = videoCourseAdapter
131 139
132 videoCourseAdapter?.setOnItemClickListener { _, _, position -> 140 videoCourseAdapter?.setOnItemClickListener { _, _, position ->
  141 + val course = CourseParam()
  142 + val data = videoLessonList!![position]
  143 + course.mLessonId = "${data.id}"
  144 + course.isTrainClass = false
  145 + course.type = data.type.toInt()
133 //视频详情 146 //视频详情
134 startActivity( 147 startActivity(
135 Intent( 148 Intent(
136 requireContext(), 149 requireContext(),
137 - OnlineDetailActivity::class.java  
138 - ).putExtra("id", videoLessonList!![position].id) 150 + CourseDetailActivity::class.java
  151 + ).putExtra(ConstantParamKey.COURSE_BEAN, course)
139 ) 152 )
140 } 153 }
141 -  
142 recommendDataAdapter = RecommendDataAdapter() 154 recommendDataAdapter = RecommendDataAdapter()
143 recommendList = mutableListOf() 155 recommendList = mutableListOf()
144 recommendedData.adapter = recommendDataAdapter 156 recommendedData.adapter = recommendDataAdapter
145 recommendDataAdapter?.addList(recommendList!!) 157 recommendDataAdapter?.addList(recommendList!!)
146 -  
147 -  
148 - 158 + recommendDataAdapter?.addListener(object : OnItemClickListener<RecommendBean.ListBean> {
  159 + override fun onClick(position: Int, data: RecommendBean.ListBean) {
  160 + val course = CourseParam()
  161 + course.mLessonId = "${data.id}"
  162 + course.isTrainClass = false
  163 + course.type = data.type.toInt()
  164 + //视频详情
  165 + startActivity(
  166 + Intent(
  167 + requireContext(),
  168 + TextDetailActivity::class.java
  169 + ).putExtra(ConstantParamKey.COURSE_BEAN, course)
  170 + )
  171 + }
  172 + })
149 } 173 }
150 -  
151 -  
152 } 174 }
153 175
154 override fun initImmersionBar() { 176 override fun initImmersionBar() {
@@ -2,9 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment @@ -2,9 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.home.fragment
2 2
3 import com.br_technology.securitytrain_master.R 3 import com.br_technology.securitytrain_master.R
4 import com.br_technology.securitytrain_master.databinding.FragmentOffLineCourseListBinding 4 import com.br_technology.securitytrain_master.databinding.FragmentOffLineCourseListBinding
  5 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.LocationSignActivity
5 import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse 6 import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse
6 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OffLineCourseListViewModel 7 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OffLineCourseListViewModel
7 -import com.br_technology.securitytrain_master.ui.view.mine.activity.SignInActivity  
8 import com.br_technology.securitytrain_master.ui.view.mine.adapter.OffLineCourseListAdapter 8 import com.br_technology.securitytrain_master.ui.view.mine.adapter.OffLineCourseListAdapter
9 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment 9 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
10 10
@@ -36,7 +36,7 @@ class OffLineCourseListFragment @@ -36,7 +36,7 @@ class OffLineCourseListFragment
36 offLineCourseListAdapter.addList(list) 36 offLineCourseListAdapter.addList(list)
37 37
38 tvSign.setOnClickListener { 38 tvSign.setOnClickListener {
39 - startActivity(SignInActivity::class.java) 39 + startActivity(LocationSignActivity::class.java)
40 } 40 }
41 } 41 }
42 } 42 }
1 package com.br_technology.securitytrain_master.ui.view.home.fragment 1 package com.br_technology.securitytrain_master.ui.view.home.fragment
2 2
3 -import android.content.Intent  
4 import android.os.Bundle 3 import android.os.Bundle
  4 +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_DES
5 import com.br_technology.securitytrain_master.databinding.FragmentOnlineDetailBinding 5 import com.br_technology.securitytrain_master.databinding.FragmentOnlineDetailBinding
6 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean 6 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean
7 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineDetailFragmentViewModel 7 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.OnlineDetailFragmentViewModel
@@ -12,36 +12,32 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment @@ -12,36 +12,32 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
12 * Author: Captain 12 * Author: Captain
13 * Description: 初见时你很迷人 13 * Description: 初见时你很迷人
14 */ 14 */
15 -class OnlineDetailFragment : 15 +class OnlineDetailFragment<String> :
16 BaseLifeCycleFragment<OnlineDetailFragmentViewModel, FragmentOnlineDetailBinding>( 16 BaseLifeCycleFragment<OnlineDetailFragmentViewModel, FragmentOnlineDetailBinding>(
17 FragmentOnlineDetailBinding::inflate 17 FragmentOnlineDetailBinding::inflate
18 ) { 18 ) {
19 private var dataBean: VideoLessonDetailBean? = null 19 private var dataBean: VideoLessonDetailBean? = null
20 20
21 override fun initDataObserver() { 21 override fun initDataObserver() {
22 -  
23 } 22 }
24 23
25 override fun initView() { 24 override fun initView() {
26 super.initView() 25 super.initView()
27 -  
28 } 26 }
29 27
30 - fun newInstance(dataBean: VideoLessonDetailBean): OnlineDetailFragment { 28 + fun newInstance(dataBean: String): OnlineDetailFragment<String> {
31 val args = Bundle() 29 val args = Bundle()
32 - args.putSerializable("dataBean", dataBean)  
33 - val fragment = OnlineDetailFragment() 30 + args.putString(COURSE_DES, dataBean.toString())
  31 + val fragment = OnlineDetailFragment<String>()
34 fragment.arguments = args 32 fragment.arguments = args
35 return fragment 33 return fragment
36 } 34 }
37 35
38 override fun initData() { 36 override fun initData() {
39 super.initData() 37 super.initData()
40 - dataBean = VideoLessonDetailBean()  
41 if (arguments != null) { 38 if (arguments != null) {
42 - dataBean = arguments?.getSerializable("dataBean") as VideoLessonDetailBean?  
43 - binding.apply {  
44 - dataBean?.detail?.let { webView.loadData(it.content) } 39 + arguments?.getString(COURSE_DES)?.let {
  40 + binding.webView.loadData(it)
45 } 41 }
46 } 42 }
47 43
1 -package com.br_technology.securitytrain_master.ui.view.home.repository  
2 -  
3 -import androidx.lifecycle.MutableLiveData  
4 -import com.br_technology.securitytrain_master.base.common.State  
5 -import com.br_technology.securitytrain_master.base.repository.ApiRepository  
6 -import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonDetailBean  
7 -import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver  
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers  
10 -import io.reactivex.rxjava3.schedulers.Schedulers  
11 -  
12 -/**  
13 - * createTime:2021/7/29 15:20  
14 - * auth:张继  
15 - * des:  
16 - */  
17 -class TextDetailRepository(val loadState: MutableLiveData<State>): ApiRepository(loadState) {  
18 - fun textLessonsDetail(  
19 - id: Int,  
20 - liveData: MutableLiveData<BaseResponse<TextLessonDetailBean>>  
21 - ) {  
22 - apiService.textLessonsDetail(id)  
23 - .subscribeOn(Schedulers.io())  
24 - .observeOn(AndroidSchedulers.mainThread())  
25 - .subscribe(  
26 - BaseObserver(  
27 - liveData,  
28 - loadState,  
29 - this  
30 - )  
31 - )  
32 -  
33 - }  
34 -}  
  1 +package com.br_technology.securitytrain_master.ui.view.home.viewmodel
  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.LessonRepository
  7 +import com.br_technology.securitytrain_master.base.view.BaseViewModel
  8 +import com.br_technology.securitytrain_master.ui.bean.LessonClassDetail
  9 +import com.br_technology.securitytrain_master.ui.bean.LessonLive
  10 +import com.br_technology.securitytrain_master.ui.bean.LessonOfflineDetail
  11 +import com.br_technology.securitytrain_master.ui.bean.LessonTrainVideoDetail
  12 +
  13 +/**
  14 + * Time: 7/30/2021 14:00
  15 + * Author: Captain
  16 + * Description: 初见时你很迷人
  17 + */
  18 +class CourseDetailViewModel : BaseViewModel<LessonRepository>() {
  19 + var mVideoLesson = MutableLiveData<BaseResponse<LessonTrainVideoDetail>>()
  20 + var mVideoLessonNormal = MutableLiveData<BaseResponse<CommonDetail<LessonClassDetail>>>()
  21 + var mLiveLesson = MutableLiveData<BaseResponse<LessonLive>>()
  22 + var mLessonOff = MutableLiveData<BaseResponse<CommonDetail<LessonOfflineDetail>>>()
  23 +
  24 + fun videoLessonsDetail(
  25 + id: Int
  26 + ) {
  27 + mRepository.lessonVideoDetail(id, mVideoLesson)
  28 + }
  29 +
  30 + fun videoLessonNormal(id: Int) {
  31 + mRepository.videoDetail(id, mVideoLessonNormal)
  32 + }
  33 +
  34 + fun liveLessonDetail(id: Int) {
  35 + mRepository.lessonLiveDetail(id, mLiveLesson)
  36 + }
  37 +
  38 + fun offLessonDetail(id: Int) {
  39 + mRepository.lessonOffDetail(id, mLessonOff)
  40 + }
  41 +}
  1 +package com.br_technology.securitytrain_master.ui.view.home.viewmodel
  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.repository.LessonRepository
  6 +import com.br_technology.securitytrain_master.base.view.BaseViewModel
  7 +
  8 +/**
  9 + * Author by YSir
  10 + * Date on 2022/1/16.
  11 + * description
  12 + * PS: Not easy to write code, please indicate.
  13 + */
  14 +class LocationSignViewModel : BaseViewModel<LessonRepository>() {
  15 + val liveData = MutableLiveData<BaseResponse<Void>>()
  16 +
  17 + fun sign(lessonId: String, lat: String, lng: String) {
  18 + mRepository.lessonOffSignup(lessonId, lat, lng, liveData)
  19 + }
  20 +}
1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.home.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.repository.LessonRepository
3 import com.br_technology.securitytrain_master.base.view.BaseViewModel 6 import com.br_technology.securitytrain_master.base.view.BaseViewModel
4 -import com.br_technology.securitytrain_master.ui.view.home.repository.OnlineDetailFragmentRepository 7 +import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean
5 8
6 /** 9 /**
7 * Time: 7/30/2021 14:14 10 * Time: 7/30/2021 14:14
8 * Author: Captain 11 * Author: Captain
9 * Description: 初见时你很迷人 12 * Description: 初见时你很迷人
10 */ 13 */
11 -class OnlineDetailFragmentViewModel : BaseViewModel<OnlineDetailFragmentRepository>() { 14 +class OnlineDetailFragmentViewModel : BaseViewModel<LessonRepository>() {
  15 + var mWorkTypeBean: MutableLiveData<BaseResponse<WorkTypeBean>> = MutableLiveData()
  16 + fun workType() {
  17 + mRepository.workType(mWorkTypeBean)
  18 + }
12 } 19 }
1 -package com.br_technology.securitytrain_master.ui.view.home.viewmodel  
2 -  
3 -import androidx.lifecycle.MutableLiveData  
4 -import com.br_technology.securitytrain_master.base.view.BaseViewModel  
5 -import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean  
6 -import com.br_technology.securitytrain_master.ui.view.home.repository.OnlineDetailRepository  
7 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
8 -  
9 -/**  
10 - * Time: 7/30/2021 14:00  
11 - * Author: Captain  
12 - * Description: 初见时你很迷人  
13 - */  
14 -class OnlineDetailViewModel : BaseViewModel<OnlineDetailRepository>() {  
15 - var mVideoLessonDetailBean: MutableLiveData<BaseResponse<VideoLessonDetailBean>> = MutableLiveData()  
16 - fun videoLessonsDetail(  
17 - id: Int,  
18 - ) {  
19 - mRepository.videoLessonsDetail(id,mVideoLessonDetailBean)  
20 - }  
21 -}  
1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean 6 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
6 -import com.br_technology.securitytrain_master.ui.view.home.bean.WorkTypeBean  
7 import com.br_technology.securitytrain_master.ui.view.home.repository.OnlineRepository 7 import com.br_technology.securitytrain_master.ui.view.home.repository.OnlineRepository
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse 8 +import com.br_technology.securitytrain_master.util.sp_job_id
9 9
10 /** 10 /**
11 * createTime:2021/7/27 15:48 11 * createTime:2021/7/27 15:48
12 * auth:张继 12 * auth:张继
13 * des: 13 * des:
14 */ 14 */
15 -class OnlineViewModel: BaseViewModel<OnlineRepository>() { 15 +class OnlineViewModel : BaseViewModel<OnlineRepository>() {
16 var mVideoLessonBean: MutableLiveData<BaseResponse<VideoLessonBean>> = MutableLiveData() 16 var mVideoLessonBean: MutableLiveData<BaseResponse<VideoLessonBean>> = MutableLiveData()
17 17
18 fun videoLessons( 18 fun videoLessons(
19 is_rec: Int, 19 is_rec: Int,
20 keyword: String, 20 keyword: String,
21 - pos_id: Int,  
22 - page: Int,  
23 - page_num: Int,  
24 - ) {  
25 - mRepository.videoLessons(is_rec,keyword,pos_id,page,page_num,mVideoLessonBean)  
26 - }  
27 - var mWorkTypeBean: MutableLiveData<BaseResponse<WorkTypeBean>> = MutableLiveData()  
28 - fun workType(  
29 - 21 + page: Int
30 ) { 22 ) {
31 - mRepository.workType(mWorkTypeBean) 23 + mRepository.videoLessons(is_rec, keyword, sp_job_id, page, 10, mVideoLessonBean)
32 } 24 }
33 } 25 }
1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 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.LessonRepository
4 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.MaterialDetail
5 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonDetailBean 9 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonDetailBean
6 -import com.br_technology.securitytrain_master.ui.view.home.repository.TextDetailRepository  
7 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
8 10
9 /** 11 /**
10 * createTime:2021/7/27 15:48 12 * createTime:2021/7/27 15:48
11 * auth:张继 13 * auth:张继
12 * des: 14 * des:
13 */ 15 */
14 -class TextDetailViewModel: BaseViewModel<TextDetailRepository>() {  
15 - var mTextLessonDetailBean: MutableLiveData<BaseResponse<TextLessonDetailBean>> = MutableLiveData() 16 +class TextDetailViewModel : BaseViewModel<LessonRepository>() {
  17 + var mTextLessonDetailBean = MutableLiveData<BaseResponse<TextLessonDetailBean>>()
  18 + var mDetailMaterialNormal = MutableLiveData<BaseResponse<CommonDetail<MaterialDetail>>>()
  19 +
  20 + var favoriteResponse = MutableLiveData<BaseResponse<Void>>()
  21 +
16 fun textLessonsDetail( 22 fun textLessonsDetail(
17 - id: Int, 23 + id: Int
  24 + ) {
  25 + mRepository.txtLessonDetail(id, mTextLessonDetailBean)
  26 + }
  27 +
  28 + fun materialDetail(id: Int) {
  29 + mRepository.materialDetail(id, mDetailMaterialNormal)
  30 + }
  31 +
  32 + fun favorite(
  33 + type: String,
  34 + favorite_id: String
18 ) { 35 ) {
19 - mRepository.textLessonsDetail(id,mTextLessonDetailBean) 36 + mRepository.favorite(type, favorite_id, favoriteResponse)
20 } 37 }
21 } 38 }
@@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.login.repository @@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.login.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 8 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
10 import io.reactivex.rxjava3.schedulers.Schedulers 9 import io.reactivex.rxjava3.schedulers.Schedulers
11 10
@@ -20,7 +19,7 @@ class ForgetPasswordRepository(val loadState: MutableLiveData<State>): ApiReposi @@ -20,7 +19,7 @@ class ForgetPasswordRepository(val loadState: MutableLiveData<State>): ApiReposi
20 captcha: String, 19 captcha: String,
21 newpassword: String, 20 newpassword: String,
22 confirmpassword: String, 21 confirmpassword: String,
23 - liveData: MutableLiveData<BaseResponse<CommonBean>> 22 + liveData: MutableLiveData<BaseResponse<Void>>
24 ) { 23 ) {
25 apiService.resetPwd(mobile, captcha,newpassword,confirmpassword) 24 apiService.resetPwd(mobile, captcha,newpassword,confirmpassword)
26 .subscribeOn(Schedulers.io()) 25 .subscribeOn(Schedulers.io())
@@ -38,7 +37,7 @@ class ForgetPasswordRepository(val loadState: MutableLiveData<State>): ApiReposi @@ -38,7 +37,7 @@ class ForgetPasswordRepository(val loadState: MutableLiveData<State>): ApiReposi
38 fun getVerifyCode( 37 fun getVerifyCode(
39 mobile: String, 38 mobile: String,
40 event: String, 39 event: String,
41 - liveData: MutableLiveData<BaseResponse<CommonBean>> 40 + liveData: MutableLiveData<BaseResponse<Void>>
42 ) { 41 ) {
43 apiService.getVerifyCode(mobile, event) 42 apiService.getVerifyCode(mobile, event)
44 .subscribeOn(Schedulers.io()) 43 .subscribeOn(Schedulers.io())
@@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.login.repository @@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.login.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean 7 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
8 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 8 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
9 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
10 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
11 import io.reactivex.rxjava3.schedulers.Schedulers 10 import io.reactivex.rxjava3.schedulers.Schedulers
12 11
@@ -19,7 +18,7 @@ class MobileLoginRepository(val loadState: MutableLiveData<State>): ApiRepositor @@ -19,7 +18,7 @@ class MobileLoginRepository(val loadState: MutableLiveData<State>): ApiRepositor
19 fun getVerifyCode( 18 fun getVerifyCode(
20 mobile: String, 19 mobile: String,
21 event: String, 20 event: String,
22 - liveData: MutableLiveData<BaseResponse<CommonBean>> 21 + liveData: MutableLiveData<BaseResponse<Void>>
23 ) { 22 ) {
24 apiService.getVerifyCode(mobile, event) 23 apiService.getVerifyCode(mobile, event)
25 .subscribeOn(Schedulers.io()) 24 .subscribeOn(Schedulers.io())
1 package com.br_technology.securitytrain_master.ui.view.login.viewmode 1 package com.br_technology.securitytrain_master.ui.view.login.viewmode
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
6 import com.br_technology.securitytrain_master.ui.view.login.repository.ForgetPasswordRepository 6 import com.br_technology.securitytrain_master.ui.view.login.repository.ForgetPasswordRepository
7 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
8 7
9 /** 8 /**
10 * createTime:2021/7/27 11:11 9 * createTime:2021/7/27 11:11
@@ -12,8 +11,8 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse @@ -12,8 +11,8 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
12 * des: 11 * des:
13 */ 12 */
14 class ForgetPasswordViewModel : BaseViewModel<ForgetPasswordRepository>() { 13 class ForgetPasswordViewModel : BaseViewModel<ForgetPasswordRepository>() {
15 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData()  
16 - var mCommonBeanresetPwd: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 14 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
  15 + var mCommonBeanresetPwd: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
17 16
18 fun getVerifyCode(mobile: String,event:String) { 17 fun getVerifyCode(mobile: String,event:String) {
19 mRepository.getVerifyCode(mobile, event,mCommonBean) 18 mRepository.getVerifyCode(mobile, event,mCommonBean)
1 package com.br_technology.securitytrain_master.ui.view.login.viewmode 1 package com.br_technology.securitytrain_master.ui.view.login.viewmode
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
6 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean 6 import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
7 import com.br_technology.securitytrain_master.ui.view.login.repository.MobileLoginRepository 7 import com.br_technology.securitytrain_master.ui.view.login.repository.MobileLoginRepository
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 8
10 /** 9 /**
11 * createTime:2021/7/27 14:44 10 * createTime:2021/7/27 14:44
@@ -13,7 +12,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse @@ -13,7 +12,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
13 * des: 12 * des:
14 */ 13 */
15 class MobileLoginViewModel: BaseViewModel<MobileLoginRepository>() { 14 class MobileLoginViewModel: BaseViewModel<MobileLoginRepository>() {
16 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 15 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
17 var mLoginWithVerifyCodeLoginBean: MutableLiveData<BaseResponse<LoginBean>> = MutableLiveData() 16 var mLoginWithVerifyCodeLoginBean: MutableLiveData<BaseResponse<LoginBean>> = MutableLiveData()
18 17
19 fun getVerifyCode(mobile: String,event:String) { 18 fun getVerifyCode(mobile: String,event:String) {
@@ -6,8 +6,8 @@ import androidx.fragment.app.FragmentPagerAdapter @@ -6,8 +6,8 @@ import androidx.fragment.app.FragmentPagerAdapter
6 import com.br_technology.securitytrain_master.databinding.ActivityMainBinding 6 import com.br_technology.securitytrain_master.databinding.ActivityMainBinding
7 import com.br_technology.securitytrain_master.ui.view.bank.fragment.BankFragment 7 import com.br_technology.securitytrain_master.ui.view.bank.fragment.BankFragment
8 import com.br_technology.securitytrain_master.ui.view.home.fragment.HomeFragment 8 import com.br_technology.securitytrain_master.ui.view.home.fragment.HomeFragment
9 -import com.br_technology.securitytrain_master.ui.view.mine.fragment.MineFragment  
10 import com.br_technology.securitytrain_master.ui.view.main.viewmodel.MainViewModel 9 import com.br_technology.securitytrain_master.ui.view.main.viewmodel.MainViewModel
  10 +import com.br_technology.securitytrain_master.ui.view.mine.fragment.MineFragment
11 import com.gyf.immersionbar.ImmersionBar 11 import com.gyf.immersionbar.ImmersionBar
12 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 12 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
13 13
@@ -25,6 +25,7 @@ class MainActivity : @@ -25,6 +25,7 @@ class MainActivity :
25 supportFragmentManager, 25 supportFragmentManager,
26 FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT 26 FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
27 ) 27 )
  28 +
28 binding.apply { 29 binding.apply {
29 viewPage.adapter = mainAdapter 30 viewPage.adapter = mainAdapter
30 mainAdapter.addData(list as List<Fragment>) 31 mainAdapter.addData(list as List<Fragment>)
@@ -4,11 +4,11 @@ import android.view.View @@ -4,11 +4,11 @@ import android.view.View
4 import androidx.core.content.ContextCompat 4 import androidx.core.content.ContextCompat
5 import androidx.fragment.app.FragmentPagerAdapter 5 import androidx.fragment.app.FragmentPagerAdapter
6 import com.br_technology.securitytrain_master.R 6 import com.br_technology.securitytrain_master.R
  7 +import com.br_technology.securitytrain_master.base.common.ConstantType.TYPE_CLASS_COURSE
  8 +import com.br_technology.securitytrain_master.base.common.ConstantType.TYPE_CLASS_EXAM
  9 +import com.br_technology.securitytrain_master.base.common.ConstantType.TYPE_CLASS_PRACTICE
7 import com.br_technology.securitytrain_master.base.view.BasePagerAdapter 10 import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
8 import com.br_technology.securitytrain_master.databinding.ActivityClassDutyBinding 11 import com.br_technology.securitytrain_master.databinding.ActivityClassDutyBinding
9 -import com.br_technology.securitytrain_master.ext.ConstantType.TYPE_CLASS_COURSE  
10 -import com.br_technology.securitytrain_master.ext.ConstantType.TYPE_CLASS_EXAM  
11 -import com.br_technology.securitytrain_master.ext.ConstantType.TYPE_CLASS_PRACTICE  
12 import com.br_technology.securitytrain_master.ui.view.mine.fragment.ClassDutyCourseFragment 12 import com.br_technology.securitytrain_master.ui.view.mine.fragment.ClassDutyCourseFragment
13 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyViewModel 13 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyViewModel
14 import com.br_technology.securitytrain_master.view.ClassifyPop 14 import com.br_technology.securitytrain_master.view.ClassifyPop
1 -package com.br_technology.securitytrain_master.ui.view.mine.activity  
2 -  
3 -import com.br_technology.securitytrain_master.databinding.ActivitySignInBinding  
4 -import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SignInViewModel  
5 -import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity  
6 -  
7 -/**  
8 - * Time: 8/3/2021 15:44  
9 - * Author: Captain  
10 - * Description: 初见时你很迷人  
11 - */  
12 -class SignInActivity :  
13 - BaseLifeCycleActivity<SignInViewModel, ActivitySignInBinding>(ActivitySignInBinding::inflate) {  
14 - override fun initDataObserver() {  
15 -  
16 - }  
17 -  
18 - override fun initData() {  
19 - super.initData()  
20 - binding.apply {  
21 -  
22 - }  
23 - }  
24 -}  
1 package com.br_technology.securitytrain_master.ui.view.mine.adapter 1 package com.br_technology.securitytrain_master.ui.view.mine.adapter
2 2
3 import android.annotation.SuppressLint 3 import android.annotation.SuppressLint
4 -import android.widget.TextView 4 +import android.content.Context
  5 +import android.view.LayoutInflater
  6 +import android.view.ViewGroup
5 import com.br_technology.securitytrain_master.R 7 import com.br_technology.securitytrain_master.R
  8 +import com.br_technology.securitytrain_master.base.view.BaseAdapter
  9 +import com.br_technology.securitytrain_master.databinding.ItemCourseBinding
6 import com.br_technology.securitytrain_master.ui.bean.LessonBean 10 import com.br_technology.securitytrain_master.ui.bean.LessonBean
7 import com.br_technology.securitytrain_master.util.CommonUtil 11 import com.br_technology.securitytrain_master.util.CommonUtil
8 import com.bumptech.glide.Glide 12 import com.bumptech.glide.Glide
9 -import com.chad.library.adapter.base.BaseMultiItemQuickAdapter  
10 -import com.chad.library.adapter.base.module.LoadMoreModule  
11 -import com.chad.library.adapter.base.viewholder.BaseViewHolder  
12 13
13 /** 14 /**
14 * Time: 8/3/2021 11:29 15 * Time: 8/3/2021 11:29
15 * Author: Captain 16 * Author: Captain
16 * Description: 初见时你很迷人 17 * Description: 初见时你很迷人
17 */ 18 */
18 -class CourseAdapter : BaseMultiItemQuickAdapter<LessonBean, BaseViewHolder>(), LoadMoreModule { 19 +class CourseAdapter : BaseAdapter<LessonBean, ItemCourseBinding>() {
19 20
20 - init {  
21 - addItemType(0, R.layout.item_course)  
22 - addItemType(1, R.layout.adapter_content_txt)  
23 - }  
24 -  
25 - var listener: IOnItemClick? = null  
26 -  
27 - interface IOnItemClick {  
28 - fun callback(type: Int, data: LessonBean)  
29 - }  
30 -  
31 - fun setItemListener(listener: IOnItemClick) {  
32 - this.listener = listener 21 + override fun getViewBinding(
  22 + context: Context,
  23 + parent: ViewGroup,
  24 + viewType: Int,
  25 + from: LayoutInflater
  26 + ): ItemCourseBinding {
  27 + return ItemCourseBinding.inflate(from, parent, false)
33 } 28 }
34 29
35 @SuppressLint("SetTextI18n") 30 @SuppressLint("SetTextI18n")
36 - override fun convert(holder: BaseViewHolder, item: LessonBean) {  
37 - when (getItemViewType(holder.layoutPosition)) {  
38 - 0 -> {  
39 - holder.apply {  
40 - itemView.findViewById<TextView>(R.id.tv_title).text =  
41 - CommonUtil.getTransStr(item.name)  
42 - itemView.findViewById<TextView>(R.id.tv_status).text = if (item.status == "0") {  
43 - "未完成"  
44 - } else {  
45 - "已完成"  
46 - }  
47 - itemView.findViewById<TextView>(R.id.tv_time).text =  
48 - CommonUtil.getTransStr(item.create_time_text)  
49 - itemView.findViewById<TextView>(R.id.tv_lesson).text = "${item.class_hours}学时"  
50 - Glide.with(itemView.context).load(item.image).error(R.mipmap.placeholder_head)  
51 - .into(itemView.findViewById(R.id.iv_pic))  
52 - }  
53 - }  
54 - 1 -> {  
55 - holder.apply {  
56 - itemView.findViewById<TextView>(R.id.name).text =  
57 - CommonUtil.getTransStr(item.name)  
58 - itemView.findViewById<TextView>(R.id.info).text =  
59 - CommonUtil.getTransStr(item.des)  
60 - Glide.with(itemView.context).load(item.image).error(R.mipmap.placeholder_head)  
61 - .into(itemView.findViewById(R.id.pic))  
62 - } 31 + override fun onBind(holder: ItemCourseBinding, position: Int, data: LessonBean) {
  32 + holder.apply {
  33 + holder.tvTitle.text = CommonUtil.getTransStr(data.name)
  34 + holder.tvStatus.text = if (data.status == "0") {
  35 + "未完成"
  36 + } else {
  37 + "已完成"
63 } 38 }
64 - else -> {  
65 - }  
66 - }  
67 - holder.itemView.setOnClickListener {  
68 - listener?.callback(getItemViewType(holder.layoutPosition), item) 39 + holder.tvTime.text = CommonUtil.getTransStr(data.create_time_text)
  40 + holder.tvLesson.text = "${data.class_hours}学时"
  41 + Glide.with(holder.root).load(data.image).error(R.mipmap.placeholder_head)
  42 + .into(holder.ivPic)
69 } 43 }
70 } 44 }
71 } 45 }
  1 +package com.br_technology.securitytrain_master.ui.view.mine.adapter
  2 +
  3 +import com.br_technology.securitytrain_master.R
  4 +import com.br_technology.securitytrain_master.ui.bean.TrainTestData
  5 +import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
  6 +import com.chad.library.adapter.base.viewholder.BaseViewHolder
  7 +
  8 +/**
  9 + * Author by YSir
  10 + * Date on 2022/1/17.
  11 + * description
  12 + * PS: Not easy to write code, please indicate.
  13 + */
  14 +class TrainTestAdapter : BaseMultiItemQuickAdapter<TrainTestData, BaseViewHolder>() {
  15 +
  16 + init {
  17 + addItemType(0, R.layout.item_mock_examnation)
  18 + addItemType(1, R.layout.item_special_exercises)
  19 + }
  20 +
  21 + override fun convert(holder: BaseViewHolder, item: TrainTestData) {
  22 + }
  23 +}
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 com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN
  5 +import com.br_technology.securitytrain_master.base.common.ConstantType
4 import com.br_technology.securitytrain_master.databinding.FragmentClassDutyCourseBinding 6 import com.br_technology.securitytrain_master.databinding.FragmentClassDutyCourseBinding
5 -import com.br_technology.securitytrain_master.ext.ConstantParamKey  
6 -import com.br_technology.securitytrain_master.ext.ConstantType 7 +import com.br_technology.securitytrain_master.ui.bean.CourseParam
7 import com.br_technology.securitytrain_master.ui.bean.LessonBean 8 import com.br_technology.securitytrain_master.ui.bean.LessonBean
8 -import com.br_technology.securitytrain_master.ui.view.home.activity.OnlineDetailActivity  
9 -import com.br_technology.securitytrain_master.ui.view.home.activity.TextDetailActivity 9 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.CourseDetailActivity
  10 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
10 import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter 11 import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter
11 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel 12 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel
  13 +import com.br_technology.securitytrain_master.util.TranslateUnit
  14 +import com.br_technology.securitytrain_master.view.VerticalDecoration
  15 +import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
12 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment 16 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
13 17
14 /** 18 /**
@@ -31,9 +35,9 @@ class ClassDutyCourseFragment(val type: Int) : @@ -31,9 +35,9 @@ class ClassDutyCourseFragment(val type: Int) :
31 val list = it.data.list 35 val list = it.data.list
32 if (list.isNotEmpty()) { 36 if (list.isNotEmpty()) {
33 if (page == 1) { 37 if (page == 1) {
34 - courseAdapter?.setList(list) 38 + courseAdapter?.addList(list)
35 } else { 39 } else {
36 - courseAdapter?.addData(list) 40 + courseAdapter?.addList(list)
37 } 41 }
38 } 42 }
39 binding.smartRefresh.setEnableLoadMore(list.size == 10) 43 binding.smartRefresh.setEnableLoadMore(list.size == 10)
@@ -60,6 +64,14 @@ class ClassDutyCourseFragment(val type: Int) : @@ -60,6 +64,14 @@ class ClassDutyCourseFragment(val type: Int) :
60 } 64 }
61 } 65 }
62 66
  67 + fun paramLessonBean(data: LessonBean): CourseParam {
  68 + val course = CourseParam()
  69 + course.mLessonId = "${data.id}"
  70 + course.isTrainClass = true
  71 + course.mTrainClassId = "${data.train_class_id}"
  72 + course.type = data.itemType
  73 + return course
  74 + }
63 75
64 override fun registerListener() { 76 override fun registerListener() {
65 binding.apply { 77 binding.apply {
@@ -70,27 +82,25 @@ class ClassDutyCourseFragment(val type: Int) : @@ -70,27 +82,25 @@ class ClassDutyCourseFragment(val type: Int) :
70 loadMore() 82 loadMore()
71 } 83 }
72 84
73 - courseAdapter?.setItemListener(object : CourseAdapter.IOnItemClick {  
74 - override fun callback(type: Int, data: LessonBean) {  
75 - when (type) {  
76 - 0 -> { 85 + courseAdapter?.addListener(object : OnItemClickListener<LessonBean> {
  86 + override fun onClick(position: Int, data: LessonBean) {
  87 + // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
  88 + val param = paramLessonBean(data)
  89 + when (data.itemType) {
  90 + 4 -> {
77 this@ClassDutyCourseFragment.startActivity( 91 this@ClassDutyCourseFragment.startActivity(
78 Intent( 92 Intent(
79 requireActivity(), 93 requireActivity(),
80 - OnlineDetailActivity::class.java  
81 - ).putExtra(ConstantParamKey.LESSON_ID, data.id).putExtra(  
82 - ConstantParamKey.CLASS_ID, data.class_id  
83 - ) 94 + TextDetailActivity::class.java
  95 + ).putExtra(COURSE_BEAN, param)
84 ) 96 )
85 } 97 }
86 - 1 -> { 98 + else -> {
87 this@ClassDutyCourseFragment.startActivity( 99 this@ClassDutyCourseFragment.startActivity(
88 Intent( 100 Intent(
89 requireActivity(), 101 requireActivity(),
90 - TextDetailActivity::class.java  
91 - ).putExtra(ConstantParamKey.LESSON_ID, data.id).putExtra(  
92 - ConstantParamKey.CLASS_ID, data.class_id  
93 - ) 102 + CourseDetailActivity::class.java
  103 + ).putExtra(COURSE_BEAN, param)
94 ) 104 )
95 } 105 }
96 } 106 }
@@ -114,9 +124,13 @@ class ClassDutyCourseFragment(val type: Int) : @@ -114,9 +124,13 @@ class ClassDutyCourseFragment(val type: Int) :
114 override fun initView() { 124 override fun initView() {
115 super.initView() 125 super.initView()
116 courseAdapter = CourseAdapter() 126 courseAdapter = CourseAdapter()
  127 + binding.recyclerview.addItemDecoration(
  128 + VerticalDecoration(
  129 + TranslateUnit.dp2px(context, 16f),
  130 + 0
  131 + )
  132 + )
117 binding.recyclerview.adapter = courseAdapter 133 binding.recyclerview.adapter = courseAdapter
118 - courseAdapter?.loadMoreModule?.isAutoLoadMore = true  
119 - courseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false  
120 } 134 }
121 135
122 override fun initData() { 136 override fun initData() {
@@ -2,12 +2,13 @@ package com.br_technology.securitytrain_master.ui.view.mine.fragment @@ -2,12 +2,13 @@ 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.View 4 import android.view.View
5 -import com.br_technology.securitytrain_master.util.token  
6 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
7 import com.br_technology.securitytrain_master.databinding.FragmentMineBinding 6 import com.br_technology.securitytrain_master.databinding.FragmentMineBinding
  7 +import com.br_technology.securitytrain_master.ui.view.home.activity.course.LocationSignActivity
8 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.MineViewModel 8 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.MineViewModel
9 import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity 9 import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity
10 import com.br_technology.securitytrain_master.ui.view.mine.activity.* 10 import com.br_technology.securitytrain_master.ui.view.mine.activity.*
  11 +import com.br_technology.securitytrain_master.util.token
11 import com.br_technology.securitytrain_master.view.DialogSureCancel 12 import com.br_technology.securitytrain_master.view.DialogSureCancel
12 import com.br_technology.securitytrain_master.view.listener.DialogListener 13 import com.br_technology.securitytrain_master.view.listener.DialogListener
13 import com.bumptech.glide.Glide 14 import com.bumptech.glide.Glide
@@ -92,7 +93,8 @@ class MineFragment @@ -92,7 +93,8 @@ class MineFragment
92 } 93 }
93 R.id.tv_academic_feedback -> { 94 R.id.tv_academic_feedback -> {
94 //学情反馈 95 //学情反馈
95 - startActivity(AcademicFeedbackActivity::class.java) 96 +// startActivity(AcademicFeedbackActivity::class.java)
  97 + startActivity(LocationSignActivity::class.java)
96 } 98 }
97 R.id.tv_offline_exercise -> { 99 R.id.tv_offline_exercise -> {
98 //线下培训 100 //线下培训
@@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository @@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 8 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
10 import io.reactivex.rxjava3.schedulers.Schedulers 9 import io.reactivex.rxjava3.schedulers.Schedulers
11 10
@@ -18,7 +17,7 @@ class ChangePhoneRepository(val loadState: MutableLiveData<State>) : ApiReposito @@ -18,7 +17,7 @@ class ChangePhoneRepository(val loadState: MutableLiveData<State>) : ApiReposito
18 fun changePhoneNumber( 17 fun changePhoneNumber(
19 mobile: String, 18 mobile: String,
20 captcha: String, 19 captcha: String,
21 - liveData: MutableLiveData<BaseResponse<CommonBean>> 20 + liveData: MutableLiveData<BaseResponse<Void>>
22 ) { 21 ) {
23 apiService.changePhoneNumber(mobile,captcha) 22 apiService.changePhoneNumber(mobile,captcha)
24 .subscribeOn(Schedulers.io()) 23 .subscribeOn(Schedulers.io())
@@ -36,7 +35,7 @@ class ChangePhoneRepository(val loadState: MutableLiveData<State>) : ApiReposito @@ -36,7 +35,7 @@ class ChangePhoneRepository(val loadState: MutableLiveData<State>) : ApiReposito
36 fun getVerifyCode( 35 fun getVerifyCode(
37 mobile: String, 36 mobile: String,
38 event: String, 37 event: String,
39 - liveData: MutableLiveData<BaseResponse<CommonBean>> 38 + liveData: MutableLiveData<BaseResponse<Void>>
40 ) { 39 ) {
41 apiService.getVerifyCode(mobile, event) 40 apiService.getVerifyCode(mobile, event)
42 .subscribeOn(Schedulers.io()) 41 .subscribeOn(Schedulers.io())
@@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository @@ -2,10 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.mine.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 7 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 8 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
10 import io.reactivex.rxjava3.schedulers.Schedulers 9 import io.reactivex.rxjava3.schedulers.Schedulers
11 10
@@ -21,7 +20,7 @@ class ChangePwdRepository(val loadState: MutableLiveData<State>) : ApiRepository @@ -21,7 +20,7 @@ class ChangePwdRepository(val loadState: MutableLiveData<State>) : ApiRepository
21 oldpassword: String, 20 oldpassword: String,
22 newpassword: String, 21 newpassword: String,
23 confirmpassword: String, 22 confirmpassword: String,
24 - liveData: MutableLiveData<BaseResponse<CommonBean>> 23 + liveData: MutableLiveData<BaseResponse<Void>>
25 ) { 24 ) {
26 apiService.changePwd(mobile, captcha,oldpassword,newpassword,confirmpassword) 25 apiService.changePwd(mobile, captcha,oldpassword,newpassword,confirmpassword)
27 .subscribeOn(Schedulers.io()) 26 .subscribeOn(Schedulers.io())
@@ -39,7 +38,7 @@ class ChangePwdRepository(val loadState: MutableLiveData<State>) : ApiRepository @@ -39,7 +38,7 @@ class ChangePwdRepository(val loadState: MutableLiveData<State>) : ApiRepository
39 fun getVerifyCode( 38 fun getVerifyCode(
40 mobile: String, 39 mobile: String,
41 event: String, 40 event: String,
42 - liveData: MutableLiveData<BaseResponse<CommonBean>> 41 + liveData: MutableLiveData<BaseResponse<Void>>
43 ) { 42 ) {
44 apiService.getVerifyCode(mobile, event) 43 apiService.getVerifyCode(mobile, event)
45 .subscribeOn(Schedulers.io()) 44 .subscribeOn(Schedulers.io())
@@ -2,12 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository @@ -2,12 +2,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
7 import com.br_technology.securitytrain_master.ui.bean.UploadFileData 7 import com.br_technology.securitytrain_master.ui.bean.UploadFileData
8 import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean 8 import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
9 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver 9 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
10 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
11 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 10 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
12 import io.reactivex.rxjava3.schedulers.Schedulers 11 import io.reactivex.rxjava3.schedulers.Schedulers
13 import okhttp3.MediaType 12 import okhttp3.MediaType
@@ -71,7 +70,7 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo @@ -71,7 +70,7 @@ class EditPersonalInfoRepository(val loadState: MutableLiveData<State>): ApiRepo
71 avatar: String, 70 avatar: String,
72 nickname: String, 71 nickname: String,
73 bio: String, 72 bio: String,
74 - liveData: MutableLiveData<BaseResponse<CommonBean>> 73 + liveData: MutableLiveData<BaseResponse<Void>>
75 ) { 74 ) {
76 apiService.changePersonalInfo(avatar,nickname,bio) 75 apiService.changePersonalInfo(avatar,nickname,bio)
77 .subscribeOn(Schedulers.io()) 76 .subscribeOn(Schedulers.io())
@@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.mine.repository @@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.mine.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
5 import com.br_technology.securitytrain_master.base.repository.ApiRepository 6 import com.br_technology.securitytrain_master.base.repository.ApiRepository
6 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
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.wjx.android.wanandroidmvvm.base.observer.BaseObserver 8 import com.wjx.android.wanandroidmvvm.base.observer.BaseObserver
9 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
10 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers 9 import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
11 import io.reactivex.rxjava3.schedulers.Schedulers 10 import io.reactivex.rxjava3.schedulers.Schedulers
12 11
@@ -33,7 +32,7 @@ class MineRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS @@ -33,7 +32,7 @@ class MineRepository(val loadState: MutableLiveData<State>): ApiRepository(loadS
33 } 32 }
34 33
35 fun logout( 34 fun logout(
36 - liveData: MutableLiveData<BaseResponse<CommonBean>> 35 + liveData: MutableLiveData<BaseResponse<Void>>
37 ) { 36 ) {
38 apiService.logout() 37 apiService.logout()
39 .subscribeOn(Schedulers.io()) 38 .subscribeOn(Schedulers.io())
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 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
6 import com.br_technology.securitytrain_master.ui.view.mine.repository.ChangePhoneRepository 6 import com.br_technology.securitytrain_master.ui.view.mine.repository.ChangePhoneRepository
7 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
8 7
9 /** 8 /**
10 * Time: 7/31/2021 15:32 9 * Time: 7/31/2021 15:32
@@ -12,13 +11,13 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse @@ -12,13 +11,13 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
12 * Description: 初见时你很迷人 11 * Description: 初见时你很迷人
13 */ 12 */
14 class ChangePhoneViewModel : BaseViewModel<ChangePhoneRepository>() { 13 class ChangePhoneViewModel : BaseViewModel<ChangePhoneRepository>() {
15 - var mCommonBeanChangePhoneNumber: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 14 + var mCommonBeanChangePhoneNumber: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
16 15
17 fun changePhoneNumber(mobile: String,captcha: String) { 16 fun changePhoneNumber(mobile: String,captcha: String) {
18 mRepository.changePhoneNumber(mobile, captcha,mCommonBeanChangePhoneNumber) 17 mRepository.changePhoneNumber(mobile, captcha,mCommonBeanChangePhoneNumber)
19 } 18 }
20 19
21 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 20 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
22 21
23 fun getVerifyCode(mobile: String,event:String) { 22 fun getVerifyCode(mobile: String,event:String) {
24 mRepository.getVerifyCode(mobile, event,mCommonBean) 23 mRepository.getVerifyCode(mobile, event,mCommonBean)
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 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
6 import com.br_technology.securitytrain_master.ui.view.mine.repository.ChangePwdRepository 6 import com.br_technology.securitytrain_master.ui.view.mine.repository.ChangePwdRepository
7 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
8 7
9 /** 8 /**
10 * Time: 7/31/2021 15:05 9 * Time: 7/31/2021 15:05
@@ -12,8 +11,8 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse @@ -12,8 +11,8 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse
12 * Description: 初见时你很迷人 11 * Description: 初见时你很迷人
13 */ 12 */
14 class ChangePwdViewModel : BaseViewModel<ChangePwdRepository>() { 13 class ChangePwdViewModel : BaseViewModel<ChangePwdRepository>() {
15 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData()  
16 - var mCommonBeanChangePwd: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 14 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
  15 + var mCommonBeanChangePwd: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
17 16
18 fun getVerifyCode(mobile: String,event:String) { 17 fun getVerifyCode(mobile: String,event:String) {
19 mRepository.getVerifyCode(mobile, event,mCommonBean) 18 mRepository.getVerifyCode(mobile, event,mCommonBean)
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 3 import androidx.lifecycle.MutableLiveData
4 -import com.br_technology.securitytrain_master.base.network.repository.TrainRepository 4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
  5 +import com.br_technology.securitytrain_master.base.network.response.CommonList
  6 +import com.br_technology.securitytrain_master.base.repository.TrainRepository
5 import com.br_technology.securitytrain_master.base.view.BaseViewModel 7 import com.br_technology.securitytrain_master.base.view.BaseViewModel
6 import com.br_technology.securitytrain_master.ui.bean.ExamBean 8 import com.br_technology.securitytrain_master.ui.bean.ExamBean
7 import com.br_technology.securitytrain_master.ui.bean.LessonList 9 import com.br_technology.securitytrain_master.ui.bean.LessonList
8 import com.br_technology.securitytrain_master.ui.bean.PractiseBean 10 import com.br_technology.securitytrain_master.ui.bean.PractiseBean
9 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
10 -import com.br_technology.securitytrain_master.base.network.response.CommonList  
11 11
12 /** 12 /**
13 * Time: 8/3/2021 11:25 13 * Time: 8/3/2021 11:25
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 com.br_technology.securitytrain_master.base.network.repository.TrainRepository 3 +import com.br_technology.securitytrain_master.base.repository.TrainRepository
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 4 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 5
6 /** 6 /**
@@ -2,7 +2,6 @@ package com.br_technology.securitytrain_master.ui.view.mine.viewmodel @@ -2,7 +2,6 @@ package com.br_technology.securitytrain_master.ui.view.mine.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 4 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
6 import com.br_technology.securitytrain_master.ui.bean.UploadFileData 5 import com.br_technology.securitytrain_master.ui.bean.UploadFileData
7 import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean 6 import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
8 import com.br_technology.securitytrain_master.ui.view.mine.repository.EditPersonalInfoRepository 7 import com.br_technology.securitytrain_master.ui.view.mine.repository.EditPersonalInfoRepository
@@ -26,7 +25,7 @@ class EditPersonalInfoViewModel : BaseViewModel<EditPersonalInfoRepository>() { @@ -26,7 +25,7 @@ class EditPersonalInfoViewModel : BaseViewModel<EditPersonalInfoRepository>() {
26 mRepository.getMineInfo( mMineInfoBean) 25 mRepository.getMineInfo( mMineInfoBean)
27 } 26 }
28 27
29 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 28 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
30 29
31 fun changePersonalInfo(avatar: String,nickname: String,bio: String) { 30 fun changePersonalInfo(avatar: String,nickname: String,bio: String) {
32 mRepository.changePersonalInfo(avatar, nickname,bio,mCommonBean) 31 mRepository.changePersonalInfo(avatar, nickname,bio,mCommonBean)
1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel 1 package com.br_technology.securitytrain_master.ui.view.home.viewmodel
2 2
3 import androidx.lifecycle.MutableLiveData 3 import androidx.lifecycle.MutableLiveData
  4 +import com.br_technology.securitytrain_master.base.network.response.BaseResponse
4 import com.br_technology.securitytrain_master.base.view.BaseViewModel 5 import com.br_technology.securitytrain_master.base.view.BaseViewModel
5 -import com.br_technology.securitytrain_master.ui.bean.CommonBean  
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.repository.MineRepository 7 import com.br_technology.securitytrain_master.ui.view.mine.repository.MineRepository
8 -import com.br_technology.securitytrain_master.base.network.response.BaseResponse  
9 8
10 /** 9 /**
11 * createTime:2021/7/27 15:48 10 * createTime:2021/7/27 15:48
@@ -19,7 +18,7 @@ class MineViewModel : BaseViewModel<MineRepository>() { @@ -19,7 +18,7 @@ class MineViewModel : BaseViewModel<MineRepository>() {
19 mRepository.getMineInfo(mMineInfoBean) 18 mRepository.getMineInfo(mMineInfoBean)
20 } 19 }
21 20
22 - var mCommonBean: MutableLiveData<BaseResponse<CommonBean>> = MutableLiveData() 21 + var mCommonBean: MutableLiveData<BaseResponse<Void>> = MutableLiveData()
23 22
24 fun logout() { 23 fun logout() {
25 mRepository.logout(mCommonBean) 24 mRepository.logout(mCommonBean)
1 -package com.br_technology.securitytrain_master.ui.view.mine.viewmodel  
2 -  
3 -import com.br_technology.securitytrain_master.base.view.BaseViewModel  
4 -import com.br_technology.securitytrain_master.ui.view.mine.repository.SignInRepository  
5 -  
6 -/**  
7 - * Time: 8/3/2021 15:45  
8 - * Author: Captain  
9 - * Description: 初见时你很迷人  
10 - */  
11 -class SignInViewModel : BaseViewModel<SignInRepository>() {  
12 -}  
  1 +package com.br_technology.securitytrain_master.util;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Context;
  5 +import android.content.res.Resources;
  6 +import android.graphics.Color;
  7 +import android.graphics.drawable.ColorDrawable;
  8 +import android.os.Build;
  9 +import android.util.DisplayMetrics;
  10 +import android.view.Display;
  11 +import android.view.View;
  12 +import android.view.ViewGroup;
  13 +import android.view.Window;
  14 +import android.view.WindowManager;
  15 +
  16 +import java.lang.reflect.Field;
  17 +import java.lang.reflect.Method;
  18 +
  19 +import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
  20 +import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
  21 +import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  22 +import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
  23 +import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
  24 +
  25 +public class SkinCompat {
  26 +
  27 + public interface JYSkinDelegate {
  28 +
  29 + boolean sbIsLight();
  30 + }
  31 +
  32 + /**
  33 + * 设置状态栏黑色字体图标,
  34 + * 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
  35 + *
  36 + * @return 1:MIUUI 2:Flyme 3:android6.0
  37 + */
  38 + public static int getStatusBarLightMode(Window window) {
  39 + int result = 0;
  40 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  41 + if (MIUISetStatusBarLightMode(window, true)) {
  42 + result = 1;
  43 + } else if (FlymeSetStatusBarLightMode(window, true)) {
  44 + result = 2;
  45 + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  46 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
  47 + result = 3;
  48 + } else {//5.0
  49 +
  50 + }
  51 + }
  52 + return result;
  53 + }
  54 +
  55 + /**
  56 + * 已知系统类型时,设置状态栏黑色字体图标。
  57 + * 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
  58 + */
  59 + public static void setStatusBarLightMode(Window window) {
  60 + int type = getStatusBarLightMode(window);
  61 + if (type == 1) {
  62 + MIUISetStatusBarLightMode(window, true);
  63 + } else if (type == 2) {
  64 + FlymeSetStatusBarLightMode(window, true);
  65 + } else if (type == 3) {
  66 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
  67 + } else {//5.0
  68 +
  69 + }
  70 + }
  71 +
  72 + /**
  73 + * 清除MIUI或flyme或6.0以上版本状态栏黑色字体
  74 + */
  75 + public static void StatusBarDarkMode(Window window) {
  76 + int type = getStatusBarLightMode(window);
  77 + if (type == 1) {
  78 + MIUISetStatusBarLightMode(window, false);
  79 + } else if (type == 2) {
  80 + FlymeSetStatusBarLightMode(window, false);
  81 + } else if (type == 3) {
  82 + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
  83 + }
  84 +
  85 + }
  86 +
  87 + /**
  88 + * 设置状态栏图标为深色和魅族特定的文字风格
  89 + * 可以用来判断是否为Flyme用户
  90 + *
  91 + * @param window 需要设置的窗口
  92 + * @param dark 是否把状态栏字体及图标颜色设置为深色
  93 + * @return boolean 成功执行返回true
  94 + */
  95 + public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
  96 + boolean result = false;
  97 + if (window != null) {
  98 + try {
  99 + WindowManager.LayoutParams lp = window.getAttributes();
  100 + Field darkFlag = WindowManager.LayoutParams.class
  101 + .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
  102 + Field meizuFlags = WindowManager.LayoutParams.class
  103 + .getDeclaredField("meizuFlags");
  104 + darkFlag.setAccessible(true);
  105 + meizuFlags.setAccessible(true);
  106 + int bit = darkFlag.getInt(null);
  107 + int value = meizuFlags.getInt(lp);
  108 + if (dark) {
  109 + value |= bit;
  110 + } else {
  111 + value &= ~bit;
  112 + }
  113 + meizuFlags.setInt(lp, value);
  114 + window.setAttributes(lp);
  115 + result = true;
  116 + } catch (Exception e) {
  117 + e.printStackTrace();
  118 + }
  119 + }
  120 + return result;
  121 + }
  122 +
  123 + /**
  124 + * 设置状态栏字体图标为深色,需要MIUIV6以上
  125 + *
  126 + * @param window 需要设置的窗口
  127 + * @param dark 是否把状态栏字体及图标颜色设置为深色
  128 + * @return boolean 成功执行返回true
  129 + */
  130 + public static boolean MIUISetStatusBarLightMode(Window window, boolean dark) {
  131 + boolean result = false;
  132 + if (window != null) {
  133 + Class clazz = window.getClass();
  134 + try {
  135 + int darkModeFlag = 0;
  136 + Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
  137 + Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
  138 + darkModeFlag = field.getInt(layoutParams);
  139 + Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
  140 + if (dark) {
  141 + extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
  142 + } else {
  143 + extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
  144 + }
  145 + result = true;
  146 + } catch (Exception e) {
  147 + e.printStackTrace();
  148 + }
  149 + }
  150 + return result;
  151 + }
  152 +
  153 + //SYSTEM_UI_FLAG_FULLSCREEN
  154 + public static void initFull(Activity activity) {
  155 + activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
  156 + }
  157 +
  158 + public static void initSystemUiVisibilityTrans(Activity activity, boolean backgroundIsLight) {
  159 + int version = Build.VERSION.SDK_INT;
  160 + int flags = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  161 + | SYSTEM_UI_FLAG_LAYOUT_STABLE
  162 + | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
  163 + if (version >= Build.VERSION_CODES.M) {
  164 + if (backgroundIsLight) {
  165 + flags |= SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  166 + } else {
  167 + flags &= ~SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  168 + }
  169 + activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
  170 + } else {
  171 + flags |= FLAG_TRANSLUCENT_STATUS;
  172 +// activity.getWindow().setStatusBarColor(Color.BLACK);
  173 + }
  174 + activity.getWindow().getDecorView().setSystemUiVisibility(flags);
  175 + activity.getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT);
  176 + activity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  177 + }
  178 +
  179 + public static void initSystemUiVisibility(Window window, boolean backgroundIsLight) {
  180 + int version = Build.VERSION.SDK_INT;
  181 + int flags = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  182 + | SYSTEM_UI_FLAG_LAYOUT_STABLE
  183 + | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
  184 + if (version >= Build.VERSION_CODES.M) {
  185 + if (backgroundIsLight) {
  186 + flags |= SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  187 + } else {
  188 + flags &= ~SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  189 + }
  190 + window.setStatusBarColor(Color.TRANSPARENT);
  191 + } else {
  192 + flags |= FLAG_TRANSLUCENT_STATUS;
  193 +// window.setStatusBarColor(Color.BLACK);
  194 + }
  195 + window.getDecorView().setSystemUiVisibility(flags);
  196 + }
  197 +
  198 +
  199 + public boolean hasNavigationBarFun(Activity activity) {
  200 + Resources rs = activity.getResources();
  201 + int id = rs.getIdentifier("config_showNavigationBar", "bool", "android");
  202 + boolean hasNavBarFun = false;
  203 + if (id > 0) {
  204 + hasNavBarFun = rs.getBoolean(id);
  205 + }
  206 + try {
  207 + Class systemPropertiesClass = Class.forName("android.os.SystemProperties");
  208 + Method m = systemPropertiesClass.getMethod("get", String.class);
  209 + String navBarOverride = (String) m.invoke(systemPropertiesClass, "qemu.hw.mainkeys");
  210 + if ("1".equals(navBarOverride)) {
  211 + hasNavBarFun = false;
  212 + } else if ("0".equals(navBarOverride)) {
  213 + hasNavBarFun = true;
  214 + }
  215 + } catch (Exception e) {
  216 + hasNavBarFun = false;
  217 + }
  218 + return hasNavBarFun;
  219 + }
  220 +
  221 + //navigationBar是否有显示
  222 + public boolean isNavigationBarShow(Activity activity) {
  223 + DisplayMetrics dm = new DisplayMetrics();
  224 + Display display = activity.getWindowManager().getDefaultDisplay();
  225 + display.getMetrics(dm);
  226 + int screenHeight = dm.heightPixels;
  227 +
  228 + DisplayMetrics realDisplayMetrics = new DisplayMetrics();
  229 +
  230 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
  231 + display.getRealMetrics(realDisplayMetrics);
  232 + } else {
  233 + Class c;
  234 + try {
  235 + c = Class.forName("android.view.Display");
  236 + Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
  237 + method.invoke(display, realDisplayMetrics);
  238 + } catch (Exception e) {
  239 + realDisplayMetrics.setToDefaults();
  240 + e.printStackTrace();
  241 + }
  242 + }
  243 +
  244 + int screenRealHeight = realDisplayMetrics.heightPixels;
  245 + return (screenRealHeight - screenHeight) > 0;
  246 + }
  247 +
  248 + //
  249 + public static void setTopPaddingStatus(View view) {
  250 + view.setPadding(0,getStatusBarHeight(view.getContext()),0,0);
  251 + }
  252 +
  253 + public static void setTopMarginStatus(View view) {
  254 + ((ViewGroup.MarginLayoutParams) view.getLayoutParams()).topMargin = getStatusBarHeight(view.getContext());
  255 + }
  256 +
  257 + public static int getStatusBarHeight(Context context) {
  258 + try {
  259 + //获得系统中的状态栏高度配置
  260 + int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
  261 + if (resourceId > 0) {
  262 + return context.getResources().getDimensionPixelSize(resourceId);
  263 + }
  264 + } catch (Exception e) {
  265 + e.printStackTrace();
  266 + }
  267 + return 0;
  268 + }
  269 +
  270 +}
  1 +package com.br_technology.securitytrain_master.util
  2 +
  3 +import android.os.Environment
  4 +import android.text.TextUtils
  5 +import com.br_technology.securitytrain_master.base.view.BaseApplication
  6 +import java.io.File
  7 +import java.io.FileOutputStream
  8 +import java.io.InputStream
  9 +import java.io.OutputStream
  10 +import java.net.HttpURLConnection
  11 +import java.net.URL
  12 +
  13 +/**
  14 + * Author by YSir
  15 + * Date on 2022/1/15.
  16 + * description
  17 + * PS: Not easy to write code, please indicate.
  18 + */
  19 +object TrainFileUtil {
  20 +
  21 + interface ILoad {
  22 + fun success(file: File)
  23 +
  24 + fun fail()
  25 +
  26 + fun progress(f: Float)
  27 + }
  28 +
  29 + private fun getTrainCacheDir(): File {
  30 + return BaseApplication.instance.cacheDir
  31 + }
  32 +
  33 + fun getTrainDocLoad(): File {
  34 + return File(getTrainCacheDir(), "trainLoad")
  35 + }
  36 +
  37 + fun getTrainExternalCacheDir(): File? {
  38 + // 判断sd卡是否存在
  39 + val sdCardExist = (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED)
  40 + if (sdCardExist) {
  41 + return BaseApplication.instance.externalCacheDir
  42 + } else {
  43 + throw SecurityException("confirm if you granted storage permissions.")
  44 + }
  45 + }
  46 +
  47 + /**
  48 + * 获取url的name
  49 + *
  50 + * @param url url
  51 + */
  52 + fun getTrainFileType(url: String): String {
  53 + if (TextUtils.isEmpty(url)) return ""
  54 + val str = url.split(".").toTypedArray()
  55 + return if (str.size > 1) {
  56 + str[str.size - 1]
  57 + } else ""
  58 + }
  59 +
  60 + fun isOffice(name: String): Boolean {
  61 + return name == "doc" || name == "docx" || name == "xls" || name == "xlsx" || name == "pdf" || name == "pptx"
  62 + }
  63 +
  64 + /**
  65 + * 获取文件名
  66 + */
  67 + fun getFileName(str: String): String {
  68 + if (TextUtils.isEmpty(str) || !str.contains("/")) {
  69 + return ""
  70 + }
  71 + return str.substring(str.lastIndexOf("/") + 1)
  72 + }
  73 +
  74 + fun fileLoad(file: File, fileUrl: String, iLoad: ILoad) {
  75 + val hasLoad = file.exists() && file.isFile
  76 + if (hasLoad) {
  77 + iLoad.success(file)
  78 + return
  79 + }
  80 + if (file.parentFile?.exists() != true) {
  81 + file.parentFile?.mkdirs()
  82 + }
  83 + var inputStream: InputStream? = null
  84 + var outputStream: OutputStream? = null
  85 + try {
  86 + val url = URL(fileUrl)
  87 + val conn = url.openConnection() as HttpURLConnection
  88 + conn.connectTimeout = 5000
  89 + // 得到输入流
  90 + inputStream = conn.inputStream
  91 + val total = conn.contentLength
  92 + var percent = 0f
  93 + outputStream = FileOutputStream(file)
  94 + val bytes = ByteArray(1024 * 1024 * 10)
  95 + var read = 0
  96 + var sum: Long = 0
  97 + while (inputStream.read(bytes).also { read = it } != -1) {
  98 + sum += read.toLong()
  99 + outputStream.write(bytes, 0, read)
  100 + val finalSum = sum
  101 + percent = finalSum * 100.0f / total
  102 + iLoad.progress(percent)
  103 + }
  104 + outputStream.flush()
  105 + iLoad.success(file)
  106 + } catch (e: Exception) {
  107 + e.printStackTrace()
  108 + iLoad.fail()
  109 + } finally {
  110 + inputStream?.close()
  111 + outputStream?.close()
  112 + iLoad.success(file)
  113 + }
  114 + }
  115 +
  116 +}
  1 +package com.br_technology.securitytrain_master.util;
  2 +
  3 +import android.content.Context;
  4 +import android.graphics.Bitmap;
  5 +import android.graphics.Canvas;
  6 +import android.graphics.Color;
  7 +import android.graphics.Paint;
  8 +import android.graphics.RectF;
  9 +import android.graphics.drawable.BitmapDrawable;
  10 +import android.graphics.drawable.Drawable;
  11 +import android.text.TextUtils;
  12 +import android.util.DisplayMetrics;
  13 +import android.view.WindowManager;
  14 +
  15 +import androidx.annotation.ColorRes;
  16 +
  17 +import java.util.Collection;
  18 +
  19 +/**
  20 + * 像素,dp.px互转
  21 + */
  22 +public class TranslateUnit {
  23 +
  24 + private static WindowManager windowManager;
  25 +
  26 + private static WindowManager getWindowManager(Context context) {
  27 + if (windowManager == null) {
  28 + windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  29 + }
  30 + return windowManager;
  31 + }
  32 +
  33 + public static float getDensity(Context context) {
  34 + return context.getResources().getDisplayMetrics().density;
  35 + }
  36 +
  37 + public static float getFontDensity(Context context) {
  38 + return context.getResources().getDisplayMetrics().scaledDensity;
  39 + }
  40 +
  41 + public static DisplayMetrics getDisplayMetrics(Context context) {
  42 + DisplayMetrics displayMetrics = new DisplayMetrics();
  43 + getWindowManager(context).getDefaultDisplay().getMetrics(displayMetrics);
  44 + return displayMetrics;
  45 + }
  46 +
  47 + public static int dp2px(Context context, float dp) {
  48 + return (int) (getDensity(context) * dp + 0.5f);
  49 + }
  50 +
  51 + public static int px2dp(Context context, float px) {
  52 + return (int) (px / getDensity(context) + 0.5f);
  53 + }
  54 +
  55 + public static int sp2px(Context context, float sp) {
  56 + return (int) (getFontDensity(context) * sp + 0.5f);
  57 + }
  58 +
  59 + public static int px2sp(Context context, float px) {
  60 + return (int) (px / getFontDensity(context) + 0.5f);
  61 + }
  62 +
  63 + public static int getWindowWidth(Context context) {
  64 + return getDisplayMetrics(context).widthPixels;
  65 + }
  66 +
  67 + public static int getWindowHeight(Context context) {
  68 + return getDisplayMetrics(context).heightPixels;
  69 + }
  70 +
  71 + public static String getPathFormat(String path) {
  72 + if (!TextUtils.isEmpty(path)) {
  73 + int lastPeriodIndex = path.lastIndexOf('.');
  74 + if (lastPeriodIndex > 0 && lastPeriodIndex + 1 < path.length()) {
  75 + String format = path.substring(lastPeriodIndex + 1);
  76 + if (!TextUtils.isEmpty(format)) {
  77 + return format.toLowerCase();
  78 + }
  79 + }
  80 + }
  81 + return "";
  82 + }
  83 +
  84 + public static boolean isGif(String url) {
  85 + return "gif".equals(getPathFormat(url));
  86 + }
  87 +
  88 + public static Bitmap getTextBitmap(Context context, int width, int height, int radius, String text, int textSize, @ColorRes int bgColor) {
  89 + radius = dp2px(context, radius);
  90 + Bitmap bitmap = Bitmap.createBitmap(dp2px(context, width), dp2px(context, height), Bitmap.Config.ARGB_8888);
  91 + Canvas canvas = new Canvas(bitmap);
  92 + RectF rect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
  93 + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  94 + paint.setColor(context.getResources().getColor(bgColor));
  95 + canvas.drawRoundRect(new RectF(0, 0, rect.width(), rect.height()), radius, radius, paint);
  96 + paint.setColor(Color.WHITE);
  97 + paint.setTextSize(dp2px(context, textSize));
  98 + paint.setTextAlign(Paint.Align.CENTER);
  99 + Paint.FontMetricsInt fontMetrics = paint.getFontMetricsInt();
  100 + float baseline = (rect.bottom + rect.top - fontMetrics.bottom - fontMetrics.top) / 2;
  101 + canvas.drawText(text, rect.centerX(), baseline, paint);
  102 + return bitmap;
  103 + }
  104 +
  105 + public static Drawable getTextDrawable(Context context, int width, int height, int radius, String text, int textSize, @ColorRes int bgColor) {
  106 + return new BitmapDrawable(getTextBitmap(context, width, height, radius, text, textSize, bgColor));
  107 + }
  108 +
  109 + public static boolean isEmpty(Collection<?> collection) {
  110 + return collection == null || collection.isEmpty();
  111 + }
  112 +
  113 + public static int getSize(Collection<?> collection) {
  114 + return collection == null ? 0 : collection.size();
  115 + }
  116 +}
  1 +package com.br_technology.securitytrain_master.view
  2 +
  3 +import android.app.Dialog
  4 +import android.content.Context
  5 +import android.os.Bundle
  6 +import android.view.LayoutInflater
  7 +import com.br_technology.securitytrain_master.databinding.DialogLoadingBinding
  8 +
  9 +/**
  10 + * Author by YSir
  11 + * Date on 2022/1/16.
  12 + * description
  13 + * PS: Not easy to write code, please indicate.
  14 + */
  15 +class DialogTrainLoading(context: Context) : Dialog(context) {
  16 + private val binding by lazy {
  17 + DialogLoadingBinding.inflate(LayoutInflater.from(context))
  18 + }
  19 +
  20 + override fun onCreate(savedInstanceState: Bundle?) {
  21 + super.onCreate(savedInstanceState)
  22 + setContentView(binding.root)
  23 + // 点击区域外不取消
  24 + setCanceledOnTouchOutside(false)
  25 + }
  26 +}
  1 +package com.br_technology.securitytrain_master.view;
  2 +
  3 +import android.graphics.Canvas;
  4 +import android.graphics.Color;
  5 +import android.graphics.Paint;
  6 +import android.graphics.Rect;
  7 +import android.view.View;
  8 +
  9 +import androidx.annotation.NonNull;
  10 +import androidx.core.content.ContextCompat;
  11 +import androidx.recyclerview.widget.RecyclerView;
  12 +
  13 +import com.br_technology.securitytrain_master.util.TranslateUnit;
  14 +
  15 +import java.util.ArrayList;
  16 +import java.util.List;
  17 +
  18 +public class VerticalDecoration extends RecyclerView.ItemDecoration {
  19 +
  20 + private int itemSpace;
  21 + private boolean isVertical = true;
  22 +
  23 + private int color = 0;
  24 +
  25 + public void setColor(int color) {
  26 + this.color = color;
  27 + }
  28 +
  29 + private List<Integer> needNot = new ArrayList<>();
  30 +
  31 + public void setShowLastVertical(boolean showLastVertical) {
  32 + this.showLastVertical = showLastVertical;
  33 + }
  34 +
  35 + private boolean showLastVertical = false;
  36 +
  37 + public VerticalDecoration() {
  38 + }
  39 +
  40 + public VerticalDecoration(int itemSpace, int color) {
  41 + this.itemSpace = itemSpace;
  42 + this.color = color;
  43 + }
  44 +
  45 + /**
  46 + * @param itemSpace item间隔
  47 + * @param isVertical 是否竖直
  48 + */
  49 + public VerticalDecoration(int itemSpace, boolean isVertical) {
  50 + this.itemSpace = itemSpace;
  51 + this.isVertical = isVertical;
  52 + }
  53 +
  54 + /**
  55 + * @param itemSpace item间隔
  56 + * @param isVertical 是否竖直
  57 + */
  58 + public VerticalDecoration(int itemSpace, boolean isVertical, List<Integer> integers) {
  59 + this.itemSpace = itemSpace;
  60 + this.isVertical = isVertical;
  61 + this.needNot.addAll(integers);
  62 + }
  63 +
  64 + @Override
  65 + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
  66 + @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
  67 + super.getItemOffsets(outRect, view, parent, state);
  68 + if (parent.getAdapter() == null) return;
  69 + int total = parent.getAdapter().getItemCount();
  70 + int now = parent.getChildLayoutPosition(view);
  71 + if (isVertical) {
  72 + if (now != total - 1 || needNot.contains(now)) {
  73 + outRect.set(0, 0, 0, itemSpace);
  74 + } else {
  75 + outRect.set(0, 0, 0, showLastVertical ? itemSpace : 0);
  76 + }
  77 +
  78 + } else {
  79 + if (now != total - 1) {
  80 + outRect.set(0, 0, itemSpace, 0);
  81 + } else {
  82 + outRect.set(0, 0, showLastVertical ? itemSpace : 0, 0);
  83 + }
  84 + }
  85 + }
  86 +
  87 + @Override
  88 + public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
  89 + super.onDraw(c, parent, state);
  90 + drawVertical(c, parent);
  91 + }
  92 +
  93 + private Paint paint;
  94 +
  95 + private void drawVertical(Canvas c, RecyclerView parent) {
  96 + int height = itemSpace == 0 ? TranslateUnit.dp2px(parent.getContext(), 10) : itemSpace;
  97 + if (paint == null) {
  98 + paint = new Paint();
  99 + }
  100 + paint.setColor(color == 0 ? Color.TRANSPARENT : ContextCompat.getColor(parent.getContext(), color));
  101 + final int childCount = parent.getChildCount();
  102 + for (int i = 0; i < childCount - 1; i++) {
  103 + final View child = parent.getChildAt(i);
  104 + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
  105 + .getLayoutParams();
  106 + final int top = child.getBottom() + params.bottomMargin;
  107 + int heightNeed = needNot.contains(i) ? 0 : height;
  108 + final int bottom = top + heightNeed;
  109 + final int left = child.getLeft() + params.leftMargin;
  110 + final int right = child.getRight() + params.rightMargin;
  111 + c.drawRect(left, top, right, bottom, paint);
  112 + }
  113 + }
  114 +}
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <item android:state_pressed="true">
  5 + <shape android:shape="oval">
  6 + <size android:width="100dp" android:height="100dp" />
  7 + <gradient android:angle="-90" android:endColor="@color/purple_200" android:startColor="@color/color_25" />
  8 + <stroke android:width="5dp" android:color="@color/white" />
  9 + </shape>
  10 + </item>
  11 +
  12 + <item>
  13 + <shape android:shape="oval">
  14 + <size android:width="100dp" android:height="100dp" />
  15 + <solid android:color="@color/color_25" />
  16 + <stroke android:width="5dp" android:color="@color/white" />
  17 + </shape>
  18 + </item>
  19 +
  20 +</selector>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@+id/lay_common_web"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:background="@android:color/transparent"
  7 + android:orientation="vertical">
  8 +
  9 +
  10 +
  11 +</LinearLayout>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:orientation="vertical">
  7 +
  8 + <include layout="@layout/layout_tool_bar" />
  9 +
  10 + <com.br_technology.securitytrain_master.view.ViewToolBar
  11 + android:id="@+id/tool_bar"
  12 + android:layout_width="match_parent"
  13 + android:layout_height="wrap_content"
  14 + app:toolTitle="课程详情" />
  15 +
  16 + <FrameLayout
  17 + android:layout_width="match_parent"
  18 + android:layout_height="0dp"
  19 + android:layout_weight="1">
  20 +
  21 + <com.tencent.tencentmap.mapsdk.maps.TextureMapView
  22 + android:id="@+id/map_view"
  23 + android:layout_width="match_parent"
  24 + android:layout_height="match_parent" />
  25 +
  26 + <RelativeLayout
  27 + android:id="@+id/rv_sign"
  28 + android:layout_width="150dp"
  29 + android:layout_height="150dp"
  30 + android:layout_gravity="center"
  31 + android:gravity="center"
  32 + android:background="@drawable/btn_sign">
  33 +
  34 + <TextView
  35 + android:id="@+id/tv_sign_mention"
  36 + android:layout_width="wrap_content"
  37 + android:text="签到"
  38 + android:textSize="16sp"
  39 + android:layout_centerHorizontal="true"
  40 + android:textColor="@color/white"
  41 + android:layout_height="wrap_content" />
  42 +
  43 + <DigitalClock
  44 + android:id="@+id/dc_sign"
  45 + android:textColor="@color/white"
  46 + android:textSize="18sp"
  47 + android:layout_marginTop="5dp"
  48 + android:layout_centerHorizontal="true"
  49 + android:layout_below="@+id/tv_sign_mention"
  50 + android:layout_width="wrap_content"
  51 + android:layout_height="wrap_content" />
  52 + </RelativeLayout>
  53 + </FrameLayout>
  54 +
  55 +</LinearLayout>
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - android:layout_width="match_parent"  
5 - android:layout_height="match_parent"  
6 - android:background="@color/white">  
7 -  
8 - <include  
9 - android:id="@+id/include"  
10 - layout="@layout/layout_tool_bar" />  
11 -  
12 - <com.br_technology.securitytrain_master.view.ViewToolBar  
13 - android:id="@+id/tool_bar"  
14 - android:layout_width="match_parent"  
15 - android:layout_height="wrap_content"  
16 - android:layout_below="@id/include"  
17 - app:toolTitle="签到" />  
18 -  
19 - <!--地图/>-->  
20 -  
21 - <LinearLayout  
22 - android:layout_width="140dp"  
23 - android:layout_height="140dp"  
24 - android:layout_centerInParent="true"  
25 - android:background="@mipmap/sign_in_bg"  
26 - android:orientation="vertical">  
27 -  
28 - <TextView  
29 - android:text="签到"  
30 - android:textSize="16sp"  
31 - android:textColor="@color/white"  
32 - android:layout_marginTop="38dp"  
33 - android:layout_gravity="center_horizontal"  
34 - android:layout_width="wrap_content"  
35 - android:layout_height="wrap_content"/>  
36 -  
37 - <TextView  
38 - android:text="08:30"  
39 - android:textSize="24sp"  
40 - android:textColor="@color/white"  
41 - android:layout_gravity="center_horizontal"  
42 - android:layout_width="wrap_content"  
43 - android:layout_height="wrap_content"/>  
44 -  
45 - </LinearLayout>  
46 -  
47 -</RelativeLayout>  
@@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
26 android:id="@+id/course_recycler" 26 android:id="@+id/course_recycler"
27 android:layout_width="match_parent" 27 android:layout_width="match_parent"
28 android:layout_height="match_parent" 28 android:layout_height="match_parent"
29 -  
30 android:overScrollMode="never" 29 android:overScrollMode="never"
31 android:scrollbars="none" 30 android:scrollbars="none"
32 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> 31 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
@@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
59 android:layout_marginBottom="8dp" 59 android:layout_marginBottom="8dp"
60 android:background="@drawable/solid_25_4" 60 android:background="@drawable/solid_25_4"
61 android:gravity="center" 61 android:gravity="center"
  62 + android:visibility="gone"
62 android:text="去做题" 63 android:text="去做题"
63 android:textColor="@color/white" 64 android:textColor="@color/white"
64 android:textSize="15sp" /> 65 android:textSize="15sp" />
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<ProgressBar
  3 + xmlns:android="http://schemas.android.com/apk/res/android"
  4 + android:indeterminateTintMode="src_atop"
  5 + android:indeterminateTint="@color/colorAccent"
  6 + android:layout_width="wrap_content"
  7 + android:layout_height="wrap_content">
  8 +</ProgressBar>
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
  7 + android:orientation="vertical"
  8 + android:foreground="?attr/selectableItemBackground"
7 android:background="@color/white"> 9 android:background="@color/white">
8 10
  11 + <com.scwang.smart.refresh.layout.SmartRefreshLayout
  12 + android:id="@+id/smart_refresh"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="0dp"
  15 + android:layout_weight="1">
  16 +
  17 + <com.scwang.smart.refresh.header.MaterialHeader
  18 + android:layout_width="wrap_content"
  19 + android:layout_height="wrap_content" />
  20 +
  21 + <androidx.recyclerview.widget.RecyclerView
  22 + android:id="@+id/recyclerview"
  23 + android:layout_width="match_parent"
  24 + android:layout_height="match_parent"
  25 + android:layout_marginStart="16dp"
  26 + android:layout_marginEnd="16dp"
  27 + android:layout_marginBottom="32dp"
  28 + android:overScrollMode="never"
  29 + android:scrollbars="none"
  30 + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
  31 +
  32 + <com.scwang.smart.refresh.footer.ClassicsFooter
  33 + android:layout_width="wrap_content"
  34 + android:layout_height="wrap_content" />
  35 + </com.scwang.smart.refresh.layout.SmartRefreshLayout>
  36 +
9 <LinearLayout 37 <LinearLayout
10 android:id="@+id/ll" 38 android:id="@+id/ll"
11 android:layout_width="match_parent" 39 android:layout_width="match_parent"
12 android:layout_height="22dp" 40 android:layout_height="22dp"
13 - android:layout_alignParentBottom="true"  
14 android:layout_marginStart="16dp" 41 android:layout_marginStart="16dp"
15 android:layout_marginEnd="16dp" 42 android:layout_marginEnd="16dp"
16 android:layout_marginBottom="34dp" 43 android:layout_marginBottom="34dp"
@@ -37,32 +64,4 @@ @@ -37,32 +64,4 @@
37 android:textColor="@color/color_32" 64 android:textColor="@color/color_32"
38 android:textSize="14sp" /> 65 android:textSize="14sp" />
39 </LinearLayout> 66 </LinearLayout>
40 -  
41 - <com.scwang.smart.refresh.layout.SmartRefreshLayout  
42 - android:id="@+id/smart_refresh"  
43 - android:layout_width="match_parent"  
44 - android:layout_height="wrap_content">  
45 -  
46 - <com.scwang.smart.refresh.header.MaterialHeader  
47 - android:layout_width="wrap_content"  
48 - android:layout_height="wrap_content" />  
49 -  
50 - <androidx.recyclerview.widget.RecyclerView  
51 - android:id="@+id/recyclerview"  
52 - android:layout_width="match_parent"  
53 - android:layout_height="match_parent"  
54 - android:layout_above="@id/ll"  
55 - android:layout_marginStart="16dp"  
56 - android:layout_marginEnd="16dp"  
57 - android:layout_marginBottom="32dp"  
58 - android:overScrollMode="never"  
59 - android:scrollbars="none"  
60 - app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />  
61 -  
62 - <com.scwang.smart.refresh.footer.ClassicsFooter  
63 - android:layout_width="wrap_content"  
64 - android:layout_height="wrap_content" />  
65 - </com.scwang.smart.refresh.layout.SmartRefreshLayout>  
66 -  
67 -  
68 -</RelativeLayout>  
  67 +</LinearLayout>
@@ -108,84 +108,60 @@ @@ -108,84 +108,60 @@
108 <LinearLayout 108 <LinearLayout
109 android:layout_width="match_parent" 109 android:layout_width="match_parent"
110 android:layout_height="wrap_content" 110 android:layout_height="wrap_content"
  111 + android:layout_marginStart="24dp"
  112 + android:layout_marginTop="20dp"
  113 + android:layout_marginEnd="24dp"
111 android:orientation="horizontal"> 114 android:orientation="horizontal">
112 115
113 - <RelativeLayout  
114 - android:layout_width="wrap_content"  
115 - android:layout_height="wrap_content"  
116 - android:layout_marginStart="24dp"  
117 - android:layout_marginTop="20dp"  
118 - android:layout_weight="1">  
119 116
120 - <TextView  
121 - android:id="@+id/tv_class_duty"  
122 - android:layout_width="wrap_content"  
123 - android:layout_height="wrap_content"  
124 - android:drawableTop="@mipmap/mine_banjirenwu"  
125 - android:drawablePadding="8dp"  
126 - android:text="班级任务"  
127 - android:textColor="@color/color_32"  
128 - android:textSize="12sp" />  
129 -  
130 - </RelativeLayout>  
131 -  
132 - <RelativeLayout  
133 - android:layout_width="wrap_content" 117 + <TextView
  118 + android:id="@+id/tv_class_duty"
  119 + android:layout_width="0dp"
134 android:layout_height="wrap_content" 120 android:layout_height="wrap_content"
135 - android:layout_marginStart="24dp"  
136 - android:layout_marginTop="20dp"  
137 - android:layout_weight="1">  
138 -  
139 - <TextView  
140 - android:id="@+id/tv_offline_exercise"  
141 - android:layout_width="wrap_content"  
142 - android:layout_height="wrap_content"  
143 - android:drawableTop="@mipmap/mine_xianxiapeixun"  
144 - android:drawablePadding="8dp"  
145 - android:text="线下培训"  
146 - android:textColor="@color/color_32"  
147 - android:textSize="12sp" />  
148 -  
149 - </RelativeLayout> 121 + android:layout_weight="1"
  122 + android:drawableTop="@mipmap/mine_banjirenwu"
  123 + android:drawablePadding="8dp"
  124 + android:gravity="center_horizontal"
  125 + android:text="班级任务"
  126 + android:textColor="@color/color_32"
  127 + android:textSize="12sp" />
150 128
151 - <RelativeLayout  
152 - android:layout_width="wrap_content" 129 + <TextView
  130 + android:id="@+id/tv_offline_exercise"
  131 + android:layout_width="0dp"
153 android:layout_height="wrap_content" 132 android:layout_height="wrap_content"
154 - android:layout_marginStart="24dp"  
155 - android:layout_marginTop="20dp"  
156 - android:layout_weight="1">  
157 -  
158 - <TextView  
159 - android:id="@+id/tv_academic_feedback"  
160 - android:layout_width="wrap_content"  
161 - android:layout_height="wrap_content"  
162 - android:drawableTop="@mipmap/mine_xueqingfankui"  
163 - android:drawablePadding="8dp"  
164 - android:text="学情反馈"  
165 - android:textColor="@color/color_32"  
166 - android:textSize="12sp" />  
167 -  
168 - </RelativeLayout> 133 + android:layout_weight="1"
  134 + android:drawableTop="@mipmap/mine_xianxiapeixun"
  135 + android:drawablePadding="8dp"
  136 + android:text="线下培训"
  137 + android:textColor="@color/color_32"
  138 + android:textSize="12sp"
  139 + android:visibility="gone" />
169 140
170 - <RelativeLayout  
171 - android:layout_width="wrap_content" 141 + <TextView
  142 + android:id="@+id/tv_academic_feedback"
  143 + android:layout_width="0dp"
172 android:layout_height="wrap_content" 144 android:layout_height="wrap_content"
173 - android:layout_marginStart="24dp"  
174 - android:layout_marginTop="20dp"  
175 - android:layout_weight="1">  
176 -  
177 - <TextView  
178 - android:id="@+id/tv_learning_report"  
179 - android:layout_width="wrap_content"  
180 - android:layout_height="wrap_content"  
181 - android:drawableTop="@mipmap/mine_xuexibaogao"  
182 - android:drawablePadding="8dp"  
183 - android:text="学习报告"  
184 - android:textColor="@color/color_32"  
185 - android:textSize="12sp" /> 145 + android:layout_weight="1"
  146 + android:drawableTop="@mipmap/mine_xueqingfankui"
  147 + android:drawablePadding="8dp"
  148 + android:gravity="center_horizontal"
  149 + android:text="学情反馈"
  150 + android:textColor="@color/color_32"
  151 + android:textSize="12sp" />
186 152
187 - </RelativeLayout>  
188 153
  154 + <TextView
  155 + android:id="@+id/tv_learning_report"
  156 + android:layout_width="0dp"
  157 + android:layout_height="wrap_content"
  158 + android:layout_weight="1"
  159 + android:drawableTop="@mipmap/mine_xuexibaogao"
  160 + android:drawablePadding="8dp"
  161 + android:gravity="center_horizontal"
  162 + android:text="学习报告"
  163 + android:textColor="@color/color_32"
  164 + android:textSize="12sp" />
189 165
190 </LinearLayout> 166 </LinearLayout>
191 167