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