More deprecation warnings.

This commit is contained in:
casey langen 2022-07-23 17:08:22 -07:00
parent 1ea0e67785
commit ec9aafe0df

View File

@ -22,6 +22,7 @@ import io.casey.musikcube.remote.ui.settings.model.Connection
import io.casey.musikcube.remote.ui.settings.model.ConnectionsDb import io.casey.musikcube.remote.ui.settings.model.ConnectionsDb
import io.casey.musikcube.remote.ui.shared.activity.BaseActivity import io.casey.musikcube.remote.ui.shared.activity.BaseActivity
import io.casey.musikcube.remote.ui.shared.extension.* import io.casey.musikcube.remote.ui.shared.extension.*
import io.casey.musikcube.remote.util.getParcelableCompat
import javax.inject.Inject import javax.inject.Inject
private const val EXTRA_CONNECTION = "extra_connection" private const val EXTRA_CONNECTION = "extra_connection"
@ -196,12 +197,12 @@ private class RenameTask(val db: ConnectionsDb, val connection: Connection, val
class ConfirmDeleteDialog : DialogFragment() { class ConfirmDeleteDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val connection = arguments!!.getParcelable<Connection>(EXTRA_CONNECTION) val connection = requireArguments().getParcelableCompat<Connection>(EXTRA_CONNECTION)
return when (connection == null) { return when (connection == null) {
true -> throw IllegalArgumentException("invalid connection") true -> throw IllegalArgumentException("invalid connection")
else -> { else -> {
AlertDialog.Builder(activity!!) AlertDialog.Builder(requireActivity())
.setTitle(R.string.settings_confirm_delete_title) .setTitle(R.string.settings_confirm_delete_title)
.setMessage(getString(R.string.settings_confirm_delete_message, connection.name)) .setMessage(getString(R.string.settings_confirm_delete_message, connection.name))
.setNegativeButton(R.string.button_no, null) .setNegativeButton(R.string.button_no, null)
@ -229,7 +230,7 @@ class ConfirmDeleteDialog : DialogFragment() {
class RenameDialog : DialogFragment() { class RenameDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val connection = arguments!!.getParcelable<Connection>(EXTRA_CONNECTION) val connection = requireArguments().getParcelableCompat<Connection>(EXTRA_CONNECTION)
return when (connection == null) { return when (connection == null) {
true -> throw IllegalArgumentException("invalid connection") true -> throw IllegalArgumentException("invalid connection")
@ -242,7 +243,7 @@ class RenameDialog : DialogFragment() {
edit.setText(connection.name) edit.setText(connection.name)
edit.selectAll() edit.selectAll()
AlertDialog.Builder(activity!!) AlertDialog.Builder(requireActivity())
.setTitle(R.string.settings_save_as_title) .setTitle(R.string.settings_save_as_title)
.setNegativeButton(R.string.button_cancel) { _, _ -> hideKeyboard() } .setNegativeButton(R.string.button_cancel) { _, _ -> hideKeyboard() }
.setOnCancelListener { hideKeyboard() } .setOnCancelListener { hideKeyboard() }