mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-29 18:19:22 +01:00
disable fade out of sidemenu scrollbar
This commit is contained in:
parent
00b05d8646
commit
362e026a76
@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
|||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
|
|
||||||
enum class ColumnPagingType {
|
enum class ColumnPagingType {
|
||||||
@ -563,11 +564,11 @@ class Column(
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private fun canHandleStreamingMessage () = !is_dispose.get() && canStartStreaming()
|
private fun canHandleStreamingMessage() = !is_dispose.get() && canStartStreaming()
|
||||||
|
|
||||||
private fun runOnMainLooperForStreamingEvent(proc : () -> Unit){
|
private fun runOnMainLooperForStreamingEvent(proc: () -> Unit) {
|
||||||
runOnMainLooper {
|
runOnMainLooper {
|
||||||
if(!canHandleStreamingMessage() )
|
if (!canHandleStreamingMessage())
|
||||||
return@runOnMainLooper
|
return@runOnMainLooper
|
||||||
proc()
|
proc()
|
||||||
}
|
}
|
||||||
@ -576,7 +577,7 @@ class Column(
|
|||||||
val streamCallback = object : StreamCallback {
|
val streamCallback = object : StreamCallback {
|
||||||
|
|
||||||
override fun onListeningStateChanged(status: StreamStatus) {
|
override fun onListeningStateChanged(status: StreamStatus) {
|
||||||
if(!canHandleStreamingMessage() ) return
|
if (!canHandleStreamingMessage()) return
|
||||||
|
|
||||||
if (status == StreamStatus.Open) {
|
if (status == StreamStatus.Open) {
|
||||||
updateMisskeyCapture()
|
updateMisskeyCapture()
|
||||||
@ -587,8 +588,8 @@ class Column(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTimelineItem(item: TimelineItem, channelId: String?,stream:JsonArray?) {
|
override fun onTimelineItem(item: TimelineItem, channelId: String?, stream: JsonArray?) {
|
||||||
if(!canHandleStreamingMessage() ) return
|
if (!canHandleStreamingMessage()) return
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
is TootConversationSummary -> {
|
is TootConversationSummary -> {
|
||||||
@ -695,7 +696,7 @@ class Column(
|
|||||||
|
|
||||||
override fun onAnnouncementUpdate(item: TootAnnouncement) {
|
override fun onAnnouncementUpdate(item: TootAnnouncement) {
|
||||||
runOnMainLooperForStreamingEvent {
|
runOnMainLooperForStreamingEvent {
|
||||||
if( type != ColumnType.HOME)
|
if (type != ColumnType.HOME)
|
||||||
return@runOnMainLooperForStreamingEvent
|
return@runOnMainLooperForStreamingEvent
|
||||||
|
|
||||||
val list = announcements
|
val list = announcements
|
||||||
@ -719,7 +720,7 @@ class Column(
|
|||||||
|
|
||||||
override fun onAnnouncementDelete(id: EntityId) {
|
override fun onAnnouncementDelete(id: EntityId) {
|
||||||
runOnMainLooperForStreamingEvent {
|
runOnMainLooperForStreamingEvent {
|
||||||
announcements?.iterator()?.let{
|
announcements?.iterator()?.let {
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
val item = it.next()
|
val item = it.next()
|
||||||
if (item.id != id) continue
|
if (item.id != id) continue
|
||||||
@ -766,23 +767,25 @@ class Column(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mergeStreamingMessage: Runnable = object : Runnable {
|
private val mergeStreamingMessage = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
|
||||||
// 前回マージしてから暫くは待機してリトライ
|
|
||||||
val handler = app_state.handler
|
val handler = app_state.handler
|
||||||
val now = SystemClock.elapsedRealtime()
|
|
||||||
val remain = last_show_stream_data.get() + 333L - now
|
// 未初期化や初期ロード中ならキューをクリアして何もしない
|
||||||
if (remain > 0) {
|
if (!canHandleStreamingMessage() ) {
|
||||||
|
stream_data_queue.clear()
|
||||||
handler.removeCallbacks(this)
|
handler.removeCallbacks(this)
|
||||||
handler.postDelayed(this, remain)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 前回マージしてから暫くは待機してリトライ
|
||||||
// カラムがビジー状態なら待機してリトライ
|
// カラムがビジー状態なら待機してリトライ
|
||||||
if( !canStartStreaming() || bRefreshLoading){
|
val now = SystemClock.elapsedRealtime()
|
||||||
|
var remain = last_show_stream_data.get() + 333L - now
|
||||||
|
if (bRefreshLoading) remain = max(333L, remain)
|
||||||
|
if (remain > 0) {
|
||||||
handler.removeCallbacks(this)
|
handler.removeCallbacks(this)
|
||||||
handler.postDelayed(this, 333L)
|
handler.postDelayed(this, remain)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,7 +1551,6 @@ class Column(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun removeNotificationOne(target_account: SavedAccount, notification: TootNotification) {
|
fun removeNotificationOne(target_account: SavedAccount, notification: TootNotification) {
|
||||||
if (!isNotificationColumn) return
|
if (!isNotificationColumn) return
|
||||||
|
|
||||||
@ -2582,7 +2584,7 @@ class Column(
|
|||||||
} else if (isSearchColumn) {
|
} else if (isSearchColumn) {
|
||||||
// 検索カラムはリフレッシュもストリーミングもないが、表示開始のタイミングでリストの再描画を行いたい
|
// 検索カラムはリフレッシュもストリーミングもないが、表示開始のタイミングでリストの再描画を行いたい
|
||||||
fireShowContent(reason = "Column onStart isSearchColumn", reset = true)
|
fireShowContent(reason = "Column onStart isSearchColumn", reset = true)
|
||||||
} else if( canStartStreaming() && streamSpec !=null ){
|
} else if (canStartStreaming() && streamSpec != null) {
|
||||||
// ギャップつきでストリーミング開始
|
// ギャップつきでストリーミング開始
|
||||||
this.bPutGap = true
|
this.bPutGap = true
|
||||||
fireShowColumnStatus()
|
fireShowColumnStatus()
|
||||||
|
@ -431,7 +431,8 @@ class SideMenuAdapter(
|
|||||||
selector = StateListDrawable()
|
selector = StateListDrawable()
|
||||||
divider = null
|
divider = null
|
||||||
dividerHeight = 0
|
dividerHeight = 0
|
||||||
|
isScrollbarFadingEnabled = false
|
||||||
|
|
||||||
val pad_tb = (actMain.density * 12f + 0.5f).toInt()
|
val pad_tb = (actMain.density * 12f + 0.5f).toInt()
|
||||||
setPadding(0, pad_tb, 0, pad_tb)
|
setPadding(0, pad_tb, 0, pad_tb)
|
||||||
clipToPadding = false
|
clipToPadding = false
|
||||||
|
@ -8,6 +8,7 @@ import jp.juggler.subwaytooter.api.TootApiResult
|
|||||||
import jp.juggler.subwaytooter.api.TootTask
|
import jp.juggler.subwaytooter.api.TootTask
|
||||||
import jp.juggler.subwaytooter.api.TootTaskRunner
|
import jp.juggler.subwaytooter.api.TootTaskRunner
|
||||||
import jp.juggler.subwaytooter.api.entity.TootNotification
|
import jp.juggler.subwaytooter.api.entity.TootNotification
|
||||||
|
import jp.juggler.subwaytooter.isNotificationColumn
|
||||||
import jp.juggler.subwaytooter.table.SavedAccount
|
import jp.juggler.subwaytooter.table.SavedAccount
|
||||||
import jp.juggler.util.showToast
|
import jp.juggler.util.showToast
|
||||||
import jp.juggler.util.toFormRequestBody
|
import jp.juggler.util.toFormRequestBody
|
||||||
|
@ -187,7 +187,6 @@ class StreamConnection(
|
|||||||
private fun handleMastodonMessage(obj: JsonObject, text: String) {
|
private fun handleMastodonMessage(obj: JsonObject, text: String) {
|
||||||
|
|
||||||
val stream = obj.jsonArray("stream")
|
val stream = obj.jsonArray("stream")
|
||||||
if(stream!=null) log.w("stream=${stream}")
|
|
||||||
|
|
||||||
when (val event = obj.string("event")) {
|
when (val event = obj.string("event")) {
|
||||||
null, "" ->
|
null, "" ->
|
||||||
@ -274,15 +273,15 @@ class StreamConnection(
|
|||||||
|
|
||||||
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
|
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
|
||||||
manager.enqueue {
|
manager.enqueue {
|
||||||
log.v("$name WebSocket onClosed code=$code, reason=$reason")
|
log.w("$name WebSocket onClosed code=$code, reason=$reason")
|
||||||
status = StreamStatus.Closed
|
status = StreamStatus.Closed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
|
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
|
||||||
manager.enqueue {
|
manager.enqueue {
|
||||||
if (t is SocketException && t.message == "Socket is closed") {
|
if (t is SocketException && t.message?.contains("closed") ==true) {
|
||||||
log.w("$name ${t.message}")
|
log.w("$name socket closed.")
|
||||||
} else {
|
} else {
|
||||||
log.e(t, "$name WebSocket onFailure.")
|
log.e(t, "$name WebSocket onFailure.")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user