アプリ設定に「プレビューカード説明文の最大文字数」を追加
This commit is contained in:
parent
c3a4c6636f
commit
ae27ae3d67
|
@ -130,6 +130,7 @@ class ActAppSetting : AppCompatActivity()
|
|||
private lateinit var etUserAgent : EditText
|
||||
private lateinit var etQuoteNameFormat : EditText
|
||||
private lateinit var etAutoCWLines : EditText
|
||||
private lateinit var etCardDescriptionLength : EditText
|
||||
private lateinit var etMediaSizeMax : EditText
|
||||
private lateinit var etMovieSizeMax : EditText
|
||||
private lateinit var etRoundRatio : EditText
|
||||
|
@ -318,7 +319,10 @@ class ActAppSetting : AppCompatActivity()
|
|||
|
||||
etAutoCWLines = findViewById(R.id.etAutoCWLines)
|
||||
etAutoCWLines.addTextChangedListener(this)
|
||||
|
||||
|
||||
etCardDescriptionLength = findViewById(R.id.etCardDescriptionLength)
|
||||
etCardDescriptionLength.addTextChangedListener(this)
|
||||
|
||||
etMediaSizeMax = findViewById(R.id.etMediaSizeMax)
|
||||
etMediaSizeMax.addTextChangedListener(this)
|
||||
|
||||
|
@ -427,6 +431,7 @@ class ActAppSetting : AppCompatActivity()
|
|||
etUserAgent.setText(Pref.spUserAgent(pref))
|
||||
etQuoteNameFormat.setText(Pref.spQuoteNameFormat(pref))
|
||||
etAutoCWLines.setText(Pref.spAutoCWLines(pref))
|
||||
etCardDescriptionLength.setText(Pref.spCardDescriptionLength(pref))
|
||||
etAvatarIconSize.setText(Pref.spAvatarIconSize(pref))
|
||||
etNotificationTlIconSize.setText(Pref.spNotificationTlIconSize(pref))
|
||||
etBoostButtonSize.setText(Pref.spBoostButtonSize(pref))
|
||||
|
@ -501,6 +506,7 @@ class ActAppSetting : AppCompatActivity()
|
|||
etUserAgent.text.toString().replace(reLinefeed, " ").trim { it <= ' ' })
|
||||
.put(Pref.spQuoteNameFormat, etQuoteNameFormat.text.toString()) // not trimmed
|
||||
.put(Pref.spAutoCWLines, etAutoCWLines.text.toString().trim { it <= ' ' })
|
||||
.put(Pref.spCardDescriptionLength, etCardDescriptionLength.text.toString().trim { it <= ' ' })
|
||||
.put(Pref.spAvatarIconSize, etAvatarIconSize.text.toString().trim { it <= ' ' })
|
||||
.put(
|
||||
Pref.spNotificationTlIconSize,
|
||||
|
|
|
@ -5009,7 +5009,7 @@ class Column(
|
|||
return
|
||||
}
|
||||
|
||||
viewHolder?.refreshLayout.isRefreshing = true
|
||||
viewHolder?.refreshLayout?.isRefreshing = true
|
||||
|
||||
bRefreshLoading = true
|
||||
mRefreshLoadingError = ""
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.text.Spannable
|
|||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import android.text.TextUtils
|
||||
import android.text.TextUtils.ellipsize
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -1683,7 +1684,10 @@ internal class ItemViewHolder(
|
|||
val description = card.description
|
||||
if(description != null && description.isNotEmpty()) {
|
||||
if(sb.isNotEmpty()) sb.append("<br>")
|
||||
sb.append(HTMLDecoder.encodeEntity(description))
|
||||
|
||||
val limit = Pref.spCardDescriptionLength.toInt(activity.pref)
|
||||
|
||||
sb.append(HTMLDecoder.encodeEntity(ellipsize(description,if( limit <= 0 ) 64 else limit)))
|
||||
}
|
||||
val html = sb.toString()
|
||||
//
|
||||
|
@ -1715,6 +1719,14 @@ internal class ItemViewHolder(
|
|||
}
|
||||
}
|
||||
|
||||
private fun ellipsize(src:String,limit:Int):String{
|
||||
return if( src.codePointCount(0,src.length) <= limit ) {
|
||||
src
|
||||
}else {
|
||||
"${src.substring(0, src.offsetByCodePoints(0,limit))}…"
|
||||
}
|
||||
}
|
||||
|
||||
private fun addLinkAndCaption(
|
||||
sb : StringBuilder,
|
||||
header : String,
|
||||
|
|
|
@ -397,6 +397,7 @@ object Pref {
|
|||
val spClientName = StringPref("client_name", "")
|
||||
val spQuoteNameFormat = StringPref("quote_name_format", "")
|
||||
val spAutoCWLines = StringPref("auto_cw_lines", "0")
|
||||
val spCardDescriptionLength = StringPref("CardDescriptionLength", "64")
|
||||
val spAvatarIconSize = StringPref("avatar_icon_size", "48")
|
||||
val spNotificationTlIconSize = StringPref("notification_tl_icon_size", "32")
|
||||
val spBoostButtonSize = StringPref("BoostButtonSize", "35")
|
||||
|
|
|
@ -902,10 +902,29 @@
|
|||
android:id="@+id/etAutoCWLines"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="number"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:labelFor="@+id/etCardDescriptionLength"
|
||||
android:text="@string/card_description_length"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etCardDescriptionLength"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -776,5 +776,6 @@
|
|||
<string name="verified_at">検証時刻</string>
|
||||
<string name="use_old_api">古いAPIを使う</string>
|
||||
<string name="around_toot_limitation_warning">バージョン2.6.0より古いインスタンスでは「指定時刻の周辺のTL」機能に制限があります。指定時間から新しい側のTLを取得することができません。</string>
|
||||
<string name="card_description_length">プレビューカード説明文の最大文字数</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -795,5 +795,6 @@
|
|||
<string name="verified_at">verified at</string>
|
||||
<string name="use_old_api">Use old API</string>
|
||||
<string name="around_toot_limitation_warning">\"timeline around the specified time\" feature has limitation for the instance older than version 2.6.0. It is impossible to get a little newer timeline from the specified time.</string>
|
||||
<string name="card_description_length">Preview card description max character count</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue