OSDN Git Service

リコー版の一覧表示での一覧最大枚数を拡大できるように設定できるようにする。
authorMRSa <mrsa@myad.jp>
Sat, 17 Aug 2019 12:24:34 +0000 (21:24 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 17 Aug 2019 12:24:34 +0000 (21:24 +0900)
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ricoh/wrapper/RicohGr2InterfaceProvider.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ricoh/wrapper/RicohGr2PlaybackControl.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/ricohgr2/RicohGr2PreferenceFragment.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_ricoh_gr2.xml

index 9c7926b..389d0c0 100644 (file)
@@ -80,6 +80,19 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
         {
             e.printStackTrace();
         }
+        int maxCount = 3000;  // デフォルトは 3000枚 とする
+        try
+        {
+            maxCount = Integer.parseInt(preferences.getString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT_DEFAULT_VALUE));
+            if (maxCount < 300)
+            {
+                maxCount = 300;  // 最小値は 300枚とする。
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
 
         //this.activity = context;
         //this.provider = provider;
@@ -88,7 +101,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
         zoomControl = new RicohGr2CameraZoomLensControl();
         buttonControl = new RicohGr2CameraButtonControl();
         statusChecker = new RicohGr2StatusChecker(500, useGrCommand);
-        playbackControl = new RicohGr2PlaybackControl(statusChecker, useGrCommand, communicationTimeoutMs);
+        playbackControl = new RicohGr2PlaybackControl(statusChecker, useGrCommand, communicationTimeoutMs, maxCount);
         hardwareStatus = new RicohGr2HardwareStatus();
         runMode = new RicohGr2RunMode();
     }
index 5cc5fcd..2cd87c4 100644 (file)
@@ -38,10 +38,10 @@ public class RicohGr2PlaybackControl implements IPlaybackControl
     private final String getPhotoUrl = "http://192.168.0.1/v1/photos/";
     private final RicohGr2StatusChecker statusChecker;
     private static final int DEFAULT_TIMEOUT = 3000;
+    private static final int DEFAULT_MAX_COUNT = 300;
     private final boolean useGrCommand;
     private final int timeoutValue;
-
-
+    private final int maxCount;
 
     /*****
          [操作メモ]
@@ -56,11 +56,12 @@ public class RicohGr2PlaybackControl implements IPlaybackControl
             動画をダウンロードする      : http://192.168.0.1/v1/photos/yyyRICOH/R0000xxx.MOV?size=full
      *****/
 
-    RicohGr2PlaybackControl(RicohGr2StatusChecker statusChecker, boolean useGrCommand, int timeoutMs)
+    RicohGr2PlaybackControl(RicohGr2StatusChecker statusChecker, boolean useGrCommand, int timeoutMs, int maxCount)
     {
         this.statusChecker = statusChecker;
         this.useGrCommand = useGrCommand;
         this.timeoutValue  = (timeoutMs < DEFAULT_TIMEOUT) ? DEFAULT_TIMEOUT : timeoutMs;
+        this.maxCount  = (maxCount < DEFAULT_MAX_COUNT) ? DEFAULT_MAX_COUNT : maxCount;
     }
 
     @Override
@@ -73,7 +74,7 @@ public class RicohGr2PlaybackControl implements IPlaybackControl
     public void downloadContentList(@NonNull IDownloadContentListCallback callback)
     {
         List<ICameraFileInfo> fileList = new ArrayList<>();
-        String imageListurl = "http://192.168.0.1/v1/photos?limit=3000";
+        String imageListurl = "http://192.168.0.1/v1/photos?" + maxCount;
         String contentList;
         try
         {
@@ -400,7 +401,7 @@ public class RicohGr2PlaybackControl implements IPlaybackControl
     private void getCameraContentListImpl(ICameraContentListCallback callback)
     {
         List<ICameraContent> fileList = new ArrayList<>();
-        String imageListurl = "http://192.168.0.1/v1/photos?limit=3000";
+        String imageListurl = "http://192.168.0.1/v1/photos?limit=" + maxCount;
         String contentList;
         try
         {
index 407c730..06b3763 100644 (file)
@@ -79,7 +79,12 @@ public interface IPreferencePropertyAccessor
 
     String RICOH_GET_PICS_LIST_TIMEOUT = "ricoh_get_pics_list_timeout";
     String RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE = "10";
-/*
+
+    String RICOH_GET_PICS_LIST_MAX_COUNT = "ricoh_get_pics_list_max_count";
+    String RICOH_GET_PICS_LIST_MAX_COUNT_DEFAULT_VALUE = "3000";
+
+
+    /*
     //String GR2_DISPLAY_MODE = "gr2_display_mode";
     //String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
 
index 439565f..eb05b91 100644 (file)
@@ -137,6 +137,9 @@ public class RicohGr2PreferenceFragment  extends PreferenceFragmentCompat implem
             if (!items.containsKey(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT)) {
                 editor.putString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE);
             }
+            if (!items.containsKey(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT)) {
+                editor.putString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT_DEFAULT_VALUE);
+            }
             editor.apply();
         }
         catch (Exception e)
index 401dba0..d2bfc2b 100644 (file)
 
     <string name="pref_ricoh_get_pics_list_timeout">撮影画像一覧取得時のタイムアウト(単位:秒)</string>
     <string name="pref_summary_ricoh_get_pics_list_timeout">カメラ内の画像が多い場合は数を増やしてください。</string>
+
+    <string name="pref_ricoh_get_pics_list_max_count">撮影画像一覧で取得する最大枚数</string>
+    <string name="pref_summary_ricoh_get_pics_list_max_count">カメラ内の画像が多い場合は数を増やしてください。</string>
+
 </resources>
index 6b23d2e..2f308e4 100644 (file)
     <string name="pref_ricoh_get_pics_list_timeout">Get Pics List Timeout(unit: sec.)</string>
     <string name="pref_summary_ricoh_get_pics_list_timeout">If the camera has many number of Pics, increase number.</string>
 
+    <string name="pref_ricoh_get_pics_list_max_count">Max Pics List Count</string>
+    <string name="pref_summary_ricoh_get_pics_list_max_count">If the camera has many number of Pics, increase number.</string>
 
 </resources>
index 2026655..08bdb81 100644 (file)
             android:inputType="number"
             android:summary="@string/pref_summary_ricoh_get_pics_list_timeout" />
 
+        <EditTextPreference
+            android:key="ricoh_get_pics_list_max_count"
+            android:title="@string/pref_ricoh_get_pics_list_max_count"
+            android:defaultValue="3000"
+            android:inputType="number"
+            android:summary="@string/pref_summary_ricoh_get_pics_list_max_count" />
+
     </PreferenceCategory>
 
     <PreferenceCategory