正在显示
10 个修改的文件
包含
85 行增加
和
26 行删除
@@ -53,9 +53,7 @@ abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>, VB : ViewBinding>( | @@ -53,9 +53,7 @@ abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>, VB : ViewBinding>( | ||
53 | // showLoading() | 53 | // showLoading() |
54 | 54 | ||
55 | mViewModel = ViewModelProvider(this).get(CommonUtil.getClass(this)) | 55 | mViewModel = ViewModelProvider(this).get(CommonUtil.getClass(this)) |
56 | - | ||
57 | mViewModel.loadState.observe(this, observer) | 56 | mViewModel.loadState.observe(this, observer) |
58 | - | ||
59 | initDataObserver() | 57 | initDataObserver() |
60 | } | 58 | } |
61 | 59 |
1 | package com.br_technology.securitytrain_master.ui.bean | 1 | package com.br_technology.securitytrain_master.ui.bean |
2 | 2 | ||
3 | import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr | 3 | import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr |
4 | -import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean | ||
5 | import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject | 4 | import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject |
6 | 5 | ||
7 | /** | 6 | /** |
@@ -123,8 +122,8 @@ open class AnswerRecord( | @@ -123,8 +122,8 @@ open class AnswerRecord( | ||
123 | var count: Int, | 122 | var count: Int, |
124 | var correct: Int, | 123 | var correct: Int, |
125 | var is_complete: String, // 是否完成:0=否,1=是 | 124 | var is_complete: String, // 是否完成:0=否,1=是 |
126 | - var create_time_text: String, // 日期 | ||
127 | - var pos: PracticeBean.Pos | 125 | + var create_time_text: String // 日期 |
126 | +// var pos: PracticeBean.Pos | ||
128 | ) | 127 | ) |
129 | 128 | ||
130 | //答题记录详情 | 129 | //答题记录详情 |
@@ -6,4 +6,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.event | @@ -6,4 +6,7 @@ package com.br_technology.securitytrain_master.ui.view.bank.event | ||
6 | * Description: 初见时你很迷人 | 6 | * Description: 初见时你很迷人 |
7 | */ | 7 | */ |
8 | class RankListEvent(var type: Int) { | 8 | class RankListEvent(var type: Int) { |
9 | +} | ||
10 | + | ||
11 | +class ExcerSize(var type: Int) { | ||
9 | } | 12 | } |
@@ -46,7 +46,8 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | @@ -46,7 +46,8 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | ||
46 | super.initData() | 46 | super.initData() |
47 | val id = intent.getStringExtra(ConstantParamKey.LESSON_ID)?:"" | 47 | val id = intent.getStringExtra(ConstantParamKey.LESSON_ID)?:"" |
48 | val detailId = intent.getStringExtra(ConstantParamKey.LESSON_DETAIL_ID)?:"" | 48 | val detailId = intent.getStringExtra(ConstantParamKey.LESSON_DETAIL_ID)?:"" |
49 | - val url = intent.getStringExtra(ConstantParamKey.COURSE_LESSON)?:"" | 49 | + val url = intent.getStringExtra(ConstantParamKey.COMMON_URL)?:"" |
50 | +// val url = "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-uni4934e7b/c4d93960-5643-11eb-a16f-5b3e54966275.m3u8" | ||
50 | val bool = intent.getBooleanExtra(ConstantParamKey.LESSON_COMPLETE,false) | 51 | val bool = intent.getBooleanExtra(ConstantParamKey.LESSON_COMPLETE,false) |
51 | courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN) | 52 | courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN) |
52 | courseBean?.mClassId = detailId | 53 | courseBean?.mClassId = detailId |
@@ -3,9 +3,12 @@ package com.br_technology.securitytrain_master.ui.view.mine.activity | @@ -3,9 +3,12 @@ package com.br_technology.securitytrain_master.ui.view.mine.activity | ||
3 | import androidx.fragment.app.FragmentPagerAdapter | 3 | import androidx.fragment.app.FragmentPagerAdapter |
4 | import com.br_technology.securitytrain_master.base.view.BasePagerAdapter | 4 | import com.br_technology.securitytrain_master.base.view.BasePagerAdapter |
5 | import com.br_technology.securitytrain_master.databinding.ActivityQuestionRecordBinding | 5 | import com.br_technology.securitytrain_master.databinding.ActivityQuestionRecordBinding |
6 | +import com.br_technology.securitytrain_master.ui.view.bank.event.ExcerSize | ||
6 | import com.br_technology.securitytrain_master.ui.view.mine.fragment.SpecialExercisesFragment | 7 | import com.br_technology.securitytrain_master.ui.view.mine.fragment.SpecialExercisesFragment |
7 | import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.QuestionRecordViewModel | 8 | import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.QuestionRecordViewModel |
9 | +import com.google.android.material.tabs.TabLayout | ||
8 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | 10 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity |
11 | +import org.greenrobot.eventbus.EventBus | ||
9 | 12 | ||
10 | /** | 13 | /** |
11 | * Time: 7/31/2021 16:44 | 14 | * Time: 7/31/2021 16:44 |
@@ -16,17 +19,12 @@ class QuestionRecordActivity : | @@ -16,17 +19,12 @@ class QuestionRecordActivity : | ||
16 | BaseLifeCycleActivity<QuestionRecordViewModel, ActivityQuestionRecordBinding>( | 19 | BaseLifeCycleActivity<QuestionRecordViewModel, ActivityQuestionRecordBinding>( |
17 | ActivityQuestionRecordBinding::inflate | 20 | ActivityQuestionRecordBinding::inflate |
18 | ) { | 21 | ) { |
19 | - override fun initDataObserver() { | ||
20 | - | ||
21 | - } | ||
22 | 22 | ||
23 | - override fun initData() { | ||
24 | - super.initData() | 23 | + override fun initDataObserver() { |
25 | binding.apply { | 24 | binding.apply { |
26 | val searchResultAdapter = BasePagerAdapter( | 25 | val searchResultAdapter = BasePagerAdapter( |
27 | supportFragmentManager, | 26 | supportFragmentManager, |
28 | - FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT | ||
29 | - ) | 27 | + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) |
30 | val list = | 28 | val list = |
31 | mutableListOf( | 29 | mutableListOf( |
32 | SpecialExercisesFragment.newInstance(3), | 30 | SpecialExercisesFragment.newInstance(3), |
@@ -40,7 +38,33 @@ class QuestionRecordActivity : | @@ -40,7 +38,33 @@ class QuestionRecordActivity : | ||
40 | viewPager.adapter = searchResultAdapter | 38 | viewPager.adapter = searchResultAdapter |
41 | tabLayout.setupWithViewPager(viewPager) | 39 | tabLayout.setupWithViewPager(viewPager) |
42 | viewPager.offscreenPageLimit = 3 | 40 | viewPager.offscreenPageLimit = 3 |
41 | + tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { | ||
42 | + override fun onTabSelected(tab: TabLayout.Tab?) { | ||
43 | + select(tab?.position ?: 0) | ||
44 | + } | ||
45 | + | ||
46 | + override fun onTabUnselected(tab: TabLayout.Tab?) { | ||
47 | + } | ||
48 | + | ||
49 | + override fun onTabReselected(tab: TabLayout.Tab?) { | ||
50 | + select(tab?.position ?: 0) | ||
51 | + } | ||
52 | + }) | ||
43 | } | 53 | } |
44 | } | 54 | } |
45 | 55 | ||
56 | + override fun initData() { | ||
57 | + super.initData() | ||
58 | + } | ||
59 | + | ||
60 | + fun select(current: Int) { | ||
61 | + var type = 0 | ||
62 | + when (current) { | ||
63 | + 0 -> type = 3 | ||
64 | + 1 -> type = 4 | ||
65 | + 2 -> type = 5 | ||
66 | + 3 -> type = 6 | ||
67 | + } | ||
68 | + EventBus.getDefault().post(ExcerSize(type)) | ||
69 | + } | ||
46 | } | 70 | } |
@@ -13,7 +13,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder | @@ -13,7 +13,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder | ||
13 | class SpecialExercisesAdapter : | 13 | class SpecialExercisesAdapter : |
14 | BaseQuickAdapter<AnswerRecord, BaseViewHolder>(R.layout.item_special_exercises) { | 14 | BaseQuickAdapter<AnswerRecord, BaseViewHolder>(R.layout.item_special_exercises) { |
15 | override fun convert(holder: BaseViewHolder, item: AnswerRecord) { | 15 | override fun convert(holder: BaseViewHolder, item: AnswerRecord) { |
16 | - holder.setText(R.id.tv_question_title, "${item.title}(${item.pos.name ?: ""})") | 16 | + holder.setText(R.id.tv_question_title, "${item.title}(${item.title})") |
17 | .setText(R.id.tv_timer, item.create_time_text) | 17 | .setText(R.id.tv_timer, item.create_time_text) |
18 | .setText(R.id.tv_answer, "答对:${item.correct}/${item.count}") | 18 | .setText(R.id.tv_answer, "答对:${item.correct}/${item.count}") |
19 | } | 19 | } |
@@ -7,10 +7,14 @@ import com.br_technology.securitytrain_master.databinding.FragmentSpecialExercis | @@ -7,10 +7,14 @@ import com.br_technology.securitytrain_master.databinding.FragmentSpecialExercis | ||
7 | import com.br_technology.securitytrain_master.expand.addItemDecorationCustom | 7 | import com.br_technology.securitytrain_master.expand.addItemDecorationCustom |
8 | import com.br_technology.securitytrain_master.ui.bean.AnswerRecord | 8 | import com.br_technology.securitytrain_master.ui.bean.AnswerRecord |
9 | import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerRecordDetailsActivity | 9 | import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerRecordDetailsActivity |
10 | +import com.br_technology.securitytrain_master.ui.view.bank.event.ExcerSize | ||
10 | import com.br_technology.securitytrain_master.ui.view.mine.adapter.SpecialExercisesAdapter | 11 | import com.br_technology.securitytrain_master.ui.view.mine.adapter.SpecialExercisesAdapter |
11 | import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SpecialExercisesFragmentViewModel | 12 | import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SpecialExercisesFragmentViewModel |
12 | import com.br_technology.securitytrain_master.util.TranslateUnit | 13 | import com.br_technology.securitytrain_master.util.TranslateUnit |
13 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment | 14 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment |
15 | +import org.greenrobot.eventbus.EventBus | ||
16 | +import org.greenrobot.eventbus.Subscribe | ||
17 | +import org.greenrobot.eventbus.ThreadMode | ||
14 | import kotlin.properties.Delegates | 18 | import kotlin.properties.Delegates |
15 | 19 | ||
16 | /** | 20 | /** |
@@ -24,14 +28,22 @@ class SpecialExercisesFragment | @@ -24,14 +28,22 @@ class SpecialExercisesFragment | ||
24 | FragmentSpecialExercisesBinding::inflate | 28 | FragmentSpecialExercisesBinding::inflate |
25 | ) { | 29 | ) { |
26 | 30 | ||
27 | - | ||
28 | private var page = 1 | 31 | private var page = 1 |
29 | private var type by Delegates.notNull<Int>() | 32 | private var type by Delegates.notNull<Int>() |
30 | private val exercisesAdapter: SpecialExercisesAdapter by lazy { | 33 | private val exercisesAdapter: SpecialExercisesAdapter by lazy { |
31 | SpecialExercisesAdapter() | 34 | SpecialExercisesAdapter() |
32 | } | 35 | } |
33 | 36 | ||
34 | - private val map = hashMapOf(1 to true, 2 to true, 3 to true, 4 to true) | 37 | + override fun onCreate(savedInstanceState: Bundle?) { |
38 | + super.onCreate(savedInstanceState) | ||
39 | + EventBus.getDefault().register(this) | ||
40 | + } | ||
41 | + | ||
42 | + override fun onDestroy() { | ||
43 | + super.onDestroy() | ||
44 | + EventBus.getDefault().unregister(this) | ||
45 | + } | ||
46 | + | ||
35 | override fun initDataObserver() { | 47 | override fun initDataObserver() { |
36 | mViewModel.liveData.observe(this) { | 48 | mViewModel.liveData.observe(this) { |
37 | binding.smartRefresh.finishRefresh() | 49 | binding.smartRefresh.finishRefresh() |
@@ -69,7 +81,7 @@ class SpecialExercisesFragment | @@ -69,7 +81,7 @@ class SpecialExercisesFragment | ||
69 | loadMore() | 81 | loadMore() |
70 | } | 82 | } |
71 | recyclerview.adapter = exercisesAdapter | 83 | recyclerview.adapter = exercisesAdapter |
72 | - exercisesAdapter.setOnItemClickListener { adapter, view, position -> | 84 | + exercisesAdapter.setOnItemClickListener { _, _, position -> |
73 | val intent = Intent(requireContext(), AnswerRecordDetailsActivity::class.java) | 85 | val intent = Intent(requireContext(), AnswerRecordDetailsActivity::class.java) |
74 | intent.putExtra("id", exercisesAdapter.data[position].id) | 86 | intent.putExtra("id", exercisesAdapter.data[position].id) |
75 | startActivity(intent) | 87 | startActivity(intent) |
@@ -85,15 +97,22 @@ class SpecialExercisesFragment | @@ -85,15 +97,22 @@ class SpecialExercisesFragment | ||
85 | binding.smartRefresh.setEnableLoadMore(false) | 97 | binding.smartRefresh.setEnableLoadMore(false) |
86 | } | 98 | } |
87 | 99 | ||
88 | - private fun loadMore(){ | ||
89 | - ++page | 100 | + @Subscribe(threadMode = ThreadMode.MAIN) |
101 | + fun onRankListEvent(event: ExcerSize?) { | ||
102 | + if (event?.type == type) { | ||
103 | + refresh() | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + private fun loadMore() { | ||
108 | + page += 1 | ||
90 | mViewModel.errorSubList(type, page) | 109 | mViewModel.errorSubList(type, page) |
91 | binding.smartRefresh.setEnableRefresh(false) | 110 | binding.smartRefresh.setEnableRefresh(false) |
92 | binding.smartRefresh.setEnableLoadMore(false) | 111 | binding.smartRefresh.setEnableLoadMore(false) |
93 | } | 112 | } |
94 | 113 | ||
95 | - override fun onResume() { | ||
96 | - super.onResume() | 114 | + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
115 | + super.onViewCreated(view, savedInstanceState) | ||
97 | refresh() | 116 | refresh() |
98 | } | 117 | } |
99 | 118 |
@@ -13,8 +13,10 @@ import com.br_technology.securitytrain_master.R | @@ -13,8 +13,10 @@ import com.br_technology.securitytrain_master.R | ||
13 | import com.br_technology.securitytrain_master.expand.loadPic | 13 | import com.br_technology.securitytrain_master.expand.loadPic |
14 | import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder | 14 | import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder |
15 | import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack | 15 | import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack |
16 | +import com.shuyu.gsyvideoplayer.player.IjkPlayerManager | ||
16 | import com.shuyu.gsyvideoplayer.utils.OrientationUtils | 17 | import com.shuyu.gsyvideoplayer.utils.OrientationUtils |
17 | import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer | 18 | import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer |
19 | +import tv.danmaku.ijk.media.player.IjkMediaPlayer | ||
18 | 20 | ||
19 | /** | 21 | /** |
20 | * createTime:2021/8/2 8:57 | 22 | * createTime:2021/8/2 8:57 |
@@ -68,9 +70,24 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | @@ -68,9 +70,24 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | ||
68 | showFull() | 70 | showFull() |
69 | } | 71 | } |
70 | } | 72 | } |
73 | + initPlayer() | ||
71 | mProgressBar.isEnabled = canTouchProgress | 74 | mProgressBar.isEnabled = canTouchProgress |
72 | } | 75 | } |
73 | 76 | ||
77 | + private fun initPlayer() { | ||
78 | + val iPlayerManager = gsyVideoManager.player | ||
79 | + try { | ||
80 | + if (iPlayerManager is IjkPlayerManager) { | ||
81 | + val mediaPlayer = iPlayerManager.mediaPlayer as IjkMediaPlayer | ||
82 | + if (!mediaPlayer.isPlaying) { | ||
83 | + mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1) | ||
84 | + } | ||
85 | + } | ||
86 | + } catch (e: Exception) { | ||
87 | + e.printStackTrace() | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
74 | fun setCantTouch(bool: Boolean) { | 91 | fun setCantTouch(bool: Boolean) { |
75 | canTouchProgress = bool | 92 | canTouchProgress = bool |
76 | mProgressBar.isEnabled = canTouchProgress | 93 | mProgressBar.isEnabled = canTouchProgress |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | android:id="@+id/tab_layout" | 18 | android:id="@+id/tab_layout" |
19 | style="@style/SearchTab" | 19 | style="@style/SearchTab" |
20 | android:layout_width="match_parent" | 20 | android:layout_width="match_parent" |
21 | - android:layout_height="?actionBarSize" | 21 | + android:layout_height="40dp" |
22 | android:overScrollMode="never" | 22 | android:overScrollMode="never" |
23 | app:tabMode="auto" | 23 | app:tabMode="auto" |
24 | app:tabSelectedTextColor="@color/color_252" | 24 | app:tabSelectedTextColor="@color/color_252" |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | 10 | ||
11 | <LinearLayout | 11 | <LinearLayout |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | - android:layout_height="83dp" | 13 | + android:layout_height="wrap_content" |
14 | android:background="@drawable/solid_eff2_4" | 14 | android:background="@drawable/solid_eff2_4" |
15 | android:orientation="vertical"> | 15 | android:orientation="vertical"> |
16 | 16 | ||
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
49 | android:layout_marginStart="52dp" | 49 | android:layout_marginStart="52dp" |
50 | android:layout_marginTop="8dp" | 50 | android:layout_marginTop="8dp" |
51 | + android:layout_marginBottom="16dp" | ||
51 | android:background="@drawable/solid_e3f1ff" | 52 | android:background="@drawable/solid_e3f1ff" |
52 | android:paddingStart="8dp" | 53 | android:paddingStart="8dp" |
53 | android:paddingTop="2dp" | 54 | android:paddingTop="2dp" |
@@ -55,8 +56,5 @@ | @@ -55,8 +56,5 @@ | ||
55 | android:paddingBottom="2dp" | 56 | android:paddingBottom="2dp" |
56 | android:textColor="@color/color_25" | 57 | android:textColor="@color/color_25" |
57 | android:textSize="12sp" /> | 58 | android:textSize="12sp" /> |
58 | - | ||
59 | - | ||
60 | </LinearLayout> | 59 | </LinearLayout> |
61 | - | ||
62 | </LinearLayout> | 60 | </LinearLayout> |
-
请 注册 或 登录 后发表评论