1 package net.osdn.gokigen.a01d.preference;
3 import android.content.SharedPreferences;
4 import android.util.Log;
6 import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlyCameraProperty;
7 import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlyCameraPropertyProvider;
8 import net.osdn.gokigen.a01d.camera.olympus.wrapper.CameraPropertyUtilities;
10 class PreferenceSynchronizer implements Runnable
12 private final String TAG = toString();
13 private final IOlyCameraPropertyProvider propertyInterface;
14 private final SharedPreferences preference;
15 private final IPropertySynchronizeCallback callback;
17 PreferenceSynchronizer(IOlyCameraPropertyProvider propertyInterface, SharedPreferences preference, IPropertySynchronizeCallback callback)
19 this.propertyInterface = propertyInterface;
20 this.preference = preference;
21 this.callback = callback;
24 private String getPropertyValue(String key)
29 String value = propertyInterface.getCameraPropertyValue(key);
30 propertyValue = CameraPropertyUtilities.getPropertyValue(value);
37 Log.v(TAG, "getPropertyValue(" + key + ") : " + propertyValue);
38 return (propertyValue);
45 SharedPreferences.Editor editor = preference.edit();
46 editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.TAKE_MODE, getPropertyValue(IOlyCameraProperty.TAKE_MODE));
47 editor.putString(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.SOUND_VOLUME_LEVEL, getPropertyValue(IOlyCameraProperty.SOUND_VOLUME_LEVEL));
49 boolean value = getPropertyValue(IOlyCameraProperty.RAW).equals("ON");
50 editor.putBoolean(net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.RAW, value);
54 callback.synchronizedProperty();
58 interface IPropertySynchronizeCallback
60 void synchronizedProperty();