@@ -85,7 +85,6 @@ public class UploadActivity extends BaseActivity implements UploadContract.View |
||
| 85 | 85 |
public void showEmptyView() {
|
| 86 | 86 |
sessionsRecyclerView.setVisibility(android.view.View.GONE); |
| 87 | 87 |
noDataLayout.setVisibility(android.view.View.VISIBLE); |
| 88 |
- |
|
| 89 | 88 |
} |
| 90 | 89 |
|
| 91 | 90 |
@Override |
@@ -95,7 +94,7 @@ public class UploadActivity extends BaseActivity implements UploadContract.View |
||
| 95 | 94 |
} |
| 96 | 95 |
|
| 97 | 96 |
@Override |
| 98 |
- public void updateSessionUploadView(SessionBean bean) {
|
|
| 97 |
+ public void updateSessionUploadViewAt(int position) {
|
|
| 99 | 98 |
|
| 100 | 99 |
} |
| 101 | 100 |
|
@@ -14,7 +14,7 @@ public class UploadContract {
|
||
| 14 | 14 |
void showBoxConnectedView(); |
| 15 | 15 |
void showEmptyView(); |
| 16 | 16 |
void showSessionViews(); |
| 17 |
- void updateSessionUploadView(SessionBean bean); |
|
| 17 |
+ void updateSessionUploadViewAt(int position); |
|
| 18 | 18 |
void refreshSessionViews(ArrayList<SessionBean> sessionList); |
| 19 | 19 |
void setNewSessionBtnEnabled(boolean isEnabled); |
| 20 | 20 |
} |
@@ -36,7 +36,6 @@ public class UploadPresenter implements UploadContract.Presenter,BaseInteractor. |
||
| 36 | 36 |
serviceConnection = new ServiceConnection() {
|
| 37 | 37 |
@Override |
| 38 | 38 |
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
| 39 |
- UploadService.MyBinder binder = (UploadService.MyBinder)iBinder; |
|
| 40 | 39 |
((UploadService.MyBinder) iBinder).getService().setPhotoUploadListener(UploadPresenter.this); |
| 41 | 40 |
} |
| 42 | 41 |
|
@@ -108,8 +107,24 @@ public class UploadPresenter implements UploadContract.Presenter,BaseInteractor. |
||
| 108 | 107 |
|
| 109 | 108 |
|
| 110 | 109 |
@Override |
| 111 |
- public void onPhotoUploaded(PhotoBean bean) {
|
|
| 112 |
- |
|
| 113 |
- uploadView.updateSessionUploadView(null); |
|
| 110 |
+ public synchronized void onPhotoUploaded(PhotoBean bean) {
|
|
| 111 |
+ int position = sessionList.size()-bean.sessionSeq-1; |
|
| 112 |
+ if(position < 0 || position>=sessionList.size()){
|
|
| 113 |
+ return; |
|
| 114 |
+ } |
|
| 115 |
+ SessionBean sessionBean = sessionList.get(position); |
|
| 116 |
+ ArrayList<PhotoBean> photoList = sessionBean.sessionPhotos; |
|
| 117 |
+ if(photoList==null || photoList.size()==0){
|
|
| 118 |
+ photoList = new ArrayList<>(); |
|
| 119 |
+ photoList.add(bean); |
|
| 120 |
+ }else{
|
|
| 121 |
+ for(PhotoBean photoBean : photoList){
|
|
| 122 |
+ if(photoBean.photoId == bean.photoId){
|
|
| 123 |
+ photoBean.isUploaded = true; |
|
| 124 |
+ break; |
|
| 125 |
+ } |
|
| 126 |
+ } |
|
| 127 |
+ } |
|
| 128 |
+ uploadView.updateSessionUploadViewAt(position); |
|
| 114 | 129 |
} |
| 115 | 130 |
} |