liveViewControl = new RicohGr2LiveViewControl();
zoomControl = new RicohGr2CameraZoomLensControl();
buttonControl = new RicohGr2CameraButtonControl();
- statusChecker = new RicohGr2StatusChecker(500);
+ statusChecker = new RicohGr2StatusChecker(context, 500);
playbackControl = new RicohGr2PlaybackControl();
hardwareStatus = new RicohGr2HardwareStatus();
runMode = new RicohGr2RunMode();
package net.osdn.gokigen.gr2control.camera.ricohgr2.wrapper;
+import android.app.Activity;
+import android.content.SharedPreferences;
import android.support.annotation.NonNull;
+import android.support.v7.preference.PreferenceManager;
import android.util.Log;
import net.osdn.gokigen.gr2control.camera.ICameraStatus;
import net.osdn.gokigen.gr2control.camera.ICameraStatusWatcher;
import net.osdn.gokigen.gr2control.camera.utils.SimpleHttpClient;
import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
+import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
import java.util.ArrayList;
import java.util.List;
private final String grCommandUrl = "http://192.168.0.1/_gr";
private final int sleepMs;
- private boolean useGrCommand = true;
+ private final boolean useGrCommand;
private int timeoutMs = 5000;
private boolean whileFetching = false;
*
*
*/
- RicohGr2StatusChecker(int sleepMs)
+ RicohGr2StatusChecker(@NonNull Activity context, int sleepMs)
{
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
this.sleepMs = sleepMs;
}
response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs);
Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)");
}
- // GR専用コマンドで、画面表示をリフレッシュ
- response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs);
- Log.v(TAG, "refresh resp. (" + response.length() + "bytes.)");
+ if (useGrCommand)
+ {
+ // GR専用コマンドで、画面表示をリフレッシュ
+ response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs);
+ Log.v(TAG, "refresh resp. (" + response.length() + "bytes.)");
+ }
}
catch (Exception e)
{
String GR2_LCD_SLEEP = "gr2_lcd_sleep";
+ String USE_GR2_SPECIAL_COMMAND = "use_gr2_special_command";
+
String DIGITAL_ZOOM_LEVEL = "digital_zoom_level";
String DIGITAL_ZOOM_LEVEL_DEFAULT_VALUE = "1.0";
if (!items.containsKey(IPreferencePropertyAccessor.USE_PLAYBACK_MENU)) {
editor.putBoolean(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, false);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW)) {
+ editor.putBoolean(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, true);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.GR2_LCD_SLEEP)) {
+ editor.putBoolean(IPreferencePropertyAccessor.GR2_LCD_SLEEP, false);
+ }
+ if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) {
+ editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
+ }
editor.apply();
}
if (!items.containsKey(IPreferencePropertyAccessor.SHARE_AFTER_SAVE)) {
editor.putBoolean(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, false);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND)) {
+ editor.putBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
+ }
editor.apply();
}
catch (Exception e)
Log.v(TAG, " " + key + " , " + value);
break;
+ case IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND:
+ value = preferences.getBoolean(key, true);
+ Log.v(TAG, " " + key + " , " + value);
+ break;
+
default:
String strValue = preferences.getString(key, "");
setListPreference(key, key, strValue);
setBooleanPreference(IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, IPreferencePropertyAccessor.GR2_DISPLAY_CAMERA_VIEW, defaultValue);
setBooleanPreference(IPreferencePropertyAccessor.GR2_LCD_SLEEP, IPreferencePropertyAccessor.GR2_LCD_SLEEP, defaultValue);
setBooleanPreference(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, IPreferencePropertyAccessor.SHARE_AFTER_SAVE, defaultValue);
+ setBooleanPreference(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, defaultValue);
}
catch (Exception e)
{
<string name="exif_metering_mode_title">測光モード :</string>
<string name="exif_custom_process_title">(スペシャル・エフェクト使用)</string>
<string name="exif_with_gps">(位置情報あり)</string>
+ <string name="pref_use_gr2_special_command">GR2専用コマンドの使用</string>
+ <string name="summary_use_gr2_special_command">制御指示の一部にGR2用コマンドを使用します。</string>
+
</resources>
<string name="pref_camera_version">Camera Version</string>
<string name="pref_camerakit_version">Camera kit Version</string>
+ <string name="pref_use_gr2_special_command">Use GR2 Special Command</string>
+ <string name="summary_use_gr2_special_command">Use some GR2 special command.</string>
+
</resources>
android:key="use_playback_menu"
android:title="@string/pref_use_playback_menu"
/>
+
+ <CheckBoxPreference
+ android:key="use_gr2_special_command"
+ android:title="@string/pref_use_gr2_special_command"
+ android:summary="@string/summary_use_gr2_special_command"
+ />
</PreferenceCategory>
<PreferenceCategory