Showing
1 changed file
with
29 additions
and
3 deletions
| ... | ... | @@ -29,10 +29,12 @@ import com.gimi.common.cinema.model.RoomStatusInfo; |
| 29 | 29 | import com.gimi.common.cinema.model.SambaMsg; |
| 30 | 30 | import com.gimi.common.cinema.utils.ActivityCollector; |
| 31 | 31 | import com.gimi.common.cinema.utils.CToast; |
| 32 | +import com.gimi.common.cinema.utils.FileHashUtils; | |
| 32 | 33 | import com.gimi.common.cinema.utils.LogUtils; |
| 33 | 34 | import com.gimi.common.cinema.utils.OpenMMUtils; |
| 34 | 35 | import com.gimi.common.cinema.utils.ResUtils; |
| 35 | 36 | import com.gimi.common.cinema.utils.SambaFileCharge; |
| 37 | +import com.gimi.common.cinema.utils.SystemUtils; | |
| 36 | 38 | import com.gimi.common.cinema.utils.Utils; |
| 37 | 39 | import com.google.gson.Gson; |
| 38 | 40 | import com.google.gson.JsonSyntaxException; |
| ... | ... | @@ -310,7 +312,8 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 310 | 312 | break; |
| 311 | 313 | } |
| 312 | 314 | //check the movie |
| 313 | - if (TextUtils.isEmpty(mApplication.getCurrentPlayUrl())) { | |
| 315 | + String currentPlayUrl = mApplication.getCurrentPlayUrl(); | |
| 316 | + if (TextUtils.isEmpty(currentPlayUrl)) { | |
| 314 | 317 | presenter.getOrderInfo(this); |
| 315 | 318 | } else { |
| 316 | 319 | if (roomStatusInfo == null || roomStatusInfo.getData() == null) { |
| ... | ... | @@ -323,12 +326,22 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 323 | 326 | Log.e("room-info", "movie not exits"); |
| 324 | 327 | break; |
| 325 | 328 | } |
| 326 | - if (!roomStatusInfo.getData().getFilm_hash().equals(lmm.getMd5())) { | |
| 329 | + if (!roomStatusInfo.getData().getFilm_hash().equals(FileHashUtils.getFileHash(currentPlayUrl))) { | |
| 327 | 330 | //当前播放电影信息不正确正在重新拉取 |
| 328 | 331 | show("当前播放电影信息不正确正在重新拉取"); |
| 332 | + try { | |
| 333 | + new SystemUtils().stopMediaPlayer(SmartControlService.this.getApplicationContext()); | |
| 334 | + } catch (Exception e) { | |
| 335 | + e.printStackTrace(); | |
| 336 | + } | |
| 329 | 337 | presenter.getOrderInfo(this); |
| 330 | 338 | } |
| 331 | 339 | } else { |
| 340 | + try { | |
| 341 | + new SystemUtils().stopMediaPlayer(SmartControlService.this.getApplicationContext()); | |
| 342 | + } catch (Exception e) { | |
| 343 | + e.printStackTrace(); | |
| 344 | + } | |
| 332 | 345 | presenter.getOrderInfo(this); |
| 333 | 346 | break; |
| 334 | 347 | } |
| ... | ... | @@ -472,7 +485,7 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 472 | 485 | |
| 473 | 486 | private void show(String msg) { |
| 474 | 487 | // Log.d(TAG, "show: " + msg); |
| 475 | - Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | |
| 488 | + Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); | |
| 476 | 489 | } |
| 477 | 490 | |
| 478 | 491 | private void onDeviceStatusChanged(DeviceEvent event) { |
| ... | ... | @@ -625,10 +638,23 @@ public class SmartControlService extends BaseService implements EventListener<St |
| 625 | 638 | public void updateOrderInfo(RoomStatusInfo orderInfo) { |
| 626 | 639 | this.roomStatusInfo = orderInfo; |
| 627 | 640 | Log.d("room-info", "update order info"); |
| 641 | + if (roomStatusInfo == null || roomStatusInfo.getData() == null) { | |
| 642 | + return; | |
| 643 | + } | |
| 628 | 644 | RoomStatusInfo.DataEntity data = orderInfo.getData(); |
| 629 | 645 | int offset = data.getNow_time() - data.getBegin_time(); |
| 630 | 646 | |
| 647 | + //修正非法时间 patch start | |
| 631 | 648 | int durationMinutes = data.getEnd_time() - data.getNow_time(); |
| 649 | + if (data.getEnd_time() < data.getNow_time()) { | |
| 650 | + LogUtils.i("room-info", "修正时间,end time less than now time:" + orderInfo.toString()); | |
| 651 | + durationMinutes += 1440; | |
| 652 | + if (durationMinutes < 0 || durationMinutes > 160) { | |
| 653 | + LogUtils.i("room-info", "修正时间后,illegal:" + durationMinutes); | |
| 654 | + durationMinutes = 0; | |
| 655 | + } | |
| 656 | + } | |
| 657 | + //修正非法时间 patch end | |
| 632 | 658 | LogUtils.i("room-info", orderInfo.toString()); |
| 633 | 659 | if (durationMinutes <= 1) { |
| 634 | 660 | return; | ... | ... |
Please
register
or
login
to post a comment