Showing
12 changed files
with
192 additions
and
55 deletions
| @@ -18,6 +18,7 @@ public class RoomQrCodeInfo extends BaseModel { | @@ -18,6 +18,7 @@ public class RoomQrCodeInfo extends BaseModel { | ||
| 18 | public static class DataEntity { | 18 | public static class DataEntity { |
| 19 | 19 | ||
| 20 | private String code; | 20 | private String code; |
| 21 | + private String room_sn; | ||
| 21 | 22 | ||
| 22 | public String getCode() { | 23 | public String getCode() { |
| 23 | return code; | 24 | return code; |
| @@ -27,10 +28,19 @@ public class RoomQrCodeInfo extends BaseModel { | @@ -27,10 +28,19 @@ public class RoomQrCodeInfo extends BaseModel { | ||
| 27 | this.code = code; | 28 | this.code = code; |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 31 | + public String getRoom_sn() { | ||
| 32 | + return room_sn; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setRoom_sn(String room_sn) { | ||
| 36 | + this.room_sn = room_sn; | ||
| 37 | + } | ||
| 38 | + | ||
| 30 | @Override | 39 | @Override |
| 31 | public String toString() { | 40 | public String toString() { |
| 32 | return "DataEntity{" + | 41 | return "DataEntity{" + |
| 33 | "code='" + code + '\'' + | 42 | "code='" + code + '\'' + |
| 43 | + ", room_sn='" + room_sn + '\'' + | ||
| 34 | '}'; | 44 | '}'; |
| 35 | } | 45 | } |
| 36 | } | 46 | } |
| @@ -22,6 +22,7 @@ public class RoomStatusInfo extends BaseModel { | @@ -22,6 +22,7 @@ public class RoomStatusInfo extends BaseModel { | ||
| 22 | private int end_time; | 22 | private int end_time; |
| 23 | private int status; | 23 | private int status; |
| 24 | private String film_hash; | 24 | private String film_hash; |
| 25 | + private String film_name; | ||
| 25 | private int now_time; | 26 | private int now_time; |
| 26 | 27 | ||
| 27 | public String getOrder_sn() { | 28 | public String getOrder_sn() { |
| @@ -64,6 +65,14 @@ public class RoomStatusInfo extends BaseModel { | @@ -64,6 +65,14 @@ public class RoomStatusInfo extends BaseModel { | ||
| 64 | this.film_hash = film_hash; | 65 | this.film_hash = film_hash; |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 68 | + public String getFilm_name() { | ||
| 69 | + return film_name; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public void setFilm_name(String film_name) { | ||
| 73 | + this.film_name = film_name; | ||
| 74 | + } | ||
| 75 | + | ||
| 67 | public int getNow_time() { | 76 | public int getNow_time() { |
| 68 | return now_time; | 77 | return now_time; |
| 69 | } | 78 | } |
| @@ -80,6 +89,7 @@ public class RoomStatusInfo extends BaseModel { | @@ -80,6 +89,7 @@ public class RoomStatusInfo extends BaseModel { | ||
| 80 | ", end_time=" + end_time + | 89 | ", end_time=" + end_time + |
| 81 | ", status=" + status + | 90 | ", status=" + status + |
| 82 | ", film_hash='" + film_hash + '\'' + | 91 | ", film_hash='" + film_hash + '\'' + |
| 92 | + ", film_name='" + film_name + '\'' + | ||
| 83 | ", now_time=" + now_time + | 93 | ", now_time=" + now_time + |
| 84 | '}'; | 94 | '}'; |
| 85 | } | 95 | } |
| 1 | +package com.gimi.common.cinema.utils; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by wugian on 2017/6/12. | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +public class ResUtils { | ||
| 10 | + public static String getResResult(Context context, int... resIds) { | ||
| 11 | + StringBuilder stringBuilder = new StringBuilder(); | ||
| 12 | + for (int resId : resIds) { | ||
| 13 | + stringBuilder.append(context.getString(resId)); | ||
| 14 | + } | ||
| 15 | + return stringBuilder.toString(); | ||
| 16 | + } | ||
| 17 | +} |
| @@ -57,5 +57,7 @@ public interface SmartControlContract { | @@ -57,5 +57,7 @@ public interface SmartControlContract { | ||
| 57 | void getCleanQrCode(String orderSn, String roomSn); | 57 | void getCleanQrCode(String orderSn, String roomSn); |
| 58 | 58 | ||
| 59 | void getSysTime(Context context); | 59 | void getSysTime(Context context); |
| 60 | + | ||
| 61 | + void getNextOrderInfo(Context context, String roomSn); | ||
| 60 | } | 62 | } |
| 61 | } | 63 | } |
| @@ -122,6 +122,23 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | @@ -122,6 +122,23 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | ||
| 122 | }); | 122 | }); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | + | ||
| 126 | + @Override | ||
| 127 | + public void getNextOrderInfo(Context context, String roomSn) { | ||
| 128 | + roomInfoModel.getRoomNestOrderInfo(roomSn, new RoomInfoModelImpl.GetRoomStatusListener() { | ||
| 129 | + @Override | ||
| 130 | + public void onGetRoomStatusSuccess(RoomStatusInfo info) { | ||
| 131 | + LogUtils.i("room-info", "onGetRoomStatusSuccess:" + info.toString()); | ||
| 132 | + mainView.updateOrderInfo(info); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @Override | ||
| 136 | + public void onGetRoomStatusFailure(WrongMsg wrongMsg) { | ||
| 137 | + LogUtils.i("room-info", "onGetRoomStatusFailure:" + wrongMsg.toString()); | ||
| 138 | + } | ||
| 139 | + }); | ||
| 140 | + } | ||
| 141 | + | ||
| 125 | @Override | 142 | @Override |
| 126 | public void reportOpenDoorStatus(String oderSn) { | 143 | public void reportOpenDoorStatus(String oderSn) { |
| 127 | roomInfoModel.reportOpenDoorStatus(oderSn, new RoomInfoModelImpl.OpenDoorStatusListener() { | 144 | roomInfoModel.reportOpenDoorStatus(oderSn, new RoomInfoModelImpl.OpenDoorStatusListener() { |
| @@ -29,6 +29,7 @@ import com.gimi.common.cinema.utils.ActivityCollector; | @@ -29,6 +29,7 @@ import com.gimi.common.cinema.utils.ActivityCollector; | ||
| 29 | import com.gimi.common.cinema.utils.CToast; | 29 | import com.gimi.common.cinema.utils.CToast; |
| 30 | import com.gimi.common.cinema.utils.LogUtils; | 30 | import com.gimi.common.cinema.utils.LogUtils; |
| 31 | import com.gimi.common.cinema.utils.OpenMMUtils; | 31 | import com.gimi.common.cinema.utils.OpenMMUtils; |
| 32 | +import com.gimi.common.cinema.utils.ResUtils; | ||
| 32 | import com.gimi.common.cinema.utils.SambaFileCharge; | 33 | import com.gimi.common.cinema.utils.SambaFileCharge; |
| 33 | import com.gimi.common.cinema.utils.Utils; | 34 | import com.gimi.common.cinema.utils.Utils; |
| 34 | import com.google.gson.Gson; | 35 | import com.google.gson.Gson; |
| @@ -51,6 +52,7 @@ import com.telink.bluetooth.light.Parameters; | @@ -51,6 +52,7 @@ import com.telink.bluetooth.light.Parameters; | ||
| 51 | import com.telink.bluetooth.light.model.Mesh; | 52 | import com.telink.bluetooth.light.model.Mesh; |
| 52 | import com.telink.util.Event; | 53 | import com.telink.util.Event; |
| 53 | import com.telink.util.EventListener; | 54 | import com.telink.util.EventListener; |
| 55 | +import com.xgimi.gimicinema.R; | ||
| 54 | import com.xgimi.gimicinema.activity.AdsPreVideoPlayerActivity; | 56 | import com.xgimi.gimicinema.activity.AdsPreVideoPlayerActivity; |
| 55 | import com.xgimi.gimicinema.activity.QrCodeShowActivity; | 57 | import com.xgimi.gimicinema.activity.QrCodeShowActivity; |
| 56 | import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; | 58 | import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; |
| @@ -68,6 +70,7 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -68,6 +70,7 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 68 | 70 | ||
| 69 | public static final int ORDER_PLAY_COMPLETE = 0x1101; | 71 | public static final int ORDER_PLAY_COMPLETE = 0x1101; |
| 70 | 72 | ||
| 73 | + private Context mContext; | ||
| 71 | private boolean hasSystemFeatureBluetoothLe = true; | 74 | private boolean hasSystemFeatureBluetoothLe = true; |
| 72 | private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver(); | 75 | private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver(); |
| 73 | private SmartControlContract.Presenter presenter; | 76 | private SmartControlContract.Presenter presenter; |
| @@ -102,6 +105,7 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -102,6 +105,7 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 102 | @Override | 105 | @Override |
| 103 | public int onStartCommand(Intent intent, int flags, int startId) { | 106 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 104 | super.onStartCommand(intent, flags, startId); | 107 | super.onStartCommand(intent, flags, startId); |
| 108 | + mContext = this; | ||
| 105 | new SmartControlPresenter(this); | 109 | new SmartControlPresenter(this); |
| 106 | mApplication = (FangTangApplication) getApplication(); | 110 | mApplication = (FangTangApplication) getApplication(); |
| 107 | mApplication.doInit(); | 111 | mApplication.doInit(); |
| @@ -331,23 +335,35 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -331,23 +335,35 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 331 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 335 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 332 | startActivity(intent); | 336 | startActivity(intent); |
| 333 | roomStatusInfo = null; | 337 | roomStatusInfo = null; |
| 334 | -// if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { | ||
| 335 | -// if (System.currentTimeMillis() - lastRequest > 3000) { | ||
| 336 | -// lastRequest = System.currentTimeMillis(); | ||
| 337 | -// countMsg = messageEvent.getMessage(); | ||
| 338 | -// presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn()); | ||
| 339 | -// } | ||
| 340 | -// } else { | ||
| 341 | -// String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) + | ||
| 342 | -// ",roomInfo is Null:" + (roomInfo == null); | ||
| 343 | -// Log.d("room-info", msg); | ||
| 344 | -// Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | ||
| 345 | -// } | 338 | + if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { |
| 339 | + if (System.currentTimeMillis() - lastRequest > 3000) { | ||
| 340 | + lastRequest = System.currentTimeMillis(); | ||
| 341 | + countMsg = messageEvent.getMessage(); | ||
| 342 | + presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn()); | ||
| 343 | + } | ||
| 344 | + } else { | ||
| 345 | + String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) + | ||
| 346 | + ",roomInfo is Null:" + (roomInfo == null); | ||
| 347 | + Log.d("room-info", msg); | ||
| 348 | + Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | ||
| 349 | + } | ||
| 346 | break; | 350 | break; |
| 347 | case ORDER_PLAY_COMPLETE: | 351 | case ORDER_PLAY_COMPLETE: |
| 352 | + if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { | ||
| 353 | + if (System.currentTimeMillis() - lastRequest > 3000) { | ||
| 354 | + lastRequest = System.currentTimeMillis(); | ||
| 355 | + countMsg = messageEvent.getMessage(); | ||
| 356 | + presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn()); | ||
| 357 | + } | ||
| 358 | + } else { | ||
| 359 | + String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) + | ||
| 360 | + ",roomInfo is Null:" + (roomInfo == null); | ||
| 361 | + Log.i("room-info", msg); | ||
| 362 | + Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | ||
| 363 | + } | ||
| 348 | LogUtils.i("room-info", messageEvent.getMessage()); | 364 | LogUtils.i("room-info", messageEvent.getMessage()); |
| 349 | Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo)); | 365 | Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo)); |
| 350 | - playEndAds(); | 366 | +// playEndAds(); |
| 351 | break; | 367 | break; |
| 352 | default: | 368 | default: |
| 353 | Log.d("room-info", messageEvent.getMessage()); | 369 | Log.d("room-info", messageEvent.getMessage()); |
| @@ -597,20 +613,23 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -597,20 +613,23 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 597 | if (!TextUtils.isEmpty(data.getFilm_hash())) { | 613 | if (!TextUtils.isEmpty(data.getFilm_hash())) { |
| 598 | localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash()); | 614 | localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash()); |
| 599 | if (localMovieMessages == null) { | 615 | if (localMovieMessages == null) { |
| 600 | - show("电影信息出错,找不到相关电影"); | ||
| 601 | LogUtils.e("room-info", "file not exists:" + orderInfo.toString()); | 616 | LogUtils.e("room-info", "file not exists:" + orderInfo.toString()); |
| 602 | - if (offset > 3) { | ||
| 603 | - CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间,没有找到电影信息,请联系客服", 90 * 1000).show(); | ||
| 604 | - } else { | ||
| 605 | - CToast.makeText(this, "没有找到电影信息,请联系客服", 90 * 1000).show(); | ||
| 606 | - } | 617 | + CToast.makeText(this, "没有找到电影信息,请联系客服", 90 * 1000).show(); |
| 607 | } | 618 | } |
| 608 | } | 619 | } |
| 609 | if (localMovieMessages != null) { | 620 | if (localMovieMessages != null) { |
| 610 | - if (offset > 3) { | ||
| 611 | - CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间", 100 * 1000).show(); | ||
| 612 | - } | ||
| 613 | LogUtils.i("room-info", "play movie" + localMovieMessages.toString()); | 621 | LogUtils.i("room-info", "play movie" + localMovieMessages.toString()); |
| 622 | + String showMsg; | ||
| 623 | + if (offset > 0) { | ||
| 624 | + showMsg = String.format(ResUtils.getResResult(mContext, | ||
| 625 | + R.string.welcome, R.string.ads_promote, | ||
| 626 | + R.string.delay_time_fill_time, | ||
| 627 | + R.string.play_movie_fill_name), | ||
| 628 | + offset, roomStatusInfo.getData().getFilm_name()); | ||
| 629 | + } else { | ||
| 630 | + showMsg = String.format(ResUtils.getResResult(mContext, R.string.welcome, R.string.ads_promote, R.string.play_movie_fill_name), roomStatusInfo.getData().getFilm_name()); | ||
| 631 | + } | ||
| 632 | + CToast.makeText(this, showMsg, 100 * 1000).show(); | ||
| 614 | OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null); | 633 | OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null); |
| 615 | } else { | 634 | } else { |
| 616 | LogUtils.e("room-info", "file not exists:" + orderInfo.toString()); | 635 | LogUtils.e("room-info", "file not exists:" + orderInfo.toString()); |
| @@ -621,15 +640,24 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -621,15 +640,24 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 621 | @Override | 640 | @Override |
| 622 | public void prepareRoomQrCodeInfo(RoomQrCodeInfo qrCodeInfo) { | 641 | public void prepareRoomQrCodeInfo(RoomQrCodeInfo qrCodeInfo) { |
| 623 | this.info = qrCodeInfo; | 642 | this.info = qrCodeInfo; |
| 624 | - Intent intent = new Intent(this, QrCodeShowActivity.class) | ||
| 625 | - .putExtra("qr", info.getData().getCode()) | ||
| 626 | - .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | ||
| 627 | - .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); | ||
| 628 | - if ("count_service".equals(countMsg)) { | ||
| 629 | - intent.putExtra("count_call", true); | 643 | + if (info != null && info.getData() != null && TextUtils.isEmpty(info.getData().getRoom_sn())) { |
| 644 | + LogUtils.i(TAG, "order_sn is null,play end ads"); | ||
| 645 | + playEndAds(); | ||
| 646 | +// Intent intent = new Intent(this, QrCodeShowActivity.class) | ||
| 647 | +// .putExtra("qr", info.getData().getCode()) | ||
| 648 | +// .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | ||
| 649 | +// .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); | ||
| 650 | +// if ("count_service".equals(countMsg)) { | ||
| 651 | +// intent.putExtra("count_call", true); | ||
| 652 | +// } | ||
| 653 | +// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 654 | +// startActivity(intent); | ||
| 655 | + } else { | ||
| 656 | + LogUtils.i(TAG, "order_sn not null:" + qrCodeInfo.toString()); | ||
| 657 | + String showMsg = ResUtils.getResResult(mContext, R.string.ads_promote, R.string.play_next_fill_name); | ||
| 658 | + CToast.makeText(mContext, showMsg, 30 * 1000).show(); | ||
| 659 | + presenter.getNextOrderInfo(SmartControlService.this, info.getData().getRoom_sn()); | ||
| 630 | } | 660 | } |
| 631 | - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 632 | - startActivity(intent); | ||
| 633 | } | 661 | } |
| 634 | 662 | ||
| 635 | @Override | 663 | @Override |
| @@ -656,6 +684,10 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -656,6 +684,10 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 656 | return; | 684 | return; |
| 657 | } | 685 | } |
| 658 | if (roomStatusInfo != null && roomStatusInfo.getData() != null && roomInfo != null && roomInfo.getData() != null) { | 686 | if (roomStatusInfo != null && roomStatusInfo.getData() != null && roomInfo != null && roomInfo.getData() != null) { |
| 687 | + if (Constant.count > 30) { | ||
| 688 | + String showMsg = ResUtils.getResResult(mContext, R.string.ads_promote, R.string.end_ads); | ||
| 689 | + CToast.makeText(mContext, showMsg, 30 * 1000).show(); | ||
| 690 | + } | ||
| 659 | Intent intentAds = new Intent(this.getApplicationContext(), SimpleAdsPlayer2.class); | 691 | Intent intentAds = new Intent(this.getApplicationContext(), SimpleAdsPlayer2.class); |
| 660 | intentAds.putExtra("ads_path", adsVideoPath); | 692 | intentAds.putExtra("ads_path", adsVideoPath); |
| 661 | intentAds | 693 | intentAds |
| @@ -228,7 +228,6 @@ public class SocketService1 extends BaseService { | @@ -228,7 +228,6 @@ public class SocketService1 extends BaseService { | ||
| 228 | LogUtils.i(TAG, "send msg:" + msg); | 228 | LogUtils.i(TAG, "send msg:" + msg); |
| 229 | } else { | 229 | } else { |
| 230 | if (heartBeatErrorCount.getAndIncrement() > 3) { | 230 | if (heartBeatErrorCount.getAndIncrement() > 3) { |
| 231 | -// if (heartBeatErrorCount.getAndDecrement() >= 0) { | ||
| 232 | LogUtils.i(TAG, "heartBeatErrorCount:" + heartBeatErrorCount.get()); | 231 | LogUtils.i(TAG, "heartBeatErrorCount:" + heartBeatErrorCount.get()); |
| 233 | clearConnect(); | 232 | clearConnect(); |
| 234 | return false; | 233 | return false; |
| @@ -10,6 +10,8 @@ public interface IRoomInfoModel { | @@ -10,6 +10,8 @@ public interface IRoomInfoModel { | ||
| 10 | 10 | ||
| 11 | void getRoomStatus(String roomSn, RoomInfoModelImpl.GetRoomStatusListener listener); | 11 | void getRoomStatus(String roomSn, RoomInfoModelImpl.GetRoomStatusListener listener); |
| 12 | 12 | ||
| 13 | + void getRoomNestOrderInfo(String orderSn, RoomInfoModelImpl.GetRoomStatusListener listener); | ||
| 14 | + | ||
| 13 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); | 15 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); |
| 14 | 16 | ||
| 15 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); | 17 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); |
| @@ -2,11 +2,11 @@ package com.xgimi.gimicinema.model; | @@ -2,11 +2,11 @@ package com.xgimi.gimicinema.model; | ||
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.text.TextUtils; | 4 | import android.text.TextUtils; |
| 5 | -import android.util.Log; | ||
| 6 | import com.gimi.common.cinema.model.RoomInfo; | 5 | import com.gimi.common.cinema.model.RoomInfo; |
| 7 | import com.gimi.common.cinema.model.RoomQrCodeInfo; | 6 | import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 8 | import com.gimi.common.cinema.model.RoomStatusInfo; | 7 | import com.gimi.common.cinema.model.RoomStatusInfo; |
| 9 | import com.gimi.common.cinema.model.WrongMsg; | 8 | import com.gimi.common.cinema.model.WrongMsg; |
| 9 | +import com.gimi.common.cinema.utils.LogUtils; | ||
| 10 | import com.gimi.common.cinema.utils.OkHttpClientManager; | 10 | import com.gimi.common.cinema.utils.OkHttpClientManager; |
| 11 | import com.gimi.common.cinema.utils.Utils; | 11 | import com.gimi.common.cinema.utils.Utils; |
| 12 | import com.google.gson.Gson; | 12 | import com.google.gson.Gson; |
| @@ -31,6 +31,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -31,6 +31,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 31 | private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | 31 | private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 32 | private static String ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | 32 | private static String ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; |
| 33 | private static String ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; | 33 | private static String ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; |
| 34 | + private static String ROOM_NEXT_STATUS_BY_ROOM_SN = roomUrl + "tcp/getRoomStatusByOrderSN?order_sn="; | ||
| 34 | 35 | ||
| 35 | public RoomInfoModelImpl() { | 36 | public RoomInfoModelImpl() { |
| 36 | Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); | 37 | Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); |
| @@ -51,6 +52,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -51,6 +52,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 51 | ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | 52 | ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 52 | ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | 53 | ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; |
| 53 | ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; | 54 | ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; |
| 55 | + ROOM_NEXT_STATUS_BY_ROOM_SN = roomUrl + "tcp/getRoomStatusByOrderSN?order_sn="; | ||
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | @Override | 58 | @Override |
| @@ -67,7 +69,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -67,7 +69,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 67 | } | 69 | } |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | - Log.d("room-info", "request:getRoomInfo,url = " + ROOM_INFO_BY_IMEI_URL + imei); | 72 | + LogUtils.i("room-info", "request:getRoomInfo,url = " + ROOM_INFO_BY_IMEI_URL + imei); |
| 71 | OkHttpClientManager.getAsyn(ROOM_INFO_BY_IMEI_URL + imei, | 73 | OkHttpClientManager.getAsyn(ROOM_INFO_BY_IMEI_URL + imei, |
| 72 | new OkHttpClientManager.ResultCallback<String>() { | 74 | new OkHttpClientManager.ResultCallback<String>() { |
| 73 | @Override | 75 | @Override |
| @@ -80,7 +82,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -80,7 +82,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 80 | @Override | 82 | @Override |
| 81 | public void onResponse(String response) { | 83 | public void onResponse(String response) { |
| 82 | RoomInfo roomInfo1 = null; | 84 | RoomInfo roomInfo1 = null; |
| 83 | - Log.d("room-info", "getRoomInfo" + response); | 85 | + LogUtils.i("room-info", "getRoomInfo" + response); |
| 84 | try { | 86 | try { |
| 85 | roomInfo1 = new Gson().fromJson(response, RoomInfo.class); | 87 | roomInfo1 = new Gson().fromJson(response, RoomInfo.class); |
| 86 | } catch (JsonSyntaxException e) { | 88 | } catch (JsonSyntaxException e) { |
| @@ -105,12 +107,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -105,12 +107,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 105 | @Override | 107 | @Override |
| 106 | public void doSomeThing() { | 108 | public void doSomeThing() { |
| 107 | long time = -1; | 109 | long time = -1; |
| 108 | - Log.d("room-info", "request:getRoomInfo,url = " + ROOM_INFO_BY_IMEI_URL + imei); | 110 | + LogUtils.i("room-info", "request:getRoomInfo,url = " + ROOM_INFO_BY_IMEI_URL + imei); |
| 109 | try { | 111 | try { |
| 110 | time = OkHttpClientManager.getSysTime(ROOM_INFO_BY_IMEI_URL + imei); | 112 | time = OkHttpClientManager.getSysTime(ROOM_INFO_BY_IMEI_URL + imei); |
| 111 | - } catch (IOException e) { | ||
| 112 | - e.printStackTrace(); | ||
| 113 | - } catch (ParseException e) { | 113 | + } catch (IOException | ParseException e) { |
| 114 | e.printStackTrace(); | 114 | e.printStackTrace(); |
| 115 | } | 115 | } |
| 116 | if (time != -1) { | 116 | if (time != -1) { |
| @@ -120,13 +120,11 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -120,13 +120,11 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | }); | 122 | }); |
| 123 | - | ||
| 124 | - | ||
| 125 | } | 123 | } |
| 126 | 124 | ||
| 127 | @Override | 125 | @Override |
| 128 | public void getRoomStatus(String roomSn, final GetRoomStatusListener listener) { | 126 | public void getRoomStatus(String roomSn, final GetRoomStatusListener listener) { |
| 129 | - Log.d("room-info", "request:getRoomStatus,url = " + ROOM_STATUS_BY_ROOM_SN_URL + roomSn); | 127 | + LogUtils.i("room-info", "request:getRoomStatus,url = " + ROOM_STATUS_BY_ROOM_SN_URL + roomSn); |
| 130 | OkHttpClientManager.getAsyn(ROOM_STATUS_BY_ROOM_SN_URL + roomSn, | 128 | OkHttpClientManager.getAsyn(ROOM_STATUS_BY_ROOM_SN_URL + roomSn, |
| 131 | new OkHttpClientManager.ResultCallback<String>() { | 129 | new OkHttpClientManager.ResultCallback<String>() { |
| 132 | @Override | 130 | @Override |
| @@ -139,8 +137,41 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -139,8 +137,41 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 139 | @Override | 137 | @Override |
| 140 | public void onResponse(String response) { | 138 | public void onResponse(String response) { |
| 141 | RoomStatusInfo roomInfo1 = null; | 139 | RoomStatusInfo roomInfo1 = null; |
| 142 | - Log.d("room-info", "getRoomStatus" + response); | 140 | + LogUtils.i("room-info", "getRoomStatus" + response); |
| 141 | + | ||
| 142 | + try { | ||
| 143 | + roomInfo1 = new Gson().fromJson(response, RoomStatusInfo.class); | ||
| 144 | + } catch (JsonSyntaxException e) { | ||
| 145 | + e.printStackTrace(); | ||
| 146 | + } | ||
| 147 | + if (roomInfo1 != null) { | ||
| 148 | + listener.onGetRoomStatusSuccess(roomInfo1); | ||
| 149 | + } else { | ||
| 150 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 151 | + wrongMsg.setMsg(response); | ||
| 152 | + listener.onGetRoomStatusFailure(wrongMsg); | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + }); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + @Override | ||
| 160 | + public void getRoomNestOrderInfo(String orderSn, final GetRoomStatusListener listener) { | ||
| 161 | + LogUtils.i("room-info", ROOM_NEXT_STATUS_BY_ROOM_SN + orderSn); | ||
| 162 | + OkHttpClientManager.getAsyn(ROOM_NEXT_STATUS_BY_ROOM_SN + orderSn, | ||
| 163 | + new OkHttpClientManager.ResultCallback<String>() { | ||
| 164 | + @Override | ||
| 165 | + public void onError(Request request, Exception e) { | ||
| 166 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 167 | + wrongMsg.setMsg(e.getMessage()); | ||
| 168 | + listener.onGetRoomStatusFailure(wrongMsg); | ||
| 169 | + } | ||
| 143 | 170 | ||
| 171 | + @Override | ||
| 172 | + public void onResponse(String response) { | ||
| 173 | + RoomStatusInfo roomInfo1 = null; | ||
| 174 | + LogUtils.i("room-info", "getRoomStatus" + response); | ||
| 144 | try { | 175 | try { |
| 145 | roomInfo1 = new Gson().fromJson(response, RoomStatusInfo.class); | 176 | roomInfo1 = new Gson().fromJson(response, RoomStatusInfo.class); |
| 146 | } catch (JsonSyntaxException e) { | 177 | } catch (JsonSyntaxException e) { |
| @@ -159,7 +190,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -159,7 +190,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 159 | 190 | ||
| 160 | @Override | 191 | @Override |
| 161 | public void getRoomQrCode(String orderSn, String roomSn, final GetRoomQrCodeListener listener) { | 192 | public void getRoomQrCode(String orderSn, String roomSn, final GetRoomQrCodeListener listener) { |
| 162 | - Log.d("room-info", "request:getRoomQrCode,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn + "&room_sn=" + roomSn); | 193 | + LogUtils.i("room-info", "request:getRoomQrCode,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn + "&room_sn=" + roomSn); |
| 163 | OkHttpClientManager.getAsyn(ROOM_QRCODE_BY_ORDER_SN + orderSn + "&room_sn=" + roomSn, | 194 | OkHttpClientManager.getAsyn(ROOM_QRCODE_BY_ORDER_SN + orderSn + "&room_sn=" + roomSn, |
| 164 | new OkHttpClientManager.ResultCallback<String>() { | 195 | new OkHttpClientManager.ResultCallback<String>() { |
| 165 | @Override | 196 | @Override |
| @@ -171,7 +202,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -171,7 +202,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 171 | 202 | ||
| 172 | @Override | 203 | @Override |
| 173 | public void onResponse(String response) { | 204 | public void onResponse(String response) { |
| 174 | - Log.d("room-info", "getRoomQrCode:" + response); | 205 | + LogUtils.i("room-info", "getRoomQrCode:" + response); |
| 175 | 206 | ||
| 176 | RoomQrCodeInfo roomInfo1 = null; | 207 | RoomQrCodeInfo roomInfo1 = null; |
| 177 | try { | 208 | try { |
| @@ -193,18 +224,18 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -193,18 +224,18 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 193 | 224 | ||
| 194 | @Override | 225 | @Override |
| 195 | public void reportOpenDoorStatus(String orderSn, final OpenDoorStatusListener listener) { | 226 | public void reportOpenDoorStatus(String orderSn, final OpenDoorStatusListener listener) { |
| 196 | - Log.d("room-info", "request:reportOpenDoorStatus,url = " + ROOM_REPORT_ROOM_STATUS + orderSn); | 227 | + LogUtils.i("room-info", "request:reportOpenDoorStatus,url = " + ROOM_REPORT_ROOM_STATUS + orderSn); |
| 197 | OkHttpClientManager.getAsyn(ROOM_REPORT_ROOM_STATUS + orderSn, | 228 | OkHttpClientManager.getAsyn(ROOM_REPORT_ROOM_STATUS + orderSn, |
| 198 | new OkHttpClientManager.ResultCallback<String>() { | 229 | new OkHttpClientManager.ResultCallback<String>() { |
| 199 | @Override | 230 | @Override |
| 200 | public void onError(Request request, Exception e) { | 231 | public void onError(Request request, Exception e) { |
| 201 | - Log.d("room-info", request.toString() + "," + e.getMessage()); | 232 | + LogUtils.i("room-info", request.toString() + "," + e.getMessage()); |
| 202 | listener.onOpenDoorFailure(); | 233 | listener.onOpenDoorFailure(); |
| 203 | } | 234 | } |
| 204 | 235 | ||
| 205 | @Override | 236 | @Override |
| 206 | public void onResponse(String response) { | 237 | public void onResponse(String response) { |
| 207 | - Log.d("room-info", "reportOpenDoorStatus:" + response); | 238 | + LogUtils.i("room-info", "reportOpenDoorStatus:" + response); |
| 208 | listener.onOpenDoorSuccess(); | 239 | listener.onOpenDoorSuccess(); |
| 209 | } | 240 | } |
| 210 | }); | 241 | }); |
| @@ -212,18 +243,18 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -212,18 +243,18 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 212 | 243 | ||
| 213 | @Override | 244 | @Override |
| 214 | public void reportSleepSysStatus(String orderSn, String roomSn, final SleepSysStatusListener listener) { | 245 | public void reportSleepSysStatus(String orderSn, String roomSn, final SleepSysStatusListener listener) { |
| 215 | - Log.d("room-info", "request:reportSleepSysStatus,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn); | 246 | + LogUtils.i("room-info", "request:reportSleepSysStatus,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn); |
| 216 | OkHttpClientManager.getAsyn(ROOM_REPORT_SLEEP_STATUS + orderSn + "&room_sn=" + roomSn, | 247 | OkHttpClientManager.getAsyn(ROOM_REPORT_SLEEP_STATUS + orderSn + "&room_sn=" + roomSn, |
| 217 | new OkHttpClientManager.ResultCallback<String>() { | 248 | new OkHttpClientManager.ResultCallback<String>() { |
| 218 | @Override | 249 | @Override |
| 219 | public void onError(Request request, Exception e) { | 250 | public void onError(Request request, Exception e) { |
| 220 | - Log.d("room-info", request.toString() + "," + e.getMessage()); | 251 | + LogUtils.i("room-info", request.toString() + "," + e.getMessage()); |
| 221 | listener.onSleepSuccess(); | 252 | listener.onSleepSuccess(); |
| 222 | } | 253 | } |
| 223 | 254 | ||
| 224 | @Override | 255 | @Override |
| 225 | public void onResponse(String response) { | 256 | public void onResponse(String response) { |
| 226 | - Log.d("room-info", "reportSleepSysStatus:" + response); | 257 | + LogUtils.i("room-info", "reportSleepSysStatus:" + response); |
| 227 | listener.onSleepFailure(); | 258 | listener.onSleepFailure(); |
| 228 | } | 259 | } |
| 229 | }); | 260 | }); |
| @@ -19,10 +19,15 @@ package com.xgimi.gimicinema.service; | @@ -19,10 +19,15 @@ package com.xgimi.gimicinema.service; | ||
| 19 | import android.app.Service; | 19 | import android.app.Service; |
| 20 | import android.content.Intent; | 20 | import android.content.Intent; |
| 21 | import android.os.IBinder; | 21 | import android.os.IBinder; |
| 22 | +import android.text.TextUtils; | ||
| 22 | import android.util.Log; | 23 | import android.util.Log; |
| 23 | import com.gimi.common.cinema.model.Constant; | 24 | import com.gimi.common.cinema.model.Constant; |
| 24 | import com.gimi.common.cinema.model.MessageEvent; | 25 | import com.gimi.common.cinema.model.MessageEvent; |
| 26 | +import com.gimi.common.cinema.utils.CToast; | ||
| 25 | import com.gimi.common.cinema.utils.LogUtils; | 27 | import com.gimi.common.cinema.utils.LogUtils; |
| 28 | +import com.gimi.common.cinema.utils.ResUtils; | ||
| 29 | +import com.xgimi.gimicinema.R; | ||
| 30 | +import com.xgimi.gimicinema.application.FangTangApplication; | ||
| 26 | import org.greenrobot.eventbus.EventBus; | 31 | import org.greenrobot.eventbus.EventBus; |
| 27 | 32 | ||
| 28 | import static com.gimi.common.cinema.model.Constant.count; | 33 | import static com.gimi.common.cinema.model.Constant.count; |
| @@ -45,6 +50,16 @@ public class CountService extends Service { | @@ -45,6 +50,16 @@ public class CountService extends Service { | ||
| 45 | LogUtils.d(TAG, "count is :" + count); | 50 | LogUtils.d(TAG, "count is :" + count); |
| 46 | if (Constant.count > 0) { | 51 | if (Constant.count > 0) { |
| 47 | Log.d(TAG, "if"); | 52 | Log.d(TAG, "if"); |
| 53 | + if (Constant.count == 5) { | ||
| 54 | + String showMsg = ResUtils.getResResult(this, R.string.ads_promote, R.string.welcome_again); | ||
| 55 | + CToast.makeText(this, showMsg, 30 * 1000).show(); | ||
| 56 | + } | ||
| 57 | + if (Constant.count == 10) { | ||
| 58 | + if (!TextUtils.isEmpty(((FangTangApplication) getApplicationContext()).getCurrentPlayUrl())) { | ||
| 59 | + String showMsg = ResUtils.getResResult(this, R.string.ads_promote, R.string.time_ends_ten_min); | ||
| 60 | + CToast.makeText(this, showMsg, 30 * 1000).show(); | ||
| 61 | + } | ||
| 62 | + } | ||
| 48 | new CountDownThread().start(); | 63 | new CountDownThread().start(); |
| 49 | } else { | 64 | } else { |
| 50 | Log.d(TAG, "else"); | 65 | Log.d(TAG, "else"); |
| @@ -106,11 +106,13 @@ | @@ -106,11 +106,13 @@ | ||
| 106 | <string name="pre_ads_times">映前广告次数</string> | 106 | <string name="pre_ads_times">映前广告次数</string> |
| 107 | <string name="set_sm_light">设置智能灯光</string> | 107 | <string name="set_sm_light">设置智能灯光</string> |
| 108 | 108 | ||
| 109 | + <string name="welcome">欢迎您的光临。</string> | ||
| 109 | <string name="ads_promote">青柠影咖,年轻人的奇幻乐园。</string> | 110 | <string name="ads_promote">青柠影咖,年轻人的奇幻乐园。</string> |
| 110 | - <string name="delay_time">您已迟到%d分钟,</string> | ||
| 111 | - <string name="play_movie">即将为你播放%s</string> | 111 | + <string name="delay_time_fill_time">您已迟到%d分钟,</string> |
| 112 | + <string name="play_movie_fill_name">即将为你播放%s</string> | ||
| 112 | <string name="end_ads">本场电影已结束,请观看《青柠电影先锋》</string> | 113 | <string name="end_ads">本场电影已结束,请观看《青柠电影先锋》</string> |
| 113 | <string name="welcome_again">离场时请携带好随身物品,欢迎下次光临。</string> | 114 | <string name="welcome_again">离场时请携带好随身物品,欢迎下次光临。</string> |
| 114 | - <string name="play_next">本场电影已结束,将于广告后为您播放下一部影片%s</string> | 115 | + <string name="play_next_fill_name">本场电影已结束,即将为您播放下一部影片</string> |
| 116 | + <string name="time_ends_ten_min">距观景时间结束还有10分钟。</string> | ||
| 115 | 117 | ||
| 116 | </resources> | 118 | </resources> |
Please
register
or
login
to post a comment