作者 liyan

解决合并冲突

正在显示 42 个修改的文件 包含 920 行增加88 行删除
... ... @@ -9,7 +9,9 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 往sdcard中写入数据的权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<!-- 在sdcard中创建/删除文件的权限 -->
<uses-permission
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
... ... @@ -45,7 +47,9 @@
android:value="portrait|landscape" />
<activity android:name=".ui.login.AccountLoginActivity">
<activity
android:name=".ui.login.AccountLoginActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
... ... @@ -74,34 +78,52 @@
android:name=".ui.home.activity.DatabaseDetailActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:screenOrientation="portrait" />
<activity android:name=".ui.home.activity.WebViewActivity" />
<activity android:name=".ui.home.activity.TextCourseActivity" />
<activity android:name=".ui.home.activity.TextDetailActivity" />
<activity android:name=".ui.home.activity.OnlineActivity" />
<activity android:name=".ui.bank.activity.PracticeActivity" />
<activity android:name=".ui.bank.activity.AnswerSheetActivity" />
<activity android:name=".ui.bank.activity.ChallengeActivity" />
<activity android:name=".ui.bank.activity.LeaderboardActivity" />
<activity android:name=".ui.bank.activity.MockExamActivity" />
<activity android:name=".ui.bank.activity.ExamTypeActivity" />
<activity android:name=".ui.bank.activity.ExamDetailActivity" />
<activity android:name=".ui.bank.activity.ExamCardActivity" />
<activity android:name=".ui.home.activity.LiveCourseActivity" />
<activity android:name=".ui.mine.activity.EditPersonalInfoActivity" />
<activity android:name=".ui.mine.activity.ChangePwdActivity" />
<activity android:name=".ui.mine.activity.ChangePhoneActivity" />
<activity android:name=".ui.mine.activity.MyErrorQuestionActivity" />
<activity android:name=".ui.mine.activity.QuestionRecordActivity" />
<activity android:name=".ui.mine.activity.MyCredentialsActivity" />
<activity android:name=".ui.mine.activity.AcademicFeedbackActivity" />
<activity android:name=".ui.mine.activity.CredentialsUpLoadActivity" />
<activity android:name=".ui.mine.activity.MyCredentialsDetailActivity" />
<activity android:name=".ui.mine.activity.OfflineExerciseActivity" />
<activity android:name=".ui.home.activity.WebViewActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.home.activity.TextCourseActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.home.activity.TextDetailActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.home.activity.OnlineActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.PracticeActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.AnswerSheetActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.ChallengeActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.LeaderboardActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.MockExamActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.ExamTypeActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.ExamDetailActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.bank.activity.ExamCardActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".ui.home.activity.OnlineDetailActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:screenOrientation="portrait" />
<activity android:name=".ui.home.activity.LiveCourseActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.EditPersonalInfoActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.ChangePwdActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.ChangePhoneActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.MyErrorQuestionActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.QuestionRecordActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.MyCredentialsActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.mine.activity.AcademicFeedbackActivity" />
<activity android:name=".ui.mine.activity.CredentialsUpLoadActivity" />
<activity android:name=".ui.mine.activity.MyCredentialsDetailActivity" />
<activity android:name=".ui.mine.activity.OfflineExerciseActivity" />
<activity android:name=".ui.mine.activity.LearningReportActivity"/>
<activity android:name=".ui.mine.activity.LearningReportDetailActivity"/>
... ...
... ... @@ -11,7 +11,7 @@ import com.br_technology.securitytrain_master.databinding.ActivityDatabaseBindin
import com.br_technology.securitytrain_master.ui.home.adapter.ClassifyAdapter
import com.br_technology.securitytrain_master.ui.home.adapter.ResultAdapter
import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData
import com.br_technology.securitytrain_master.ui.home.viewmodel.DatabaseViewModel
import com.br_technology.securitytrain_master.ui.home.viewmodel.DatabaseFViewModel
import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
import com.google.android.material.tabs.TabLayout
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
... ... @@ -22,7 +22,7 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
* des:
*/
class DatabaseActivity :
BaseLifeCycleActivity<DatabaseViewModel, ActivityDatabaseBinding>(ActivityDatabaseBinding::inflate) {
BaseLifeCycleActivity<DatabaseFViewModel, ActivityDatabaseBinding>(ActivityDatabaseBinding::inflate) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
... ...
... ... @@ -9,6 +9,8 @@ import com.br_technology.securitytrain_master.ui.home.adapter.VideoCourseAdapter
import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData
import com.br_technology.securitytrain_master.ui.home.pojo.VideoCourse
import com.br_technology.securitytrain_master.ui.home.viewmodel.MineViewModel
import com.br_technology.securitytrain_master.ui.mine.activity.CollectActivity
import com.br_technology.securitytrain_master.ui.mine.activity.ServiceActivity
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
... ... @@ -35,7 +37,8 @@ class HomeFragment :
binding.apply {
//搜索
search.setOnClickListener {
startActivity(SearchActivity::class.java)
startActivity(CollectActivity::class.java)
// startActivity(SearchActivity::class.java)
}
banner.setAdapter(object : BannerImageAdapter<Int>(
mutableListOf(
... ...
... ... @@ -13,42 +13,41 @@ import com.br_technology.securitytrain_master.databinding.FragmentResultBinding
import com.br_technology.securitytrain_master.ui.home.activity.DatabaseActivity
import com.br_technology.securitytrain_master.ui.home.adapter.ResultAdapter
import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData
import com.br_technology.securitytrain_master.ui.home.viewmodel.ResultViewModel
import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
/**
* createTime:2021/7/28 15:39
* auth:张继
* des:
*/
class ResultFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return FragmentResultBinding.inflate(inflater).root
}
class ResultFragment : BaseLifeCycleFragment<ResultViewModel,FragmentResultBinding>(FragmentResultBinding::inflate) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val resultRecycler: RecyclerView = view.findViewById(R.id.result)
val recommendList = mutableListOf(
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
)
val resultAdapter = ResultAdapter()
resultRecycler.adapter = resultAdapter
resultAdapter.addList(recommendList)
override fun initData() {
super.initData()
binding.apply {
val recommendList = mutableListOf(
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"),
)
val resultAdapter = ResultAdapter()
result.adapter = resultAdapter
resultAdapter.addList(recommendList)
}
}
override fun initDataObserver() {
}
... ...
package com.br_technology.securitytrain_master.ui.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository
/**
* createTime:2021/7/27 15:49
* auth:张继
* des:
*/
class ResultRepository(val loadState: MutableLiveData<State>):ApiRepository() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.viewmodel
import com.br_technology.securitytrain_master.ui.home.repository.HomeRepository
import com.br_technology.securitytrain_master.ui.home.repository.ResultRepository
import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
/**
* createTime:2021/7/27 15:48
* auth:张继
* des:
*/
class ResultViewModel:BaseViewModel<ResultRepository>() {
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@ import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityClassDutyBinding
import com.br_technology.securitytrain_master.ui.mine.fragment.CourseFragment
import com.br_technology.securitytrain_master.ui.mine.fragment.ClassDutyCourseFragment
import com.br_technology.securitytrain_master.ui.mine.viewmodel.ClassDutyViewModel
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
... ... @@ -55,9 +55,9 @@ class ClassDutyActivity :
)
val list =
listOf(
CourseFragment(),
CourseFragment(),
CourseFragment()
ClassDutyCourseFragment(),
ClassDutyCourseFragment(),
ClassDutyCourseFragment()
)
val titles = listOf("课程", "练习", "考试")
searchResultAdapter.addData(list)
... ...
package com.br_technology.securitytrain_master.ui.mine.activity
import androidx.fragment.app.FragmentPagerAdapter
import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
import com.br_technology.securitytrain_master.databinding.ActivityCollectBinding
import com.br_technology.securitytrain_master.ui.home.viewmodel.CollectViewModel
import com.br_technology.securitytrain_master.ui.mine.fragment.ClassDutyCourseFragment
import com.br_technology.securitytrain_master.ui.mine.fragment.DatabaseFragment
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
/**
* createTime:2021/8/2 16:07
* auth:张继
* des: 收藏
*/
class CollectActivity :
BaseLifeCycleActivity<CollectViewModel, ActivityCollectBinding>(ActivityCollectBinding::inflate) {
override fun initData() {
super.initData()
binding.apply {
val listTitle = listOf(
"课程",
"资料",
)
val fragments = listOf(
ClassDutyCourseFragment(), DatabaseFragment()
)
val basePagerAdapter = BasePagerAdapter(
supportFragmentManager,
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
)
basePagerAdapter.addTitle(listTitle)
basePagerAdapter.addData(fragments)
viewPager.adapter= basePagerAdapter
tabLayout.setupWithViewPager(viewPager)
}
}
override fun initDataObserver() {
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.mine.activity
import com.br_technology.securitytrain_master.databinding.ActivityServiceBinding
import com.br_technology.securitytrain_master.ui.home.viewmodel.ServiceViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
/**
* createTime:2021/8/2 15:29
* auth:张继
* des:客服
*/
class ServiceActivity :
BaseLifeCycleActivity<ServiceViewModel, ActivityServiceBinding>(ActivityServiceBinding::inflate) {
override fun initData() {
super.initData()
binding.apply {
// 拨打电话
call.setOnClickListener { }
// 下载二维码
download.setOnClickListener { }
}
}
override fun initDataObserver() {
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.mine.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.br_technology.securitytrain_master.base.view.BaseAdapter
import com.br_technology.securitytrain_master.databinding.AdapterSideslipBinding
import com.br_technology.securitytrain_master.expand.glideRound
import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData
/**
* createTime:2021/8/2 17:48
* auth:张继
* des:
*/
class SideslipAdapter:BaseAdapter<RecommendData,AdapterSideslipBinding>() {
override fun getViewBinding(
context: Context,
parent: ViewGroup,
viewType: Int,
from: LayoutInflater
): AdapterSideslipBinding {
return AdapterSideslipBinding.inflate(from,parent,false)
}
override fun onBind(holder: AdapterSideslipBinding, position: Int, data: RecommendData) {
holder.pic.glideRound(data.pic, 16)
holder.name.text = data.name
holder.info.text = data.info
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.mine.fragment
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.FragmentCourseBinding
import com.br_technology.securitytrain_master.databinding.FragmentClassDutyCourseBinding
import com.br_technology.securitytrain_master.ui.home.pojo.VideoCourse
import com.br_technology.securitytrain_master.ui.mine.adapter.CourseAdapter
import com.br_technology.securitytrain_master.ui.mine.adapter.MockExaminationAdapter
import com.br_technology.securitytrain_master.ui.mine.viewmodel.CourseViewModel
import com.br_technology.securitytrain_master.ui.mine.viewmodel.ClassDutyCourseViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
/**
... ... @@ -13,8 +12,8 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
* Author: Captain
* Description: 初见时你很迷人
*/
class CourseFragment :
BaseLifeCycleFragment<CourseViewModel, FragmentCourseBinding>(FragmentCourseBinding::inflate) {
class ClassDutyCourseFragment :
BaseLifeCycleFragment<ClassDutyCourseViewModel, FragmentClassDutyCourseBinding>(FragmentClassDutyCourseBinding::inflate) {
override fun initDataObserver() {
}
... ... @@ -24,10 +23,10 @@ class CourseFragment :
binding.apply {
val courseAdapter = CourseAdapter()
val list = mutableListOf(
VideoCourse(R.mipmap.banner, "12学时", "[直播]自动化制作课程", "2020-09-09 12:00", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "12学时", "[直播]自动化制作课程", "2020-09-09 12:00", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "12学时", "[直播]自动化制作课程", "2020-09-09 12:00", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "12学时", "[直播]自动化制作课程", "2020-09-09 12:00", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "01:45:00", "自动化制作课程", "45分", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "01:45:00", "自动化制作课程", "68分", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "01:45:00", "自动化制作课程", "100分", "张钧-三岗职位培训班"),
VideoCourse(R.mipmap.banner, "01:45:00", "自动化制作课程", "99分", "张钧-三岗职位培训班"),
)
recyclerview.adapter = courseAdapter
courseAdapter.addList(list)
... ...
package com.br_technology.securitytrain_master.ui.mine.fragment
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.FragmentDatabaseBinding
import com.br_technology.securitytrain_master.ui.home.adapter.ResultAdapter
import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData
import com.br_technology.securitytrain_master.ui.home.viewmodel.DatabaseFViewModel
import com.br_technology.securitytrain_master.ui.mine.adapter.SideslipAdapter
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
/**
* createTime:2021/8/2 16:21
* auth:张继
* des:资料
*/
class DatabaseFragment :BaseLifeCycleFragment<DatabaseFViewModel,FragmentDatabaseBinding>(FragmentDatabaseBinding::inflate){
override fun initData() {
super.initData()
binding.apply {
val recommendList = mutableListOf(
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
RecommendData(
R.mipmap.banner,
"思维导图高分作文法(高中)议论",
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
),
)
val resultAdapter = SideslipAdapter()
result.adapter = resultAdapter
resultAdapter.addList(recommendList)
}
}
override fun initDataObserver() {
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.mine.repository
import androidx.lifecycle.MutableLiveData
... ... @@ -5,9 +6,10 @@ import com.br_technology.securitytrain_master.base.common.State
import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository
/**
<<<<<<< HEAD
* Time: 8/3/2021 11:25
* Author: Captain
* Description: 初见时你很迷人
*/
class CourseRepository(val loadState: MutableLiveData<State>) : ApiRepository() {
class ClassDutyCourseRepository(val loadState: MutableLiveData<State>) : ApiRepository() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository
/**
* createTime:2021/7/27 15:49
* auth:张继
* des:
*/
class CollectRepository(val loadState: MutableLiveData<State>):ApiRepository() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository
/**
* createTime:2021/7/27 15:49
* auth:张继
* des:
*/
class DatabaseFRepository(val loadState: MutableLiveData<State>):ApiRepository() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.repository
import androidx.lifecycle.MutableLiveData
import com.br_technology.securitytrain_master.base.common.State
import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository
/**
* createTime:2021/7/27 15:49
* auth:张继
* des:
*/
class ServiceRepository(val loadState: MutableLiveData<State>):ApiRepository() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.mine.viewmodel
import com.br_technology.securitytrain_master.ui.mine.repository.CourseRepository
import com.br_technology.securitytrain_master.ui.mine.repository.ClassDutyRepository
import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
/**
... ... @@ -8,5 +8,5 @@ import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
* Author: Captain
* Description: 初见时你很迷人
*/
class CourseViewModel : BaseViewModel<CourseRepository>() {
class ClassDutyCourseViewModel : BaseViewModel<ClassDutyRepository>(){
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.viewmodel
import com.br_technology.securitytrain_master.ui.home.repository.CollectRepository
import com.br_technology.securitytrain_master.ui.home.repository.MineRepository
import com.br_technology.securitytrain_master.ui.home.repository.ServiceRepository
import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
/**
* createTime:2021/7/27 15:48
* auth:张继
* des:
*/
class CollectViewModel:BaseViewModel<CollectRepository>() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.viewmodel
import com.br_technology.securitytrain_master.ui.home.repository.CollectRepository
import com.br_technology.securitytrain_master.ui.home.repository.DatabaseFRepository
import com.br_technology.securitytrain_master.ui.home.repository.MineRepository
import com.br_technology.securitytrain_master.ui.home.repository.ServiceRepository
import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
/**
* createTime:2021/7/27 15:48
* auth:张继
* des:
*/
class DatabaseFViewModel:BaseViewModel<DatabaseFRepository>() {
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.home.viewmodel
import com.br_technology.securitytrain_master.ui.home.repository.MineRepository
import com.br_technology.securitytrain_master.ui.home.repository.ServiceRepository
import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel
/**
* createTime:2021/7/27 15:48
* auth:张继
* des:
*/
class ServiceViewModel:BaseViewModel<ServiceRepository>() {
}
\ No newline at end of file
... ...
... ... @@ -38,6 +38,12 @@ class MyVideoPlayer : StandardGSYVideoPlayer,LifecycleObserver {
}
override fun updateStartImage() {
super.updateStartImage()
if (this.startButton is ImageView) {
(this.startButton as ImageView).setImageResource(R.mipmap.play)
}
}
/**
* 选择普通模式
*/
... ...
package com.br_technology.securitytrain_master.view
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import android.view.*
import android.widget.Scroller
import androidx.annotation.Nullable
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
/**
* createTime:2021/8/2 16:51
* auth:张继
* des:
*/
class SlideRecyclerView : RecyclerView {
private val TAG = "SlideRecyclerView"
private val INVALID_POSITION = -1 // 触摸到的点不在子View范围内
private val INVALID_CHILD_WIDTH = -1 // 子ItemView不含两个子View
private val SNAP_VELOCITY = 600 // 最小滑动速度
private var mVelocityTracker // 速度追踪器
: VelocityTracker? = null
private var mTouchSlop // 认为是滑动的最小距离(一般由系统提供)
= 0
private var mTouchFrame // 子View所在的矩形范围
: Rect? = null
private var mScroller: Scroller? = null
private var mLastX // 滑动过程中记录上次触碰点X
= 0f
private var mFirstX = 0f
private var mFirstY = 0f // 首次触碰范围
private var mIsSlide // 是否滑动子View
= false
private var mFlingView // 触碰的子View
: ViewGroup? = null
private var mPosition // 触碰的view的位置
= 0
private var mMenuViewWidth // 菜单按钮宽度
= 0
constructor(context: Context) : this(context, null)
constructor(context: Context, @Nullable attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, @Nullable attrs: AttributeSet?, defStyle: Int) : super(
context,
attrs,
defStyle
)
init {
mTouchSlop = ViewConfiguration.get(context).scaledTouchSlop
mScroller = Scroller(context)
}
override fun onInterceptTouchEvent(e: MotionEvent): Boolean {
val x = e.x.toInt()
val y = e.y.toInt()
obtainVelocity(e)
when (e.action) {
MotionEvent.ACTION_DOWN -> {
if (!mScroller!!.isFinished) { // 如果动画还没停止,则立即终止动画
mScroller!!.abortAnimation()
}
run {
mLastX = x.toFloat()
mFirstX = mLastX
}
mFirstY = y.toFloat()
mPosition = pointToPosition(x, y) // 获取触碰点所在的position
if (mPosition != INVALID_POSITION) {
val view: View? = mFlingView
// 获取触碰点所在的view
mFlingView =
getChildAt(mPosition - (layoutManager as LinearLayoutManager?)!!.findFirstVisibleItemPosition()) as ViewGroup
// 这里判断一下如果之前触碰的view已经打开,而当前碰到的view不是那个view则立即关闭之前的view,此处并不需要担动画没完成冲突,因为之前已经abortAnimation
if (view != null && mFlingView != view && view.scrollX != 0) {
view.scrollTo(0, 0)
}
// 这里进行了强制的要求,RecyclerView的子ViewGroup必须要有2个子view,这样菜单按钮才会有值,
// 需要注意的是:如果不定制RecyclerView的子View,则要求子View必须要有固定的width。
// 比如使用LinearLayout作为根布局,而content部分width已经是match_parent,此时如果菜单view用的是wrap_content,menu的宽度就会为0。
mMenuViewWidth = if (mFlingView!!.childCount == 2) {
mFlingView!!.getChildAt(1).width
} else {
INVALID_CHILD_WIDTH
}
}
}
MotionEvent.ACTION_MOVE -> {
mVelocityTracker!!.computeCurrentVelocity(10000)
// 此处有俩判断,满足其一则认为是侧滑:
// 1.如果x方向速度大于y方向速度,且大于最小速度限制;
// 2.如果x方向的侧滑距离大于y方向滑动距离,且x方向达到最小滑动距离;
val xVelocity = mVelocityTracker!!.xVelocity
val yVelocity = mVelocityTracker!!.yVelocity
if (Math.abs(xVelocity) > SNAP_VELOCITY && Math.abs(xVelocity) > Math.abs(yVelocity)
|| Math.abs(x - mFirstX) >= mTouchSlop
&& Math.abs(x - mFirstX) > Math.abs(y - mFirstY)
) {
mIsSlide = true
return true
}
}
MotionEvent.ACTION_UP -> releaseVelocity()
}
return super.onInterceptTouchEvent(e)
}
override fun onTouchEvent(e: MotionEvent): Boolean {
if (mIsSlide && mPosition != INVALID_POSITION) {
val x = e.x
obtainVelocity(e)
when (e.action) {
MotionEvent.ACTION_DOWN -> {
}
MotionEvent.ACTION_MOVE -> // 随手指滑动
if (mMenuViewWidth != INVALID_CHILD_WIDTH) {
val dx = mLastX - x
if (mFlingView!!.scrollX + dx <= mMenuViewWidth
&& mFlingView!!.scrollX + dx > 0
) {
mFlingView!!.scrollBy(dx.toInt(), 0)
}
mLastX = x
}
MotionEvent.ACTION_UP -> {
if (mMenuViewWidth != INVALID_CHILD_WIDTH) {
val scrollX = mFlingView!!.scrollX
mVelocityTracker!!.computeCurrentVelocity(1000)
// 此处有两个原因决定是否打开菜单:
// 1.菜单被拉出宽度大于菜单宽度一半;
// 2.横向滑动速度大于最小滑动速度;
// 注意:之所以要小于负值,是因为向左滑则速度为负值
if (mVelocityTracker!!.xVelocity < -SNAP_VELOCITY) { // 向左侧滑达到侧滑最低速度,则打开
mScroller!!.startScroll(
scrollX,
0,
mMenuViewWidth - scrollX,
0,
Math.abs(mMenuViewWidth - scrollX)
)
} else if (mVelocityTracker!!.xVelocity >= SNAP_VELOCITY) { // 向右侧滑达到侧滑最低速度,则关闭
mScroller!!.startScroll(scrollX, 0, -scrollX, 0, Math.abs(scrollX))
} else if (scrollX >= mMenuViewWidth / 2) { // 如果超过删除按钮一半,则打开
mScroller!!.startScroll(
scrollX,
0,
mMenuViewWidth - scrollX,
0,
Math.abs(mMenuViewWidth - scrollX)
)
} else { // 其他情况则关闭
mScroller!!.startScroll(scrollX, 0, -scrollX, 0, Math.abs(scrollX))
}
invalidate()
}
mMenuViewWidth = INVALID_CHILD_WIDTH
mIsSlide = false
mPosition = INVALID_POSITION
releaseVelocity() // 这里之所以会调用,是因为如果前面拦截了,就不会执行ACTION_UP,需要在这里释放追踪
}
}
return true
} else {
// 此处防止RecyclerView正常滑动时,还有菜单未关闭
closeMenu()
// Velocity,这里的释放是防止RecyclerView正常拦截了,但是在onTouchEvent中却没有被释放;
// 有三种情况:1.onInterceptTouchEvent并未拦截,在onInterceptTouchEvent方法中,DOWN和UP一对获取和释放;
// 2.onInterceptTouchEvent拦截,DOWN获取,但事件不是被侧滑处理,需要在这里进行释放;
// 3.onInterceptTouchEvent拦截,DOWN获取,事件被侧滑处理,则在onTouchEvent的UP中释放。
releaseVelocity()
}
return super.onTouchEvent(e)
}
private fun releaseVelocity() {
if (mVelocityTracker != null) {
mVelocityTracker!!.clear()
mVelocityTracker!!.recycle()
mVelocityTracker = null
}
}
private fun obtainVelocity(event: MotionEvent) {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain()
}
mVelocityTracker!!.addMovement(event)
}
private fun pointToPosition(x: Int, y: Int): Int {
val firstPosition = (layoutManager as LinearLayoutManager?)!!.findFirstVisibleItemPosition()
var frame: Rect? = mTouchFrame
if (frame == null) {
mTouchFrame = Rect()
frame = mTouchFrame
}
val count = childCount
for (i in count - 1 downTo 0) {
val child: View = getChildAt(i)
if (child.visibility == View.VISIBLE) {
child.getHitRect(frame)
if (frame!!.contains(x, y)) {
return firstPosition + i
}
}
}
return INVALID_POSITION
}
override fun computeScroll() {
if (mScroller!!.computeScrollOffset()) {
mFlingView!!.scrollTo(mScroller!!.currX, mScroller!!.currY)
invalidate()
}
}
/**
* 将显示子菜单的子view关闭
* 这里本身是要自己来实现的,但是由于不定制item,因此不好监听器点击事件,因此需要调用者手动的关闭
*/
fun closeMenu() {
if (mFlingView != null && mFlingView!!.scrollX != 0) {
mFlingView!!.scrollTo(0, 0)
}
}
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.databinding.BarToolViewBinding
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
... ... @@ -32,8 +33,9 @@ class ViewToolBar(context: Context, attrs: AttributeSet) : RelativeLayout(contex
}
// 标题文字
val title = typedArray.getString(R.styleable.UIToolBar_toolTitle)
val titleColor = typedArray.getColor(R.styleable.UIToolBar_toolTitleTextColor,ContextCompat.getColor(context,R.color.black))
inflate.title.text = title
inflate.title.setTextColor(titleColor)
inflate.back.setOnClickListener {
if (leftClickListener == null) {
(context as Activity).finish()
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#40000000" />
<corners android:radius="9dp" />
</shape>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_e8" />
<corners android:radius="20dp" />
</shape>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_ff2" />
<corners android:radius="4dp" />
</shape>
\ 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:background="@color/white"
android:orientation="vertical">
<include layout="@layout/layout_tool_bar" />
<com.br_technology.securitytrain_master.view.ViewToolBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:toolTitle="我的收藏" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/SearchTab"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@color/color_f7" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:background="#10257CFF">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:gravity="center_vertical"
android:text="左滑可删除通知哦……"
android:textColor="@color/color_25"
android:textSize="12sp" />
<ImageView
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/logo"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:src="@mipmap/close_blue" />
</FrameLayout>
<com.br_technology.securitytrain_master.view.NoScrollViewPage
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:paddingTop="16dp"
android:paddingBottom="0dp"
android:scrollbars="none" />
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -31,7 +31,7 @@
android:id="@+id/start"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/start_n" />
android:src="@mipmap/star_black_n" />
<ImageView
android:id="@+id/share"
... ...
<?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:background="@color/color_25"
android:orientation="vertical">
<include layout="@layout/layout_tool_bar" />
<com.br_technology.securitytrain_master.view.ViewToolBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:leftImg="@mipmap/ic_back_white"
app:toolTitle="客服"
app:toolTitleTextColor="@color/white" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="476dp"
android:layout_margin="40dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:background="@drawable/solid_ff_4"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:text="客服"
android:textColor="@color/color_22"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="添加客服微信,一对一解决您的问题"
android:textColor="@color/color_87"
android:textSize="12sp" />
<ImageView
android:id="@+id/code"
android:layout_width="196dp"
android:layout_height="196dp"
android:src="@mipmap/mask"
android:scaleType="fitXY"
android:layout_marginTop="43dp"
android:layout_marginBottom="40dp"
android:contentDescription="@string/logo" />
<FrameLayout
android:id="@+id/call"
android:layout_width="196dp"
android:layout_height="40dp"
android:layout_marginBottom="24dp"
android:background="@drawable/solid_a2_20">
<TextView
android:id="@+id/mobile"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:text="1856547589"
android:textColor="@color/white"
android:textSize="16sp"
app:drawableStartCompat="@mipmap/call" />
</FrameLayout>
</LinearLayout>
<ImageView
android:id="@+id/head"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo"
android:src="@mipmap/placeholder_head" />
</FrameLayout>
<TextView
android:id="@+id/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:drawablePadding="12dp"
android:text="保存在本地"
android:textColor="@color/white"
android:textSize="12sp"
app:drawableTopCompat="@mipmap/download" />
</LinearLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_marginEnd="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/pic"
android:layout_width="97dp"
android:layout_height="72dp"
android:contentDescription="@string/logo"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:minHeight="22dp"
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/color_96"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@color/color_eb" />
</LinearLayout>
<TextView
android:id="@+id/delete"
android:layout_width="52dp"
android:layout_height="88dp"
android:background="@drawable/solid_ff2_4"
android:gravity="center"
android:text="删除"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
<ProgressBar
android:id="@+id/pr_upload_value"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="210dp"
android:layout_width="229dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:max="100"
... ...
<?xml version="1.0" encoding="utf-8"?>
<com.br_technology.securitytrain_master.view.SlideRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
... ...
... ... @@ -96,6 +96,7 @@
android:id="@+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="7dp"
android:background="@drawable/video_title_bg"
android:gravity="center_vertical">
... ... @@ -105,15 +106,18 @@
android:layout_height="48dp"
android:paddingLeft="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_back" />
android:src="@mipmap/ic_back_white" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
</LinearLayout>
... ... @@ -146,15 +150,5 @@
android:src="@drawable/video_small_close"
android:visibility="gone" />
<ImageView
android:id="@+id/lock_screen"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:scaleType="centerInside"
android:src="@drawable/unlock"
android:visibility="gone" />
</RelativeLayout>
... ...
... ... @@ -34,6 +34,10 @@
<color name="color_f7">#F7F8FA</color>
<color name="color_e3">#E3F1FF</color>
<color name="color_dcdee0">#DCDEE0</color>
<color name="color_22">#22272B</color>
<color name="color_87">#879099</color>
<color name="color_ff2">#FF2F2F</color>
<color name="color_4425FF">#4425FF</color>
<color name="color_25CBFF">#25CBFF</color>
... ...