- (InstanceTicker)SVG画像に対応。- 「アプリについて」に翻訳者のacctを表示する。
This commit is contained in:
parent
6e6766c069
commit
8126d30f33
|
@ -15,11 +15,9 @@ class ActAbout : AppCompatActivity() {
|
|||
|
||||
class Translators(
|
||||
val name:String,
|
||||
_search:String?,
|
||||
val acct:String?,
|
||||
val lang:String
|
||||
){
|
||||
val search :String = _search ?: name
|
||||
}
|
||||
)
|
||||
|
||||
companion object {
|
||||
val log = LogCategory("ActAbout")
|
||||
|
@ -46,8 +44,8 @@ class ActAbout : AppCompatActivity() {
|
|||
Translators("Elizabeth Sherrock",null,"Chinese (Simplified)"),
|
||||
Translators("Gennady Archangorodsky",null,"Hebrew"),
|
||||
Translators("inqbs Siina",null,"Korean"),
|
||||
Translators("Jeong Arm","jarm@qdon.space","Korean"),
|
||||
Translators("Kai Zhang",null,"Chinese (Simplified)"),
|
||||
Translators("Jeong Arm","@jarm@qdon.space","Korean"),
|
||||
Translators("Kai Zhang","@bearzk@mastodon.social","Chinese (Simplified)"),
|
||||
Translators("lptprjh",null,"Korean"),
|
||||
Translators("mynameismonkey",null,"Welsh"),
|
||||
Translators("Nathan",null,"French"),
|
||||
|
@ -127,13 +125,13 @@ class ActAbout : AppCompatActivity() {
|
|||
isAllCaps = false
|
||||
|
||||
//
|
||||
text = who.name + "\n" + getString(R.string.thanks_for, who.lang)
|
||||
|
||||
val acct = who.acct ?: "@?@?"
|
||||
text = "${who.name}\n$acct\n${getString(R.string.thanks_for, who.lang)}"
|
||||
gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||
|
||||
setOnClickListener {
|
||||
val data = Intent()
|
||||
data.putExtra(EXTRA_SEARCH, who.search)
|
||||
data.putExtra(EXTRA_SEARCH, who.acct ?: who.name)
|
||||
setResult(Activity.RESULT_OK, data)
|
||||
finish()
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ package jp.juggler.subwaytooter
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.PictureDrawable
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.annotation.Nullable
|
||||
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.GlideBuilder
|
||||
import com.bumptech.glide.Registry
|
||||
|
@ -19,16 +17,38 @@ import com.caverock.androidsvg.SVG
|
|||
import com.caverock.androidsvg.SVGParseException
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import kotlin.math.min
|
||||
|
||||
@GlideModule
|
||||
class MyAppGlideModule : AppGlideModule() {
|
||||
|
||||
companion object{
|
||||
private val svgSig = "<svg".toByteArray(Charsets.UTF_8)
|
||||
private fun findBytes(data:ByteArray,dataSize:Int = data.size,key:ByteArray):Int{
|
||||
fun check(start:Int):Boolean{
|
||||
for(j in key.indices){
|
||||
if( data[start+j] != key[j] ) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
for(i in 0 .. dataSize - key.size){
|
||||
if(check(i)) return i
|
||||
}
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
// Decodes an SVG internal representation from an [InputStream].
|
||||
inner class SvgDecoder : ResourceDecoder<InputStream, SVG> {
|
||||
|
||||
override fun handles(source : InputStream, options : Options) : Boolean {
|
||||
// TODO: Can we tell?
|
||||
return true
|
||||
val size = min(source.available(),1024)
|
||||
if(size<=0) return false
|
||||
val buf = ByteArray(size)
|
||||
val nRead = source.read(buf,0,size)
|
||||
val isSvg = -1 != findBytes(buf,nRead,svgSig)
|
||||
return isSvg
|
||||
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.graphics.Matrix
|
|||
import android.graphics.drawable.Animatable
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.PictureDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -250,19 +251,29 @@ class MyNetworkImageView : AppCompatImageView {
|
|||
) : ImageViewTarget<Drawable>(this@MyNetworkImageView), UrlTarget {
|
||||
|
||||
// errorDrawable The error drawable to optionally show, or null.
|
||||
override fun onLoadFailed(errorDrawable : Drawable?) = onLoadFailed(urlLoading)
|
||||
override fun onLoadFailed(errorDrawable : Drawable?) {
|
||||
onLoadFailed(urlLoading)
|
||||
}
|
||||
|
||||
override fun setResource(resource : Drawable?) {
|
||||
try {
|
||||
// 別の画像を表示するよう指定が変化していたなら何もしない
|
||||
if(urlLoading != mUrl) return
|
||||
if(resource !is BitmapDrawable) return
|
||||
|
||||
if(mCornerRadius <= 0f) {
|
||||
setImageDrawable(resource)
|
||||
} else {
|
||||
setImageDrawable(replaceBitmapDrawable(resource.bitmap))
|
||||
if(mCornerRadius > 0f) {
|
||||
if(resource is BitmapDrawable) {
|
||||
// BitmapDrawableは角丸処理が可能。
|
||||
setImageDrawable(replaceBitmapDrawable(resource.bitmap))
|
||||
return
|
||||
}
|
||||
// その他のDrawable
|
||||
// たとえばInstanceTickerのアイコンにSVGが使われていたらPictureDrawableになる
|
||||
log.w("cornerRadius=$mCornerRadius,drawable=$resource,url=$urlLoading")
|
||||
}
|
||||
|
||||
setImageDrawable(resource)
|
||||
return
|
||||
|
||||
} catch(ex : Throwable) {
|
||||
log.trace(ex)
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<string name="confirm_account_remove">Aquest compte s\'eliminarà i es desfaran totes les pissarres.
|
||||
\nN\'estàs segura\?</string>
|
||||
<string name="user_name_not_match">El nom d\'usuària no coincideix</string>
|
||||
<string name="access_token_updated_for">"la credencial d\'accés de %1$s s\'ha actualitzat."</string>
|
||||
<string name="access_token_updated_for">la credencial d\'accés de %1$s s\'ha actualitzat.</string>
|
||||
<string name="back_to_column_list">Ves a la llista de pissarres en pitjar \"Enrera\"</string>
|
||||
<string name="account_empty">No s\'ha configurat cap compte. Sisplau afegeix-hi un compte.</string>
|
||||
<string name="dont_confirm_before_close_column">Tanca la pissarra sense confirmació</string>
|
||||
|
@ -166,7 +166,7 @@
|
|||
<string name="boost">Difon</string>
|
||||
<string name="favourite">Marcar com a preferit</string>
|
||||
<string name="mention2">Mencionar</string>
|
||||
<string name="notification_count">notificacions %1$s</string>
|
||||
<string name="notification_count">notificacions %1$d</string>
|
||||
<string name="app_exit">Tanca l\'aplicació</string>
|
||||
<string name="ask_always">Sempre preguntar</string>
|
||||
<string name="open_column_list">Obre la llista de pissarres</string>
|
||||
|
|
Loading…
Reference in New Issue