avast / android-styled-dialogs

Backport of Material dialogs with easy-to-use API based on DialogFragment
Apache License 2.0
2.15k stars 450 forks source link

[Question] How To disable and enable positive button ? #139

Closed khalid-mahmood closed 7 years ago

khalid-mahmood commented 7 years ago

how i can disable positive button and enable it on demand ?

kuFEAR commented 7 years ago

You can extend SimpleDialogFragment and set custom logic in override onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) { val content = super.onCreateView(inflater, container, savedInstanceState) val positiveButton = content.findViewById(com.avast.android.dialogs.R.id.sdl_button_positive) as Button val positiveButtonStack = content.findViewById(com.avast.android.dialogs.R.id.sdl_button_positive_stacked) as Button positiveButton.isEnabled = false positiveButtonStack.isEnabled = false }

khalid-mahmood commented 7 years ago

@kuFEAR Thanks for reply. since i have forgot why this was needed.