brianchance / MvvmCross-UserInteraction

MvvmCross plugin for interacting with the user from a view model
MIT License
43 stars 44 forks source link

Allow AlertDialog.Builder customization before its AlertDialog is shown. #10

Closed danielcweber closed 9 years ago

danielcweber commented 10 years ago

This change allows an AlertDialog.Builder to be futher modified before it is shown to the user (e.g. an Icon may be set). A custom implementation of UserInteraction need just override OnShowDialog, modify the Builder and call base.OnShowDialog.

brianchance commented 10 years ago

I like the idea, but would change a couple things.

  1. the OnShowDialog should probably not call .Show(), rather, maybe call it OnBeforeShowDialog and just let the user fix it up. Otherwise they must call base.OnShowDialog().
  2. Needs an iOS equivalent I think.
  3. It seems like forcing a use to subclass and register could be done differently. Maybe a static event that is raised instead? or pass an Action<> callback parameter.
danielcweber commented 10 years ago
  1. Even better.
  2. I don't do iOS Development and cannot even open Touch projects (maybe in MonoDevelop) but I'll have a look at it.
  3. The need to re-register one's own UserInteraction class is an issue but one that's easily worked around with a bit of documentation. Static events, I don't like them and they seem not a clean approach to me. A callback parameter is fine but who wants to provide a callback to set the same icon again and again throughout the whole app? I would rather create an IAlertDialogCustomizer interface which a user can provide and that is looked up by Mvx.Resolve. What do you think?
brianchance commented 10 years ago

Try the customizer, see how it fits.

danielcweber commented 10 years ago

Please have a look. CRLF and tab/space interop is really a pain...

danielcweber commented 10 years ago

Added methods to choose one or more items in a Dialog (Android only at this time).

brianchance commented 10 years ago

Been a while since I have been able to get back to this. I see where you are going but I am not sure I can take all the concepts since I would need to provide iOS specific implementations (time issue). I will try and see what I can take on.