アプリ設定に「リンクの色」を追加
This commit is contained in:
parent
9c1103ec37
commit
80e1802576
@ -75,6 +75,7 @@ class ActAppSetting : AppCompatActivity()
|
||||
internal const val COLOR_DIALOG_ID_TOOT_BG_FOLLOWER = 8
|
||||
internal const val COLOR_DIALOG_ID_TOOT_BG_DIRECT_USER = 9
|
||||
internal const val COLOR_DIALOG_ID_TOOT_BG_DIRECT_ME = 10
|
||||
internal const val COLOR_DIALOG_ID_LINK = 11
|
||||
|
||||
internal const val REQUEST_CODE_TIMELINE_FONT = 1
|
||||
internal const val REQUEST_CODE_TIMELINE_FONT_BOLD = 2
|
||||
@ -121,6 +122,7 @@ class ActAppSetting : AppCompatActivity()
|
||||
private var toot_color_follower : Int = 0
|
||||
private var toot_color_direct_user : Int = 0
|
||||
private var toot_color_direct_me : Int = 0
|
||||
private var link_color : Int = 0
|
||||
|
||||
private lateinit var ivFooterToot : ImageView
|
||||
private lateinit var ivFooterMenu : ImageView
|
||||
@ -287,6 +289,8 @@ class ActAppSetting : AppCompatActivity()
|
||||
findViewById<View>(R.id.btnBackgroundColorDirectNoUserEdit).setOnClickListener(this)
|
||||
findViewById<View>(R.id.btnBackgroundColorDirectNoUserReset).setOnClickListener(this)
|
||||
|
||||
findViewById<View>(R.id.btnLinkColorEdit).setOnClickListener(this)
|
||||
findViewById<View>(R.id.btnLinkColorReset).setOnClickListener(this)
|
||||
|
||||
findViewById<View>(R.id.btnTimelineFontEdit).setOnClickListener(this)
|
||||
findViewById<View>(R.id.btnTimelineFontReset).setOnClickListener(this)
|
||||
@ -422,6 +426,7 @@ class ActAppSetting : AppCompatActivity()
|
||||
toot_color_follower = Pref.ipTootColorFollower(pref)
|
||||
toot_color_direct_user = Pref.ipTootColorDirectUser(pref)
|
||||
toot_color_direct_me = Pref.ipTootColorDirectMe(pref)
|
||||
link_color = Pref.ipLinkColor(pref)
|
||||
|
||||
etColumnWidth.setText(Pref.spColumnWidth(pref))
|
||||
etMediaThumbHeight.setText(Pref.spMediaThumbHeight(pref))
|
||||
@ -542,6 +547,8 @@ class ActAppSetting : AppCompatActivity()
|
||||
.put(Pref.ipTootColorDirectUser, toot_color_direct_user)
|
||||
.put(Pref.ipTootColorDirectMe, toot_color_direct_me)
|
||||
|
||||
.put(Pref.ipLinkColor, link_color)
|
||||
|
||||
.apply()
|
||||
|
||||
showUserAgentError()
|
||||
@ -658,7 +665,7 @@ class ActAppSetting : AppCompatActivity()
|
||||
toot_color_direct_me,
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
R.id.btnListDividerColorReset -> {
|
||||
list_divider_color = 0
|
||||
saveUIToData()
|
||||
@ -680,6 +687,16 @@ class ActAppSetting : AppCompatActivity()
|
||||
saveUIToData()
|
||||
}
|
||||
|
||||
R.id.btnLinkColorEdit -> openColorPicker(
|
||||
COLOR_DIALOG_ID_LINK,
|
||||
link_color,
|
||||
true
|
||||
)
|
||||
R.id.btnLinkColorReset -> {
|
||||
link_color = 0
|
||||
saveUIToData()
|
||||
}
|
||||
|
||||
R.id.btnTimelineFontReset -> {
|
||||
timeline_font = ""
|
||||
saveUIToData()
|
||||
@ -820,7 +837,10 @@ class ActAppSetting : AppCompatActivity()
|
||||
toot_color_direct_me = if(colorSelected == 0) 0x01000000 else colorSelected
|
||||
saveUIToData()
|
||||
}
|
||||
|
||||
COLOR_DIALOG_ID_LINK ->{
|
||||
link_color = if(colorSelected == 0) 0x01000000 else colorSelected
|
||||
saveUIToData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1141,6 +1141,8 @@ class ActMain : AppCompatActivity()
|
||||
internal fun initUI() {
|
||||
setContentView(R.layout.act_main)
|
||||
|
||||
MyClickableSpan.defaultLinkColor = Pref.ipLinkColor(pref)
|
||||
|
||||
var sv = Pref.spTimelineFont(pref)
|
||||
if(sv.isNotEmpty()) {
|
||||
try {
|
||||
|
@ -343,6 +343,8 @@ object Pref {
|
||||
val ipLastColumnPos = IntPref("last_column_pos", - 1)
|
||||
val ipBoostButtonJustify = IntPref("ipBoostButtonJustify", 0) // 0=左,1=中央,2=右
|
||||
|
||||
val ipLinkColor = IntPref("LinkColor", 0)
|
||||
|
||||
val ipTootColorUnlisted = IntPref("ipTootColorUnlisted", 0)
|
||||
val ipTootColorFollower = IntPref("ipTootColorFollower", 0)
|
||||
val ipTootColorDirectUser = IntPref("ipTootColorDirectUser", 0)
|
||||
|
@ -20,6 +20,7 @@ class MyClickableSpan(
|
||||
|
||||
companion object {
|
||||
var link_callback : WeakReference<MyClickableSpanClickCallback>? = null
|
||||
var defaultLinkColor : Int =0
|
||||
}
|
||||
|
||||
val color_fg : Int
|
||||
@ -41,8 +42,13 @@ class MyClickableSpan(
|
||||
|
||||
override fun updateDrawState(ds : TextPaint) {
|
||||
super.updateDrawState(ds)
|
||||
if(color_fg != 0) ds.color = color_fg
|
||||
if(color_bg != 0) ds.bgColor = color_bg
|
||||
|
||||
if(color_fg != 0){
|
||||
ds.color = color_fg
|
||||
}else if( defaultLinkColor != 0){
|
||||
ds.color = defaultLinkColor
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1093,6 +1093,32 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/link_color"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLinkColorEdit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/edit"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLinkColorReset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reset"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
|
@ -757,5 +757,6 @@
|
||||
<string name="your_statuses">あなたのトゥート</string>
|
||||
<string name="yourself_can_see_your_network">もしあなたがソーシャルグラフを隠す選択をした場合でも、あなた自身はそれを見ることができます。</string>
|
||||
<string name="zooming_of">×%3$.1f\n%1$d×%2$d</string>
|
||||
<string name="link_color">リンクの色 (アプリ再起動が必要)</string>
|
||||
|
||||
</resources>
|
||||
|
@ -775,5 +775,6 @@
|
||||
<string name="reaction">Reaction (Misskey)</string>
|
||||
<string name="vote">Vote (Misskey)</string>
|
||||
<string name="timeout_for_embed_media_viewer">Timeout for embed media viewer (unit:seconds, app restart(delete from app history) required)</string>
|
||||
<string name="link_color">Link color (app restart required)</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user