Ricoh GR2 Control App for Android.
Revision | a1b73cb05836be4e0eb3d1cfee8b1bdb4394c3dc (tree) |
---|---|
Zeit | 2020-05-10 22:07:08 |
Autor | MRSa <mrsa@myad...> |
Commiter | MRSa |
FUJIFILM用画像詳細画面で、タイミングによってはスモールイメージを使用できるようにした。
@@ -1,5 +1,6 @@ | ||
1 | 1 | *.iml |
2 | 2 | .gradle |
3 | +.project | |
3 | 4 | .idea |
4 | 5 | /local.properties |
5 | 6 | /.idea/libraries |
@@ -0,0 +1,17 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>gr2control</name> | |
4 | + <comment>Project gr2control created by Buildship.</comment> | |
5 | + <projects> | |
6 | + </projects> | |
7 | + <buildSpec> | |
8 | + <buildCommand> | |
9 | + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | |
10 | + <arguments> | |
11 | + </arguments> | |
12 | + </buildCommand> | |
13 | + </buildSpec> | |
14 | + <natures> | |
15 | + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | |
16 | + </natures> | |
17 | +</projectDescription> |
@@ -0,0 +1,13 @@ | ||
1 | +arguments= | |
2 | +auto.sync=false | |
3 | +build.scans.enabled=false | |
4 | +connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | |
5 | +connection.project.dir= | |
6 | +eclipse.preferences.version=1 | |
7 | +gradle.user.home= | |
8 | +java.home=C\:/Program Files/Java/jdk1.8.0_112 | |
9 | +jvm.arguments= | |
10 | +offline.mode=false | |
11 | +override.workspace.settings=true | |
12 | +show.console.view=true | |
13 | +show.executions.view=true |
@@ -0,0 +1,6 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<classpath> | |
3 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> | |
4 | + <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | |
5 | + <classpathentry kind="output" path="bin/default"/> | |
6 | +</classpath> |
@@ -0,0 +1,23 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>app</name> | |
4 | + <comment>Project app created by Buildship.</comment> | |
5 | + <projects> | |
6 | + </projects> | |
7 | + <buildSpec> | |
8 | + <buildCommand> | |
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | |
10 | + <arguments> | |
11 | + </arguments> | |
12 | + </buildCommand> | |
13 | + <buildCommand> | |
14 | + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | |
15 | + <arguments> | |
16 | + </arguments> | |
17 | + </buildCommand> | |
18 | + </buildSpec> | |
19 | + <natures> | |
20 | + <nature>org.eclipse.jdt.core.javanature</nature> | |
21 | + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | |
22 | + </natures> | |
23 | +</projectDescription> |
@@ -0,0 +1,2 @@ | ||
1 | +connection.project.dir=.. | |
2 | +eclipse.preferences.version=1 |
@@ -0,0 +1,73 @@ | ||
1 | +package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages; | |
2 | + | |
3 | + | |
4 | + | |
5 | +import androidx.annotation.NonNull; | |
6 | + | |
7 | +import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback; | |
8 | +import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXMessages; | |
9 | + | |
10 | +public class GetScreenNail extends FujiXCommandBase | |
11 | +{ | |
12 | + private final IFujiXCommandCallback callback; | |
13 | + private final byte lower; | |
14 | + private final byte upper; | |
15 | + private final byte data0; | |
16 | + private final byte data1; | |
17 | + private final byte data2; | |
18 | + private final byte data3; | |
19 | + | |
20 | + public GetScreenNail(int indexNumber, int imageSize, @NonNull IFujiXCommandCallback callback) | |
21 | + { | |
22 | + this.lower = ((byte) (0x000000ff & indexNumber)); | |
23 | + this.upper = ((byte)((0x0000ff00 & indexNumber) >> 8)); | |
24 | + | |
25 | + data0 = ((byte) (0x000000ff & imageSize)); | |
26 | + data1 = ((byte)((0x0000ff00 & imageSize) >> 8)); | |
27 | + data2 = ((byte)((0x00ff0000 & imageSize) >> 16)); | |
28 | + data3 = ((byte)((0xff000000 & imageSize) >> 24)); | |
29 | + this.callback = callback; | |
30 | + } | |
31 | + | |
32 | + @Override | |
33 | + public IFujiXCommandCallback responseCallback() | |
34 | + { | |
35 | + return (callback); | |
36 | + } | |
37 | + | |
38 | + @Override | |
39 | + public int getId() | |
40 | + { | |
41 | + return (IFujiXMessages.SEQ_FULL_IMAGE); | |
42 | + } | |
43 | + | |
44 | + @Override | |
45 | + public byte[] commandBody() | |
46 | + { | |
47 | + return (new byte[] { | |
48 | + | |
49 | + // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other) | |
50 | + (byte)0x01, (byte)0x00, | |
51 | + | |
52 | + // message_header.type : full_image (0x101b) | |
53 | + (byte)0x1b, (byte)0x10, | |
54 | + | |
55 | + // sequence number | |
56 | + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
57 | + | |
58 | + // data ... (index number) | |
59 | + lower, upper, (byte)0x00, (byte)0x00, | |
60 | + | |
61 | + // 現物合わせ1 : 0~ | |
62 | + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
63 | + | |
64 | + // 現物合わせ2 : ~0x01000000 bytes | |
65 | + data0, data1, data2, data3, | |
66 | + }); | |
67 | + } | |
68 | + @Override | |
69 | + public boolean dumpLog() | |
70 | + { | |
71 | + return (false); | |
72 | + } | |
73 | +} |
@@ -1,11 +1,13 @@ | ||
1 | 1 | package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.playback; |
2 | 2 | |
3 | 3 | import android.app.Activity; |
4 | +import android.content.SharedPreferences; | |
4 | 5 | import android.util.Log; |
5 | 6 | import android.util.SparseArray; |
6 | 7 | |
7 | 8 | import androidx.annotation.NonNull; |
8 | 9 | import androidx.annotation.Nullable; |
10 | +import androidx.preference.PreferenceManager; | |
9 | 11 | |
10 | 12 | import net.osdn.gokigen.gr2control.camera.ICameraFileInfo; |
11 | 13 | import net.osdn.gokigen.gr2control.camera.ICameraStatus; |
@@ -14,13 +16,16 @@ import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCa | ||
14 | 16 | import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher; |
15 | 17 | import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.GetFullImage; |
16 | 18 | import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.GetImageInfo; |
19 | +import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.GetScreenNail; | |
17 | 20 | import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.GetThumbNail; |
21 | +import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.SetPropertyValue; | |
18 | 22 | import net.osdn.gokigen.gr2control.camera.playback.ICameraContent; |
19 | 23 | import net.osdn.gokigen.gr2control.camera.playback.IContentInfoCallback; |
20 | 24 | import net.osdn.gokigen.gr2control.camera.playback.IDownloadContentCallback; |
21 | 25 | import net.osdn.gokigen.gr2control.camera.playback.ICameraContentListCallback; |
22 | 26 | import net.osdn.gokigen.gr2control.camera.playback.IDownloadThumbnailImageCallback; |
23 | 27 | import net.osdn.gokigen.gr2control.camera.playback.IPlaybackControl; |
28 | +import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor; | |
24 | 29 | |
25 | 30 | import java.util.ArrayList; |
26 | 31 | import java.util.List; |
@@ -87,8 +92,65 @@ public class FujiXPlaybackControl implements IPlaybackControl, IFujiXCommandCall | ||
87 | 92 | @Override |
88 | 93 | public void downloadContentScreennail(@Nullable String path, @NonNull String name, @NonNull IDownloadThumbnailImageCallback callback) |
89 | 94 | { |
90 | - // Thumbnail と同じ画像を表示する | |
91 | - downloadContentThumbnail(path, name, callback); | |
95 | + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); | |
96 | + boolean useSmallImage = preferences.getBoolean(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
97 | + if (useSmallImage) | |
98 | + { | |
99 | + // small image を表示する | |
100 | + downloadContentScreennailImpl(path, name, callback); | |
101 | + } | |
102 | + else | |
103 | + { | |
104 | + // Thumbnail と同じ画像を表示する | |
105 | + downloadContentThumbnail(path, name, callback); | |
106 | + } | |
107 | + } | |
108 | + | |
109 | + private void downloadContentScreennailImpl(@Nullable String path, @NonNull String name, @NonNull IDownloadThumbnailImageCallback callback) | |
110 | + { | |
111 | + try | |
112 | + { | |
113 | + Log.v(TAG, " ----- downloadContentScreennailImpl() "); | |
114 | + int start = 0; | |
115 | + if (name.indexOf("/") == 0) | |
116 | + { | |
117 | + start = 1; | |
118 | + } | |
119 | + Log.v(TAG, " downloadContentThumbnail() : " + path + " " + name); | |
120 | + int index = getIndexNumber(start, name); | |
121 | + if ((index > 0)&&(index <= imageContentInfo.size())) | |
122 | + { | |
123 | + IFujiXCommandPublisher publisher = provider.getCommandPublisher(); | |
124 | + FujiXImageContentInfo contentInfo = imageContentInfo.get(index); | |
125 | + if (contentInfo.isReceived()) | |
126 | + { | |
127 | + if (!contentInfo.isMovie()) | |
128 | + { | |
129 | + // スモール画像を取得する (たぶんこのシーケンスでいけるはず...) | |
130 | + publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyReceiver(), 0xd226, 2, 0x0001)); | |
131 | + publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyReceiver(), 0xd227, 2, 0x0001)); | |
132 | + publisher.enqueueCommand(new GetScreenNail(index, 0x00800000, new FujiXThumbnailImageReceiver(activity, callback))); | |
133 | + publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyReceiver(), 0xd226, 2, 0x0000)); | |
134 | + publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyReceiver(), 0xd227, 2, 0x0001)); | |
135 | + } | |
136 | + else | |
137 | + { | |
138 | + // movieの時は、Small画像を使えないのでThumbnailで代用する。 | |
139 | + publisher.enqueueCommand(new GetThumbNail(index, new FujiXThumbnailImageReceiver(activity, callback))); | |
140 | + } | |
141 | + } | |
142 | + else | |
143 | + { | |
144 | + // まだ、ファイル情報を受信していない場合は、サムネイルの情報を流用する | |
145 | + publisher.enqueueCommand(new GetImageInfo(index, index, contentInfo)); | |
146 | + publisher.enqueueCommand(new GetThumbNail(index, new FujiXThumbnailImageReceiver(activity, callback))); | |
147 | + } | |
148 | + } | |
149 | + } | |
150 | + catch (Exception e) | |
151 | + { | |
152 | + e.printStackTrace(); | |
153 | + } | |
92 | 154 | } |
93 | 155 | |
94 | 156 | @Override |
@@ -0,0 +1,36 @@ | ||
1 | +package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.playback; | |
2 | + | |
3 | +import android.util.Log; | |
4 | + | |
5 | +import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback; | |
6 | +import net.osdn.gokigen.gr2control.camera.utils.SimpleLogDumper; | |
7 | + | |
8 | +public class FujiXReplyReceiver implements IFujiXCommandCallback | |
9 | +{ | |
10 | + private final String TAG = toString(); | |
11 | + | |
12 | + @Override | |
13 | + public void receivedMessage(int id, byte[] rx_body) | |
14 | + { | |
15 | + try | |
16 | + { | |
17 | + SimpleLogDumper.dump_bytes(" RECV : ", rx_body); | |
18 | + } | |
19 | + catch (Exception e) | |
20 | + { | |
21 | + e.printStackTrace(); | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + @Override | |
26 | + public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body) | |
27 | + { | |
28 | + Log.v(TAG, " " + currentBytes + "/" + totalBytes); | |
29 | + } | |
30 | + | |
31 | + @Override | |
32 | + public boolean isReceiveMulti() | |
33 | + { | |
34 | + return (false); | |
35 | + } | |
36 | +} |
@@ -167,6 +167,9 @@ public class Gr2ControlPreferenceFragment extends PreferenceFragmentCompat impl | ||
167 | 167 | if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) { |
168 | 168 | editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE); |
169 | 169 | } |
170 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE)) { | |
171 | + editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
172 | + } | |
170 | 173 | editor.apply(); |
171 | 174 | } |
172 | 175 | catch (Exception e) |
@@ -63,6 +63,7 @@ public interface IPreferencePropertyAccessor | ||
63 | 63 | String FUJI_X_COMMAND_POLLING_WAIT = "fujix_command_polling_wait"; |
64 | 64 | String FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE = "500"; |
65 | 65 | |
66 | + String FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE = "fujix_get_screennail_as_small_picture"; | |
66 | 67 | |
67 | 68 | /* |
68 | 69 | //String GR2_DISPLAY_MODE = "gr2_display_mode"; |
@@ -165,6 +165,9 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement | ||
165 | 165 | if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) { |
166 | 166 | editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE); |
167 | 167 | } |
168 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE)) { | |
169 | + editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
170 | + } | |
168 | 171 | editor.apply(); |
169 | 172 | } |
170 | 173 | catch (Exception e) |
@@ -206,6 +209,11 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement | ||
206 | 209 | Log.v(TAG, " DISPLAY CAMERA VIEW : " + key + " , " + value); |
207 | 210 | break; |
208 | 211 | |
212 | + case IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE: | |
213 | + value = preferences.getBoolean(key, false); | |
214 | + Log.v(TAG, " SMALL IMAGE AS SCREENNAIL : " + key + " , " + value); | |
215 | + break; | |
216 | + | |
209 | 217 | case IPreferencePropertyAccessor.SHARE_AFTER_SAVE: |
210 | 218 | value = preferences.getBoolean(key, false); |
211 | 219 | Log.v(TAG, " SHARE AFTER SAVE : " + key + " , " + value); |
@@ -378,6 +386,7 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement | ||
378 | 386 | setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue); |
379 | 387 | setBooleanPreference(IPreferencePropertyAccessor.USE_PLAYBACK_MENU, IPreferencePropertyAccessor.USE_PLAYBACK_MENU, defaultValue); |
380 | 388 | setBooleanPreference(IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW, IPreferencePropertyAccessor.FUJI_X_DISPLAY_CAMERA_VIEW, false); |
389 | + setBooleanPreference(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
381 | 390 | setBooleanPreference(IPreferencePropertyAccessor.SHARE_AFTER_SAVE, IPreferencePropertyAccessor.SHARE_AFTER_SAVE, defaultValue); |
382 | 391 | } |
383 | 392 | catch (Exception e) |
@@ -186,6 +186,9 @@ public class PreferenceFragment extends PreferenceFragmentCompat implements Shar | ||
186 | 186 | if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) { |
187 | 187 | editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE); |
188 | 188 | } |
189 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE)) { | |
190 | + editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
191 | + } | |
189 | 192 | editor.apply(); |
190 | 193 | } |
191 | 194 |
@@ -166,6 +166,9 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem | ||
166 | 166 | if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT)) { |
167 | 167 | editor.putString(IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT, IPreferencePropertyAccessor.FUJI_X_COMMAND_POLLING_WAIT_DEFAULT_VALUE); |
168 | 168 | } |
169 | + if (!items.containsKey(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE)) { | |
170 | + editor.putBoolean(IPreferencePropertyAccessor.FUJI_X_GET_SCREENNAIL_AS_SMALL_PICTURE, false); | |
171 | + } | |
169 | 172 | editor.apply(); |
170 | 173 | } |
171 | 174 | catch (Exception e) |
@@ -203,4 +203,7 @@ | ||
203 | 203 | <string name="pref_fuji_x_exit_only">アプリ終了 (FUJI)</string> |
204 | 204 | <string name="pref_opc_exit_power_off">アプリ終了 (OPC)</string> |
205 | 205 | <string name="pref_ricoh_exit_power_off">アプリ終了 (RICOH)</string> |
206 | + | |
207 | + <string name="pref_fujix_get_screennail_as_small_picture">表示画像はスモール画像を使用</string> | |
208 | + <string name="pref_summary_fujix_get_screennail_as_small_picture">すこし時間がかかりますが、画像表示にスモール画像を使用します。</string> | |
206 | 209 | </resources> |
@@ -244,4 +244,7 @@ | ||
244 | 244 | <string name="pref_fuji_x_exit_only">Exit Application (FUJI)</string> |
245 | 245 | <string name="pref_opc_exit_power_off">Exit Application (OPC)</string> |
246 | 246 | <string name="pref_ricoh_exit_power_off">Exit Application (RICOH)</string> |
247 | + | |
248 | + <string name="pref_fujix_get_screennail_as_small_picture">Use small image as detail screen</string> | |
249 | + <string name="pref_summary_fujix_get_screennail_as_small_picture">Use small size image for detail screen.</string> | |
247 | 250 | </resources> |
@@ -52,6 +52,10 @@ | ||
52 | 52 | android:defaultValue="80" |
53 | 53 | android:summary="@string/pref_summary_fujix_liveview_wait" /> |
54 | 54 | |
55 | + <CheckBoxPreference | |
56 | + android:key="fujix_get_screennail_as_small_picture" | |
57 | + android:title="@string/pref_fujix_get_screennail_as_small_picture" | |
58 | + android:summary="@string/pref_summary_fujix_get_screennail_as_small_picture" /> | |
55 | 59 | </PreferenceCategory> |
56 | 60 | <!-- |
57 | 61 | <PreferenceCategory |