private void onSharedPreferenceChanged(SharedPreferences sharedPreferences, PreferenceKey key) { switch (key) { case DATA_SOURCE: String providerTypeString = sharedPreferences.getString( PreferenceKey.DATA_SOURCE.toString(), DataProviderType.HTTP.toString()); DataProviderType providerType = DataProviderType.valueOf(providerTypeString.toUpperCase()); switch (providerType) { case HTTP: enableBlitzortungHttpMode(); break; case RPC: enableAppServiceMode(); break; } break; case LOCATION_MODE: LocationHandler.Provider locationProvider = LocationHandler.Provider.fromString( sharedPreferences.getString(key.toString(), "NETWORK")); enableManualLocationMode(locationProvider == LocationHandler.Provider.MANUAL); break; } }
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String keyString) { onSharedPreferenceChanged(sharedPreferences, PreferenceKey.fromString(keyString)); }