Skip to content

Commit

Permalink
Fix import/export dialog behaviour broken
Browse files Browse the repository at this point in the history
  • Loading branch information
SamAmco committed Aug 30, 2021
1 parent 8c79725 commit 2179204
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,15 @@ class ExportFeaturesDialog : DialogFragment() {
alertDialog = builder.create()
alertDialog.setCanceledOnTouchOutside(true)
alertDialog.setOnShowListener { setAlertDialogShowListeners() }
alertDialog.setOnShowListener {
val negativeButton = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE)
negativeButton.setTextColor(requireContext().getColorFromAttr(R.attr.colorControlNormal))
}
alertDialog
} ?: throw IllegalStateException("Activity cannot be null")
}

private fun setAlertDialogShowListeners() {
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
positiveButton.setTextColor(positiveButton.context.getColorFromAttr(R.attr.colorSecondary))
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE)
.setTextColor(alertDialog.context.getColorFromAttr(R.attr.colorControlNormal))
alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE)
.setTextColor(requireContext().getColorFromAttr(R.attr.colorControlNormal))
positiveButton.isEnabled = false
viewModel.loadFeatures(requireActivity(), groupId!!)
listenToState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ class ImportFeaturesDialog : DialogFragment() {
alertDialog = builder.create()
alertDialog.setCanceledOnTouchOutside(true)
alertDialog.setOnShowListener { setAlertDialogShowListeners() }
alertDialog.setOnShowListener {
val negativeButton = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE)
negativeButton.setTextColor(requireContext().getColorFromAttr(R.attr.colorControlNormal))
}
alertDialog
} ?: throw IllegalStateException("Activity cannot be null")
}
Expand All @@ -88,7 +84,7 @@ class ImportFeaturesDialog : DialogFragment() {
listenToImportState()
listenToException()
val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE)
negativeButton.setTextColor(negativeButton.context.getColorFromAttr(R.attr.colorControlNormal))
negativeButton.setTextColor(requireContext().getColorFromAttr(R.attr.colorControlNormal))
negativeButton.setOnClickListener { dismiss() }
alertDialog.setOnCancelListener { run {} }
}
Expand Down

0 comments on commit 2179204

Please sign in to comment.