Skip to content

Commit

Permalink
fix rating
Browse files Browse the repository at this point in the history
  • Loading branch information
ekibun committed Dec 29, 2019
1 parent ec85074 commit 330b69f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,15 @@ class EditSubjectDialog(context: Context) : Dialog(context, R.style.AppTheme_Dia
Collection.STATUS_ON_HOLD to R.id.radio_hold,
Collection.STATUS_DROPPED to R.id.radio_dropped)
view.findViewById<RadioButton>(selectMap[collection.status] ?: R.id.radio_collect)?.isChecked = true

view.item_rating.rating = collection.rating.toFloat()
view.item_tags.setText(collection.tag?.joinToString(" "))

val hasTag = { tag: String ->
view.item_tags.editableText.split(" ").contains(tag)
}
val myTagAdapter = TagAdapter(null, hasTag)
myTagAdapter.setNewData(collection.myTag?.map { it to 0 }?.toMutableList())
val myTagLayoutManager = LinearLayoutManager(context)
myTagLayoutManager.orientation = RecyclerView.HORIZONTAL
view.item_my_tag_list.layoutManager = myTagLayoutManager
view.item_my_tag_list.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
view.item_my_tag_list.adapter = myTagAdapter
myTagAdapter.setOnItemClickListener { _, _, position ->
val tag = myTagAdapter.data[position].first
Expand All @@ -79,9 +77,7 @@ class EditSubjectDialog(context: Context) : Dialog(context, R.style.AppTheme_Dia
}
val userTagAdapter = TagAdapter(null, hasTag)
userTagAdapter.setNewData(subject.tags?.toMutableList())
val userTagLayoutManager = LinearLayoutManager(context)
userTagLayoutManager.orientation = RecyclerView.HORIZONTAL
view.item_user_tag_list.layoutManager = userTagLayoutManager
view.item_user_tag_list.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
view.item_user_tag_list.adapter = userTagAdapter
userTagAdapter.setOnItemClickListener { _, _, position ->
val tag = userTagAdapter.data[position].first
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/soko/ekibun/bangumi/util/TextUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ object TextUtil {
fun bbcode2html(text: String): String {
return text.replace("\n", "<br/>").replace(Regex("""\[(/?(b|i|u|mask))]"""), "<$1>")
.replace("[s]", "<span style=\"text-decoration:line-through\">")
.replace(Regex("""\[url](.*?)\[/url]"""), "<a href=\"$1\"></a>")
.replace(Regex("""\[url=(.*?)]"""), "<a href=\"$1\">")
.replace(Regex("""\[/url]"""), "</a>")
.replace(Regex("""\[img](.*?)\[/img]"""), "<img src=\"$1\"/>")
.replace(Regex("""\[color=(.*?)]"""), "<span style=\"color:$1\">")
.replace(Regex("""\[size=(.*?)]"""), "<span style=\"font-size:$1px\">")
Expand Down

0 comments on commit 330b69f

Please sign in to comment.