@@ -12,11 +12,12 @@ import com.remoteyourcam.usb.ptp.Camera; |
||
| 12 | 12 |
import com.remoteyourcam.usb.ptp.PtpConstants; |
| 13 | 13 |
import com.remoteyourcam.usb.ptp.PtpService; |
| 14 | 14 |
import com.remoteyourcam.usb.ptp.model.LiveViewData; |
| 15 |
+import com.remoteyourcam.usb.ptp.model.ObjectInfo; |
|
| 15 | 16 |
|
| 16 | 17 |
import ai.pai.ptp.R; |
| 17 | 18 |
|
| 18 | 19 |
|
| 19 |
-public class MyTestActivity extends Activity implements Camera.CameraListener {
|
|
| 20 |
+public class MyTestActivity extends Activity implements Camera.CameraListener,Camera.StorageInfoListener,Camera.RetrieveImageInfoListener{
|
|
| 20 | 21 |
|
| 21 | 22 |
private ImageView photoIv; |
| 22 | 23 |
private ListView infoListView; |
@@ -93,6 +94,7 @@ public class MyTestActivity extends Activity implements Camera.CameraListener {
|
||
| 93 | 94 |
public void onCameraStarted(Camera camera) {
|
| 94 | 95 |
this.camera = camera; |
| 95 | 96 |
adapter.addInfo("开始会话");
|
| 97 |
+ camera.retrieveStorages(this); |
|
| 96 | 98 |
} |
| 97 | 99 |
|
| 98 | 100 |
@Override |
@@ -192,4 +194,25 @@ public class MyTestActivity extends Activity implements Camera.CameraListener {
|
||
| 192 | 194 |
public void onLogMessage(String msg) {
|
| 193 | 195 |
adapter.addInfo(msg); |
| 194 | 196 |
} |
| 197 |
+ |
|
| 198 |
+ @Override |
|
| 199 |
+ public void onStorageFound(int handle, String label) {
|
|
| 200 |
+ adapter.addInfo("找到相机存储文件,句柄="+handle + " label = "+label);
|
|
| 201 |
+ |
|
| 202 |
+ } |
|
| 203 |
+ |
|
| 204 |
+ @Override |
|
| 205 |
+ public void onAllStoragesFound() {
|
|
| 206 |
+ adapter.addInfo("找到相机存储");
|
|
| 207 |
+ } |
|
| 208 |
+ |
|
| 209 |
+ @Override |
|
| 210 |
+ public void onImageHandlesRetrieved(int[] handles) {
|
|
| 211 |
+ adapter.addInfo("找到相机存储图像文件,共"+handles.length + "张");
|
|
| 212 |
+ } |
|
| 213 |
+ |
|
| 214 |
+ @Override |
|
| 215 |
+ public void onImageInfoRetrieved(int objectHandle, ObjectInfo objectInfo, Bitmap thumbnail) {
|
|
| 216 |
+ adapter.addInfo("找到相机存储图像文件,句柄="+objectHandle + " info = "+objectInfo);
|
|
| 217 |
+ } |
|
| 195 | 218 |
} |
@@ -44,10 +44,15 @@ public class MyTestAdapter extends BaseAdapter {
|
||
| 44 | 44 |
return position; |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 |
- public void addInfo(String info){
|
|
| 48 |
- infoList.add(formatter.format(new Date())+info); |
|
| 49 |
- notifyDataSetChanged(); |
|
| 50 |
- listView.smoothScrollToPosition(infoList.size()); |
|
| 47 |
+ public void addInfo(final String info){
|
|
| 48 |
+ listView.post(new Runnable() {
|
|
| 49 |
+ @Override |
|
| 50 |
+ public void run() {
|
|
| 51 |
+ infoList.add(formatter.format(new Date())+info); |
|
| 52 |
+ notifyDataSetChanged(); |
|
| 53 |
+ listView.smoothScrollToPosition(infoList.size()); |
|
| 54 |
+ } |
|
| 55 |
+ }); |
|
| 51 | 56 |
} |
| 52 | 57 |
|
| 53 | 58 |
@Override |