Implement optional notifications muting for account muting (#1856)

This commit is contained in:
Mélanie Chauvel 2020-07-27 10:28:59 +02:00 committed by GitHub
commit b3b4794a2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 240 additions and 49 deletions

View file

@ -0,0 +1,27 @@
@file:JvmName("MuteAccountDialog")
package com.keylesspalace.tusky.view
import android.app.Activity
import android.widget.CheckBox
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import com.keylesspalace.tusky.R
fun showMuteAccountDialog(
activity: Activity,
accountUsername: String,
onOk: (notifications: Boolean) -> Unit
) {
val view = activity.layoutInflater.inflate(R.layout.dialog_mute_account, null)
(view.findViewById(R.id.warning) as TextView).text =
activity.getString(R.string.dialog_mute_warning, accountUsername)
val checkbox: CheckBox = view.findViewById(R.id.checkbox)
checkbox.setChecked(true)
AlertDialog.Builder(activity)
.setView(view)
.setPositiveButton(android.R.string.ok) { _, _ -> onOk(checkbox.isChecked) }
.setNegativeButton(android.R.string.cancel, null)
.show()
}