|
|
31
|
+ public UploadPresenter(UploadContract.View view){
|
|
25
|
32
|
this.uploadView = view;
|
|
26
|
|
- this.lensmanId = lensmanId;
|
|
|
33
|
+ this.lensmanId = Preferences.getInstance().getLensManId();
|
|
27
|
34
|
sessionIds = new ArrayList<>();
|
|
28
|
35
|
interactor = new FetchSessionIdsInteractor(lensmanId,100,this);
|
|
|
36
|
+ serviceConnection = new ServiceConnection() {
|
|
|
37
|
+ @Override
|
|
|
38
|
+ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
|
39
|
+ UploadService.MyBinder binder = (UploadService.MyBinder)iBinder;
|
|
|
40
|
+ ((UploadService.MyBinder) iBinder).getService().setPhotoUploadListener(UploadPresenter.this);
|
|
|
41
|
+ }
|
|
|
42
|
+
|
|
|
43
|
+ @Override
|
|
|
44
|
+ public void onServiceDisconnected(ComponentName componentName) {
|
|
|
45
|
+
|
|
|
46
|
+ }
|
|
|
47
|
+ };
|
|
29
|
48
|
}
|
|
30
|
49
|
|
|
31
|
50
|
|
|
|
|
@@ -49,11 +68,12 @@ public class UploadPresenter implements UploadContract.Presenter,BaseInteractor.
|
|
49
|
68
|
sessionSeq = sessionList.size();
|
|
50
|
69
|
|
|
51
|
70
|
App.getAppContext().startService(new Intent(App.getAppContext(), UploadService.class));
|
|
|
71
|
+ App.getAppContext().bindService(new Intent(App.getAppContext(),UploadService.class),serviceConnection, Context.BIND_AUTO_CREATE);
|
|
52
|
72
|
}
|
|
53
|
73
|
|
|
54
|
74
|
@Override
|
|
55
|
75
|
public void stop() {
|
|
56
|
|
-
|
|
|
76
|
+ App.getAppContext().unbindService(serviceConnection);
|
|
57
|
77
|
}
|
|
58
|
78
|
|
|
59
|
79
|
@Override
|
|
|
|
@@ -83,7 +103,13 @@ public class UploadPresenter implements UploadContract.Presenter,BaseInteractor.
|
|
83
|
103
|
|
|
84
|
104
|
@Override
|
|
85
|
105
|
public void onInteractFail(String errorMsg) {
|
|
86
|
|
-// interactor.startJob();
|
|
|
106
|
+ interactor.startJob();
|
|
87
|
107
|
}
|
|
88
|
108
|
|
|
|
109
|
+
|
|
|
110
|
+ @Override
|
|
|
111
|
+ public void onPhotoUploaded(PhotoBean bean) {
|
|
|
112
|
+
|
|
|
113
|
+ uploadView.updateSessionUploadView(null);
|
|
|
114
|
+ }
|
|
89
|
115
|
}
|