4fe07d0c7063eb0ba1c3bb5a6752465e1a3331R18">18
void updateSessionUploadViewAt(int position);
void refreshSessionViews(ArrayList<SessionBean> sessionList);
void setNewSessionBtnEnabled(boolean isEnabled);
- void showTimeSyncView();
- void showRetrySyncView(int strId);
- void showBoxUpgradeActivity(String bpversion_str,int updatingVersionCode);
}
interface Presenter extends BasePresenter{
SessionBean createNewSession();
- void resyncTime();
}
}
@@ -26,10 +26,8 @@ import ai.pai.lensman.db.DBService; |
||
| 26 | 26 |
import ai.pai.lensman.db.Preferences; |
| 27 | 27 |
import ai.pai.lensman.service.OrderDealService; |
| 28 | 28 |
import ai.pai.lensman.service.UploadService; |
| 29 |
-import ai.pai.lensman.upgrade.BoxUpgradeActivity; |
|
| 30 |
-import ai.pai.lensman.upgrade.CheckBoxUpgradeInfoInteractor; |
|
| 31 | 29 |
|
| 32 |
-class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTimeListener,CheckBoxUpgradeInfoInteractor.FetchUpgradeInfoListener, |
|
| 30 |
+class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTimeListener, |
|
| 33 | 31 |
UploadService.PhotoUploadListener, QueryBoxStatusInteractor.BoxStatusListener,OrderDealService.OrderServiceListener {
|
| 34 | 32 |
|
| 35 | 33 |
private int sessionSeq; |
@@ -41,13 +39,11 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 41 | 39 |
|
| 42 | 40 |
private SyncTimeInteractor syncTimeInteractor; |
| 43 | 41 |
private QueryBoxStatusInteractor boxStatusInteractor; |
| 44 |
- private CheckBoxUpgradeInfoInteractor checkBoxUpgradeInfoInteractor; |
|
| 45 | 42 |
private ServiceConnection uploadServiceConnection; |
| 46 | 43 |
private ServiceConnection orderServiceConnection; |
| 47 | 44 |
|
| 48 | 45 |
private boolean isTimeSync = false; |
| 49 | 46 |
private boolean isBoxConnected = true; |
| 50 |
- private boolean isBoxUpdateChecked = false; |
|
| 51 | 47 |
|
| 52 | 48 |
private BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
|
| 53 | 49 |
@Override |
@@ -70,7 +66,6 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 70 | 66 |
|
| 71 | 67 |
boxStatusInteractor = new QueryBoxStatusInteractor(this); |
| 72 | 68 |
syncTimeInteractor = new SyncTimeInteractor(lensmanId,this); |
| 73 |
- checkBoxUpgradeInfoInteractor = new CheckBoxUpgradeInfoInteractor(lensmanId,this); |
|
| 74 | 69 |
uploadServiceConnection = new ServiceConnection() {
|
| 75 | 70 |
@Override |
| 76 | 71 |
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
@@ -105,14 +100,10 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 105 | 100 |
view.showBoxDisconnectedView(); |
| 106 | 101 |
} |
| 107 | 102 |
view.setNewSessionBtnEnabled(false); |
| 108 |
- view.showTimeSyncView(); |
|
| 109 | 103 |
if(!isTimeSync){
|
| 110 | 104 |
syncTimeInteractor.startJob(); |
| 111 | 105 |
} |
| 112 | 106 |
boxStatusInteractor.startJob(); |
| 113 |
- if(!isBoxUpdateChecked){
|
|
| 114 |
- checkBoxUpgradeInfoInteractor.startJob(); |
|
| 115 |
- } |
|
| 116 | 107 |
registerWifiChangeReceiver(); |
| 117 | 108 |
App.getAppContext().startService(new Intent(App.getAppContext(), OrderDealService.class)); |
| 118 | 109 |
App.getAppContext().bindService(new Intent(App.getAppContext(),OrderDealService.class), |
@@ -126,9 +117,6 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 126 | 117 |
} |
| 127 | 118 |
|
| 128 | 119 |
private void onDataReady(){
|
| 129 |
- if(!isTimeSync){
|
|
| 130 |
- return; |
|
| 131 |
- } |
|
| 132 | 120 |
view.setNewSessionBtnEnabled(true); |
| 133 | 121 |
if(sessionList.size()==0){
|
| 134 | 122 |
view.showEmptyView(); |
@@ -142,8 +130,7 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 142 | 130 |
@Override |
| 143 | 131 |
public void stop() {
|
| 144 | 132 |
boxStatusInteractor.cancelJob(); |
| 145 |
- syncTimeInteractor.cancelJob(); |
|
| 146 |
- checkBoxUpgradeInfoInteractor.cancelJob(); |
|
| 133 |
+// syncTimeInteractor.cancelJob(); |
|
| 147 | 134 |
App.getAppContext().unbindService(uploadServiceConnection); |
| 148 | 135 |
App.getAppContext().unbindService(orderServiceConnection); |
| 149 | 136 |
App.getAppContext().unregisterReceiver(wifiReceiver); |
@@ -162,13 +149,6 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 162 | 149 |
return sessionBean; |
| 163 | 150 |
} |
| 164 | 151 |
|
| 165 |
- @Override |
|
| 166 |
- public void resyncTime() {
|
|
| 167 |
- if(syncTimeInteractor!=null){
|
|
| 168 |
- syncTimeInteractor.cancelJob(); |
|
| 169 |
- syncTimeInteractor.startJob(); |
|
| 170 |
- } |
|
| 171 |
- } |
|
| 172 | 152 |
|
| 173 | 153 |
private long getSessionDateInLongFormat(){
|
| 174 | 154 |
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
@@ -255,21 +235,6 @@ class MainPresenter implements MainContract.Presenter,SyncTimeInteractor.SyncTim |
||
| 255 | 235 |
@Override |
| 256 | 236 |
public void onTimeSync(boolean result, @StringRes int strId) {
|
| 257 | 237 |
isTimeSync = result; |
| 258 |
- if(result){
|
|
| 259 |
- onDataReady(); |
|
| 260 |
- }else{
|
|
| 261 |
- if(strId!=0){
|
|
| 262 |
- view.showRetrySyncView(strId); |
|
| 263 |
- } |
|
| 264 |
- } |
|
| 265 |
- } |
|
| 266 |
- |
|
| 267 |
- @Override |
|
| 268 |
- public void onUpgradeInfoFetched(boolean result, String bpversion_str,int versionCode) {
|
|
| 269 |
- isBoxUpdateChecked = true; |
|
| 270 |
- if(result){
|
|
| 271 |
- view.showBoxUpgradeActivity(bpversion_str,versionCode); |
|
| 272 |
- } |
|
| 273 | 238 |
} |
| 274 | 239 |
|
| 275 | 240 |
} |
@@ -450,12 +450,15 @@ |
||
| 450 | 450 |
<View |
| 451 | 451 |
android:layout_width="match_parent" |
| 452 | 452 |
android:layout_height="1px" |
| 453 |
+ android:visibility="gone" |
|
| 453 | 454 |
android:background="@color/text_hint_grey_color" /> |
| 454 | 455 |
|
| 455 | 456 |
<LinearLayout |
| 456 | 457 |
android:layout_width="match_parent" |
| 457 | 458 |
android:layout_height="44dp" |
| 458 |
- android:orientation="horizontal"> |
|
| 459 |
+ android:orientation="horizontal" |
|
| 460 |
+ android:visibility="gone" |
|
| 461 |
+ > |
|
| 459 | 462 |
|
| 460 | 463 |
<TextView |
| 461 | 464 |
android:layout_width="wrap_content" |
@@ -56,46 +56,6 @@ |
||
| 56 | 56 |
android:layout_centerInParent="true" |
| 57 | 57 |
android:src="@drawable/no_photo_tip" /> |
| 58 | 58 |
|
| 59 |
- <RelativeLayout |
|
| 60 |
- android:id="@+id/sync_time_view" |
|
| 61 |
- android:layout_width="match_parent" |
|
| 62 |
- android:layout_height="match_parent" |
|
| 63 |
- android:background="@color/half_transparent"> |
|
| 64 |
- |
|
| 65 |
- <com.android.views.loadingdrawable.LoadingView |
|
| 66 |
- android:id="@+id/loading_gear_view" |
|
| 67 |
- android:layout_width="180dp" |
|
| 68 |
- android:layout_height="180dp" |
|
| 69 |
- android:layout_centerInParent="true" |
|
| 70 |
- app:loading_renderer="GearLoadingRenderer"/> |
|
| 71 |
- |
|
| 72 |
- <TextView |
|
| 73 |
- android:id="@+id/tv_sync_time_status" |
|
| 74 |
- android:layout_width="wrap_content" |
|
| 75 |
- android:layout_height="wrap_content" |
|
| 76 |
- android:textSize="16sp" |
|
| 77 |
- android:text="@string/time_syncing" |
|
| 78 |
- android:layout_below="@id/loading_gear_view" |
|
| 79 |
- android:layout_marginTop="10dp" |
|
| 80 |
- android:layout_centerHorizontal="true" |
|
| 81 |
- android:textColor="@color/white"/> |
|
| 82 |
- |
|
| 83 |
- <Button |
|
| 84 |
- android:id="@+id/btn_retry_sync" |
|
| 85 |
- android:layout_width="140dp" |
|
| 86 |
- android:layout_height="40dp" |
|
| 87 |
- android:layout_centerHorizontal="true" |
|
| 88 |
- android:layout_below="@id/tv_sync_time_status" |
|
| 89 |
- android:layout_marginTop="10dp" |
|
| 90 |
- android:background="@drawable/retry_sync_btn_rounded_rect_bg" |
|
| 91 |
- android:gravity="center" |
|
| 92 |
- android:text="@string/time_sync_retry" |
|
| 93 |
- android:textColor="@color/white" |
|
| 94 |
- android:visibility="gone" |
|
| 95 |
- android:textSize="18sp" /> |
|
| 96 |
- </RelativeLayout> |
|
| 97 |
- |
|
| 98 |
- |
|
| 99 | 59 |
<android.support.v7.widget.RecyclerView |
| 100 | 60 |
android:id="@+id/recycler_view_sessions" |
| 101 | 61 |
android:layout_width="match_parent" |