作者 杨谦

1.课程相关接口对接

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

要显示太多修改。

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

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