afebL253">253 301
     @Override
254 302
     public void onImageInfoRetrieved(final int objectHandle, final ObjectInfo objectInfo, final Bitmap thumbnail) {
255
-        adapter.addInfo("找到相机存储图像文件,句柄=" + objectHandle + " 文件名 = " + objectInfo.filename + " 拍摄日期 = "+ objectInfo.captureDate);
256
-        photoIv.post(new Runnable() {
303
+        adapter.addInfo("找到相机存储图像文件,句柄=" + objectHandle + " 文件名 = " + objectInfo.filename + " 拍摄日期 = " + objectInfo.captureDate);
304
+        mainHandler.post(new Runnable() {
257 305
             @Override
258 306
             public void run() {
259 307
                 Photo photo = new Photo();
@@ -267,7 +315,7 @@ public class MyTestActivity extends Activity implements Camera.CameraListener, C
267 315
     }
268 316
 
269 317
     public void retrieveImageInfo(final int handle) {
270
-        photoIv.post(new Runnable() {
318
+        mainHandler.post(new Runnable() {
271 319
             @Override
272 320
             public void run() {
273 321
                 if (camera != null) {

+ 6 - 1
app/src/main/java/ai/pai/ptp/test/TestPhotoGridAdapter.java

@@ -57,15 +57,20 @@ public class TestPhotoGridAdapter extends BaseAdapter {
57 57
         gridView.post(new Runnable() {
58 58
             @Override
59 59
             public void run() {
60
+                boolean isFound = false;
60 61
                 for(int k = 0; k < photos.size();k++){
61 62
                     if(photos.get(k).handle == newPhoto.handle){
62 63
                         photos.get(k).captureTime = newPhoto.captureTime;
63 64
                         photos.get(k).thumb = newPhoto.thumb;
64 65
                         photos.get(k).origin = newPhoto.origin;
65 66
                         photos.get(k).fileName = newPhoto.fileName;
67
+                        isFound = true;
66 68
                         break;
67 69
                     }
68 70
                 }
71
+                if(!isFound){
72
+                    photos.add(0,newPhoto);
73
+                }
69 74
                 notifyDataSetChanged();
70 75
             }
71 76
         });
@@ -81,7 +86,7 @@ public class TestPhotoGridAdapter extends BaseAdapter {
81 86
                     photo.handle = handles[k];
82 87
                     tmp.add(photo);
83 88
                 }
84
-                photos.addAll(tmp);
89
+                photos.addAll(0,tmp);
85 90
                 notifyDataSetChanged();
86 91
             }
87 92
         });

+ 2 - 0
app/src/main/java/com/remoteyourcam/usb/ptp/Camera.java

@@ -145,6 +145,8 @@ public interface Camera {
145 145
 
146 146
     void capture();
147 147
 
148
+    void openCapture();
149
+
148 150
     boolean isLiveViewSupported();
149 151
 
150 152
     boolean isLiveViewAfAreaSupported();

+ 6 - 0
app/src/main/java/com/remoteyourcam/usb/ptp/PtpCamera.java

@@ -28,6 +28,7 @@ import com.remoteyourcam.usb.ptp.commands.GetDevicePropValueCommand;
28 28
 import com.remoteyourcam.usb.ptp.commands.GetObjectHandlesCommand;
29 29
 import com.remoteyourcam.usb.ptp.commands.GetStorageInfosAction;
30 30
 import com.remoteyourcam.usb.ptp.commands.InitiateCaptureCommand;
31
+import com.remoteyourcam.usb.ptp.commands.InitiateOpenCaptureCommand;
31 32
 import com.remoteyourcam.usb.ptp.commands.OpenSessionCommand;
32 33
 import com.remoteyourcam.usb.ptp.commands.RetrieveImageAction;
33 34
 import com.remoteyourcam.usb.ptp.commands.RetrieveImageInfoAction;
@@ -804,6 +805,11 @@ public abstract class PtpCamera implements Camera {
804 805
     }
805 806
 
806 807
     @Override
808
+    public void openCapture() {
809
+        queue.add(new InitiateOpenCaptureCommand(this));
810
+    }
811
+
812
+    @Override
807 813
     public boolean isAutoFocusSupported() {
808 814
         return autoFocusSupported;
809 815
     }

+ 44 - 0
app/src/main/java/com/remoteyourcam/usb/ptp/commands/InitiateOpenCaptureCommand.java

@@ -0,0 +1,44 @@
1
+/**
2
+ * Copyright 2013 Nils Assbeck, Guersel Ayaz and Michael Zoech
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+package com.remoteyourcam.usb.ptp.commands;
17
+
18
+import com.remoteyourcam.usb.ptp.PtpCamera;
19
+import com.remoteyourcam.usb.ptp.PtpCamera.IO;
20
+import com.remoteyourcam.usb.ptp.PtpConstants.Operation;
21
+import com.remoteyourcam.usb.ptp.PtpConstants.Response;
22
+
23
+import java.nio.ByteBuffer;
24
+
25
+public class InitiateOpenCaptureCommand extends Command {
26
+
27
+    public InitiateOpenCaptureCommand(PtpCamera camera) {
28
+        super(camera);
29
+    }
30
+
31
+    @Override
32
+    public void exec(IO io) {
33
+        io.handleCommand(this);
34
+        if (responseCode == Response.DeviceBusy) {
35
+            camera.onDeviceBusy(this, true); // TODO when nikon live view is enabled this stalls
36
+            return;
37
+        }
38
+    }
39
+
40
+    @Override
41
+    public void encodeCommand(ByteBuffer b) {
42
+        encodeCommand(b, Operation.InitiateOpenCapture, 0, 0);
43
+    }
44
+}

Kodo/kodo - Gogs: Go Git Service

1 Commits (7d17a82ab813dd5263e28d762fd19af1e6b5614a)

Autor SHA1 Mensaje Fecha
  Brightcells 7d85bed0b0 move errno_utils.py/response_utils.py into error file %!s(int64=9) %!d(string=hace) años