mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-04 12:47:48 +01:00
more
change
This commit is contained in:
parent
caf06354c3
commit
d03116840a
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
import jp.juggler.subwaytooter.R
|
import jp.juggler.subwaytooter.R
|
||||||
import jp.juggler.subwaytooter.api.ApiTask
|
import jp.juggler.subwaytooter.api.ApiTask
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
import jp.juggler.subwaytooter.App1
|
import jp.juggler.subwaytooter.App1
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.text.method.LinkMovementMethod
|
import android.text.method.LinkMovementMethod
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
import jp.juggler.util.notEmpty
|
import jp.juggler.util.notEmpty
|
||||||
import jp.juggler.util.vg
|
import jp.juggler.util.vg
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
import jp.juggler.subwaytooter.R
|
import jp.juggler.subwaytooter.R
|
||||||
import jp.juggler.subwaytooter.api.TootParser
|
import jp.juggler.subwaytooter.api.TootParser
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package jp.juggler.subwaytooter.actpost
|
package jp.juggler.subwaytooter.actpost
|
||||||
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import jp.juggler.subwaytooter.ActPost
|
import jp.juggler.subwaytooter.ActPost
|
||||||
import jp.juggler.subwaytooter.R
|
import jp.juggler.subwaytooter.R
|
||||||
|
@ -41,7 +41,7 @@ class Column(
|
|||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
internal val log = LogCategory("Column")
|
private val log = LogCategory("Column")
|
||||||
|
|
||||||
internal const val LOOP_TIMEOUT = 10000L
|
internal const val LOOP_TIMEOUT = 10000L
|
||||||
internal const val LOOP_READ_ENOUGH = 30 // フィルタ後のデータ数がコレ以上ならループを諦めます
|
internal const val LOOP_READ_ENOUGH = 30 // フィルタ後のデータ数がコレ以上ならループを諦めます
|
||||||
|
@ -8,10 +8,13 @@ import jp.juggler.subwaytooter.util.BucketList
|
|||||||
import jp.juggler.subwaytooter.util.matchHost
|
import jp.juggler.subwaytooter.util.matchHost
|
||||||
import jp.juggler.util.AdapterChange
|
import jp.juggler.util.AdapterChange
|
||||||
import jp.juggler.util.AdapterChangeType
|
import jp.juggler.util.AdapterChangeType
|
||||||
|
import jp.juggler.util.LogCategory
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnActions")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
なんらかアクションを行った後にカラムデータを更新する処理など
|
なんらかアクションを行った後にカラムデータを更新する処理など
|
||||||
*/
|
*/
|
||||||
@ -377,12 +380,12 @@ fun replaceConversationSummary(
|
|||||||
changeList.add(AdapterChange(AdapterChangeType.RangeChange, i, 1))
|
changeList.add(AdapterChange(AdapterChangeType.RangeChange, i, 1))
|
||||||
listData[i] = newItem
|
listData[i] = newItem
|
||||||
removeSet.add(newItem.id)
|
removeSet.add(newItem.id)
|
||||||
Column.log.d("replaceConversationSummary: in-place update")
|
log.d("replaceConversationSummary: in-place update")
|
||||||
} else {
|
} else {
|
||||||
// 投稿が異なるので古い方を削除して、リストの順序を変える
|
// 投稿が異なるので古い方を削除して、リストの順序を変える
|
||||||
changeList.add(AdapterChange(AdapterChangeType.RangeRemove, i, 1))
|
changeList.add(AdapterChange(AdapterChangeType.RangeRemove, i, 1))
|
||||||
listData.removeAt(i)
|
listData.removeAt(i)
|
||||||
Column.log.d("replaceConversationSummary: order change")
|
log.d("replaceConversationSummary: order change")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,14 @@ import jp.juggler.subwaytooter.api.entity.EntityId
|
|||||||
import jp.juggler.subwaytooter.api.entity.TimelineItem
|
import jp.juggler.subwaytooter.api.entity.TimelineItem
|
||||||
import jp.juggler.subwaytooter.api.entity.TootStatus
|
import jp.juggler.subwaytooter.api.entity.TootStatus
|
||||||
import jp.juggler.subwaytooter.columnviewholder.ColumnViewHolder
|
import jp.juggler.subwaytooter.columnviewholder.ColumnViewHolder
|
||||||
|
import jp.juggler.util.LogCategory
|
||||||
import jp.juggler.util.getAdaptiveRippleDrawable
|
import jp.juggler.util.getAdaptiveRippleDrawable
|
||||||
import jp.juggler.util.notZero
|
import jp.juggler.util.notZero
|
||||||
import jp.juggler.util.showToast
|
import jp.juggler.util.showToast
|
||||||
import org.jetbrains.anko.backgroundDrawable
|
import org.jetbrains.anko.backgroundDrawable
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnExtra1")
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// ViewHolderとの連携
|
// ViewHolderとの連携
|
||||||
|
|
||||||
@ -155,19 +158,19 @@ fun Column.onActivityStart() {
|
|||||||
|
|
||||||
// 破棄されたカラムなら何もしない
|
// 破棄されたカラムなら何もしない
|
||||||
if (isDispose.get()) {
|
if (isDispose.get()) {
|
||||||
Column.log.d("onStart: column was disposed.")
|
log.d("onStart: column was disposed.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 未初期化なら何もしない
|
// 未初期化なら何もしない
|
||||||
if (!bFirstInitialized) {
|
if (!bFirstInitialized) {
|
||||||
Column.log.d("onStart: column is not initialized.")
|
log.d("onStart: column is not initialized.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初期ロード中なら何もしない
|
// 初期ロード中なら何もしない
|
||||||
if (bInitialLoading) {
|
if (bInitialLoading) {
|
||||||
Column.log.d("onStart: column is in initial loading.")
|
log.d("onStart: column is in initial loading.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +184,7 @@ fun Column.onActivityStart() {
|
|||||||
// 始端リフレッシュの最中だった
|
// 始端リフレッシュの最中だった
|
||||||
// リフレッシュ終了時に自動でストリーミング開始するはず
|
// リフレッシュ終了時に自動でストリーミング開始するはず
|
||||||
if (bRefreshingTop) {
|
if (bRefreshingTop) {
|
||||||
Column.log.d("onStart: bRefreshingTop is true.")
|
log.d("onStart: bRefreshingTop is true.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +194,7 @@ fun Column.onActivityStart() {
|
|||||||
!dontAutoRefresh
|
!dontAutoRefresh
|
||||||
) {
|
) {
|
||||||
// リフレッシュしてからストリーミング開始
|
// リフレッシュしてからストリーミング開始
|
||||||
Column.log.d("onStart: start auto refresh.")
|
log.d("onStart: start auto refresh.")
|
||||||
startRefresh(bSilent = true, bBottom = false)
|
startRefresh(bSilent = true, bBottom = false)
|
||||||
} else if (isSearchColumn) {
|
} else if (isSearchColumn) {
|
||||||
// 検索カラムはリフレッシュもストリーミングもないが、表示開始のタイミングでリストの再描画を行いたい
|
// 検索カラムはリフレッシュもストリーミングもないが、表示開始のタイミングでリストの再描画を行いたい
|
||||||
|
@ -4,7 +4,6 @@ import android.content.Context
|
|||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import androidx.annotation.RawRes
|
import androidx.annotation.RawRes
|
||||||
import jp.juggler.subwaytooter.*
|
import jp.juggler.subwaytooter.*
|
||||||
import jp.juggler.subwaytooter.column.Column.Companion.log
|
|
||||||
import jp.juggler.subwaytooter.api.TootApiClient
|
import jp.juggler.subwaytooter.api.TootApiClient
|
||||||
import jp.juggler.subwaytooter.api.TootApiResult
|
import jp.juggler.subwaytooter.api.TootApiResult
|
||||||
import jp.juggler.subwaytooter.api.TootParser
|
import jp.juggler.subwaytooter.api.TootParser
|
||||||
@ -14,6 +13,8 @@ import jp.juggler.util.*
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnExtra2")
|
||||||
|
|
||||||
val Column.isMastodon: Boolean
|
val Column.isMastodon: Boolean
|
||||||
get() = accessInfo.isMastodon
|
get() = accessInfo.isMastodon
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ suspend fun Column.updateRelation(
|
|||||||
) {
|
) {
|
||||||
if (accessInfo.isPseudo) return
|
if (accessInfo.isPseudo) return
|
||||||
|
|
||||||
val env = UpdateRelationEnv(this)
|
val env = UserRelationLoader(this)
|
||||||
|
|
||||||
env.add(whoRef)
|
env.add(whoRef)
|
||||||
|
|
||||||
|
@ -11,12 +11,11 @@ import jp.juggler.subwaytooter.table.FavMute
|
|||||||
import jp.juggler.subwaytooter.table.HighlightWord
|
import jp.juggler.subwaytooter.table.HighlightWord
|
||||||
import jp.juggler.subwaytooter.table.SavedAccount
|
import jp.juggler.subwaytooter.table.SavedAccount
|
||||||
import jp.juggler.subwaytooter.table.UserRelation
|
import jp.juggler.subwaytooter.table.UserRelation
|
||||||
import jp.juggler.util.AdapterChange
|
import jp.juggler.util.*
|
||||||
import jp.juggler.util.AdapterChangeType
|
|
||||||
import jp.juggler.util.WordTrieTree
|
|
||||||
import jp.juggler.util.launchMain
|
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnFilters")
|
||||||
|
|
||||||
val Column.isFilterEnabled: Boolean
|
val Column.isFilterEnabled: Boolean
|
||||||
get() = withAttachment ||
|
get() = withAttachment ||
|
||||||
withHighlight ||
|
withHighlight ||
|
||||||
@ -152,7 +151,7 @@ fun Column.initFilter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex: Throwable) {
|
} catch (ex: Throwable) {
|
||||||
Column.log.trace(ex)
|
log.trace(ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +176,7 @@ fun Column.isFiltered(status: TootStatus): Boolean {
|
|||||||
val filterTrees = keywordFilterTrees
|
val filterTrees = keywordFilterTrees
|
||||||
if (filterTrees != null) {
|
if (filterTrees != null) {
|
||||||
if (status.isKeywordFiltered(accessInfo, filterTrees.treeIrreversible)) {
|
if (status.isKeywordFiltered(accessInfo, filterTrees.treeIrreversible)) {
|
||||||
Column.log.d("status filtered by treeIrreversible")
|
log.d("status filtered by treeIrreversible")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +296,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Column.log.d("isFiltered: ${item.type} notification filtered.")
|
log.d("isFiltered: ${item.type} notification filtered.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +304,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
|
|||||||
val filterTrees = keywordFilterTrees
|
val filterTrees = keywordFilterTrees
|
||||||
if (status != null && filterTrees != null) {
|
if (status != null && filterTrees != null) {
|
||||||
if (status.isKeywordFiltered(accessInfo, filterTrees.treeIrreversible)) {
|
if (status.isKeywordFiltered(accessInfo, filterTrees.treeIrreversible)) {
|
||||||
Column.log.d("isFiltered: status muted by treeIrreversible.")
|
log.d("isFiltered: status muted by treeIrreversible.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +314,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
|
|||||||
if (checkLanguageFilter(status)) return true
|
if (checkLanguageFilter(status)) return true
|
||||||
|
|
||||||
if (status?.checkMuted() == true) {
|
if (status?.checkMuted() == true) {
|
||||||
Column.log.d("isFiltered: status muted by in-app muted words.")
|
log.d("isFiltered: status muted by in-app muted words.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +333,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
|
|||||||
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> {
|
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> {
|
||||||
val who = item.account
|
val who = item.account
|
||||||
if (who != null && favMuteSet?.contains(accessInfo.getFullAcct(who)) == true) {
|
if (who != null && favMuteSet?.contains(accessInfo.getFullAcct(who)) == true) {
|
||||||
Column.log.d("${accessInfo.getFullAcct(who)} is in favMuteSet.")
|
log.d("${accessInfo.getFullAcct(who)} is in favMuteSet.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,7 +423,7 @@ fun reloadFilter(context: Context, accessInfo: SavedAccount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resultList?.let {
|
resultList?.let {
|
||||||
Column.log.d("update filters for ${accessInfo.acct.pretty}")
|
log.d("update filters for ${accessInfo.acct.pretty}")
|
||||||
for (column in App1.getAppState(context).columnList) {
|
for (column in App1.getAppState(context).columnList) {
|
||||||
if (column.accessInfo == accessInfo) {
|
if (column.accessInfo == accessInfo) {
|
||||||
column.onFiltersChanged2(it)
|
column.onFiltersChanged2(it)
|
||||||
|
@ -4,6 +4,9 @@ import jp.juggler.subwaytooter.api.entity.Acct
|
|||||||
import jp.juggler.subwaytooter.api.entity.EntityId
|
import jp.juggler.subwaytooter.api.entity.EntityId
|
||||||
import jp.juggler.subwaytooter.api.entity.Host
|
import jp.juggler.subwaytooter.api.entity.Host
|
||||||
import jp.juggler.subwaytooter.table.SavedAccount
|
import jp.juggler.subwaytooter.table.SavedAccount
|
||||||
|
import jp.juggler.util.LogCategory
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnSpec")
|
||||||
|
|
||||||
object ColumnSpec {
|
object ColumnSpec {
|
||||||
|
|
||||||
@ -161,7 +164,7 @@ object ColumnSpec {
|
|||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
} catch (ex: Throwable) {
|
} catch (ex: Throwable) {
|
||||||
Column.log.trace(ex)
|
log.trace(ex)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,30 +4,28 @@ import android.os.SystemClock
|
|||||||
import jp.juggler.subwaytooter.*
|
import jp.juggler.subwaytooter.*
|
||||||
import jp.juggler.subwaytooter.api.TootApiClient
|
import jp.juggler.subwaytooter.api.TootApiClient
|
||||||
import jp.juggler.subwaytooter.api.entity.*
|
import jp.juggler.subwaytooter.api.entity.*
|
||||||
import jp.juggler.subwaytooter.column.*
|
|
||||||
import jp.juggler.subwaytooter.columnviewholder.*
|
import jp.juggler.subwaytooter.columnviewholder.*
|
||||||
import jp.juggler.subwaytooter.notification.PollingWorker
|
import jp.juggler.subwaytooter.notification.PollingWorker
|
||||||
import jp.juggler.subwaytooter.streaming.StreamManager
|
import jp.juggler.subwaytooter.streaming.StreamManager
|
||||||
import jp.juggler.subwaytooter.streaming.StreamStatus
|
import jp.juggler.subwaytooter.streaming.StreamStatus
|
||||||
import jp.juggler.subwaytooter.util.ScrollPosition
|
import jp.juggler.subwaytooter.util.ScrollPosition
|
||||||
import jp.juggler.util.AdapterChange
|
import jp.juggler.util.*
|
||||||
import jp.juggler.util.AdapterChangeType
|
|
||||||
import jp.juggler.util.notEmpty
|
|
||||||
import jp.juggler.util.runOnMainLooper
|
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnStreaming")
|
||||||
|
|
||||||
// 別スレッドから呼ばれるが大丈夫か
|
// 別スレッドから呼ばれるが大丈夫か
|
||||||
fun Column.canStreamingState() = when {
|
fun Column.canStreamingState() = when {
|
||||||
// 未初期化なら何もしない
|
// 未初期化なら何もしない
|
||||||
!bFirstInitialized -> {
|
!bFirstInitialized -> {
|
||||||
if (StreamManager.traceDelivery) Column.log.v("canStartStreaming: column is not initialized.")
|
if (StreamManager.traceDelivery) log.v("canStartStreaming: column is not initialized.")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初期ロード中なら何もしない
|
// 初期ロード中なら何もしない
|
||||||
bInitialLoading -> {
|
bInitialLoading -> {
|
||||||
if (StreamManager.traceDelivery) Column.log.v("canStartStreaming: is in initial loading.")
|
if (StreamManager.traceDelivery) log.v("canStartStreaming: is in initial loading.")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +107,7 @@ fun Column.mergeStreamingMessage() {
|
|||||||
} catch (ex: Throwable) {
|
} catch (ex: Throwable) {
|
||||||
// IDを取得できないタイプのオブジェクトだった
|
// IDを取得できないタイプのオブジェクトだった
|
||||||
// ストリームに来るのは通知かステータスだから、多分ここは通らない
|
// ストリームに来るのは通知かステータスだから、多分ここは通らない
|
||||||
Column.log.trace(ex)
|
log.trace(ex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +134,7 @@ fun Column.mergeStreamingMessage() {
|
|||||||
restoreIdx = holder.findFirstVisibleListItem()
|
restoreIdx = holder.findFirstVisibleListItem()
|
||||||
restoreY = holder.getListItemOffset(restoreIdx)
|
restoreY = holder.getListItemOffset(restoreIdx)
|
||||||
} catch (ex: IndexOutOfBoundsException) {
|
} catch (ex: IndexOutOfBoundsException) {
|
||||||
Column.log.w(ex, "findFirstVisibleListItem failed.")
|
log.w(ex, "findFirstVisibleListItem failed.")
|
||||||
restoreIdx = -2
|
restoreIdx = -2
|
||||||
restoreY = 0
|
restoreY = 0
|
||||||
}
|
}
|
||||||
@ -201,7 +199,7 @@ private fun Column.addGapAfterStreaming(listNew: ArrayList<TimelineItem>, newIdM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex: Throwable) {
|
} catch (ex: Throwable) {
|
||||||
Column.log.e(ex, "can't put gap.")
|
log.e(ex, "can't put gap.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,24 +218,24 @@ private fun Column.scrollAfterStreaming(added: Int, holderSp: ScrollPosition?, r
|
|||||||
when {
|
when {
|
||||||
holderSp == null -> {
|
holderSp == null -> {
|
||||||
// スクロール位置が先頭なら先頭にする
|
// スクロール位置が先頭なら先頭にする
|
||||||
Column.log.d("mergeStreamingMessage: has VH. missing scroll position.")
|
log.d("mergeStreamingMessage: has VH. missing scroll position.")
|
||||||
viewHolder?.scrollToTop()
|
viewHolder?.scrollToTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
holderSp.isHead -> {
|
holderSp.isHead -> {
|
||||||
// スクロール位置が先頭なら先頭にする
|
// スクロール位置が先頭なら先頭にする
|
||||||
Column.log.d("mergeStreamingMessage: has VH. keep head. $holderSp")
|
log.d("mergeStreamingMessage: has VH. keep head. $holderSp")
|
||||||
holder.setScrollPosition(ScrollPosition())
|
holder.setScrollPosition(ScrollPosition())
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreIdx < -1 -> {
|
restoreIdx < -1 -> {
|
||||||
// 可視範囲の検出に失敗
|
// 可視範囲の検出に失敗
|
||||||
Column.log.d("mergeStreamingMessage: has VH. can't get visible range.")
|
log.d("mergeStreamingMessage: has VH. can't get visible range.")
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
// 現在の要素が表示され続けるようにしたい
|
// 現在の要素が表示され続けるようにしたい
|
||||||
Column.log.d("mergeStreamingMessage: has VH. added=$added")
|
log.d("mergeStreamingMessage: has VH. added=$added")
|
||||||
holder.setListItemTop(restoreIdx + added, restoreY)
|
holder.setListItemTop(restoreIdx + added, restoreY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,7 +249,7 @@ fun Column.runOnMainLooperForStreamingEvent(proc: () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Column.onStreamStatusChanged(status: StreamStatus) {
|
fun Column.onStreamStatusChanged(status: StreamStatus) {
|
||||||
Column.log.d(
|
log.d(
|
||||||
"onStreamStatusChanged status=$status, bFirstInitialized=$bFirstInitialized, bInitialLoading=$bInitialLoading, column=${accessInfo.acct}/${
|
"onStreamStatusChanged status=$status, bFirstInitialized=$bFirstInitialized, bInitialLoading=$bInitialLoading, column=${accessInfo.acct}/${
|
||||||
getColumnName(true)
|
getColumnName(true)
|
||||||
}"
|
}"
|
||||||
@ -268,7 +266,7 @@ fun Column.onStreamStatusChanged(status: StreamStatus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Column.onStreamingTimelineItem(item: TimelineItem) {
|
fun Column.onStreamingTimelineItem(item: TimelineItem) {
|
||||||
if (StreamManager.traceDelivery) Column.log.v("${accessInfo.acct} onTimelineItem")
|
if (StreamManager.traceDelivery) log.v("${accessInfo.acct} onTimelineItem")
|
||||||
if (!canHandleStreamingMessage()) return
|
if (!canHandleStreamingMessage()) return
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
@ -368,7 +366,7 @@ fun Column.onMisskeyNoteUpdated(ev: MisskeyNoteUpdate) {
|
|||||||
// (でないとリアクションの2重カウントなどが発生してしまう)
|
// (でないとリアクションの2重カウントなどが発生してしまう)
|
||||||
val myId = EntityId.from(accessInfo.token_info, TootApiClient.KEY_USER_ID)
|
val myId = EntityId.from(accessInfo.token_info, TootApiClient.KEY_USER_ID)
|
||||||
if (myId == null) {
|
if (myId == null) {
|
||||||
Column.log.w("onNoteUpdated: missing my userId. updating access token is recommenced!!")
|
log.w("onNoteUpdated: missing my userId. updating access token is recommenced!!")
|
||||||
}
|
}
|
||||||
|
|
||||||
val byMe = myId == ev.userId
|
val byMe = myId == ev.userId
|
||||||
|
@ -5,7 +5,6 @@ import jp.juggler.subwaytooter.*
|
|||||||
import jp.juggler.subwaytooter.api.*
|
import jp.juggler.subwaytooter.api.*
|
||||||
import jp.juggler.subwaytooter.api.entity.*
|
import jp.juggler.subwaytooter.api.entity.*
|
||||||
import jp.juggler.subwaytooter.api.finder.*
|
import jp.juggler.subwaytooter.api.finder.*
|
||||||
import jp.juggler.subwaytooter.column.*
|
|
||||||
import jp.juggler.subwaytooter.columnviewholder.getListItemOffset
|
import jp.juggler.subwaytooter.columnviewholder.getListItemOffset
|
||||||
import jp.juggler.subwaytooter.columnviewholder.setListItemTop
|
import jp.juggler.subwaytooter.columnviewholder.setListItemTop
|
||||||
import jp.juggler.subwaytooter.notification.PollingWorker
|
import jp.juggler.subwaytooter.notification.PollingWorker
|
||||||
@ -151,12 +150,12 @@ class ColumnTask_Gap(
|
|||||||
try {
|
try {
|
||||||
restoreY = holder.getListItemOffset(restoreIdx)
|
restoreY = holder.getListItemOffset(restoreIdx)
|
||||||
} catch (ex: IndexOutOfBoundsException) {
|
} catch (ex: IndexOutOfBoundsException) {
|
||||||
Column.log.w(ex, "getListItemOffset failed.")
|
log.w(ex, "getListItemOffset failed.")
|
||||||
restoreIdx = position
|
restoreIdx = position
|
||||||
try {
|
try {
|
||||||
restoreY = holder.getListItemOffset(restoreIdx)
|
restoreY = holder.getListItemOffset(restoreIdx)
|
||||||
} catch (ex2: IndexOutOfBoundsException) {
|
} catch (ex2: IndexOutOfBoundsException) {
|
||||||
Column.log.w(ex2, "getListItemOffset failed.")
|
log.w(ex2, "getListItemOffset failed.")
|
||||||
restoreIdx = -1
|
restoreIdx = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,8 @@ import jp.juggler.subwaytooter.R
|
|||||||
import jp.juggler.subwaytooter.api.*
|
import jp.juggler.subwaytooter.api.*
|
||||||
import jp.juggler.subwaytooter.api.entity.*
|
import jp.juggler.subwaytooter.api.entity.*
|
||||||
import jp.juggler.subwaytooter.api.finder.*
|
import jp.juggler.subwaytooter.api.finder.*
|
||||||
import jp.juggler.subwaytooter.column.*
|
|
||||||
import jp.juggler.subwaytooter.notification.PollingWorker
|
|
||||||
import jp.juggler.subwaytooter.columnviewholder.scrollToTop
|
import jp.juggler.subwaytooter.columnviewholder.scrollToTop
|
||||||
|
import jp.juggler.subwaytooter.notification.PollingWorker
|
||||||
import jp.juggler.subwaytooter.util.OpenSticker
|
import jp.juggler.subwaytooter.util.OpenSticker
|
||||||
import jp.juggler.util.*
|
import jp.juggler.util.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -5,7 +5,6 @@ import jp.juggler.subwaytooter.*
|
|||||||
import jp.juggler.subwaytooter.api.*
|
import jp.juggler.subwaytooter.api.*
|
||||||
import jp.juggler.subwaytooter.api.entity.*
|
import jp.juggler.subwaytooter.api.entity.*
|
||||||
import jp.juggler.subwaytooter.api.finder.*
|
import jp.juggler.subwaytooter.api.finder.*
|
||||||
import jp.juggler.subwaytooter.column.*
|
|
||||||
import jp.juggler.subwaytooter.columnviewholder.setScrollPosition
|
import jp.juggler.subwaytooter.columnviewholder.setScrollPosition
|
||||||
import jp.juggler.subwaytooter.util.ScrollPosition
|
import jp.juggler.subwaytooter.util.ScrollPosition
|
||||||
import jp.juggler.util.*
|
import jp.juggler.util.*
|
||||||
|
@ -12,6 +12,8 @@ import jp.juggler.subwaytooter.api.entity.TootStatus
|
|||||||
import jp.juggler.subwaytooter.api.syncAccountByAcct
|
import jp.juggler.subwaytooter.api.syncAccountByAcct
|
||||||
import jp.juggler.util.*
|
import jp.juggler.util.*
|
||||||
|
|
||||||
|
private val log = LogCategory("ColumnUrls")
|
||||||
|
|
||||||
private const val PATH_HOME = "/api/v1/timelines/home?limit=${ApiPath.READ_LIMIT}"
|
private const val PATH_HOME = "/api/v1/timelines/home?limit=${ApiPath.READ_LIMIT}"
|
||||||
private const val PATH_LOCAL = "/api/v1/timelines/public?local=true&limit=${ApiPath.READ_LIMIT}"
|
private const val PATH_LOCAL = "/api/v1/timelines/public?local=true&limit=${ApiPath.READ_LIMIT}"
|
||||||
|
|
||||||
@ -207,7 +209,7 @@ suspend fun Column.makeHashtagAcctUrl(client: TootApiClient): String? {
|
|||||||
val (result, whoRef) = client.syncAccountByAcct(accessInfo, hashtagAcct)
|
val (result, whoRef) = client.syncAccountByAcct(accessInfo, hashtagAcct)
|
||||||
result ?: return null // cancelled.
|
result ?: return null // cancelled.
|
||||||
if (whoRef == null) {
|
if (whoRef == null) {
|
||||||
Column.log.w("makeHashtagAcctUrl: ${result.error ?: "?"}")
|
log.w("makeHashtagAcctUrl: ${result.error ?: "?"}")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
profileId = whoRef.get().id
|
profileId = whoRef.get().id
|
||||||
@ -351,7 +353,6 @@ fun Column.makeProfileStatusesUrl(profileId: EntityId?): String {
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun StringBuilder.appendHashtagExtra(column: Column): StringBuilder {
|
fun StringBuilder.appendHashtagExtra(column: Column): StringBuilder {
|
||||||
val limit = (Column.HASHTAG_ELLIPSIZE * 2 - kotlin.math.min(length, Column.HASHTAG_ELLIPSIZE)) / 3
|
val limit = (Column.HASHTAG_ELLIPSIZE * 2 - kotlin.math.min(length, Column.HASHTAG_ELLIPSIZE)) / 3
|
||||||
if (column.hashtagAny.isNotBlank()) append(' ').append(
|
if (column.hashtagAny.isNotBlank()) append(' ').append(
|
||||||
|
@ -6,11 +6,15 @@ import jp.juggler.subwaytooter.api.entity.*
|
|||||||
import jp.juggler.subwaytooter.table.AcctSet
|
import jp.juggler.subwaytooter.table.AcctSet
|
||||||
import jp.juggler.subwaytooter.table.TagSet
|
import jp.juggler.subwaytooter.table.TagSet
|
||||||
import jp.juggler.subwaytooter.table.UserRelation
|
import jp.juggler.subwaytooter.table.UserRelation
|
||||||
|
import jp.juggler.util.LogCategory
|
||||||
import jp.juggler.util.toJsonArray
|
import jp.juggler.util.toJsonArray
|
||||||
import jp.juggler.util.toPostRequestBuilder
|
import jp.juggler.util.toPostRequestBuilder
|
||||||
import java.util.HashSet
|
import java.util.HashSet
|
||||||
|
|
||||||
class UpdateRelationEnv(val column: Column) {
|
class UserRelationLoader(val column: Column) {
|
||||||
|
companion object {
|
||||||
|
private val log = LogCategory("UserRelationLoader")
|
||||||
|
}
|
||||||
|
|
||||||
val whoSet = HashSet<EntityId>()
|
val whoSet = HashSet<EntityId>()
|
||||||
val acctSet = HashSet<String>()
|
val acctSet = HashSet<String>()
|
||||||
@ -63,7 +67,7 @@ class UpdateRelationEnv(val column: Column) {
|
|||||||
UserRelation.saveListMisskey(now, column.accessInfo.db_id, whoList, start, step)
|
UserRelation.saveListMisskey(now, column.accessInfo.db_id, whoList, start, step)
|
||||||
start += step
|
start += step
|
||||||
}
|
}
|
||||||
Column.log.d("updateRelation: update $end relations.")
|
log.d("updateRelation: update $end relations.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018/11/1 Misskeyにもリレーション取得APIができた
|
// 2018/11/1 Misskeyにもリレーション取得APIができた
|
||||||
@ -108,7 +112,7 @@ class UpdateRelationEnv(val column: Column) {
|
|||||||
UserRelation.saveListMisskeyRelationApi(now, column.accessInfo.db_id, list)
|
UserRelation.saveListMisskeyRelationApi(now, column.accessInfo.db_id, list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column.log.d("updateRelation: update $n relations.")
|
log.d("updateRelation: update $n relations.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// アカウントIDの集合からRelationshipを取得してデータベースに記録する
|
// アカウントIDの集合からRelationshipを取得してデータベースに記録する
|
||||||
@ -137,7 +141,7 @@ class UpdateRelationEnv(val column: Column) {
|
|||||||
list
|
list
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Column.log.d("updateRelation: update $n relations.")
|
log.d("updateRelation: update $n relations.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +160,7 @@ class UpdateRelationEnv(val column: Column) {
|
|||||||
AcctSet.saveList(now, acctList, n, length)
|
AcctSet.saveList(now, acctList, n, length)
|
||||||
n += length
|
n += length
|
||||||
}
|
}
|
||||||
Column.log.d("updateRelation: update $n acct.")
|
log.d("updateRelation: update $n acct.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 出現したタグをデータベースに記録する
|
// 出現したタグをデータベースに記録する
|
||||||
@ -174,7 +178,7 @@ class UpdateRelationEnv(val column: Column) {
|
|||||||
TagSet.saveList(now, tagList, n, length)
|
TagSet.saveList(now, tagList, n, length)
|
||||||
n += length
|
n += length
|
||||||
}
|
}
|
||||||
Column.log.d("updateRelation: update $n tag.")
|
log.d("updateRelation: update $n tag.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user