依存関係の更新。detektで指摘されたコードスタイルの整形。

This commit is contained in:
tateisu 2022-03-11 08:11:49 +09:00
parent 128c069d81
commit 771d8789a9
33 changed files with 132 additions and 181 deletions

View File

@ -139,7 +139,9 @@ dependencies {
implementation "androidx.appcompat:appcompat:$appcompat_version"
def emojiVersion = "1.0.1"
implementation "androidx.core:core-ktx:1.7.0"
def emojiVersion = "1.1.0"
implementation "androidx.emoji2:emoji2:$emojiVersion"
implementation "androidx.emoji2:emoji2-bundled:$emojiVersion"
@ -147,10 +149,7 @@ dependencies {
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
// NavigationView
implementation "com.google.android.material:material:1.4.0"
// PreferenceManager
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "com.google.android.material:material:1.5.0"
implementation "androidx.exifinterface:exifinterface:1.3.3"
@ -170,18 +169,9 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
// Anko Layouts
// sdk15, sdk19, sdk21, sdk23 are also available
// implementation "org.jetbrains.anko:anko-sdk25:$anko_version"
// implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
// Coroutine listeners for Anko Layouts
//implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
//implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
testImplementation "junit:junit:$junit_version" // kotlin-testとjunitを併用
def okhttpVersion = "4.9.2"
@ -204,7 +194,7 @@ dependencies {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
def glideVersion = '4.12.0'
def glideVersion = '4.13.1'
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:annotations:$glideVersion"
implementation("com.github.bumptech.glide:okhttp3-integration:$glideVersion") {
@ -223,7 +213,7 @@ dependencies {
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
implementation 'commons-io:commons-io:2.6'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.hjson:hjson:3.0.0'
@ -231,7 +221,7 @@ dependencies {
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer:2.17.0'
/*
WARNING: [Processor] Library '…\exoplayer-ui-2.12.0.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
@ -243,10 +233,9 @@ dependencies {
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
@ -266,8 +255,7 @@ dependencies {
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version"
def roomVersion = "2.4.0"
def roomVersion = "2.4.2"
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"
@ -276,19 +264,7 @@ dependencies {
implementation "androidx.work:work-runtime:$workVersion"
implementation "androidx.work:work-runtime-ktx:$workVersion"
implementation "androidx.startup:startup-runtime:1.1.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
// implementation "androidx.compose.ui:ui:$compose_version"
// implementation "androidx.compose.material:material:$compose_version"
// implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
// implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
// implementation "androidx.compose.material:material-icons-extended:$compose_version"
// androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
// debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
// implementation "androidx.activity:activity-compose:1.4.0"
// implementation "com.google.accompanist:accompanist-flowlayout:0.20.0"
implementation "androidx.startup:startup-runtime:1.1.1"
// Koin main features for Android
implementation "io.insert-koin:koin-android:$koin_version"
@ -321,6 +297,8 @@ detekt {
// point to your custom config defining rules to run, overwriting default behavior
config = files("$rootDir/config/detekt/config.yml")
// detekt 1.19.0
// app/build/reports/detekt
reports {
// checkstyle like format mainly for integrations like Jenkins
xml {

View File

@ -98,7 +98,6 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
) {
}
}
}
@kotlinx.serialization.Serializable
@ -250,6 +249,7 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
var density: Float = 1f
@Suppress("LongMethod")
private fun initUI() {
this.density = resources.displayMetrics.density
this.handler = App1.getAppState(this).handler
@ -360,7 +360,7 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
}
etMaxTootChars.addTextChangedListener(
simpleTextWatcher{
simpleTextWatcher {
val num = etMaxTootChars.parseInt()
if (num != null && num >= 0) {
saveUIToData()
@ -460,7 +460,6 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
cbConfirmReaction.isChecked = a.confirm_reaction
cbConfirmUnbookmark.isChecked = a.confirm_unbookmark
notificationSoundUri = a.sound_uri
etDefaultText.setText(a.default_text)
@ -548,7 +547,6 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
} finally {
loadingBusy = false
}
}
private fun showAcctColor() {
@ -861,7 +859,6 @@ class ActAccountSetting : AppCompatActivity(), View.OnClickListener,
viewBinding.apply {
ivProfileAvatar.setErrorImage(defaultColorIcon(this@ActAccountSetting, questionId))
ivProfileAvatar.setDefaultImage(defaultColorIcon(this@ActAccountSetting, questionId))

View File

@ -95,7 +95,6 @@ class ActCallback : AppCompatActivity() {
// どうであれメイン画面に戻る
afterDispatch()
}
private fun afterDispatch() {

View File

@ -39,7 +39,6 @@ import java.util.*
import javax.net.ssl.HttpsURLConnection
import kotlin.math.max
class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
companion object {
@ -157,7 +156,6 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
}
}
private val mediaSourceEventListener = object : MediaSourceEventListener {
override fun onLoadStarted(
windowIndex: Int,
@ -267,7 +265,6 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
overridePendingTransition(R.anim.fade_in, R.anim.slide_to_bottom)
}
internal fun initUI() {
viewBinding = ActMediaViewerBinding.inflate(layoutInflater)
setContentView(viewBinding.root)
@ -743,7 +740,6 @@ class ActMediaViewer : AppCompatActivity(), View.OnClickListener {
}
}
private fun more(ta: TootAttachmentLike) {
val ad = ActionsDialog()
if (ta is TootAttachment) {

View File

@ -106,7 +106,7 @@ class ActPost : AppCompatActivity(),
var density: Float = 0f
private lateinit var progressChannel : Channel<Unit>
private lateinit var progressChannel: Channel<Unit>
///////////////////////////////////////////////////
@ -166,7 +166,7 @@ class ActPost : AppCompatActivity(),
density = resources.displayMetrics.density
arMushroom.register(this, log)
progressChannel = Channel(capacity = Channel.CONFLATED )
progressChannel = Channel(capacity = Channel.CONFLATED)
launchMain {
try {
while (true) {
@ -174,8 +174,8 @@ class ActPost : AppCompatActivity(),
showMedisAttachmentProgress()
delay(1000L)
}
}catch(ex:Throwable){
when(ex){
} catch (ex: Throwable) {
when (ex) {
is CancellationException, is ClosedReceiveChannelException -> Unit
else -> log.trace(ex)
}
@ -193,7 +193,7 @@ class ActPost : AppCompatActivity(),
override fun onDestroy() {
try {
progressChannel.close()
}catch(ex:Throwable){
} catch (ex: Throwable) {
log.e(ex)
}
completionHelper.onDestroy()
@ -290,10 +290,10 @@ class ActPost : AppCompatActivity(),
}
override fun onPostAttachmentProgress() {
launchIO{
try{
launchIO {
try {
progressChannel.send(Unit)
}catch(ex:Throwable){
} catch (ex: Throwable) {
log.w(ex)
}
}
@ -323,8 +323,6 @@ class ActPost : AppCompatActivity(),
Styler.fixHorizontalMargin(findViewById(R.id.llFooterBar))
}
views.root.callbackOnSizeChanged = { _, _, _, _ ->
if (Build.VERSION.SDK_INT >= 24 && isMultiWindowPost) saveWindowSize()
// ビューのw,hはシステムバーその他を含まないので使わない
@ -366,7 +364,6 @@ class ActPost : AppCompatActivity(),
}
}
ivMedia = listOf(
views.ivMedia1,
views.ivMedia2,
@ -381,7 +378,6 @@ class ActPost : AppCompatActivity(),
views.etChoice4,
)
arrayOf(
views.ibSchedule,
views.ibScheduleReset,

View File

@ -46,7 +46,6 @@ import java.util.logging.Level
import java.util.logging.Logger
import kotlin.math.max
class App1 : Application() {
override fun onCreate() {
@ -60,7 +59,6 @@ class App1 : Application() {
super.onTerminate()
}
companion object {
internal val log = LogCategory("App1")

View File

@ -102,7 +102,12 @@ private fun ActMain.accountCreate(
r1
}?.let { result ->
val sa: SavedAccount? = null
if (activity.afterAccountVerify(result, resultTootAccount, sa, apiHost, resultApDomain)) {
if (activity.afterAccountVerify(result,
resultTootAccount,
sa,
apiHost,
resultApDomain)
) {
dialogHost.dismissSafe()
dialog_create.dismissSafe()
}
@ -235,7 +240,6 @@ private fun appServerUnregister(context: Context, account: SavedAccount) {
}&app_id=${
context.packageName.encodePercent()
}&tag=$tag"
.toFormRequestBody()
.toPost()
.url(PollingWorker.APP_SERVER + "/unregister")

View File

@ -1,13 +1,15 @@
package jp.juggler.subwaytooter.action
import android.app.Dialog
import jp.juggler.subwaytooter.*
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.R
import jp.juggler.subwaytooter.actmain.addColumn
import jp.juggler.subwaytooter.api.*
import jp.juggler.subwaytooter.api.TootParser
import jp.juggler.subwaytooter.api.entity.MisskeyAntenna
import jp.juggler.subwaytooter.api.entity.TimelineItem
import jp.juggler.subwaytooter.api.entity.TootList
import jp.juggler.subwaytooter.api.entity.parseItem
import jp.juggler.subwaytooter.api.runApiTask
import jp.juggler.subwaytooter.column.ColumnType
import jp.juggler.subwaytooter.column.onListListUpdated
import jp.juggler.subwaytooter.column.onListNameUpdated
@ -192,7 +194,6 @@ fun ActMain.listRename(
jsonObject {
put("title", text)
}
.toPutRequestBuilder()
)
}?.also { result ->

View File

@ -78,8 +78,8 @@ fun ActMain.reloadIconSize() {
ActMain.eventFadeAlpha = PrefS.spEventTextAlpha()
.toFloatOrNull()
?.takeIf{ it.isFinite()}
?.clip(0f,1f)
?.takeIf { it.isFinite() }
?.clip(0f, 1f)
?: 1f
}

View File

@ -41,10 +41,11 @@ class SideMenuAdapter(
private val actMain: ActMain,
val handler: Handler,
navigationView: ViewGroup,
private val drawer: DrawerLayout
private val drawer: DrawerLayout,
) : BaseAdapter() {
companion object {
private val log = LogCategory("SideMenuAdapter")
private val itemTypeCount = ItemType.values().size
@ -177,7 +178,7 @@ class SideMenuAdapter(
// 項目の文字列リソース or 0: divider, 1: バージョン表記, 2: タイムゾーン
val title: Int = 0,
val icon: Int = 0,
val action: ActMain.() -> Unit = {}
val action: ActMain.() -> Unit = {},
) {
val itemType: ItemType
@ -407,7 +408,7 @@ class SideMenuAdapter(
private inline fun <reified T : View> viewOrInflate(
view: View?,
parent: ViewGroup?,
resId: Int
resId: Int,
): T =
(view ?: actMain.layoutInflater.inflate(resId, parent, false))
as? T ?: error("invalid view type! ${T::class.java.simpleName}")
@ -486,6 +487,7 @@ class SideMenuAdapter(
}
}
} catch (ex: Throwable) {
log.w(ex)
return "(incorrect TimeZone)"
}
}

View File

@ -225,7 +225,7 @@ fun ActPost.deleteAttachment(pa: PostAttachment) {
.setPositiveButton(R.string.ok) { _, _ ->
try {
pa.isCancelled = true
pa.status= PostAttachment.Status.Error
pa.status = PostAttachment.Status.Error
pa.job.cancel()
attachmentList.remove(pa)
} catch (ignored: Throwable) {

View File

@ -124,10 +124,9 @@ class CompletionHelper(
}
}
private fun checkMention(et: MyEditText, src: String) {
// 選択範囲末尾からスキャン
var count_atMark = 0
var countAtmark = 0
var start: Int = -1
val end = et.selectionEnd
var i = end
@ -137,8 +136,8 @@ class CompletionHelper(
if (cp == '@'.code) {
start = i
if (++count_atMark >= 2) break else continue
} else if (count_atMark == 1) {
if (++countAtmark >= 2) break else continue
} else if (countAtmark == 1) {
// @username@host の username部分はUnicodeを含まない
if (matchUserNameOrAsciiDomain(cp)) continue else break
} else {
@ -161,62 +160,62 @@ class CompletionHelper(
val limit = 100
val s = src.substring(start, end)
val acct_list = AcctSet.searchPrefix(s, limit)
log.d("search for $s, result=${acct_list.size}")
if (acct_list.isEmpty()) {
val acctList = AcctSet.searchPrefix(s, limit)
log.d("search for $s, result=${acctList.size}")
if (acctList.isEmpty()) {
closeAcctPopup()
} else {
openPopup()?.setList(et, start, end, acct_list, null, null)
openPopup()?.setList(et, start, end, acctList, null, null)
}
}
private fun checkTag(et: MyEditText, src: String) {
val end = et.selectionEnd
val last_sharp = src.lastIndexOf('#', end - 1)
if (last_sharp == -1 || end - last_sharp < 2) {
val lastSharp = src.lastIndexOf('#', end - 1)
if (lastSharp == -1 || end - lastSharp < 2) {
checkEmoji(et, src)
return
}
val part = src.substring(last_sharp + 1, end)
val part = src.substring(lastSharp + 1, end)
if (!TootTag.isValid(part, accessInfo?.isMisskey == true)) {
checkEmoji(et, src)
return
}
val limit = 100
val s = src.substring(last_sharp + 1, end)
val tag_list = TagSet.searchPrefix(s, limit)
log.d("search for $s, result=${tag_list.size}")
if (tag_list.isEmpty()) {
val s = src.substring(lastSharp + 1, end)
val tagList = TagSet.searchPrefix(s, limit)
log.d("search for $s, result=${tagList.size}")
if (tagList.isEmpty()) {
closeAcctPopup()
} else {
openPopup()?.setList(et, last_sharp, end, tag_list, null, null)
openPopup()?.setList(et, lastSharp, end, tagList, null, null)
}
}
private fun checkEmoji(et: MyEditText, src: String) {
val end = et.selectionEnd
val last_colon = src.lastIndexOf(':', end - 1)
if (last_colon == -1 || end - last_colon < 1) {
val lastColon = src.lastIndexOf(':', end - 1)
if (lastColon == -1 || end - lastColon < 1) {
closeAcctPopup()
return
}
if (!EmojiDecoder.canStartShortCode(src, last_colon)) {
if (!EmojiDecoder.canStartShortCode(src, lastColon)) {
// : の手前は始端か改行か空白でなければならない
log.d("checkEmoji: invalid character before shortcode.")
closeAcctPopup()
return
}
val part = src.substring(last_colon + 1, end)
val part = src.substring(lastColon + 1, end)
if (part.isEmpty()) {
// :を入力した直後は候補は0で、「閉じる」と「絵文字を選ぶ」だけが表示されたポップアップを出す
openPopup()?.setList(
et, last_colon, end, null, pickerCaptionEmoji, openPickerEmoji
et, lastColon, end, null, pickerCaptionEmoji, openPickerEmoji
)
return
}
@ -227,28 +226,28 @@ class CompletionHelper(
return
}
val code_list = ArrayList<CharSequence>()
val codeList = ArrayList<CharSequence>()
val limit = 100
// カスタム絵文字の候補を部分一致検索
code_list.addAll(customEmojiCodeList(accessInfo, limit, part))
codeList.addAll(customEmojiCodeList(accessInfo, limit, part))
// 通常の絵文字を部分一致で検索
val remain = limit - code_list.size
val remain = limit - codeList.size
if (remain > 0) {
val s = src.substring(last_colon + 1, end)
.lowercase()
.replace('-', '_')
val s = src.substring(lastColon + 1, end)
.lowercase()
.replace('-', '_')
val matches = EmojiDecoder.searchShortCode(activity, s, remain)
log.d("checkEmoji: search for $s, result=${matches.size}")
code_list.addAll(matches)
codeList.addAll(matches)
}
openPopup()?.setList(
et,
last_colon,
lastColon,
end,
code_list,
codeList,
pickerCaptionEmoji,
openPickerEmoji
)
@ -262,11 +261,11 @@ class CompletionHelper(
) = buildList<CharSequence> {
accessInfo ?: return@buildList
val custom_list =
val customList =
App1.custom_emoji_lister.getListWithAliases(accessInfo, onEmojiListLoad)
?: return@buildList
for (item in custom_list) {
for (item in customList) {
if (size >= limit) break
if (!item.shortcode.contains(needle)) continue
@ -354,7 +353,6 @@ class CompletionHelper(
handler.postDelayed(procTextChanged, if (popup?.isShowing == true) 100L else 500L)
}
override fun afterTextChanged(s: Editable) {
// ペースト時に余計な装飾を取り除く
val spans = s.getSpans(0, s.length, Any::class.java)

View File

@ -71,7 +71,7 @@ fun ColumnViewHolder.onCheckedChangedImpl(view: CompoundButton?, isChecked: Bool
activity.appState.saveColumnList()
}
cbShowMediaDescription->{
cbShowMediaDescription -> {
column.showMediaDescription = isChecked
activity.appState.saveColumnList()
column.startLoading()

View File

@ -591,7 +591,6 @@ internal class ViewHolderHeaderProfile(
else ->
append(emoji.unifiedCode)
}
}
if (who.bot) {

View File

@ -91,13 +91,13 @@ interface AppDatabaseHolder {
}
class AppDatabaseHolderImpl(context: Context) : AppDatabaseHolder {
companion object{
companion object {
private val log = LogCategory("AppDatabaseHolderImpl")
}
private class DBOpenHelper(context: Context) :
SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
companion object{
companion object {
private val log = LogCategory("DBOpenHelper")
}

View File

@ -24,7 +24,7 @@ object Global {
private var isPrepared = false
fun prepare(contextArg: Context,caller:String): Global {
fun prepare(contextArg: Context, caller: String): Global {
// double check befort/after lock
if (!isPrepared) {
synchronized(this) {
@ -46,7 +46,7 @@ object Global {
}
})
}
getKoin().get<AppDatabaseHolder>(). afterGlobalPrepare()
getKoin().get<AppDatabaseHolder>().afterGlobalPrepare()
}
}
}
@ -60,6 +60,6 @@ class GlobalInitializer : Initializer<Global> {
}
override fun create(context: Context): Global {
return Global.prepare(context,"GlobalInitializer")
return Global.prepare(context, "GlobalInitializer")
}
}

View File

@ -24,7 +24,7 @@ import org.jetbrains.anko.textColor
fun ItemViewHolder.showStatusOrReply(
item: TootStatus,
colorBgArg: Int = 0,
fadeText: Boolean = false
fadeText: Boolean = false,
) {
var colorBg = colorBgArg
val reply = item.reply
@ -47,7 +47,7 @@ fun ItemViewHolder.showStatusOrReply(
fun ItemViewHolder.showStatus(
status: TootStatus,
colorBg: Int = 0,
fadeText: Boolean = false
fadeText: Boolean = false,
) {
val filteredWord = status.filteredWord
@ -134,7 +134,7 @@ fun ItemViewHolder.showStatus(
tvCardText.alpha = a
}
tvMentions.textOrGone =status.decoded_mentions
tvMentions.textOrGone = status.decoded_mentions
tvContent.text = modifiedContent
contentInvalidator.register(modifiedContent)

View File

@ -1,10 +1,9 @@
package jp.juggler.subwaytooter.mfm
import java.util.HashMap
import java.util.*
import java.util.regex.Matcher
import java.util.regex.Pattern
// 正規表現パターンごとにMatcherをキャッシュする
// 対象テキストが変わったらキャッシュを捨てて更新する
// Matcher#region(start,text.length) を設定してから返す

View File

@ -4,8 +4,7 @@ import android.graphics.Color
import jp.juggler.subwaytooter.util.DecodeOptions
import jp.juggler.util.LogCategory
import jp.juggler.util.removeEndWhitespaces
import java.util.ArrayList
import java.util.*
object MisskeyMarkdownDecoder {
@ -13,8 +12,6 @@ object MisskeyMarkdownDecoder {
internal const val DEBUG = false
////////////////////////////////////////////////////////////////////////////
private fun mixColor(
@ -38,7 +35,6 @@ object MisskeyMarkdownDecoder {
mixColor(Color.GRAY, 0x8000ff)
)
// 入力テキストからタグを抽出するために使う
// #を含まないタグ文字列のリスト、またはnullを返す
fun findHashtags(src: String?): ArrayList<String>? {

View File

@ -171,7 +171,6 @@ fun String.removeOrphanedBrackets(urlSafe: Boolean = false): String {
return substring(0, pos + 1)
}
// [title] 【title】
// 直後に改行が必要だったが文末でも良いことになった https://github.com/syuilo/misskey/commit/79ffbf95db9d0cc019d06ab93b1bfa6ba0d4f9ae
// val titleParser = simpleParser(
@ -210,7 +209,6 @@ private fun NodeParseEnv.titleParserImpl(): NodeDetected? {
return null
}
@Suppress("SpellCheckingInspection")
private val latexEscape = listOf(
"\\#" to "#",

View File

@ -108,7 +108,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
closePreviousBlock()
val text = it.args[0]
val kw_start = sb.length // キーワードの開始位置
val keywordStart = sb.length // キーワードの開始位置
appendText(text)
appendText(" ")
start = sb.length // 検索リンクの開始位置
@ -117,7 +117,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
context.getString(jp.juggler.subwaytooter.R.string.search),
"https://www.google.co.jp/search?q=${text.encodePercent()}"
)
spanList.addLast(kw_start, sb.length, android.text.style.RelativeSizeSpan(1.2f))
spanList.addLast(keywordStart, sb.length, android.text.style.RelativeSizeSpan(1.2f))
closeBlock()
}
@ -131,7 +131,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
fireRenderChildNodes(it)
spanList.addLast(
start, sb.length,
jp.juggler.subwaytooter.span.MisskeyBigSpan(font_bold)
jp.juggler.subwaytooter.span.MisskeyBigSpan(fontBold)
)
}
}),
@ -142,7 +142,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
} else {
val start = this.start
fireRenderChildNodes(it)
spanList.addLast(start, sb.length, jp.juggler.util.fontSpan(font_bold))
spanList.addLast(start, sb.length, jp.juggler.util.fontSpan(fontBold))
}
}),
@ -306,7 +306,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
fireRenderChildNodes(it)
val bg_color =
val bgColor =
MisskeyMarkdownDecoder.quoteNestColors[it.quoteNest % MisskeyMarkdownDecoder.quoteNestColors.size]
// TextView の文字装飾では「ブロック要素の入れ子」を表現できない
// 内容の各行の始端に何か追加するというのがまずキツい
@ -325,7 +325,7 @@ enum class NodeType(val render: SpanOutputEnv.(Node) -> Unit) {
spanList.insert(i, 2)
spanList.addLast(
i, i + 1,
android.text.style.BackgroundColorSpan(bg_color)
android.text.style.BackgroundColorSpan(bgColor)
)
}
}

View File

@ -4,7 +4,6 @@ import android.text.SpannableStringBuilder
import android.text.Spanned
import java.util.*
// 文字装飾の指定を溜めておいてノードの親子関係に応じて順序を調整して、最後にまとめて適用する
class SpanList {

View File

@ -17,7 +17,6 @@ import jp.juggler.subwaytooter.table.HighlightWord
import jp.juggler.subwaytooter.util.*
import java.util.*
// 装飾つきテキストの出力時に使うデータの集まり
class SpanOutputEnv(
val options: DecodeOptions,
@ -28,7 +27,7 @@ class SpanOutputEnv(
val decorationEnabled = PrefB.bpMfmDecorationEnabled(context)
val showUnsupportedMarkup = PrefB.bpMfmDecorationShowUnsupportedMarkup(context)
val font_bold = ActMain.timeline_font_bold
val fontBold = ActMain.timeline_font_bold
val linkHelper: LinkHelper? = options.linkHelper
var spanList = SpanList()
@ -43,13 +42,13 @@ class SpanOutputEnv(
}
internal fun fireRenderChildNodes(parent: Node): SpanList {
val parent_result = this.spanList
val parentResult = this.spanList
parent.childNodes.forEach {
val child_result = fireRender(it)
parent_result.addAll(child_result)
val childResult = fireRender(it)
parentResult.addAll(childResult)
}
this.spanList = parent_result
return parent_result
this.spanList = parentResult
return parentResult
}
// 直前の文字が改行文字でなければ改行する

View File

@ -26,4 +26,3 @@ fun SharedPreferences.Editor.put(item: LongPref, v: Long) =
fun SharedPreferences.Editor.put(item: FloatPref, v: Float) =
this.apply { item.put(this, v) }

View File

@ -266,7 +266,6 @@ class AttachmentUploader(
launchIO { prepareChannel().send(request) }
}
@WorkerThread
private suspend fun AttachmentRequest.upload(): TootApiResult? {
try {

View File

@ -1,7 +1,6 @@
package jp.juggler.subwaytooter.util
import android.content.Context
import android.content.SharedPreferences
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.util.SparseBooleanArray
@ -60,11 +59,13 @@ object EmojiDecoder {
Character.LOWERCASE_LETTER,
Character.TITLECASE_LETTER,
Character.MODIFIER_LETTER,
Character.OTHER_LETTER -> false
Character.OTHER_LETTER,
-> false
// Mark
Character.NON_SPACING_MARK,
Character.COMBINING_SPACING_MARK,
Character.ENCLOSING_MARK -> false
Character.ENCLOSING_MARK,
-> false
// Decimal_Number
Character.DECIMAL_DIGIT_NUMBER -> false
@ -270,7 +271,7 @@ object EmojiDecoder {
fun onShortCode(
prevCodePoint: Int,
part: String,
name: String
name: String,
) // part : ":shortcode:", name : "shortcode"
}
@ -279,7 +280,7 @@ object EmojiDecoder {
private fun splitShortCode(
s: String,
callback: ShortCodeSplitterCallback
callback: ShortCodeSplitterCallback,
) {
val urlList = ArrayList<IntRange>().apply {
val m = reUrl.matcher(s)
@ -427,7 +428,7 @@ object EmojiDecoder {
// カスタム絵文字の変換も行わない
fun decodeShortCode(
s: String,
emojiMapCustom: HashMap<String, CustomEmoji>? = null
emojiMapCustom: HashMap<String, CustomEmoji>? = null,
): String {
val decodeEmojioneShortcode = PrefB.bpEmojioneShortcode()
@ -464,7 +465,7 @@ object EmojiDecoder {
internal fun searchShortCode(
context: Context,
prefix: String,
limit: Int
limit: Int,
): ArrayList<CharSequence> {
val dst = ArrayList<CharSequence>()
for (shortCode in EmojiMap.shortNameList) {

View File

@ -20,9 +20,9 @@ class PostAttachment : Comparable<PostAttachment> {
var status: Status
var attachment: TootAttachment? = null
var callback: Callback? = null
var progress =""
set(value){
if( field!=value){
var progress = ""
set(value) {
if (field != value) {
field = value
callback?.onPostAttachmentProgress()
}

View File

@ -27,6 +27,7 @@ interface PostCompleteCallback {
fun onScheduledPostComplete(targetAccount: SavedAccount)
}
@Suppress("LongParameterList")
class PostImpl(
val activity: AppCompatActivity,
val account: SavedAccount,

View File

@ -48,7 +48,7 @@ object ToastUtils {
fun Context.showToast(bLong: Boolean, caption: String?): Boolean =
ToastUtils.showToastImpl(this, bLong, caption ?: "(null)")
fun Context.showToast(ex: Throwable, caption: String="error."): Boolean =
fun Context.showToast(ex: Throwable, caption: String = "error."): Boolean =
ToastUtils.showToastImpl(this, true, ex.withCaption(caption))
fun Context.showToast(bLong: Boolean, stringId: Int, vararg args: Any): Boolean =

View File

@ -35,7 +35,6 @@ class VideoInfo(
private fun MediaMetadataRetriever.long(key: Int) =
string(key)?.toLongOrNull()
/**
* 調査のためコーデックを列挙して情報をログに出す
*/
@ -47,6 +46,7 @@ class VideoInfo(
val caps = try {
info.getCapabilitiesForType(MediaFormat.MIMETYPE_VIDEO_AVC) ?: continue
} catch (ex: Throwable) {
log.w(ex)
continue
}
@ -117,7 +117,6 @@ class VideoInfo(
}
}
val mimeType = mmr.string(MediaMetadataRetriever.METADATA_KEY_MIMETYPE)
val rotation = mmr.int(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION) ?: 0
@ -185,5 +184,4 @@ class VideoInfo(
override fun toString() =
"rotation=$rotation, size=$size, frameRatio=$frameRatio, bitrate=${actualBps ?: bitrate}, audioSampleRate=$audioSampleRate, mimeType=$mimeType, file=${file.canonicalPath}"
}

View File

@ -6,8 +6,8 @@ buildscript {
ext.target_sdk_version = 31
ext.compile_sdk_version = 31
ext.appcompat_version = "1.4.0"
ext.lifecycle_version = "2.4.0"
ext.appcompat_version = "1.4.1"
ext.lifecycle_version = "2.4.1"
ext.arch_version = "2.1.0"
ext.kotlin_version = '1.6.10'
@ -17,7 +17,7 @@ buildscript {
ext.junit_version = '4.13.2'
ext.detekt_version = '1.18.1'
ext.detekt_version = '1.19.0'
ext.compose_version = '1.0.5'
@ -54,7 +54,8 @@ allprojects {
maven { url 'https://dl.bintray.com/google/exoplayer/' }
maven { url 'https://dl.bintray.com/google/flexbox-layout/' }
maven { url "https://plugins.gradle.org/m2/" } // detekt
// detekt
maven { url "https://plugins.gradle.org/m2/" }
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<!-- <ID>ArrayPrimitive:TagHistoryView.kt$TagHistoryView$Array&lt;Float&gt;?</ID> -->
</CurrentIssues>
</SmellBaseline>

View File

@ -85,10 +85,10 @@ complexity:
includePrivateDeclarations: false
ComplexMethod:
active: true
threshold: 24
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
ignoreNestingFunctions: false
threshold: 100
ignoreSingleWhenExpression: true
ignoreSimpleWhenEntries: true
ignoreNestingFunctions: true
nestingFunctions: ['run', 'let', 'apply', 'with', 'also', 'use', 'forEach', 'isNotNull', 'ifNull']
LabeledExpression:
active: false
@ -97,13 +97,13 @@ complexity:
active: true
threshold: 2000
LongMethod:
active: true
threshold: 60
active: false
threshold: 100
LongParameterList:
active: true
functionThreshold: 6
constructorThreshold: 7
ignoreDefaultParameters: false
functionThreshold: 12
constructorThreshold: 12
ignoreDefaultParameters: true
ignoreDataClasses: true
ignoreAnnotated: []
MethodOverloading:
@ -127,14 +127,14 @@ complexity:
TooManyFunctions:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
thresholdInFiles: 11
thresholdInClasses: 11
thresholdInInterfaces: 11
thresholdInObjects: 11
thresholdInEnums: 11
ignoreDeprecated: false
thresholdInFiles: 100
thresholdInClasses: 100
thresholdInInterfaces: 100
thresholdInObjects: 100
thresholdInEnums: 100
ignoreDeprecated: true
ignorePrivate: false
ignoreOverridden: false
ignoreOverridden: true
coroutines:
active: true
@ -270,7 +270,7 @@ formatting:
Filename:
active: true
FinalNewline:
active: true
active: false
autoCorrect: true
insertFinalNewLine: true
ImportOrdering:
@ -436,7 +436,7 @@ naming:
active: true
mustBeFirst: true
MemberNameEqualsClassName:
active: true
active: false
ignoreOverridden: true
NoNameShadowing:
active: false