作者 杨谦

1.teacher数据判空

2.添加友盟...todo,preinit,协议等
@@ -66,7 +66,7 @@ dependencies { @@ -66,7 +66,7 @@ dependencies {
66 //smartRefresh 66 //smartRefresh
67 implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' 67 implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1'
68 implementation 'com.scwang.smart:refresh-header-classics:2.0.1' 68 implementation 'com.scwang.smart:refresh-header-classics:2.0.1'
69 - implementation 'com.scwang.smart:refresh-header-material:2.0.3' 69 + implementation 'com.scwang.smart:refresh-header-material:2.0.3'
70 //经典刷新头 70 //经典刷新头
71 implementation 'com.scwang.smart:refresh-footer-classics:2.0.1' 71 implementation 'com.scwang.smart:refresh-footer-classics:2.0.1'
72 implementation 'com.alibaba:fastjson:1.1.68.android' 72 implementation 'com.alibaba:fastjson:1.1.68.android'
@@ -140,4 +140,9 @@ dependencies { @@ -140,4 +140,9 @@ dependencies {
140 implementation 'com.tencent.map:sdk-utilities:1.0.6' 140 implementation 'com.tencent.map:sdk-utilities:1.0.6'
141 implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0' 141 implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0'
142 api 'org.jsoup:jsoup:1.11.3' 142 api 'org.jsoup:jsoup:1.11.3'
  143 +
  144 + //umeng 统计
  145 + implementation 'com.umeng.umsdk:common:9.4.4'
  146 + implementation 'com.umeng.umsdk:asms:1.4.1'
  147 + implementation 'com.umeng.umsdk:apm:1.5.2'
143 } 148 }
@@ -54,3 +54,19 @@ @@ -54,3 +54,19 @@
54 -dontwarn org.eclipse.jdt.annotation.** 54 -dontwarn org.eclipse.jdt.annotation.**
55 -dontwarn c.t.** 55 -dontwarn c.t.**
56 ########################################################## 56 ##########################################################
  57 +
  58 +##########################################################
  59 +-keep class com.umeng.** { *; }
  60 +
  61 +-keep class com.uc.** { *; }
  62 +
  63 +-keep class com.efs.** { *; }
  64 +
  65 +-keepclassmembers class *{
  66 + public<init>(org.json.JSONObject);
  67 +}
  68 +-keepclassmembers enum *{
  69 + publicstatic**[] values();
  70 + publicstatic** valueOf(java.lang.String);
  71 +}
  72 +##########################################################
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 8 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
10 <uses-permission android:name="android.permission.CAMERA" /> 10 <uses-permission android:name="android.permission.CAMERA" />
  11 +
11 <uses-permission 12 <uses-permission
12 android:name="android.permission.WRITE_EXTERNAL_STORAGE" 13 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
13 tools:ignore="ScopedStorage" /> 14 tools:ignore="ScopedStorage" />
@@ -13,6 +13,7 @@ import com.scwang.smart.refresh.layout.SmartRefreshLayout @@ -13,6 +13,7 @@ import com.scwang.smart.refresh.layout.SmartRefreshLayout
13 import com.tencent.map.geolocation.TencentLocationManager 13 import com.tencent.map.geolocation.TencentLocationManager
14 import com.tencent.smtt.sdk.QbSdk 14 import com.tencent.smtt.sdk.QbSdk
15 import com.tencent.smtt.sdk.TbsDownloader 15 import com.tencent.smtt.sdk.TbsDownloader
  16 +import com.umeng.commonsdk.UMConfigure
16 import kotlin.properties.Delegates 17 import kotlin.properties.Delegates
17 18
18 /** 19 /**
@@ -30,6 +31,10 @@ open class BaseApplication : Application() { @@ -30,6 +31,10 @@ open class BaseApplication : Application() {
30 TencentLocationManager.getInstance(this) 31 TencentLocationManager.getInstance(this)
31 } 32 }
32 33
  34 + val APP_KEY = "62224f3a317aa877607f7bdf"
  35 + val APP_SECRET_MASTER = "diydqlsnvtoezjzuqpnbbexinqqe2jdj"
  36 + val APP_UMENG_SECRET_MESSAGE = "812eaaaea656367d90feb94066e9507c"
  37 +
33 override fun onCreate() { 38 override fun onCreate() {
34 super.onCreate() 39 super.onCreate()
35 instance = this 40 instance = this
@@ -42,6 +47,7 @@ open class BaseApplication : Application() { @@ -42,6 +47,7 @@ open class BaseApplication : Application() {
42 QbSdk.initX5Environment(this, object : QbSdk.PreInitCallback { 47 QbSdk.initX5Environment(this, object : QbSdk.PreInitCallback {
43 override fun onCoreInitFinished() { 48 override fun onCoreInitFinished() {
44 } 49 }
  50 +
45 override fun onViewInitFinished(b: Boolean) { 51 override fun onViewInitFinished(b: Boolean) {
46 Log.e("BaseApplication", "dsadasda$b") 52 Log.e("BaseApplication", "dsadasda$b")
47 } 53 }
@@ -50,12 +56,24 @@ open class BaseApplication : Application() { @@ -50,12 +56,24 @@ open class BaseApplication : Application() {
50 if (needDownload) { 56 if (needDownload) {
51 TbsDownloader.startDownload(this); 57 TbsDownloader.startDownload(this);
52 } 58 }
  59 + initUmeng()
53 } 60 }
54 61
55 - 62 + fun initUmeng() {
  63 +// UMConfigure.preInit(this,APP_KEY,"umeng")
  64 + UMConfigure.init(
  65 + this,
  66 + APP_KEY,
  67 + "umeng",
  68 + UMConfigure.DEVICE_TYPE_PHONE,
  69 + APP_UMENG_SECRET_MESSAGE
  70 + );
  71 + UMConfigure.setLogEnabled(true)
  72 + }
56 73
57 companion object { 74 companion object {
58 var instance: BaseApplication by Delegates.notNull() 75 var instance: BaseApplication by Delegates.notNull()
  76 +
59 init { 77 init {
60 SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout -> 78 SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
61 layout.setPrimaryColorsId(R.color.transparent, android.R.color.black) 79 layout.setPrimaryColorsId(R.color.transparent, android.R.color.black)
@@ -74,9 +74,19 @@ class SearchAdapter : BaseMultiItemQuickAdapter<SearchBean, BaseViewHolder>() { @@ -74,9 +74,19 @@ class SearchAdapter : BaseMultiItemQuickAdapter<SearchBean, BaseViewHolder>() {
74 @SuppressLint("SetTextI18n") 74 @SuppressLint("SetTextI18n")
75 private fun initVideo(holder: BaseViewHolder, data: VideoLessonBean.ListBean.DataBean) { 75 private fun initVideo(holder: BaseViewHolder, data: VideoLessonBean.ListBean.DataBean) {
76 holder.apply { 76 holder.apply {
  77 + val head = if (data.teacher != null) {
  78 + data.teacher.avatar
  79 + } else {
  80 + ""
  81 + }
  82 + val name = if (data.teacher != null) {
  83 + data.teacher.name
  84 + } else {
  85 + ""
  86 + }
77 getView<ImageView>(R.id.video_pic).glideRound(data.image, 16) 87 getView<ImageView>(R.id.video_pic).glideRound(data.image, 16)
78 - getView<ImageView>(R.id.head).glideRound(data.teacher.avatar, 16)  
79 - getView<TextView>(R.id.name).text = data.teacher.name 88 + getView<ImageView>(R.id.head).glideRound(head, 16)
  89 + getView<TextView>(R.id.name).text = name
80 getView<TextView>(R.id.course_name).text = data.name 90 getView<TextView>(R.id.course_name).text = data.name
81 getView<TextView>(R.id.lesson).text = "${data.class_hours}课时" 91 getView<TextView>(R.id.lesson).text = "${data.class_hours}课时"
82 } 92 }
1 package com.br_technology.securitytrain_master.ui.view.home.adapter 1 package com.br_technology.securitytrain_master.ui.view.home.adapter
2 2
3 -import android.content.Context  
4 -import android.view.LayoutInflater  
5 -import android.view.ViewGroup  
6 import com.br_technology.securitytrain_master.R 3 import com.br_technology.securitytrain_master.R
7 -import com.br_technology.securitytrain_master.base.view.BaseAdapter  
8 -import com.br_technology.securitytrain_master.databinding.AdapterVideoCourseBinding  
9 -import com.br_technology.securitytrain_master.expand.courseHead  
10 -import com.br_technology.securitytrain_master.expand.glideRound  
11 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean 4 import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
12 -import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse  
13 import com.bumptech.glide.Glide 5 import com.bumptech.glide.Glide
14 import com.bumptech.glide.load.resource.bitmap.RoundedCorners 6 import com.bumptech.glide.load.resource.bitmap.RoundedCorners
15 import com.bumptech.glide.request.RequestOptions 7 import com.bumptech.glide.request.RequestOptions
@@ -23,19 +15,36 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder @@ -23,19 +15,36 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder
23 * des: 15 * des:
24 */ 16 */
25 class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.ListBean.DataBean>?) : 17 class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.ListBean.DataBean>?) :
26 - BaseQuickAdapter<VideoLessonBean.ListBean.DataBean, BaseViewHolder>(layoutResId, data) ,LoadMoreModule{ 18 + BaseQuickAdapter<VideoLessonBean.ListBean.DataBean, BaseViewHolder>(layoutResId, data),
  19 + LoadMoreModule {
27 20
28 override fun convert(holder: BaseViewHolder, item: VideoLessonBean.ListBean.DataBean) { 21 override fun convert(holder: BaseViewHolder, item: VideoLessonBean.ListBean.DataBean) {
29 // 视频首贞图片 22 // 视频首贞图片
30 - Glide.with(context).load(item.image).apply(RequestOptions.bitmapTransform(RoundedCorners(14))).into(holder.getView(R.id.video_pic)) 23 + Glide.with(context).load(item.image)
  24 + .apply(RequestOptions.bitmapTransform(RoundedCorners(14)))
  25 + .into(holder.getView(R.id.video_pic))
31 // 课时 26 // 课时
32 - holder.setText(R.id.lesson,item.class_hours.toString() + "课时") 27 + holder.setText(R.id.lesson, item.class_hours.toString() + "课时")
33 // 视频名称 28 // 视频名称
34 - holder.setText(R.id.course_name,item.name) 29 + holder.setText(R.id.course_name, item.name)
  30 + val teacher = item.teacher;
35 Glide.with(context) 31 Glide.with(context)
36 - .load(item.teacher.avatar) 32 + .load(
  33 + if (teacher == null) {
  34 + ""
  35 + } else {
  36 + teacher.avatar
  37 + }
  38 + )
37 .placeholder(R.mipmap.placeholder_head) 39 .placeholder(R.mipmap.placeholder_head)
38 .into(holder.getView(R.id.head)) 40 .into(holder.getView(R.id.head))
39 - holder.setText(R.id.name,item.teacher.name) 41 + holder.setText(
  42 + R.id.name, if (teacher == null) {
  43 + ""
  44 + } else {
  45 + teacher.name
  46 + }
  47 + )
  48 +
40 } 49 }
41 } 50 }
@@ -14,7 +14,9 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder @@ -14,7 +14,9 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder
14 class ChatRecordAdapter : 14 class ChatRecordAdapter :
15 BaseQuickAdapter<ChatRecordBean, BaseViewHolder>(R.layout.adapter_chat_record) { 15 BaseQuickAdapter<ChatRecordBean, BaseViewHolder>(R.layout.adapter_chat_record) {
16 override fun convert(holder: BaseViewHolder, item: ChatRecordBean) { 16 override fun convert(holder: BaseViewHolder, item: ChatRecordBean) {
17 - holder.setText(R.id.chat_name, item.teacher.name) 17 + holder.setText(
  18 + R.id.chat_name, item.teacher.name
  19 + )
18 .setText(R.id.chat_content, item.last_content) 20 .setText(R.id.chat_content, item.last_content)
19 .setText(R.id.chat_date, item.update_time) 21 .setText(R.id.chat_date, item.update_time)
20 } 22 }
@@ -40,4 +40,4 @@ data class ChatDetailBean( @@ -40,4 +40,4 @@ data class ChatDetailBean(
40 val msg_id: Int, 40 val msg_id: Int,
41 val to_id: Int, 41 val to_id: Int,
42 val update_time: String, override var itemType: Int 42 val update_time: String, override var itemType: Int
43 -):MultiItemEntity  
  43 +) : MultiItemEntity
@@ -5,6 +5,7 @@ buildscript { @@ -5,6 +5,7 @@ buildscript {
5 maven{ 5 maven{
6 url "https://oss.sonatype.org/content/groups/public" 6 url "https://oss.sonatype.org/content/groups/public"
7 } 7 }
  8 + maven { url 'https://repo1.maven.org/maven2/' }
8 maven { url 'https://maven.aliyun.com/repository/apache-snapshots' } 9 maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }
9 maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' } 10 maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' }
10 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } 11 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
@@ -26,6 +27,7 @@ allprojects { @@ -26,6 +27,7 @@ allprojects {
26 maven{ 27 maven{
27 url "https://oss.sonatype.org/content/groups/public" 28 url "https://oss.sonatype.org/content/groups/public"
28 } 29 }
  30 + maven { url 'https://repo1.maven.org/maven2/' }
29 maven { url 'https://maven.aliyun.com/repository/apache-snapshots' } 31 maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }
30 maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' } 32 maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' }
31 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } 33 maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }