アカウント設定でPush購読をON/OFFしたらそのタイミングで購読の更新を行う
This commit is contained in:
parent
6f7340c5d4
commit
63b19940b5
|
@ -646,12 +646,27 @@ class ActAccountSetting : AppCompatActivity(),
|
|||
views.cbLocked -> {
|
||||
if (!profileBusy) sendLocked(isChecked)
|
||||
}
|
||||
views.swNotificationPullEnabled,
|
||||
views.swNotificationPushEnabled,
|
||||
-> {
|
||||
views.swNotificationPullEnabled -> {
|
||||
saveUIToData()
|
||||
showPushSetting()
|
||||
}
|
||||
|
||||
views.swNotificationPushEnabled -> launchAndShowError {
|
||||
val oldChecked = account.notificationPushEnable
|
||||
try {
|
||||
if (oldChecked == isChecked) return@launchAndShowError
|
||||
account.notificationPushEnable = isChecked
|
||||
updatePushSubscription(force = true)
|
||||
saveUIToData()
|
||||
} catch (ex: Throwable) {
|
||||
account.notificationPushEnable = oldChecked
|
||||
buttonView.isChecked = oldChecked
|
||||
throw ex
|
||||
} finally {
|
||||
showPushSetting()
|
||||
}
|
||||
}
|
||||
|
||||
else -> saveUIToData()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,16 @@ package jp.juggler.subwaytooter.view
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.os.SystemClock
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import jp.juggler.util.log.LogCategory
|
||||
|
||||
class MyDrawerLayout : DrawerLayout {
|
||||
|
||||
companion object {
|
||||
// private val log = LogCategory("MyDrawerLayout")
|
||||
private val log = LogCategory("MyDrawerLayout")
|
||||
}
|
||||
|
||||
constructor(context: Context) :
|
||||
|
@ -26,7 +28,10 @@ class MyDrawerLayout : DrawerLayout {
|
|||
private val exclusionRects = listOf(Rect(), Rect(), Rect(), Rect())
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||
val timeStart = SystemClock.elapsedRealtime()
|
||||
super.onLayout(changed, l, t, r, b)
|
||||
val timeEnd = SystemClock.elapsedRealtime()
|
||||
log.i("onLayout ${timeEnd - timeStart}ms changed=$changed")
|
||||
|
||||
// 画面下部の左右にはボタンがあるので、システムジェスチャーナビゲーションの対象外にする
|
||||
val w = r - l
|
||||
|
|
Loading…
Reference in New Issue