Refactored onSharedPreferenceChanged method code

Instead of reassigning all preference variables, only the changed
variable is assigned. Code uses a switch/case with an enum to switch
between the values.