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

added method to show dialog allowing stateloss #64

Closed evant closed 10 years ago

tomas-vondracek commented 10 years ago

Hi @evant, thanks for the pull request, although I don't think the proposed change is a good idea for the library. I can't see much point in showing dialog after activity is paused. It would be better to make sure you show the dialog when activity is resumed, where usual commit will make the work.

evant commented 10 years ago

You make a good point, though it could still be useful if you don't care about the dialog showing if the activity is left, but still want it to show if it's still in the foreground. Loaders won't let you just do commit() for obvious reasons. The name is consistent with similar methods in the Android api, so I would expect people to use it with the same caution.

davidvavra commented 10 years ago

Yes I agree with @evant: I have experienced a lot of 'IllegalStateException: Can not perform this action after onSaveInstanceState' in various apps. While generally you should design the architecture that this would never happen, sometimes you are working on legacy code and changing architecture like that is not possible. So allowing state loss is a solution, bit hacky I know. But if it's in the Android framework, we could have it in the library as well.

tomas-vondracek commented 10 years ago

Very well, then. @destil feel free to review the PR and merge it. Although, I still believe we should encourage people to "do the right thing" :)

davidvavra commented 10 years ago

Yes we should encourage people to do the right thing!

@evant: Can you write a longer Javadoc to the public methods explaining the method and encourage people to use it only as last resort?