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