| package com.xkl.cdl.data.bean.course | package com.xkl.cdl.data.bean.course | ||||
| import android.os.Parcel | |||||
| import android.os.Parcelable | |||||
| import androidx.databinding.BaseObservable | import androidx.databinding.BaseObservable | ||||
| import androidx.databinding.Bindable | import androidx.databinding.Bindable | ||||
| import com.xkl.cdl.BR | import com.xkl.cdl.BR | ||||
| var downLoadZipUrl : String = "" //压缩包下载地址 | var downLoadZipUrl : String = "" //压缩包下载地址 | ||||
| var isDown = false //是否下载 | var isDown = false //是否下载 | ||||
| //阶段id | |||||
| var stageId = 0 | |||||
| //年级id | |||||
| var gradeId = 0 | |||||
| //在CourseManger中的subjectWithCoursePackMap对应subject下的list中所在的位置 | //在CourseManger中的subjectWithCoursePackMap对应subject下的list中所在的位置 | ||||
| field = value | field = value | ||||
| notifyPropertyChanged(BR.reviewNumber) | notifyPropertyChanged(BR.reviewNumber) | ||||
| } | } | ||||
| override fun equals(other : Any?) : Boolean { | |||||
| if (this === other) return true | |||||
| if (javaClass != other?.javaClass) return false | |||||
| other as CoursePack | |||||
| if (coursePackId != other.coursePackId) return false | |||||
| if (coursePackName != other.coursePackName) return false | |||||
| if (cover != other.cover) return false | |||||
| if (summary != other.summary) return false | |||||
| if (subjectId != other.subjectId) return false | |||||
| if (coursePackType != other.coursePackType) return false | |||||
| if (inCoursePackPosition != other.inCoursePackPosition) return false | |||||
| if (childrenCourses != other.childrenCourses) return false | |||||
| if (learnProgress != other.learnProgress) return false | |||||
| return true | |||||
| } | |||||
| override fun hashCode() : Int { | override fun hashCode() : Int { | ||||
| var result = coursePackId.hashCode() | var result = coursePackId.hashCode() | ||||
| result = 31 * result + coursePackName.hashCode() | result = 31 * result + coursePackName.hashCode() | ||||
| result = 31 * result + cover.hashCode() | |||||
| result = 31 * result + summary.hashCode() | result = 31 * result + summary.hashCode() | ||||
| result = 31 * result + subjectId | result = 31 * result + subjectId | ||||
| result = 31 * result + coursePackType | result = 31 * result + coursePackType | ||||
| result = 31 * result + cover.hashCode() | |||||
| result = 31 * result + downLoadZipUrl.hashCode() | |||||
| result = 31 * result + isDown.hashCode() | |||||
| result = 31 * result + stageId | |||||
| result = 31 * result + gradeId | |||||
| result = 31 * result + inCoursePackPosition | result = 31 * result + inCoursePackPosition | ||||
| result = 31 * result + childrenCourses.hashCode() | result = 31 * result + childrenCourses.hashCode() | ||||
| result = 31 * result + learnProgress.hashCode() | |||||
| return result | return result | ||||
| } | } | ||||
| } | } |
| } | } | ||||
| override fun onDestroy() { | override fun onDestroy() { | ||||
| mPlayer?.setCompletionListener(null) | |||||
| mPlayer?.setOnStopListener(null) | |||||
| mPlayer?.setPlayingListener(null) | |||||
| mPlayer?.release() | mPlayer?.release() | ||||
| super.onDestroy() | super.onDestroy() | ||||
| } | } |
| package com.xkl.cdl.module.splash | package com.xkl.cdl.module.splash | ||||
| import android.os.Handler | |||||
| import androidx.lifecycle.MutableLiveData | import androidx.lifecycle.MutableLiveData | ||||
| import com.suliang.common.base.viewmodel.BaseViewModel | import com.suliang.common.base.viewmodel.BaseViewModel | ||||
| import com.suliang.common.util.LogUtil | import com.suliang.common.util.LogUtil | ||||
| import okhttp3.Request | import okhttp3.Request | ||||
| import okhttp3.RequestBody.Companion.toRequestBody | import okhttp3.RequestBody.Companion.toRequestBody | ||||
| import okhttp3.Response | import okhttp3.Response | ||||
| import org.json.JSONException | |||||
| import org.json.JSONObject | import org.json.JSONObject | ||||
| import java.io.* | import java.io.* | ||||
| import java.util.zip.ZipEntry | import java.util.zip.ZipEntry | ||||
| }) | }) | ||||
| } | } | ||||
| @Throws(JSONException::class) | |||||
| private fun decodeBinderCourseJson(json : String) : MutableList<CoursePack>? { | private fun decodeBinderCourseJson(json : String) : MutableList<CoursePack>? { | ||||
| if (json.isEmpty()) return null | if (json.isEmpty()) return null | ||||
| val result = mutableListOf<CoursePack>() | val result = mutableListOf<CoursePack>() | ||||
| //定义课程包 | //定义课程包 | ||||
| val coursePack = CoursePack(coursePackId, coursePackName, summary, subject_id, coursePackType) | val coursePack = CoursePack(coursePackId, coursePackName, summary, subject_id, coursePackType) | ||||
| coursePack.gradeId = cp.getInt("grade_id") | |||||
| coursePack.stageId = cp.getInt("stage_id") | |||||
| //定义课程列表集合 | //定义课程列表集合 | ||||
| val courseList = mutableListOf<Course>() | val courseList = mutableListOf<Course>() | ||||
| val courseMap = mutableMapOf<Int, Course>() // key : typeId value : Course | val courseMap = mutableMapOf<Int, Course>() // key : typeId value : Course | ||||
| coursePack.childrenCourses = courseList | coursePack.childrenCourses = courseList | ||||
| result.add(coursePack) | result.add(coursePack) | ||||
| } | } | ||||
| //排序 | |||||
| result.sortWith { o1, o2 -> | |||||
| var compareResult = o2.stageId.compareTo(o1.stageId) | |||||
| if (compareResult == 0) { | |||||
| compareResult = o2.gradeId.compareTo(o1.gradeId) | |||||
| } | |||||
| compareResult | |||||
| } | |||||
| return result | return result | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| //课程排序 | |||||
| // englishCoursePack.sortBy { | |||||
| // it. | |||||
| // } | |||||
| // | |||||
| CourseManager.subjectWithCoursePackMap[AppConstants.SUBJECT_ENGLISH] = englishCoursePack.toList() | CourseManager.subjectWithCoursePackMap[AppConstants.SUBJECT_ENGLISH] = englishCoursePack.toList() | ||||
| CourseManager.subjectWithCoursePackMap[AppConstants.SUBJECT_CHINESE] = chineseCoursePack.toList() | CourseManager.subjectWithCoursePackMap[AppConstants.SUBJECT_CHINESE] = chineseCoursePack.toList() | ||||
| mergeCoursePackResult.postValue(true) | mergeCoursePackResult.postValue(true) | ||||
| it.flush() | it.flush() | ||||
| } | } | ||||
| } | } | ||||
| zipInputStream?.close() | |||||
| outPut.forEach { | outPut.forEach { | ||||
| it.flush() | |||||
| it.close() | it.close() | ||||
| } | } | ||||
| zipInputStream?.close() | |||||
| } | } | ||||
| } | } | ||||
| } | } |