正在显示
18 个修改的文件
包含
381 行增加
和
143 行删除
1 | <component name="ProjectCodeStyleConfiguration"> | 1 | <component name="ProjectCodeStyleConfiguration"> |
2 | <code_scheme name="Project" version="173"> | 2 | <code_scheme name="Project" version="173"> |
3 | <JetCodeStyleSettings> | 3 | <JetCodeStyleSettings> |
4 | - <option name="PACKAGES_TO_USE_STAR_IMPORTS"> | ||
5 | - <value> | ||
6 | - <package name="java.util" alias="false" withSubpackages="false" /> | ||
7 | - <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" /> | ||
8 | - <package name="io.ktor" alias="false" withSubpackages="true" /> | ||
9 | - </value> | ||
10 | - </option> | ||
11 | - <option name="PACKAGES_IMPORT_LAYOUT"> | ||
12 | - <value> | ||
13 | - <package name="" alias="false" withSubpackages="true" /> | ||
14 | - <package name="java" alias="false" withSubpackages="true" /> | ||
15 | - <package name="javax" alias="false" withSubpackages="true" /> | ||
16 | - <package name="kotlin" alias="false" withSubpackages="true" /> | ||
17 | - <package name="" alias="true" withSubpackages="true" /> | ||
18 | - </value> | ||
19 | - </option> | ||
20 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> | 4 | <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |
21 | </JetCodeStyleSettings> | 5 | </JetCodeStyleSettings> |
22 | <codeStyleSettings language="XML"> | 6 | <codeStyleSettings language="XML"> |
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 3 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
4 | <output url="file://$PROJECT_DIR$/build/classes" /> | 4 | <output url="file://$PROJECT_DIR$/build/classes" /> |
5 | </component> | 5 | </component> |
6 | <component name="ProjectType"> | 6 | <component name="ProjectType"> |
.idea/runConfigurations.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="RunConfigurationProducerService"> | ||
4 | + <option name="ignoredProducers"> | ||
5 | + <set> | ||
6 | + <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" /> | ||
7 | + </set> | ||
8 | + </option> | ||
9 | + </component> | ||
10 | +</project> |
@@ -72,6 +72,7 @@ | @@ -72,6 +72,7 @@ | ||
72 | <activity android:name=".ui.home.activity.WebViewActivity" /> | 72 | <activity android:name=".ui.home.activity.WebViewActivity" /> |
73 | <activity android:name=".ui.home.activity.TextCourseActivity" /> | 73 | <activity android:name=".ui.home.activity.TextCourseActivity" /> |
74 | <activity android:name=".ui.home.activity.TextDetailActivity" /> | 74 | <activity android:name=".ui.home.activity.TextDetailActivity" /> |
75 | + <activity android:name=".ui.home.activity.OnlineActivity" /> | ||
75 | 76 | ||
76 | 77 | ||
77 | </application> | 78 | </application> |
1 | package com.wjx.android.wanandroidmvvm.base.view | 1 | package com.wjx.android.wanandroidmvvm.base.view |
2 | 2 | ||
3 | 3 | ||
4 | +import android.app.Activity | ||
5 | +import android.content.Intent | ||
4 | import android.os.Bundle | 6 | import android.os.Bundle |
5 | import android.text.TextUtils | 7 | import android.text.TextUtils |
6 | import android.view.LayoutInflater | 8 | import android.view.LayoutInflater |
@@ -27,7 +29,8 @@ import com.wjx.android.wanandroidmvvm.common.callback.LoadingCallBack | @@ -27,7 +29,8 @@ import com.wjx.android.wanandroidmvvm.common.callback.LoadingCallBack | ||
27 | * Time: 16:36 | 29 | * Time: 16:36 |
28 | */ | 30 | */ |
29 | 31 | ||
30 | -abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>,VB : ViewBinding>(private val inflate: (LayoutInflater, ViewGroup?, Boolean) -> VB | 32 | +abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>, VB : ViewBinding>( |
33 | + private val inflate: (LayoutInflater, ViewGroup?, Boolean) -> VB | ||
31 | ) : BaseFragment() { | 34 | ) : BaseFragment() { |
32 | protected lateinit var mViewModel: VM | 35 | protected lateinit var mViewModel: VM |
33 | private var _binding: VB? = null | 36 | private var _binding: VB? = null |
@@ -114,4 +117,15 @@ abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>,VB : ViewBinding>(pri | @@ -114,4 +117,15 @@ abstract class BaseLifeCycleFragment<VM : BaseViewModel<*>,VB : ViewBinding>(pri | ||
114 | _binding = null | 117 | _binding = null |
115 | } | 118 | } |
116 | 119 | ||
120 | + protected fun startActivity(cls: Class<out Activity>) { | ||
121 | + startActivity(cls, null) | ||
122 | + } | ||
123 | + | ||
124 | + private fun startActivity(cls: Class<out Activity>, bundle: Bundle?) { | ||
125 | + val intent = Intent(requireActivity(), cls) | ||
126 | + if (bundle != null) { | ||
127 | + intent.putExtras(bundle) | ||
128 | + } | ||
129 | + startActivity(intent) | ||
130 | + } | ||
117 | } | 131 | } |
@@ -27,6 +27,13 @@ fun View.screenWidth(): Int { | @@ -27,6 +27,13 @@ fun View.screenWidth(): Int { | ||
27 | manager.defaultDisplay.getRealSize(point) | 27 | manager.defaultDisplay.getRealSize(point) |
28 | return point.x | 28 | return point.x |
29 | } | 29 | } |
30 | +fun View.screenHeight(): Int { | ||
31 | + val manager: WindowManager = | ||
32 | + this.context.getSystemService(Context.WINDOW_SERVICE) as WindowManager | ||
33 | + val point = Point() | ||
34 | + manager.defaultDisplay.getRealSize(point) | ||
35 | + return point.y | ||
36 | +} | ||
30 | 37 | ||
31 | fun RecyclerView.addItemDecoration(spanCount: Int, spacing: Int) { | 38 | fun RecyclerView.addItemDecoration(spanCount: Int, spacing: Int) { |
32 | this.addItemDecoration(object : RecyclerView.ItemDecoration() { | 39 | this.addItemDecoration(object : RecyclerView.ItemDecoration() { |
app/src/main/java/com/br_technology/securitytrain_master/ui/home/activity/OnlineActivity.kt
0 → 100644
1 | +package com.br_technology.securitytrain_master.ui.home.activity | ||
2 | + | ||
3 | +import android.os.Bundle | ||
4 | +import com.br_technology.securitytrain_master.R | ||
5 | +import com.br_technology.securitytrain_master.databinding.ActivityOnlineBinding | ||
6 | +import com.br_technology.securitytrain_master.ui.home.adapter.VideoCourseAdapter | ||
7 | +import com.br_technology.securitytrain_master.ui.home.pojo.VideoCourse | ||
8 | +import com.br_technology.securitytrain_master.ui.home.viewmodel.OnlineViewModel | ||
9 | +import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | ||
10 | + | ||
11 | +/** | ||
12 | + * createTime:2021/7/30 8:53 | ||
13 | + * auth:张继 | ||
14 | + * des:在线课程 | ||
15 | + */ | ||
16 | +class OnlineActivity : | ||
17 | + BaseLifeCycleActivity<OnlineViewModel, ActivityOnlineBinding>(ActivityOnlineBinding::inflate) { | ||
18 | + override fun onCreate(savedInstanceState: Bundle?) { | ||
19 | + super.onCreate(savedInstanceState) | ||
20 | + binding.apply { | ||
21 | + val videoCourseAdapter = VideoCourseAdapter() | ||
22 | + val list = mutableListOf( | ||
23 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
24 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
25 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
26 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
27 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
28 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
29 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
30 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
31 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
32 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
33 | + ) | ||
34 | + onlineRecycler.adapter = videoCourseAdapter | ||
35 | + videoCourseAdapter.addList(list) | ||
36 | + } | ||
37 | + } | ||
38 | + override fun initDataObserver() { | ||
39 | + | ||
40 | + } | ||
41 | +} |
@@ -13,6 +13,7 @@ import com.br_technology.securitytrain_master.ui.home.adapter.ResultAdapter | @@ -13,6 +13,7 @@ import com.br_technology.securitytrain_master.ui.home.adapter.ResultAdapter | ||
13 | import com.br_technology.securitytrain_master.ui.home.adapter.TextCourseTypeAdapter | 13 | import com.br_technology.securitytrain_master.ui.home.adapter.TextCourseTypeAdapter |
14 | import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData | 14 | import com.br_technology.securitytrain_master.ui.home.pojo.RecommendData |
15 | import com.br_technology.securitytrain_master.ui.home.viewmodel.TextCourseViewModel | 15 | import com.br_technology.securitytrain_master.ui.home.viewmodel.TextCourseViewModel |
16 | +import com.br_technology.securitytrain_master.view.ClassifyPop | ||
16 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener | 17 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener |
17 | import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener | 18 | import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener |
18 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | 19 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity |
@@ -24,6 +25,13 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | @@ -24,6 +25,13 @@ import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | ||
24 | */ | 25 | */ |
25 | class TextCourseActivity : | 26 | class TextCourseActivity : |
26 | BaseLifeCycleActivity<TextCourseViewModel, ActivityTextCourseBinding>(ActivityTextCourseBinding::inflate) { | 27 | BaseLifeCycleActivity<TextCourseViewModel, ActivityTextCourseBinding>(ActivityTextCourseBinding::inflate) { |
28 | + | ||
29 | + | ||
30 | + | ||
31 | + private val classifyPop by lazy { | ||
32 | + ClassifyPop(this) | ||
33 | + } | ||
34 | + | ||
27 | override fun onCreate(savedInstanceState: Bundle?) { | 35 | override fun onCreate(savedInstanceState: Bundle?) { |
28 | super.onCreate(savedInstanceState) | 36 | super.onCreate(savedInstanceState) |
29 | binding.apply { | 37 | binding.apply { |
@@ -36,7 +44,10 @@ class TextCourseActivity : | @@ -36,7 +44,10 @@ class TextCourseActivity : | ||
36 | ) | 44 | ) |
37 | toolBar.addRightListener(object : ToolBarClickListener { | 45 | toolBar.addRightListener(object : ToolBarClickListener { |
38 | override fun onClick(view: View) { | 46 | override fun onClick(view: View) { |
39 | - courseTypeGroup.visibility = View.VISIBLE | 47 | +// courseTypeGroup.visibility = View.VISIBLE |
48 | + if (!classifyPop.isShowing) { | ||
49 | + classifyPop.showAsDropDown(view) | ||
50 | + } | ||
40 | } | 51 | } |
41 | }) | 52 | }) |
42 | 53 |
@@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView | @@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView | ||
13 | import com.br_technology.securitytrain_master.R | 13 | import com.br_technology.securitytrain_master.R |
14 | import com.br_technology.securitytrain_master.databinding.FragmentHomeBinding | 14 | import com.br_technology.securitytrain_master.databinding.FragmentHomeBinding |
15 | import com.br_technology.securitytrain_master.ui.home.activity.DatabaseActivity | 15 | import com.br_technology.securitytrain_master.ui.home.activity.DatabaseActivity |
16 | +import com.br_technology.securitytrain_master.ui.home.activity.OnlineActivity | ||
16 | import com.br_technology.securitytrain_master.ui.home.activity.SearchActivity | 17 | import com.br_technology.securitytrain_master.ui.home.activity.SearchActivity |
17 | import com.br_technology.securitytrain_master.ui.home.activity.TextCourseActivity | 18 | import com.br_technology.securitytrain_master.ui.home.activity.TextCourseActivity |
18 | import com.br_technology.securitytrain_master.ui.home.adapter.RecommendDataAdapter | 19 | import com.br_technology.securitytrain_master.ui.home.adapter.RecommendDataAdapter |
@@ -36,126 +37,149 @@ import com.youth.banner.indicator.CircleIndicator | @@ -36,126 +37,149 @@ import com.youth.banner.indicator.CircleIndicator | ||
36 | * auth:张继 | 37 | * auth:张继 |
37 | * des: | 38 | * des: |
38 | */ | 39 | */ |
39 | -class HomeFragment : BaseLifeCycleFragment<MineViewModel,FragmentHomeBinding>(FragmentHomeBinding::inflate) { | 40 | +class HomeFragment : |
41 | + BaseLifeCycleFragment<MineViewModel, FragmentHomeBinding>(FragmentHomeBinding::inflate) { | ||
40 | override fun initDataObserver() { | 42 | override fun initDataObserver() { |
41 | 43 | ||
42 | } | 44 | } |
43 | 45 | ||
46 | + override fun initData() { | ||
47 | + super.initData() | ||
48 | + binding.apply { | ||
49 | + //搜索 | ||
50 | + search.setOnClickListener { | ||
51 | + startActivity(SearchActivity::class.java) | ||
52 | + } | ||
53 | + banner.setAdapter(object : BannerImageAdapter<Int>( | ||
54 | + mutableListOf( | ||
55 | + R.mipmap.banner, | ||
56 | + R.mipmap.banner, | ||
57 | + R.mipmap.banner | ||
58 | + ) | ||
59 | + ) { | ||
60 | + override fun onBindView( | ||
61 | + holder: BannerImageHolder, | ||
62 | + data: Int, | ||
63 | + position: Int, | ||
64 | + size: Int | ||
65 | + ) { | ||
66 | + Glide.with(requireActivity()) | ||
67 | + .load(data) | ||
68 | + .apply(RequestOptions.bitmapTransform(RoundedCorners(8))) | ||
69 | + .into(holder.imageView) | ||
70 | + | ||
71 | + } | ||
72 | + }).addBannerLifecycleObserver(requireActivity()) | ||
73 | + .indicator = CircleIndicator(requireContext()) | ||
74 | + | ||
75 | + | ||
76 | + // 共享资料库 | ||
77 | + database.setOnClickListener { | ||
78 | + startActivity(DatabaseActivity::class.java) | ||
79 | + } | ||
80 | + | ||
81 | + // 共享资料库 | ||
82 | + txtCourse.setOnClickListener { | ||
83 | + startActivity(TextCourseActivity::class.java) | ||
84 | + } | ||
85 | + // 在线课程 | ||
86 | + onlineCourse.setOnClickListener { | ||
87 | + startActivity(OnlineActivity::class.java) | ||
88 | + } | ||
89 | + | ||
90 | + // 视频课程 | ||
91 | + videoCourse.addItemDecoration(object : RecyclerView.ItemDecoration() { | ||
92 | + override fun getItemOffsets( | ||
93 | + outRect: Rect, | ||
94 | + view: View, | ||
95 | + parent: RecyclerView, | ||
96 | + state: RecyclerView.State | ||
97 | + ) { | ||
98 | + super.getItemOffsets(outRect, view, parent, state) | ||
99 | + if (parent.getChildAdapterPosition(view) % 2 == 0) { | ||
100 | + outRect.top = 24 | ||
101 | + outRect.right = 15 | ||
102 | + } else { | ||
103 | + outRect.top = 24 | ||
104 | + outRect.left = 15 | ||
105 | + } | ||
106 | + } | ||
107 | + }) | ||
108 | + val videoCourseAdapter = VideoCourseAdapter() | ||
109 | + val list = mutableListOf( | ||
110 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
111 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
112 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
113 | + VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
114 | + ) | ||
115 | + videoCourse.adapter = videoCourseAdapter | ||
116 | + videoCourseAdapter.addList(list) | ||
117 | + | ||
118 | + val recommendDataAdapter = RecommendDataAdapter() | ||
119 | + val recommendList = mutableListOf( | ||
120 | + RecommendData( | ||
121 | + R.mipmap.banner, | ||
122 | + "思维导图高分作文法(高中)议论", | ||
123 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
124 | + ), | ||
125 | + RecommendData( | ||
126 | + R.mipmap.banner, | ||
127 | + "思维导图高分作文法(高中)议论", | ||
128 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
129 | + ), | ||
130 | + RecommendData( | ||
131 | + R.mipmap.banner, | ||
132 | + "思维导图高分作文法(高中)议论", | ||
133 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
134 | + ), | ||
135 | + RecommendData( | ||
136 | + R.mipmap.banner, | ||
137 | + "思维导图高分作文法(高中)议论", | ||
138 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
139 | + ), | ||
140 | + RecommendData( | ||
141 | + R.mipmap.banner, | ||
142 | + "思维导图高分作文法(高中)议论", | ||
143 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
144 | + ), | ||
145 | + RecommendData( | ||
146 | + R.mipmap.banner, | ||
147 | + "思维导图高分作文法(高中)议论", | ||
148 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
149 | + ), | ||
150 | + RecommendData( | ||
151 | + R.mipmap.banner, | ||
152 | + "思维导图高分作文法(高中)议论", | ||
153 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
154 | + ), | ||
155 | + RecommendData( | ||
156 | + R.mipmap.banner, | ||
157 | + "思维导图高分作文法(高中)议论", | ||
158 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
159 | + ), | ||
160 | + RecommendData( | ||
161 | + R.mipmap.banner, | ||
162 | + "思维导图高分作文法(高中)议论", | ||
163 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
164 | + ), | ||
165 | + RecommendData( | ||
166 | + R.mipmap.banner, | ||
167 | + "思维导图高分作文法(高中)议论", | ||
168 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
169 | + ), | ||
170 | + RecommendData( | ||
171 | + R.mipmap.banner, | ||
172 | + "思维导图高分作文法(高中)议论", | ||
173 | + "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么" | ||
174 | + ), | ||
175 | + ) | ||
176 | + recommendedData.adapter = recommendDataAdapter | ||
177 | + recommendDataAdapter.addList(recommendList) | ||
178 | + | ||
179 | + | ||
180 | + } | ||
181 | + | ||
182 | + | ||
183 | + } | ||
184 | + | ||
44 | } | 185 | } |
45 | -//class HomeFragment : Fragment() { | ||
46 | -// override fun onCreateView( | ||
47 | -// inflater: LayoutInflater, | ||
48 | -// container: ViewGroup?, | ||
49 | -// savedInstanceState: Bundle? | ||
50 | -// ): View? { | ||
51 | -// return inflater.inflate(R.layout.fragment_home, container, false) | ||
52 | -// } | ||
53 | -// | ||
54 | -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
55 | -// super.onViewCreated(view, savedInstanceState) | ||
56 | -// | ||
57 | -// | ||
58 | -// val banner: Banner<Int, BannerImageAdapter<Int>> = view.findViewById(R.id.banner) | ||
59 | -// banner.setAdapter(object : BannerImageAdapter<Int>( | ||
60 | -// mutableListOf( | ||
61 | -// R.mipmap.banner, | ||
62 | -// R.mipmap.banner, | ||
63 | -// R.mipmap.banner | ||
64 | -// ) | ||
65 | -// ) { | ||
66 | -// override fun onBindView( | ||
67 | -// holder: BannerImageHolder, | ||
68 | -// data: Int, | ||
69 | -// position: Int, | ||
70 | -// size: Int | ||
71 | -// ) { | ||
72 | -// Glide.with(requireActivity()) | ||
73 | -// .load(data) | ||
74 | -// .apply(RequestOptions.bitmapTransform(RoundedCorners(8))) | ||
75 | -// .into(holder.imageView) | ||
76 | -// | ||
77 | -// } | ||
78 | -// }).addBannerLifecycleObserver(this) | ||
79 | -// .indicator = CircleIndicator(requireContext()) | ||
80 | -// | ||
81 | -// // 共享资料库 | ||
82 | -// view.findViewById<TextView>(R.id.database).setOnClickListener { | ||
83 | -// startActivity(DatabaseActivity::class.java) | ||
84 | -// } | ||
85 | -// | ||
86 | -// // 共享资料库 | ||
87 | -// view.findViewById<TextView>(R.id.txt_course).setOnClickListener { | ||
88 | -// startActivity(TextCourseActivity::class.java) | ||
89 | -// } | ||
90 | -// // 在线课程 | ||
91 | -// view.findViewById<TextView>(R.id.online_course).setOnClickListener { | ||
92 | -//// startActivity() | ||
93 | -// } | ||
94 | -// | ||
95 | -// // 视频课程 | ||
96 | -// val videoCourse: RecyclerView = view.findViewById(R.id.video_course) | ||
97 | -// videoCourse.addItemDecoration(object : RecyclerView.ItemDecoration() { | ||
98 | -// override fun getItemOffsets( | ||
99 | -// outRect: Rect, | ||
100 | -// view: View, | ||
101 | -// parent: RecyclerView, | ||
102 | -// state: RecyclerView.State | ||
103 | -// ) { | ||
104 | -// super.getItemOffsets(outRect, view, parent, state) | ||
105 | -// if (parent.getChildAdapterPosition(view) % 2 == 0) { | ||
106 | -// outRect.top = 24 | ||
107 | -// outRect.right = 15 | ||
108 | -// } else { | ||
109 | -// outRect.top = 24 | ||
110 | -// outRect.left = 15 | ||
111 | -// } | ||
112 | -// } | ||
113 | -// }) | ||
114 | -// val videoCourseAdapter = VideoCourseAdapter() | ||
115 | -// val list = mutableListOf( | ||
116 | -// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
117 | -// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
118 | -// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
119 | -// VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"), | ||
120 | -// ) | ||
121 | -// videoCourse.adapter = videoCourseAdapter | ||
122 | -// videoCourseAdapter.addList(list) | ||
123 | -// | ||
124 | -// val recommendData: RecyclerView = view.findViewById(R.id.recommended_data) | ||
125 | -// val recommendDataAdapter = RecommendDataAdapter() | ||
126 | -// val recommendList = mutableListOf( | ||
127 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
128 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
129 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
130 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
131 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
132 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
133 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
134 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
135 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
136 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
137 | -// RecommendData(R.mipmap.banner, "思维导图高分作文法(高中)议论", "从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"), | ||
138 | -// ) | ||
139 | -// recommendData.adapter = recommendDataAdapter | ||
140 | -// recommendDataAdapter.addList(recommendList) | ||
141 | -// | ||
142 | -// | ||
143 | -// view.findViewById<View>(R.id.search).setOnClickListener { | ||
144 | -// val intent = Intent(requireActivity(), SearchActivity::class.java) | ||
145 | -// startActivity(intent) | ||
146 | -// } | ||
147 | -// } | ||
148 | -// | ||
149 | -// | ||
150 | -// private fun startActivity(cls: Class<out Activity>) { | ||
151 | -// startActivity(cls, null) | ||
152 | -// } | ||
153 | -// | ||
154 | -// private fun startActivity(cls: Class<out Activity>, bundle: Bundle?) { | ||
155 | -// val intent = Intent(requireActivity(), cls) | ||
156 | -// if (bundle != null) { | ||
157 | -// intent.putExtras(bundle) | ||
158 | -// } | ||
159 | -// startActivity(intent) | ||
160 | -// } | ||
161 | -//} |
app/src/main/java/com/br_technology/securitytrain_master/ui/home/repository/OnlineRepository.kt
0 → 100644
1 | +package com.br_technology.securitytrain_master.ui.home.repository | ||
2 | + | ||
3 | +import androidx.lifecycle.MutableLiveData | ||
4 | +import com.br_technology.securitytrain_master.base.common.State | ||
5 | +import com.wjx.android.wanandroidmvvm.base.repository.ApiRepository | ||
6 | + | ||
7 | +/** | ||
8 | + * createTime:2021/7/29 15:20 | ||
9 | + * auth:张继 | ||
10 | + * des: | ||
11 | + */ | ||
12 | +class OnlineRepository(val loadState: MutableLiveData<State>): ApiRepository() { | ||
13 | +} |
app/src/main/java/com/br_technology/securitytrain_master/ui/home/viewmodel/OnlineViewModel.kt
0 → 100644
1 | +package com.br_technology.securitytrain_master.ui.home.viewmodel | ||
2 | + | ||
3 | +import com.br_technology.securitytrain_master.ui.home.repository.OnlineRepository | ||
4 | +import com.br_technology.securitytrain_master.ui.home.repository.TextDetailRepository | ||
5 | +import com.wjx.android.wanandroidmvvm.base.viewmodel.BaseViewModel | ||
6 | + | ||
7 | +/** | ||
8 | + * createTime:2021/7/27 15:48 | ||
9 | + * auth:张继 | ||
10 | + * des: | ||
11 | + */ | ||
12 | +class OnlineViewModel:BaseViewModel<OnlineRepository>() { | ||
13 | +} |
@@ -19,8 +19,6 @@ class MainActivity : | @@ -19,8 +19,6 @@ class MainActivity : | ||
19 | override fun onCreate(savedInstanceState: Bundle?) { | 19 | override fun onCreate(savedInstanceState: Bundle?) { |
20 | super.onCreate(savedInstanceState) | 20 | super.onCreate(savedInstanceState) |
21 | 21 | ||
22 | - ImmersionBar.with(this).statusBarColor(R.color.color_25).init() | ||
23 | - | ||
24 | val list = listOf(HomeFragment(), BankFragment(), MineFragment()) | 22 | val list = listOf(HomeFragment(), BankFragment(), MineFragment()) |
25 | 23 | ||
26 | // 初始化适配器 | 24 | // 初始化适配器 |
@@ -47,9 +45,6 @@ class MainActivity : | @@ -47,9 +45,6 @@ class MainActivity : | ||
47 | } | 45 | } |
48 | 46 | ||
49 | override fun initDataObserver() { | 47 | override fun initDataObserver() { |
50 | -// mViewModel.liveData.observe(this) { | ||
51 | -// mainAdapter.addData(it) | ||
52 | -// } | ||
53 | } | 48 | } |
54 | 49 | ||
55 | } | 50 | } |
1 | +package com.br_technology.securitytrain_master.view | ||
2 | + | ||
3 | +import android.app.Activity | ||
4 | +import android.content.Context | ||
5 | +import android.view.LayoutInflater | ||
6 | +import android.widget.PopupWindow | ||
7 | +import androidx.core.content.ContextCompat | ||
8 | +import com.br_technology.securitytrain_master.R | ||
9 | +import com.br_technology.securitytrain_master.databinding.PopClassifyBinding | ||
10 | +import com.br_technology.securitytrain_master.expand.addItemDecoration | ||
11 | +import com.br_technology.securitytrain_master.expand.screenWidth | ||
12 | +import com.br_technology.securitytrain_master.ui.home.adapter.TextCourseTypeAdapter | ||
13 | +import com.br_technology.securitytrain_master.view.listener.OnItemClickListener | ||
14 | + | ||
15 | +/** | ||
16 | + * createTime:2021/7/30 9:25 | ||
17 | + * auth:张继 | ||
18 | + * des: | ||
19 | + */ | ||
20 | +class ClassifyPop(context: Activity) : PopupWindow(context) { | ||
21 | + | ||
22 | + private val binding by lazy { | ||
23 | + PopClassifyBinding.inflate(LayoutInflater.from(context)) | ||
24 | + } | ||
25 | + | ||
26 | + init { | ||
27 | + contentView = binding.root | ||
28 | + width = contentView.screenWidth() | ||
29 | + height = height | ||
30 | + setBackgroundDrawable(ContextCompat.getDrawable(context, R.color.white)) | ||
31 | + | ||
32 | + | ||
33 | + binding.apply { | ||
34 | + courseType.addItemDecoration(3, 14) | ||
35 | + val list = listOf( | ||
36 | + "测试", | ||
37 | + "岗位1", | ||
38 | + "岗位2", | ||
39 | + "岗位3", | ||
40 | + "gangw4", | ||
41 | + "岗位5", | ||
42 | + "岗位6", | ||
43 | + "岗位8", | ||
44 | + "岗位7", | ||
45 | + "岗位9", | ||
46 | + ) | ||
47 | + val textCourseTypeAdapter = TextCourseTypeAdapter() | ||
48 | + textCourseTypeAdapter.addListener(object : OnItemClickListener<String> { | ||
49 | + override fun onClick(position: Int, data: String) { | ||
50 | + textCourseTypeAdapter.index = position | ||
51 | + textCourseTypeAdapter.notifyDataSetChanged() | ||
52 | + } | ||
53 | + }) | ||
54 | + courseType.adapter = textCourseTypeAdapter | ||
55 | + textCourseTypeAdapter.addList(list) | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + | ||
60 | +} |
app/src/main/res/layout/activity_online.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="match_parent" | ||
6 | + android:orientation="vertical"> | ||
7 | + | ||
8 | + <include layout="@layout/layout_tool_bar" /> | ||
9 | + | ||
10 | + <com.br_technology.securitytrain_master.view.ViewToolBar | ||
11 | + android:id="@+id/tool_bar" | ||
12 | + android:layout_width="match_parent" | ||
13 | + android:layout_height="wrap_content" /> | ||
14 | + | ||
15 | + <androidx.recyclerview.widget.RecyclerView | ||
16 | + android:id="@+id/online_recycler" | ||
17 | + android:layout_width="match_parent" | ||
18 | + android:layout_height="match_parent" | ||
19 | + android:layout_marginStart="16dp" | ||
20 | + android:layout_marginEnd="16dp" | ||
21 | + android:overScrollMode="never" | ||
22 | + android:paddingTop="16dp" | ||
23 | + android:scrollbars="none" | ||
24 | + app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | ||
25 | + app:spanCount="2" /> | ||
26 | +</LinearLayout> |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | android:orientation="vertical"> | 7 | android:orientation="vertical"> |
8 | 8 | ||
9 | + <include layout="@layout/layout_tool_bar_theme" /> | ||
9 | <LinearLayout | 10 | <LinearLayout |
10 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
11 | android:layout_height="?actionBarSize" | 12 | android:layout_height="?actionBarSize" |
app/src/main/res/layout/pop_classify.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="match_parent" | ||
6 | + android:background="@color/white" | ||
7 | + android:orientation="vertical"> | ||
8 | + | ||
9 | + <androidx.recyclerview.widget.RecyclerView | ||
10 | + android:id="@+id/course_type" | ||
11 | + android:layout_width="match_parent" | ||
12 | + android:layout_height="0dp" | ||
13 | + android:layout_marginBottom="8dp" | ||
14 | + android:layout_weight="1" | ||
15 | + android:overScrollMode="never" | ||
16 | + android:paddingStart="16dp" | ||
17 | + android:paddingEnd="16dp" | ||
18 | + android:scrollbars="none" | ||
19 | + app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | ||
20 | + app:spanCount="3" /> | ||
21 | + | ||
22 | + <TextView | ||
23 | + android:id="@+id/complete" | ||
24 | + android:layout_width="match_parent" | ||
25 | + android:layout_height="40dp" | ||
26 | + android:layout_margin="16dp" | ||
27 | + android:background="@drawable/solid_25_4" | ||
28 | + android:gravity="center" | ||
29 | + android:text="完成" | ||
30 | + android:textColor="@color/white" | ||
31 | + android:textSize="15sp" /> | ||
32 | +</LinearLayout> |
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME | @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME | ||
3 | distributionPath=wrapper/dists | 3 | distributionPath=wrapper/dists |
4 | zipStoreBase=GRADLE_USER_HOME | 4 | zipStoreBase=GRADLE_USER_HOME |
5 | zipStorePath=wrapper/dists | 5 | zipStorePath=wrapper/dists |
6 | -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip | 6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip |
-
请 注册 或 登录 后发表评论