「アプリ設定/見た目/タイムラインの行間」を追加。
This commit is contained in:
parent
47661d2358
commit
76c15e4858
|
@ -12,6 +12,7 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.SparseArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
|
@ -257,6 +258,7 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
private var etAcctFontSize : EditText? = null
|
||||
private var tvTimelineFontSize : TextView? = null
|
||||
private var tvAcctFontSize : TextView? = null
|
||||
private var etTimelineSpacing : EditText? = null
|
||||
|
||||
private var etHeaderTextSize : EditText? = null
|
||||
private var tvHeaderTextSize : TextView? = null
|
||||
|
@ -591,15 +593,19 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
tvAcctFontSize = findViewById(R.id.tvAcctFontSize)
|
||||
tvNotificationTlFontSize = findViewById(R.id.tvNotificationTlFontSize)
|
||||
|
||||
etTimelineSpacing = findViewById(R.id.etTimelineSpacing)
|
||||
etTimelineFontSize = findViewById(R.id.etTimelineFontSize)
|
||||
|
||||
etTimelineFontSize?.addTextChangedListener(
|
||||
SizeCheckTextWatcher(
|
||||
tvTimelineFontSize !!,
|
||||
etTimelineFontSize !!,
|
||||
Pref.default_timeline_font_size
|
||||
Pref.default_timeline_font_size,
|
||||
etSpacing = etTimelineSpacing !!
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
etAcctFontSize = findViewById(R.id.etAcctFontSize)
|
||||
etAcctFontSize?.addTextChangedListener(
|
||||
SizeCheckTextWatcher(
|
||||
|
@ -625,10 +631,30 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
SizeCheckTextWatcher(
|
||||
tvNotificationTlFontSize !!,
|
||||
etNotificationTlFontSize !!,
|
||||
Pref.default_notification_tl_font_size
|
||||
Pref.default_notification_tl_font_size,
|
||||
etSpacing = etTimelineSpacing !!
|
||||
)
|
||||
)
|
||||
|
||||
etTimelineSpacing?.addTextChangedListener(
|
||||
SizeCheckTextWatcher(
|
||||
tvTimelineFontSize !!,
|
||||
etTimelineFontSize !!,
|
||||
Pref.default_timeline_font_size,
|
||||
etSpacing = etTimelineSpacing !!
|
||||
)
|
||||
)
|
||||
|
||||
etTimelineSpacing?.addTextChangedListener(
|
||||
SizeCheckTextWatcher(
|
||||
tvNotificationTlFontSize !!,
|
||||
etNotificationTlFontSize !!,
|
||||
Pref.default_notification_tl_font_size,
|
||||
etSpacing = etTimelineSpacing !!
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
etAvatarIconSize = findViewById(R.id.etAvatarIconSize)
|
||||
etNotificationTlIconSize = findViewById(R.id.etNotificationTlIconSize)
|
||||
etPullNotificationCheckInterval = findViewById(R.id.etPullNotificationCheckInterval)
|
||||
|
@ -650,7 +676,7 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
tvSampleAcct = findViewById(R.id.tvSampleAcct)
|
||||
tvSampleContent = findViewById(R.id.tvSampleContent)
|
||||
|
||||
if( Build.VERSION.SDK_INT < 26){
|
||||
if(Build.VERSION.SDK_INT < 26) {
|
||||
findViewById<Switch>(R.id.swSeparateReplyNotificationGroup)?.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
@ -761,6 +787,7 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
etAcctFontSize?.setText(formatFontSize(Pref.fpAcctFontSize(pref)))
|
||||
etNotificationTlFontSize?.setText(formatFontSize(Pref.fpNotificationTlFontSize(pref)))
|
||||
etHeaderTextSize?.setText(formatFontSize(Pref.fpHeaderTextSize(pref)))
|
||||
etTimelineSpacing?.setText(Pref.spTimelineSpacing(pref))
|
||||
|
||||
etUserAgent?.hint = App1.userAgentDefault
|
||||
|
||||
|
@ -770,12 +797,18 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
showTimelineFont(tvTimelineFontUrl, timeline_font)
|
||||
showTimelineFont(tvTimelineFontBoldUrl, timeline_font_bold)
|
||||
|
||||
showFontSize(tvTimelineFontSize, etTimelineFontSize, Pref.default_timeline_font_size)
|
||||
showFontSize(
|
||||
tvTimelineFontSize,
|
||||
etTimelineFontSize,
|
||||
Pref.default_timeline_font_size,
|
||||
etSpacing = etTimelineSpacing
|
||||
)
|
||||
showFontSize(tvAcctFontSize, etAcctFontSize, Pref.default_acct_font_size)
|
||||
showFontSize(
|
||||
tvNotificationTlFontSize,
|
||||
etNotificationTlFontSize,
|
||||
Pref.default_notification_tl_font_size
|
||||
Pref.default_notification_tl_font_size,
|
||||
etSpacing = etTimelineSpacing
|
||||
)
|
||||
showFontSize(tvHeaderTextSize, etHeaderTextSize, Pref.default_header_font_size)
|
||||
|
||||
|
@ -844,6 +877,7 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
putText(Pref.spRoundRatio, etRoundRatio)
|
||||
putText(Pref.spBoostAlpha, etBoostAlpha)
|
||||
putText(Pref.spMediaReadTimeout, etMediaReadTimeout)
|
||||
putText(Pref.spTimelineSpacing, etTimelineSpacing)
|
||||
|
||||
fun putIf(hasUi : Boolean, sp : StringPref, value : String) {
|
||||
if(! hasUi) return
|
||||
|
@ -1586,7 +1620,8 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
private inner class SizeCheckTextWatcher internal constructor(
|
||||
internal val sample : TextView,
|
||||
internal val et : EditText,
|
||||
internal val default_size_sp : Float
|
||||
internal val default_size_sp : Float,
|
||||
internal val etSpacing : EditText? = null
|
||||
) : TextWatcher {
|
||||
|
||||
override fun beforeTextChanged(s : CharSequence, start : Int, count : Int, after : Int) {
|
||||
|
@ -1599,7 +1634,7 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
|
||||
override fun afterTextChanged(s : Editable) {
|
||||
saveUIToData()
|
||||
showFontSize(sample, et, default_size_sp)
|
||||
showFontSize(sample, et, default_size_sp, etSpacing)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1630,10 +1665,15 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
return Float.NaN
|
||||
}
|
||||
|
||||
private val defaultLineSpacingExtra = SparseArray<Float>()
|
||||
private val defaultLineSpacingMultiplier = SparseArray<Float>()
|
||||
|
||||
|
||||
private fun showFontSize(
|
||||
sample : TextView?,
|
||||
et : EditText?,
|
||||
default_sp : Float
|
||||
default_sp : Float,
|
||||
etSpacing : EditText? =null
|
||||
) {
|
||||
sample ?: return
|
||||
et ?: return
|
||||
|
@ -1644,6 +1684,25 @@ class ActAppSettingChild : AppCompatActivity()
|
|||
if(fv < 1f) fv = 1f
|
||||
sample.textSize = fv
|
||||
}
|
||||
if( etSpacing != null){
|
||||
var defaultExtra = defaultLineSpacingExtra[sample.id]
|
||||
if(defaultExtra == null){
|
||||
defaultExtra = sample.lineSpacingExtra
|
||||
defaultLineSpacingExtra.put(sample.id, defaultExtra)
|
||||
}
|
||||
var defaultMultiplier = defaultLineSpacingMultiplier[sample.id]
|
||||
if(defaultMultiplier == null){
|
||||
defaultMultiplier = sample.lineSpacingMultiplier
|
||||
defaultLineSpacingMultiplier.put(sample.id, defaultMultiplier)
|
||||
}
|
||||
|
||||
val spacing = etSpacing.text.toString().toFloatOrNull()
|
||||
if( spacing ==null || !spacing.isFinite()){
|
||||
sample.setLineSpacing(defaultExtra,defaultMultiplier)
|
||||
}else{
|
||||
sample.setLineSpacing(0f,spacing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showTimelineFont(
|
||||
|
|
|
@ -117,6 +117,7 @@ class ActMain : AppCompatActivity()
|
|||
var acct_font_size_sp = Float.NaN
|
||||
var notification_tl_font_size_sp = Float.NaN
|
||||
var header_text_size_sp = Float.NaN
|
||||
var timeline_spacing:Float? = null
|
||||
var avatarIconSize : Int = 0
|
||||
var notificationTlIconSize : Int = 0
|
||||
|
||||
|
@ -431,6 +432,9 @@ class ActMain : AppCompatActivity()
|
|||
notification_tl_font_size_sp = Pref.fpNotificationTlFontSize(pref).clipFontSize()
|
||||
header_text_size_sp = Pref.fpHeaderTextSize(pref).clipFontSize()
|
||||
|
||||
val fv = Pref.spTimelineSpacing(pref).toFloatOrNull()
|
||||
timeline_spacing = if(fv!=null && fv.isFinite() && fv!=0f) fv else null
|
||||
|
||||
initUI()
|
||||
|
||||
updateColumnStrip()
|
||||
|
@ -2816,6 +2820,10 @@ class ActMain : AppCompatActivity()
|
|||
if(! timeline_font_size_sp.isNaN()) {
|
||||
tv.textSize = timeline_font_size_sp
|
||||
}
|
||||
|
||||
val fv = timeline_spacing
|
||||
if( fv != null) tv.setLineSpacing(0f,fv)
|
||||
|
||||
tv.typeface = timeline_font
|
||||
tv.text = text
|
||||
tv.measure(
|
||||
|
|
|
@ -266,6 +266,29 @@ internal class ItemViewHolder(
|
|||
tvFilterDetail.textSize = f
|
||||
}
|
||||
|
||||
val spacing = activity.timeline_spacing
|
||||
if( spacing != null){
|
||||
tvFollowerName.setLineSpacing(0f,spacing)
|
||||
tvName.setLineSpacing(0f,spacing)
|
||||
tvMentions.setLineSpacing(0f,spacing)
|
||||
tvContentWarning.setLineSpacing(0f,spacing)
|
||||
tvContent.setLineSpacing(0f,spacing)
|
||||
btnShowMedia.setLineSpacing(0f,spacing)
|
||||
tvApplication.setLineSpacing(0f,spacing)
|
||||
tvMessageHolder.setLineSpacing(0f,spacing)
|
||||
btnListTL.setLineSpacing(0f,spacing)
|
||||
tvTrendTagName.setLineSpacing(0f,spacing)
|
||||
tvTrendTagCount.setLineSpacing(0f,spacing)
|
||||
tvFilterPhrase.setLineSpacing(0f,spacing)
|
||||
tvMediaDescription.setLineSpacing(0f,spacing)
|
||||
tvCardText.setLineSpacing(0f,spacing)
|
||||
tvConversationIconsMore.setLineSpacing(0f,spacing)
|
||||
tvConversationParticipants.setLineSpacing(0f,spacing)
|
||||
tvBoosted.setLineSpacing(0f,spacing)
|
||||
tvReply.setLineSpacing(0f,spacing)
|
||||
}
|
||||
|
||||
|
||||
var s = activity.avatarIconSize
|
||||
ivThumbnail.layoutParams.height = s
|
||||
ivThumbnail.layoutParams.width = s
|
||||
|
|
|
@ -566,6 +566,8 @@ object Pref {
|
|||
val spCustomShare2 = StringPref("CustomShare2","")
|
||||
val spCustomShare3 = StringPref("CustomShare3","")
|
||||
|
||||
val spTimelineSpacing = StringPref("TimelineSpacing","")
|
||||
|
||||
// long
|
||||
val lpTabletTootDefaultAccount = LongPref("tablet_toot_default_account", - 1L)
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ internal abstract class ViewHolderHeaderBase(val activity : ActMain, val viewRoo
|
|||
if(! activity.timeline_font_size_sp.isNaN()) {
|
||||
v.textSize = activity.timeline_font_size_sp
|
||||
}
|
||||
|
||||
val fv = activity.timeline_spacing
|
||||
if( fv != null) v.setLineSpacing(0f,fv)
|
||||
}
|
||||
} catch(ex : Throwable) {
|
||||
log.trace(ex)
|
||||
|
|
|
@ -149,6 +149,12 @@ internal class ViewHolderHeaderProfile(
|
|||
tvLastStatusAt.textSize = f
|
||||
}
|
||||
|
||||
val spacing = activity.timeline_spacing
|
||||
if( spacing != null) {
|
||||
tvMovedName.setLineSpacing(0f, spacing)
|
||||
tvMoved.setLineSpacing(0f, spacing)
|
||||
}
|
||||
|
||||
val contentColor = column.getContentColor()
|
||||
this.contentColor = contentColor
|
||||
|
||||
|
|
|
@ -381,6 +381,25 @@
|
|||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:labelFor="@+id/etTimelineSpacing"
|
||||
android:text="@string/timeline_line_spacing"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etTimelineSpacing"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
android:inputType="numberDecimal"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:labelFor="@+id/etBoostButtonSize"
|
||||
|
|
|
@ -478,7 +478,7 @@
|
|||
<string name="notification_sound_before_oreo">通知音 (Android 7.x 以下)</string>
|
||||
<string name="notification_style_after_oreo">通知スタイル(Android 8.x 以降)</string>
|
||||
<string name="notification_style_before_oreo">通知スタイル(Android 7.x以下。もしお使いのデバイスが8.x以降の場合、アカウント設定から通知スタイルを変更できます)</string>
|
||||
<string name="notification_tl_font_size">通知TLのフォントの大きさ (単位:sp。空欄でデフォルト。アプリ再起動が必要)</string>
|
||||
<string name="notification_tl_font_size">通知TLのフォントの大きさ\n(単位:sp。空欄でデフォルト。アプリ再起動が必要)\n…\n…</string>
|
||||
<string name="notification_tl_icon_size">通知TLのアイコンの大きさ (単位:dp。デフォルト:24。アプリ再起動が必要)</string>
|
||||
<string name="notification_type_boost">ブースト</string>
|
||||
<string name="notification_type_favourite">お気に入り</string>
|
||||
|
@ -693,7 +693,7 @@
|
|||
<string name="time_within_second">たった今</string>
|
||||
<string name="timeline_font">タイムラインのフォント(アプリ再起動が必要)</string>
|
||||
<string name="timeline_font_bold">タイムラインのフォント(太字)(アプリ再起動が必要)</string>
|
||||
<string name="timeline_font_size">タイムラインのフォントの大きさ(単位:sp。空欄でデフォルト。アプリ再起動が必要)</string>
|
||||
<string name="timeline_font_size">タイムラインのフォントの大きさ\n(単位:sp。空欄でデフォルト。アプリ再起動が必要)\n…\n…</string>
|
||||
<string name="timeout_for_embed_media_viewer">内蔵メディアビューアのタイムアウト (単位:秒 アプリ再起動(アプリ履歴からの消去)が必要)</string>
|
||||
<string name="title">名前</string>
|
||||
<string name="token_exported">アプリデータのエクスポート、インポート、バックアップからの復元などでアクセストークンが他のデバイスでも使われている可能性があります。アクセストークンの更新をおすすめします。</string>
|
||||
|
@ -957,5 +957,6 @@
|
|||
<string name="instance_actions_for">\"%1$s\" サーバへのアクション</string>
|
||||
<string name="quick_toot_omit_account_selection">簡易投稿でも可能ならアカウント選択を省略する</string>
|
||||
<string name="separate_notification_group_for_reply">返信の通知グループを分ける (Android 8+)</string>
|
||||
<string name="timeline_line_spacing">タイムラインの行間 (数値は文字に対する割合を示します。空欄でデフォルト状態。アプリ再起動が必要)</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -409,7 +409,7 @@
|
|||
<string name="send_header_account_image_header_static">Account-Image-Header-Static</string>
|
||||
<string name="open_local_timeline_for">Open timeline of \"%1$s\"</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="timeline_font_size">Timeline font size (Unit:sp. leave empty to default. app restart required)</string>
|
||||
<string name="timeline_font_size">Timeline font size\n(Unit:sp. leave empty to default. app restart required)\n…\n…</string>
|
||||
<string name="acct_font_size">Acct font size (Unit:sp. leave empty to default. app restart required)</string>
|
||||
<string name="dont_add_duplication_check_header">Don\'t add duplication check header</string>
|
||||
<string name="show_quick_toot_bar">Show \"Quick Toot\" bar (app restart required.)</string>
|
||||
|
@ -684,7 +684,7 @@
|
|||
<string name="cant_sync_toot">Can\'t synchronize toot.</string>
|
||||
<string name="cant_change_account_when_redraft">Can\'t change account while using redraft.</string>
|
||||
<string name="delete_base_status_before_toot">Delete base status before posting. All of favourites/boosts will be lost. Replies will be disconnected. Media attachments will not kept on Mastodon pre-2.4.1 . Are you sure?</string>
|
||||
<string name="notification_tl_font_size">Notification TL font size (Unit: sp. leave empty to default. app restart required)</string>
|
||||
<string name="notification_tl_font_size">Notification TL font size\n(Unit: sp. leave empty to default. app restart required)\n…\n…</string>
|
||||
<string name="notification_tl_icon_size">Notification TL icon size (Unit:dp. default:24. app restart required)</string>
|
||||
<string name="post_button_tapped_repeatly">Post button was tapped repeatedly</string>
|
||||
<string name="regex_filter_matches_empty_string">Regex filter matches to empty string.</string>
|
||||
|
@ -952,4 +952,5 @@
|
|||
<string name="instance_actions_for">Actions for the server \"%1$s\"</string>
|
||||
<string name="quick_toot_omit_account_selection">When using quick toot, omit account selection if possible</string>
|
||||
<string name="separate_notification_group_for_reply">Separate notification groups for reply (Android 8+)</string>
|
||||
<string name="timeline_line_spacing">Timeline line spacing (floating number is used as line spacing multiplier. leave empty to default. app restart required)</string>
|
||||
</resources>
|
Loading…
Reference in New Issue