Skip to content

Commit

Permalink
courses: smoother description (fixes #4792) (#4799)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <dogi@users.noreply.github.com>
  • Loading branch information
deeppp15 and dogi authored Nov 22, 2024
1 parent c4c11d5 commit aa2d236
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 26
targetSdkVersion 34
versionCode 2106
versionName "0.21.6"
versionCode 2107
versionName "0.21.7"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,23 @@ class AdapterCourses(private val context: Context, private var courseList: List<
}

holder.rowCourseBinding.title.text = course.courseTitle
holder.rowCourseBinding.description.text = course.description
val markdownContentWithLocalPaths = prependBaseUrlToImages(
course.description, "file://" + MainApplication.context.getExternalFilesDir(null) + "/ole/"
)
setMarkdownText(holder.rowCourseBinding.description, markdownContentWithLocalPaths)
holder.rowCourseBinding.description.apply {
text = course.description
val markdownContentWithLocalPaths = AdapterCourses.prependBaseUrlToImages(
course.description, "file://" + MainApplication.context.getExternalFilesDir(null) + "/ole/"
)
setMarkdownText(this, markdownContentWithLocalPaths)

setOnClickListener {
homeItemClickListener?.openCallFragment(TakeCourseFragment().apply {
arguments = Bundle().apply {
putString("id", course.courseId)
putInt("position", position)
}
})
}
}

if (course.gradeLevel.isNullOrEmpty() && course.subjectLevel.isNullOrEmpty()) {
holder.rowCourseBinding.holder.visibility = View.VISIBLE
holder.rowCourseBinding.tvDate2.visibility = View.VISIBLE
Expand Down Expand Up @@ -182,12 +194,18 @@ class AdapterCourses(private val context: Context, private var courseList: List<
holder.rowCourseBinding.checkbox.setOnClickListener { view: View ->
holder.rowCourseBinding.checkbox.contentDescription = context.getString(R.string.select_res_course, course.courseTitle)
Utilities.handleCheck((view as CheckBox).isChecked, position, selectedItems, courseList)
if (listener != null) listener!!.onSelectedListChange(selectedItems)
listener?.onSelectedListChange(selectedItems)
}
} else {
holder.rowCourseBinding.checkbox.visibility = View.GONE
}
showProgressAndRating(position, holder)

holder.rowCourseBinding.root.setOnClickListener {
if (position != RecyclerView.NO_POSITION) {
openCourse(courseList[position], 0)
}
}
}
}
}
Expand Down Expand Up @@ -350,4 +368,4 @@ class AdapterCourses(private val context: Context, private var courseList: List<
return result.toString()
}
}
}
}

0 comments on commit aa2d236

Please sign in to comment.