detekt 1.21.0-RC1
This commit is contained in:
parent
895bfed506
commit
eae1c313f0
|
@ -126,7 +126,7 @@ class ActAbout : AppCompatActivity() {
|
|||
val padding = (0.5f + density * 8).toInt()
|
||||
|
||||
for (who in translators) {
|
||||
ll.addView(AppCompatButton(this).apply {
|
||||
AppCompatButton(this).apply {
|
||||
//
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
|
@ -150,7 +150,7 @@ class ActAbout : AppCompatActivity() {
|
|||
setResult(Activity.RESULT_OK, data)
|
||||
finish()
|
||||
}
|
||||
})
|
||||
}.let { ll.addView(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,11 +52,12 @@ import java.io.File
|
|||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.io.InputStream
|
||||
import java.util.*
|
||||
import kotlin.math.max
|
||||
|
||||
class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
|
||||
CompoundButton.OnCheckedChangeListener, AdapterView.OnItemSelectedListener {
|
||||
class ActAccountSetting : AppCompatActivity(),
|
||||
View.OnClickListener,
|
||||
CompoundButton.OnCheckedChangeListener,
|
||||
AdapterView.OnItemSelectedListener {
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -1186,7 +1187,8 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
|
|||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,6 @@ fun ActMain.follow(
|
|||
}
|
||||
.setNeutralButton(R.string.ignore_suggestion) { _, _ ->
|
||||
cont.resume(R.string.ignore_suggestion)
|
||||
|
||||
}
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create()
|
||||
|
|
|
@ -16,7 +16,6 @@ private val log = LogCategory("ActPostAccount")
|
|||
fun ActPost.selectAccount(a: SavedAccount?) {
|
||||
this.account = a
|
||||
|
||||
|
||||
completionHelper.setInstance(a)
|
||||
|
||||
if (a == null) {
|
||||
|
@ -30,7 +29,7 @@ fun ActPost.selectAccount(a: SavedAccount?) {
|
|||
App1.custom_emoji_lister.getList(a)
|
||||
}
|
||||
|
||||
views.spLanguage.setSelection(max(0,languages.indexOfFirst { it.first == a.lang}))
|
||||
views.spLanguage.setSelection(max(0, languages.indexOfFirst { it.first == a.lang }))
|
||||
|
||||
val ac = AcctColor.load(a)
|
||||
views.btnAccount.text = ac.nickname
|
||||
|
|
|
@ -255,7 +255,7 @@ fun ActPost.restoreDraft(draft: JsonObject) {
|
|||
|
||||
val sv = draft.string(DRAFT_POLL_TYPE)
|
||||
if (sv != null) {
|
||||
views.spPollType.setSelection(min(1,sv.toPollTypeIndex()))
|
||||
views.spPollType.setSelection(min(1, sv.toPollTypeIndex()))
|
||||
} else {
|
||||
// old draft
|
||||
val bv = draft.optBoolean(DRAFT_IS_ENQUETE, false)
|
||||
|
|
|
@ -311,7 +311,7 @@ fun ActPost.performPost() {
|
|||
var pollHideTotals = false
|
||||
var pollMultipleChoice = false
|
||||
when (views.spPollType.selectedItemPosition) {
|
||||
0-> Unit // not poll
|
||||
0 -> Unit // not poll
|
||||
else -> {
|
||||
pollType = TootPollsType.Mastodon
|
||||
pollItems = pollChoiceList()
|
||||
|
|
|
@ -8,7 +8,6 @@ import jp.juggler.subwaytooter.api.TootParser
|
|||
import jp.juggler.subwaytooter.api.entity.Acct
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus
|
||||
import jp.juggler.subwaytooter.api.entity.TootVisibility
|
||||
import jp.juggler.subwaytooter.api.entity.unknownHostAndDomain
|
||||
import jp.juggler.subwaytooter.api.runApiTask
|
||||
import jp.juggler.subwaytooter.api.syncStatus
|
||||
import jp.juggler.subwaytooter.table.SavedAccount
|
||||
|
|
|
@ -120,7 +120,6 @@ class TootAttachment : TootAttachmentLike {
|
|||
remote_url = url
|
||||
text_url = url
|
||||
|
||||
|
||||
description = src.string("comment")?.notBlank()
|
||||
?: src.string("name")?.notBlank()
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ class TootNotification(parser: TootParser, src: JsonObject) : TimelineItem() {
|
|||
|
||||
// (Fedibird beta)
|
||||
const val TYPE_STATUS_REFERENCE = "status_reference"
|
||||
|
||||
}
|
||||
|
||||
val json: JsonObject
|
||||
|
|
|
@ -23,14 +23,13 @@ import kotlin.math.max
|
|||
import kotlin.math.min
|
||||
|
||||
/*
|
||||
カラム種別ごとの処理
|
||||
- Loading : 初回ロード
|
||||
- Refresh : (始端/終端の)差分更新
|
||||
- Gap : ギャップ部分の読み込み
|
||||
カラム種別ごとの処理
|
||||
- Loading : 初回ロード
|
||||
- Refresh : (始端/終端の)差分更新
|
||||
- Gap : ギャップ部分の読み込み
|
||||
|
||||
loading,refresh,gap はそれぞれ this の種類が異なるので注意
|
||||
同じ関数を呼び出してるように見えても実際には異なるクラスの異なる関数を呼び出している場合がある
|
||||
|
||||
loading,refresh,gap はそれぞれ this の種類が異なるので注意
|
||||
同じ関数を呼び出してるように見えても実際には異なるクラスの異なる関数を呼び出している場合がある
|
||||
*/
|
||||
|
||||
private val unsupportedRefresh: suspend ColumnTask_Refresh.(client: TootApiClient) -> TootApiResult? =
|
||||
|
|
|
@ -14,8 +14,10 @@ import jp.juggler.subwaytooter.span.MyClickableSpan
|
|||
import jp.juggler.subwaytooter.span.SvgEmojiSpan
|
||||
import jp.juggler.subwaytooter.table.AcctColor
|
||||
import jp.juggler.subwaytooter.table.HighlightWord
|
||||
import jp.juggler.subwaytooter.util.*
|
||||
import java.util.*
|
||||
import jp.juggler.subwaytooter.util.DecodeOptions
|
||||
import jp.juggler.subwaytooter.util.HTMLDecoder
|
||||
import jp.juggler.subwaytooter.util.LinkHelper
|
||||
import jp.juggler.subwaytooter.util.getFullAcctOrNull
|
||||
|
||||
// 装飾つきテキストの出力時に使うデータの集まり
|
||||
class SpanOutputEnv(
|
||||
|
@ -204,7 +206,7 @@ class SpanOutputEnv(
|
|||
linkHelper
|
||||
)
|
||||
|
||||
if( fullAcct==null){
|
||||
if (fullAcct == null) {
|
||||
appendText("@${rawAcct.pretty}")
|
||||
return
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import okhttp3.MultipartBody
|
|||
import okhttp3.RequestBody
|
||||
import okio.BufferedSink
|
||||
import java.io.*
|
||||
import java.util.*
|
||||
import java.util.concurrent.CancellationException
|
||||
import kotlin.coroutines.coroutineContext
|
||||
import kotlin.math.min
|
||||
|
@ -909,18 +908,18 @@ class AttachmentUploader(
|
|||
var resultAttachment: TootAttachment? = null
|
||||
val result = try {
|
||||
context.runApiTask(account) { client ->
|
||||
if( account.isMisskey){
|
||||
if (account.isMisskey) {
|
||||
client.request(
|
||||
"/api/drive/files/update",
|
||||
account.putMisskeyApiToken().apply {
|
||||
put("fileId", attachmentId.toString())
|
||||
put("comment",description)
|
||||
put("comment", description)
|
||||
}.toPostRequestBuilder()
|
||||
)?.also { result ->
|
||||
resultAttachment =
|
||||
parseItem(::TootAttachment, ServiceType.MISSKEY, result.jsonObject)
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
client.request(
|
||||
"/api/v1/media/$attachmentId",
|
||||
jsonObject {
|
||||
|
|
|
@ -3,14 +3,13 @@ package jp.juggler.util
|
|||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
|
||||
private interface JsonAnnotationBase :Annotation
|
||||
annotation class JsonPropInt(val key:String,val defVal:Int)
|
||||
annotation class JsonPropString(val key:String,val defVal:String)
|
||||
annotation class JsonPropBoolean(val key:String,val defVal:Boolean)
|
||||
annotation class JsonPropInt(val key: String, val defVal: Int)
|
||||
annotation class JsonPropString(val key: String, val defVal: String)
|
||||
annotation class JsonPropBoolean(val key: String, val defVal: Boolean)
|
||||
|
||||
class JsonDelegate<T>(val parent: JsonDelegates)
|
||||
|
||||
class JsonDelegates(val src: JsonObject){
|
||||
class JsonDelegates(val src: JsonObject) {
|
||||
val int = JsonDelegate<Int>(this)
|
||||
val string = JsonDelegate<String>(this)
|
||||
val boolean = JsonDelegate<Boolean>(this)
|
||||
|
@ -18,7 +17,7 @@ class JsonDelegates(val src: JsonObject){
|
|||
|
||||
private fun getMetaString(property: KProperty<*>) =
|
||||
property.findAnnotation<JsonPropString>()
|
||||
?: error("${property.name}, required=String, defined=(missing)")
|
||||
?: error("${property.name}, required=String, defined=(missing)")
|
||||
|
||||
operator fun JsonDelegate<String>.getValue(thisRef: Any?, property: KProperty<*>): String =
|
||||
getMetaString(property).let { parent.src.string(it.key) ?: it.defVal }
|
||||
|
@ -29,7 +28,7 @@ operator fun JsonDelegate<String>.setValue(thisRef: Any?, property: KProperty<*>
|
|||
|
||||
private fun getMetaInt(property: KProperty<*>) =
|
||||
property.findAnnotation<JsonPropInt>()
|
||||
?: error("${property.name}, required=Int, defined=(missing)")
|
||||
?: error("${property.name}, required=Int, defined=(missing)")
|
||||
|
||||
operator fun JsonDelegate<Int>.getValue(thisRef: Any?, property: KProperty<*>): Int =
|
||||
getMetaInt(property).let { parent.src.int(it.key) ?: it.defVal }
|
||||
|
@ -40,7 +39,7 @@ operator fun JsonDelegate<Int>.setValue(thisRef: Any?, property: KProperty<*>, v
|
|||
|
||||
private fun getMetaBoolean(property: KProperty<*>) =
|
||||
property.findAnnotation<JsonPropBoolean>()
|
||||
?: error("${property.name}, required=Boolean, defined=(missing)")
|
||||
?: error("${property.name}, required=Boolean, defined=(missing)")
|
||||
|
||||
operator fun JsonDelegate<Boolean>.getValue(thisRef: Any?, property: KProperty<*>): Boolean =
|
||||
getMetaBoolean(property).let { parent.src.boolean(it.key) ?: it.defVal }
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.res.Resources
|
|||
import android.util.Log
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
fun Throwable.withCaption(caption: String?=null) =
|
||||
fun Throwable.withCaption(caption: String? = null) =
|
||||
when {
|
||||
caption.isNullOrBlank() -> "${javaClass.simpleName} $message"
|
||||
else -> "$caption :${javaClass.simpleName} $message"
|
||||
|
@ -40,8 +40,12 @@ class LogCategory(category: String) {
|
|||
///////////////////////////////
|
||||
// Resources.getString()
|
||||
|
||||
private fun msg(priority: Int, res: Resources, @StringRes stringId: Int, args: Array<out Any?>) =
|
||||
msg(priority, res.getString(stringId, *args))
|
||||
private fun msg(
|
||||
priority: Int,
|
||||
res: Resources,
|
||||
@StringRes stringId: Int,
|
||||
args: Array<out Any?>,
|
||||
) = msg(priority, res.getString(stringId, *args))
|
||||
|
||||
fun e(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||
msg(Log.ERROR, res, stringId, args)
|
||||
|
@ -61,7 +65,7 @@ class LogCategory(category: String) {
|
|||
///////////////////////////////
|
||||
// Throwable + string
|
||||
|
||||
private fun msg(priority: Int, ex: Throwable, caption: String? =null) =
|
||||
private fun msg(priority: Int, ex: Throwable, caption: String? = null) =
|
||||
msg(priority, ex.withCaption(caption))
|
||||
|
||||
fun e(ex: Throwable, caption: String = "exception") = msg(Log.ERROR, ex, caption)
|
||||
|
|
|
@ -17,7 +17,7 @@ buildscript {
|
|||
|
||||
ext.junit_version = '4.13.2'
|
||||
|
||||
ext.detekt_version = '1.20.0'
|
||||
ext.detekt_version = '1.21.0-RC1'
|
||||
|
||||
ext.compose_version = '1.0.5'
|
||||
|
||||
|
|
|
@ -247,6 +247,8 @@ formatting:
|
|||
active: true
|
||||
android: false
|
||||
autoCorrect: true
|
||||
Wrapping:
|
||||
active: false
|
||||
AnnotationOnSeparateLine:
|
||||
active: false
|
||||
autoCorrect: true
|
||||
|
|
Loading…
Reference in New Issue