作者 杨谦

1.teacher数据判空

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