@@ -7,15 +7,12 @@ import android.support.v7.widget.GridLayoutManager; |
||
| 7 | 7 |
import android.support.v7.widget.LinearLayoutManager; |
| 8 | 8 |
import android.support.v7.widget.RecyclerView; |
| 9 | 9 |
import android.view.View; |
| 10 |
-import android.widget.Button; |
|
| 11 | 10 |
import android.widget.ImageView; |
| 12 |
-import android.widget.RelativeLayout; |
|
| 13 | 11 |
import android.widget.TextView; |
| 14 | 12 |
import android.widget.Toast; |
| 15 | 13 |
|
| 16 | 14 |
import com.android.common.utils.LogHelper; |
| 17 | 15 |
import com.android.common.utils.NetworkUtil; |
| 18 |
-import com.android.views.loadingdrawable.LoadingView; |
|
| 19 | 16 |
import com.umeng.analytics.MobclickAgent; |
| 20 | 17 |
|
| 21 | 18 |
import java.util.ArrayList; |
@@ -25,7 +22,6 @@ import ai.pai.lensman.base.BaseActivity; |
||
| 25 | 22 |
import ai.pai.lensman.bean.SessionBean; |
| 26 | 23 |
import ai.pai.lensman.briefs.BriefsActivity; |
| 27 | 24 |
import ai.pai.lensman.session.SessionActivity; |
| 28 |
-import ai.pai.lensman.upgrade.BoxUpgradeActivity; |
|
| 29 | 25 |
import ai.pai.lensman.upload.UploadActivity; |
| 30 | 26 |
import ai.pai.lensman.utils.UmengEvent; |
| 31 | 27 |
import butterknife.BindView; |
@@ -39,10 +35,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 39 | 35 |
@BindView(R.id.icon_no_data) View noDataLayout; |
| 40 | 36 |
@BindView(R.id.iv_add_session) ImageView addSessionBtn; |
| 41 | 37 |
@BindView(R.id.recycler_view_sessions) RecyclerView sessionsRecyclerView; |
| 42 |
- @BindView(R.id.sync_time_view) RelativeLayout syncTimeView; |
|
| 43 |
- @BindView(R.id.loading_gear_view) LoadingView loadingView; |
|
| 44 |
- @BindView(R.id.tv_sync_time_status) TextView syncStatusTextView; |
|
| 45 |
- @BindView(R.id.btn_retry_sync) Button retrySyncBtn; |
|
| 46 | 38 |
private SessionRecyclerAdapter adapter; |
| 47 | 39 |
private MainContract.Presenter presenter; |
| 48 | 40 |
private long exitTime; |
@@ -84,11 +76,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 84 | 76 |
} |
| 85 | 77 |
} |
| 86 | 78 |
|
| 87 |
- @OnClick(R.id.btn_retry_sync) |
|
| 88 |
- void retrySync(){
|
|
| 89 |
- showTimeSyncView(); |
|
| 90 |
- presenter.resyncTime(); |
|
| 91 |
- } |
|
| 92 | 79 |
|
| 93 | 80 |
@OnClick(R.id.layout_brief) |
| 94 | 81 |
void jumpToBriefs(){
|
@@ -127,7 +114,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 127 | 114 |
|
| 128 | 115 |
@Override |
| 129 | 116 |
public void showEmptyView() {
|
| 130 |
- syncTimeView.setVisibility(View.GONE); |
|
| 131 | 117 |
sessionsRecyclerView.setVisibility(View.GONE); |
| 132 | 118 |
noDataLayout.setVisibility(View.VISIBLE); |
| 133 | 119 |
} |
@@ -135,7 +121,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 135 | 121 |
@Override |
| 136 | 122 |
public void showSessionViews() {
|
| 137 | 123 |
noDataLayout.setVisibility(View.GONE); |
| 138 |
- syncTimeView.setVisibility(View.GONE); |
|
| 139 | 124 |
sessionsRecyclerView.setVisibility(View.VISIBLE); |
| 140 | 125 |
} |
| 141 | 126 |
|
@@ -155,27 +140,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 155 | 140 |
addSessionBtn.setEnabled(isEnabled); |
| 156 | 141 |
} |
| 157 | 142 |
|
| 158 |
- @Override |
|
| 159 |
- public void showTimeSyncView() {
|
|
| 160 |
- sessionsRecyclerView.setVisibility(View.GONE); |
|
| 161 |
- syncTimeView.setVisibility(View.VISIBLE); |
|
| 162 |
- loadingView.setVisibility(View.VISIBLE); |
|
| 163 |
- syncStatusTextView.setText(R.string.time_syncing); |
|
| 164 |
- } |
|
| 165 |
- |
|
| 166 |
- @Override |
|
| 167 |
- public void showRetrySyncView(int strId) {
|
|
| 168 |
- retrySyncBtn.setVisibility(View.VISIBLE); |
|
| 169 |
- loadingView.setVisibility(View.INVISIBLE); |
|
| 170 |
- if(strId!=0){
|
|
| 171 |
- syncStatusTextView.setText(strId); |
|
| 172 |
- } |
|
| 173 |
- } |
|
| 174 |
- |
|
| 175 |
- @Override |
|
| 176 |
- public void showBoxUpgradeActivity(String bpversion_str,int updatingVersionCode) {
|
|
| 177 |
- BoxUpgradeActivity.startBoxUpgradeActivity(this,bpversion_str,updatingVersionCode); |
|
| 178 |
- } |
|
| 179 | 143 |
|
| 180 | 144 |
private void jumpToSelectedSession(SessionBean sessionBean) {
|
| 181 | 145 |
Intent intent = new Intent(this, SessionActivity.class); |
@@ -18,14 +18,10 @@ public class MainContract {
|
||
| 18 | 18 |
void updateSessionUploadViewAt(int position); |
| 19 | 19 |
void refreshSessionViews(ArrayList<SessionBean> sessionList); |
| 20 | 20 |
void setNewSessionBtnEnabled(boolean isEnabled); |
| 21 |
- void showTimeSyncView(); |
|
| 22 |
- void showRetrySyncView(int strId); |
|
| 23 |
- void showBoxUpgradeActivity(String bpversion_str,int updatingVersionCode); |
|
| 24 | 21 |
} |
| 25 | 22 |
|
| 26 | 23 |
interface Presenter extends BasePresenter{
|
| 27 | 24 |
SessionBean createNewSession(); |
| 28 |
- void resyncTime(); |
|
| 29 | 25 |
} |
| 30 | 26 |
|
| 31 | 27 |
} |
@@ -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" |