mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-11 08:53:54 +01:00
インスタンス情報の表示バグを修正
This commit is contained in:
parent
34c60cae90
commit
f0ed7631e8
@ -12,8 +12,8 @@ android {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
|
||||
versionCode 216
|
||||
versionName "2.1.6"
|
||||
versionCode 217
|
||||
versionName "2.1.7"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
@ -6,11 +6,14 @@ import android.view.View
|
||||
import android.widget.TextView
|
||||
|
||||
import jp.juggler.subwaytooter.api.entity.TootInstance
|
||||
import jp.juggler.subwaytooter.util.CharacterGroup
|
||||
import jp.juggler.subwaytooter.util.DecodeOptions
|
||||
import jp.juggler.subwaytooter.util.LogCategory
|
||||
import jp.juggler.subwaytooter.util.showToast
|
||||
import jp.juggler.subwaytooter.view.MyLinkMovementMethod
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
internal class ViewHolderHeaderInstance(
|
||||
arg_activity : ActMain,
|
||||
@ -90,22 +93,32 @@ internal class ViewHolderHeaderInstance(
|
||||
btnEmail.text = email
|
||||
btnEmail.isEnabled = email.isNotEmpty()
|
||||
|
||||
val sb = DecodeOptions(activity, access_info,decodeEmoji = true)
|
||||
var sb = DecodeOptions(activity, access_info,decodeEmoji = true)
|
||||
.decodeHTML( "<p>" + (instance.description ?: "") + "</p>")
|
||||
|
||||
// 行末の空白を除去
|
||||
val reWhitespaceBeforeLineFeed = Pattern.compile("[ \t\r]+\n")
|
||||
val m = reWhitespaceBeforeLineFeed.matcher(sb)
|
||||
val matchList = LinkedList<Pair<Int,Int>>()
|
||||
while(m.find()){
|
||||
// 逆順に並べる
|
||||
matchList.addFirst( Pair(m.start(),m.end()))
|
||||
}
|
||||
for( pair in matchList ){
|
||||
sb.replace( pair.first,pair.second,"\n")
|
||||
}
|
||||
// 連続する改行をまとめる
|
||||
var previous_br_count = 0
|
||||
var i = 0
|
||||
while(i < sb.length) {
|
||||
val c = sb[i]
|
||||
if(c != '\n') {
|
||||
previous_br_count = 0
|
||||
} else {
|
||||
++ previous_br_count
|
||||
if(previous_br_count >= 3) {
|
||||
if(c == '\n') {
|
||||
if(++ previous_br_count >= 3) {
|
||||
sb.delete(i, i + 1)
|
||||
-- previous_br_count
|
||||
-- i
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
previous_br_count = 0
|
||||
}
|
||||
++ i
|
||||
}
|
||||
|
@ -2,13 +2,12 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="128dp"
|
||||
android:paddingTop="12dp"
|
||||
android:id="@+id/llInstanceInformation"
|
||||
|
||||
>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
Loading…
Reference in New Issue
Block a user