InstanceTickerのライセンス表記。グラデーションの右端を透明色にする

This commit is contained in:
tateisu 2018-12-09 12:17:29 +09:00
parent 52fe206292
commit 7e30c38577
6 changed files with 44 additions and 17 deletions

View File

@ -321,6 +321,7 @@ class ActAppSettingChild : AppCompatActivity()
, R.id.btnCcdContentAcctReset
, R.id.btnCcdContentTextEdit
, R.id.btnCcdContentTextReset
,R.id.btnInstanceTickerCopyright
).forEach {
findViewById<View>(it)?.setOnClickListener(this)
}
@ -907,6 +908,8 @@ class ActAppSettingChild : AppCompatActivity()
} catch(ex : Throwable) {
showToast(this, ex, "could not open picker for font")
}
R.id.btnInstanceTickerCopyright -> App1.openBrowser(this@ActAppSettingChild,"https://cdn.weep.me/mastodon/")
}
}

View File

@ -53,7 +53,7 @@ object InstanceTicker {
val imageUrl : String,
val imageWidth : Int,
val colorText : Int,
val colorBg : IntArray
val colorBg : List<Int>
) {
GnuSocial(
@ -61,7 +61,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/gnus.png",
16,
color("#fff"),
intArrayOf(color("#000"), color("#a23"))
listOf(color("#a23"))
),
MastodonJapan(
@ -69,7 +69,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/mstdn.png",
16,
color("#fff"),
intArrayOf(color("#000"), color("#27c"))
listOf(color("#27c"))
),
MastodonAbroad(
@ -77,7 +77,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/mstdn.png",
16,
color("#fff"),
intArrayOf(color("#000"), color("#49c"))
listOf(color("#49c"))
),
Pleroma(
@ -85,7 +85,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/plrm.png",
16,
color("#da5"),
intArrayOf(color("#000"), color("#123"))
listOf(color("#123"))
),
Misskey(
@ -93,7 +93,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/msky2.png",
36,
color("#fff"),
intArrayOf(color("#000"), color("#29b"))
listOf(color("#29b"))
),
PeerTube(
@ -101,7 +101,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/peertube2.png",
16,
color("#000"),
intArrayOf(color("#000"), color("#fff"), color("#fff"), color("#fff"))
listOf(color("#fff"), color("#fff"), color("#fff"))
),
// ロシアの大手マイクロブログ
@ -110,7 +110,7 @@ object InstanceTicker {
"https://cdn.weep.me/img/juick2.png",
16,
color("#fff"),
intArrayOf(color("#000"), color("#000"))
listOf(color("#000"))
)
;
@ -123,7 +123,19 @@ object InstanceTicker {
val map = HashMap<String, GradientDrawable>()
}
val key : String = array.joinToString(",") { it.toString() }
constructor(src : List<Int>) : this(
IntArray(src.size + 1) {
if(it == 0) Color.TRANSPARENT else src[it - 1]
}
)
constructor(src : Int) : this(
IntArray(2) {
if(it == 0) Color.TRANSPARENT else src
}
)
val key = array.joinToString(",") { it.toString() }
val size = array.size
@ -143,7 +155,10 @@ object InstanceTicker {
}
}
private const val colorClosed = Color.BLACK or 0x666666
class Item(type : Type, cols : List<String>) {
// 0 type
val type : Type
//[1]インスタンス名(ドメイン) (空文字列かもしれない)
val name : String
@ -180,7 +195,7 @@ object InstanceTicker {
if(cols[1] == "閉鎖") {
this.name = "閉鎖済み"
this.colorText = Color.WHITE
this.colorBg = ColorBg(intArrayOf(color("#666")))
this.colorBg = ColorBg(colorClosed)
} else {
this.name = ellipsize(
when {
@ -195,7 +210,6 @@ object InstanceTicker {
val ia = cols[4].split(',')
.filter { it.isNotBlank() }
.map { color(it) }
.toIntArray()
this.colorBg = ColorBg(
when {
@ -206,9 +220,9 @@ object InstanceTicker {
}
}
}
var lastList = ConcurrentHashMap<String, Item>()
private var timeNextLoad = 0L
private val reLine = Pattern.compile("""([^\x0d\x0a]+)""")
@ -227,6 +241,7 @@ object InstanceTicker {
while(m.find()) {
try {
val cols = m.group(1).split('\t')
if(cols.size < 7 || cols[0].contains('[')) continue
val type = try {
findType(cols[0].toInt())
@ -236,7 +251,6 @@ object InstanceTicker {
val item = Item(type, cols)
if(item.instance.isNotEmpty()) list[item.instance] = item
} catch(ex : Throwable) {
log.trace(ex)

View File

@ -472,7 +472,11 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<Button
style="@style/setting_row_button"
android:text="@string/instance_ticker_copyright"
android:id="@+id/btnInstanceTickerCopyright"
/>
</LinearLayout>
</ScrollView>

View File

@ -292,3 +292,8 @@ Icons8
https://icons8.com/license/
https://icons8.com/articles/weve-contributed-an-icon-to-imageoptim/
====================================================
#InstanceTicker
https://cdn.weep.me/mastodon/
Copyright 2018 weepjp, kyori19.

View File

@ -808,6 +808,6 @@
<string name="profile_directory">プロフィールディレクトリ</string>
<string name="about_this_instance">このインスタンスについて</string>
<string name="top_page">トップページ</string>
<string name="show_instance_ticker">Instance tickerを表示する(カラムのリロードが必要)</string>
<string name="show_instance_ticker">#InstanceTicker を表示する(カラムのリロードが必要)</string>
</resources>

View File

@ -825,6 +825,7 @@
<string name="profile_directory">Profile directory</string>
<string name="about_this_instance">About this instance</string>
<string name="top_page">Top page</string>
<string name="show_instance_ticker">Show instance ticker (column reload required)</string>
<string name="show_instance_ticker">Show #InstanceTicker (column reload required)</string>
<string name="instance_ticker_copyright">#InstanceTicker\nhttps://cdn.weep.me/mastodon/\nCopyright 2018 weepjp, kyori19.</string>
</resources>