Hide the AM/PM preference completely if using a 24-hour clock

In addition, this commit also fixes a bug where the switch would not be
disabled on a fresh 24-hour clock install, as the preference value would
be null. This is avoided by using a higher-level method from
DateFormat to check the clock mode.

Patch Set 2: improve code styling

Patch Set 3: remove pointless application context retrieval