アプリミュート時に確認ダイアログを表示する。fix #84.

This commit is contained in:
tateisu 2018-11-13 03:19:21 +09:00
parent afda85ea91
commit 38fb89c242
4 changed files with 38 additions and 10 deletions

View File

@ -433,6 +433,10 @@ class ActMain : AppCompatActivity()
}
}
override fun onNewIntent(intent : Intent?) {
super.onNewIntent(intent)
log.w("onNewIntent: isResumed = isResumed")
}
override fun onSaveInstanceState(outState : Bundle?) {
log.d("onSaveInstanceState")
super.onSaveInstanceState(outState)
@ -549,9 +553,12 @@ class ActMain : AppCompatActivity()
}
private var isResumed = false
override fun onResume() {
super.onResume()
log.d("onResume")
isResumed = true
MyClickableSpan.link_callback = WeakReference(link_click_listener)
@ -577,6 +584,7 @@ class ActMain : AppCompatActivity()
override fun onPause() {
log.d("onPause")
isResumed = false
// 最後に表示していたカラムの位置
val last_pos = phoneTab(
@ -629,15 +637,19 @@ class ActMain : AppCompatActivity()
private fun handleSentIntent(intent : Intent) {
sent_intent2 = intent
AccountPicker.pick(
this,
bAllowPseudo = false,
bAuto = true,
message = getString(R.string.account_picker_toot)
, dismiss_callback = { sent_intent2 = null }
) { ai ->
sent_intent2 = null
ActPost.open(this@ActMain, REQUEST_CODE_POST, ai.db_id, sent_intent = intent)
// Galaxy S8+ で STのSSを取った後に出るポップアップからそのまま共有でSTを選ぶと何も起きない問題への対策
handler.post{
AccountPicker.pick(
this,
bAllowPseudo = false,
bAuto = true,
message = getString(R.string.account_picker_toot)
, dismiss_callback = { sent_intent2 = null }
) { ai ->
sent_intent2 = null
ActPost.open(this@ActMain, REQUEST_CODE_POST, ai.db_id, sent_intent = intent)
}
}
}

View File

@ -1,5 +1,6 @@
package jp.juggler.subwaytooter.action
import android.app.AlertDialog
import jp.juggler.subwaytooter.ActColumnList
import jp.juggler.subwaytooter.ActMain
import jp.juggler.subwaytooter.App1
@ -17,8 +18,21 @@ object Action_App {
// アプリをミュートする
fun muteApp(
activity : ActMain, application : TootApplication
activity : ActMain,
application : TootApplication,
confirmed : Boolean = false
) {
if(! confirmed) {
AlertDialog.Builder(activity)
.setMessage(activity.getString(R.string.mute_application_confirm, application.name))
.setPositiveButton(R.string.ok) { _, _ ->
muteApp(activity, application, confirmed = true)
}
.setNegativeButton(R.string.cancel, null)
.show()
return
}
MutedApp.save(application.name)
App1.getAppState(activity).onMuteUpdated()
showToast(activity, false, R.string.app_was_muted)

View File

@ -785,5 +785,6 @@
<string name="participants_and_more">…他</string>
<string name="conversation_to">送り先:</string>
<string name="make_quote_renote">引用Renoteにする</string>
<string name="mute_application_confirm">アプリ \"%1$s\" はミュートされます。よろしいですか?</string>
</resources>

View File

@ -804,5 +804,6 @@
<string name="participants_and_more">… and more</string>
<string name="conversation_to">To:</string>
<string name="make_quote_renote">Use \"Quoted Renote\"</string>
<string name="mute_application_confirm">Application \"%1$s\" will be muted. Are you sure ?</string>
</resources>