1 package net.osdn.gokigen.gr2control.preference.olympus;
3 import android.content.SharedPreferences;
4 import android.util.Log;
6 import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.CameraPropertyUtilities;
7 import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraProperty;
8 import net.osdn.gokigen.gr2control.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
9 import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
12 class PreferenceSynchronizer implements Runnable
14 private final String TAG = toString();
15 private final IOlyCameraPropertyProvider propertyInterface;
16 private final SharedPreferences preference;
17 private final IPropertySynchronizeCallback callback;
19 PreferenceSynchronizer(IOlyCameraPropertyProvider propertyInterface, SharedPreferences preference, IPropertySynchronizeCallback callback)
21 this.propertyInterface = propertyInterface;
22 this.preference = preference;
23 this.callback = callback;
26 private String getPropertyValue(String key)
31 String value = propertyInterface.getCameraPropertyValue(key);
32 propertyValue = CameraPropertyUtilities.getPropertyValue(value);
39 Log.v(TAG, "getPropertyValue(" + key + ") : " + propertyValue);
40 return (propertyValue);
47 SharedPreferences.Editor editor = preference.edit();
48 editor.putString(IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, getPropertyValue(IOlyCameraProperty.SOUND_VOLUME_LEVEL));
49 boolean value = getPropertyValue(IOlyCameraProperty.RAW).equals("ON");
50 editor.putBoolean(IPreferencePropertyAccessor.RAW, value);
54 callback.synchronizedProperty();
58 interface IPropertySynchronizeCallback
60 void synchronizedProperty();