Skip to content

Commit

Permalink
fix post floor 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ekibun committed Nov 25, 2019
1 parent 7981a42 commit 4fe1b61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ data class TopicPost(
editable = it.selectFirst(".re_info")?.text()?.contains("/") == true,
relate = relate.toString(),
model = Regex("'([^']*)'").find(data.getOrNull(0) ?: "")?.groupValues?.get(1) ?: "",
floor = floor?.getOrNull(1)?.toIntOrNull() ?: 0,
floor = floor?.getOrNull(1)?.toIntOrNull() ?: 1,
sub_floor = floor?.getOrNull(2)?.trim('-')?.toIntOrNull() ?: 0,
badge = badge
)
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/soko/ekibun/bangumi/util/HtmlTagHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.text.*
import android.text.style.ClickableSpan
import android.text.style.ImageSpan
import android.text.style.RelativeSizeSpan
import android.util.Log
import android.view.View
import android.widget.TextView
import com.awarmisland.android.richedittext.view.RichEditText
Expand Down Expand Up @@ -47,11 +48,12 @@ class HtmlTagHandler(view: TextView? = null, private var baseSize: Float = 12f,

private fun endSize(tag: String, output: Editable, xmlReader: XMLReader) {
endSizeIndex = output.length
var size = attributes["size"]?:""
var size = attributes["size"] ?: ""
size = size.split("px".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0]
// 设置字体大小
if (!TextUtils.isEmpty(size)) {
output.setSpan(RelativeSizeSpan((size.toFloatOrNull()?:baseSize)/ baseSize), startSizeIndex, endSizeIndex,
output.setSpan(RelativeSizeSpan((size.toFloatOrNull()
?: baseSize) / baseSize), startSizeIndex, endSizeIndex,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
}
Expand All @@ -76,8 +78,8 @@ class HtmlTagHandler(view: TextView? = null, private var baseSize: Float = 12f,
private val edit = textView.get() is RichEditText
override fun onClick(widget: View) {
if (edit) return
val view = textView.get()?:return
view.tag = if(view.tag == this) null else this
val view = textView.get() ?: return
view.tag = if (view.tag == this) null else this
view.text = view.text
}

Expand Down Expand Up @@ -120,7 +122,7 @@ class HtmlTagHandler(view: TextView? = null, private var baseSize: Float = 12f,
attributes[data[i * 5 + 1]] = data[i * 5 + 4]
}
} catch (e: Exception) {
e.printStackTrace()
Log.e("HtmlTag", e.localizedMessage ?: e.message ?: "")
}
}

Expand Down

0 comments on commit 4fe1b61

Please sign in to comment.