Backport "Allow creating custom dialogs in DialogPreference." from CM10.1

This allows creating non-AlertDialogs while still using the click and
state handling of DialogPreference.

Originally author: Danny Baumann
Backported from CM10.1 by: Daveee10