parent
7875e7c630
commit
be60155de5
44 changed files with 303 additions and 260 deletions
|
@ -4,6 +4,7 @@ package com.keylesspalace.tusky.view
|
|||
|
||||
import android.app.Activity
|
||||
import android.widget.CheckBox
|
||||
import android.widget.Spinner
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.keylesspalace.tusky.R
|
||||
|
@ -11,7 +12,7 @@ import com.keylesspalace.tusky.R
|
|||
fun showMuteAccountDialog(
|
||||
activity: Activity,
|
||||
accountUsername: String,
|
||||
onOk: (notifications: Boolean) -> Unit
|
||||
onOk: (notifications: Boolean, duration: Int) -> Unit
|
||||
) {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_mute_account, null)
|
||||
(view.findViewById(R.id.warning) as TextView).text =
|
||||
|
@ -21,7 +22,11 @@ fun showMuteAccountDialog(
|
|||
|
||||
AlertDialog.Builder(activity)
|
||||
.setView(view)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ -> onOk(checkbox.isChecked) }
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
val spinner: Spinner = view.findViewById(R.id.duration)
|
||||
val durationValues = activity.resources.getIntArray(R.array.mute_duration_values)
|
||||
onOk(checkbox.isChecked, durationValues[spinner.selectedItemPosition])
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue