1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-27 09:11:23 +01:00

アプリ設定に「見た目/リンクの下線を表示する」を追加

This commit is contained in:
tateisu 2019-01-25 23:38:21 +09:00
parent 785abf1ce8
commit 19172518bd
10 changed files with 54 additions and 12 deletions

15
.idea/misc.xml generated
View File

@ -10,21 +10,32 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<list size="10">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="4" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
</list>
</value>
</option>

View File

@ -2,6 +2,7 @@ import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
// apply plugin: 'kotlin-android-extensions'
android {
@ -62,6 +63,10 @@ android {
}
kapt {
useBuildCache = true
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
@ -141,5 +146,4 @@ repositories {
mavenCentral()
}
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'

View File

@ -499,6 +499,9 @@ class ActMain : AppCompatActivity()
ItemViewHolder.toot_color_follower = Pref.ipTootColorFollower(pref)
ItemViewHolder.toot_color_direct_user = Pref.ipTootColorDirectUser(pref)
ItemViewHolder.toot_color_direct_me = Pref.ipTootColorDirectMe(pref)
MyClickableSpan.showLinkUnderline = Pref.bpShowLinkUnderline(pref)
MyClickableSpan.defaultLinkColor = Pref.ipLinkColor(pref).notZero()
?: getAttributeColor(this, R.attr.colorLink)
// アカウント設定から戻ってきたら、カラムを消す必要があるかもしれない
run {
@ -1205,8 +1208,7 @@ class ActMain : AppCompatActivity()
internal fun initUI() {
setContentView(R.layout.act_main)
MyClickableSpan.defaultLinkColor = Pref.ipLinkColor(pref).notZero()
?: getAttributeColor(this, R.attr.colorLink)
Column.reloadDefaultColor(this, pref)

View File

@ -1320,12 +1320,8 @@ class ActPost : AppCompatActivity(),
if(isFinishing) return
if(attachment_list.isEmpty()) {
llAttachment.visibility = View.GONE
} else {
llAttachment.visibility = View.VISIBLE
ivMedia.forEachIndexed { i, v -> showAttachment_sub(v, i) }
}
vg(llAttachment,attachment_list.isNotEmpty())
ivMedia.forEachIndexed { i, v -> showAttachment_sub(v, i) }
}
private fun showAttachment_sub(iv : MyNetworkImageView, idx : Int) {

View File

@ -361,6 +361,13 @@ object Pref {
false,
R.id.swShowAcctInSystemNotification
)
val bpShowLinkUnderline = BooleanPref(
"ShowLinkUnderline",
true,
R.id.swShowLinkUnderline
)
// int
val ipBackButtonAction = IntPref("back_button_action", 0)

View File

@ -1,5 +1,6 @@
package jp.juggler.subwaytooter.span
import android.graphics.Paint
import android.text.TextPaint
import android.text.style.ClickableSpan
import android.view.View
@ -22,6 +23,7 @@ class MyClickableSpan(
companion object {
var link_callback : WeakReference<MyClickableSpanClickCallback>? = null
var defaultLinkColor : Int =0
var showLinkUnderline = true
}
val color_fg : Int
@ -46,6 +48,7 @@ class MyClickableSpan(
if(color_bg != 0) ds.bgColor = color_bg
ds.color = color_fg.notZero() ?: defaultLinkColor
ds.isUnderlineText = showLinkUnderline
}
}

View File

@ -55,6 +55,7 @@ fun View.showKeyboard() {
}
}
fun vg(v : View, visible : Boolean) {
fun vg(v : View, visible : Boolean) : Boolean {
v.visibility = if(visible) View.VISIBLE else View.GONE
return visible
}

View File

@ -573,6 +573,22 @@
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/show_link_underline"
/>
<LinearLayout style="@style/setting_row_form">
<Switch
android:id="@+id/swShowLinkUnderline"
style="@style/setting_horizontal_stretch"
/>
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/move_notifications_quick_filter_to_column_setting"

View File

@ -852,5 +852,6 @@
<string name="copy_account_id">アカウントID %1$s をコピー</string>
<string name="open_in_admin_ui">管理者WebUIで開く</string>
<string name="show_acct_in_system_notification">システム通知に(ユーザ名ではなく)acctを使用する</string>
<string name="show_link_underline">リンクの下線を表示する</string>
</resources>

View File

@ -874,5 +874,6 @@
<string name="copy_account_id">Copy account ID %1$s</string>
<string name="open_in_admin_ui">Open in admin web UI</string>
<string name="show_acct_in_system_notification">Show acct (instead of user name) in system notification</string>
<string name="show_link_underline">Show link underline</string>
</resources>