Showing
19 changed files
with
523 additions
and
130 deletions
| @@ -19,6 +19,9 @@ | @@ -19,6 +19,9 @@ | ||
| 19 | tools:ignore="ProtectedPermissions"/> | 19 | tools:ignore="ProtectedPermissions"/> |
| 20 | <uses-permission android:name="android.permission.READ_PHONE_STATE"/> | 20 | <uses-permission android:name="android.permission.READ_PHONE_STATE"/> |
| 21 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | 21 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
| 22 | + <action android:name="android.intent.action.PACKAGE_ADDED"/> | ||
| 23 | + <action android:name="android.intent.action.PACKAGE_REMOVED"/> | ||
| 24 | + <action android:name="android.intent.action.PACKAGE_REPLACED"/> | ||
| 22 | 25 | ||
| 23 | <!-- | 26 | <!-- |
| 24 | windows not support lable replace by gradle,just replace by string values | 27 | windows not support lable replace by gradle,just replace by string values |
| @@ -85,6 +88,28 @@ | @@ -85,6 +88,28 @@ | ||
| 85 | <action android:name="android.intent.action.BOOT_COMPLETED"/> | 88 | <action android:name="android.intent.action.BOOT_COMPLETED"/> |
| 86 | </intent-filter> | 89 | </intent-filter> |
| 87 | </receiver> | 90 | </receiver> |
| 91 | + <receiver android:enabled="true" android:exported="true" android:name=".receiver.AppInstalledReceiver"> | ||
| 92 | + <intent-filter> | ||
| 93 | + <action android:name="android.intent.action.BOOT_COMPLETED"/> | ||
| 94 | + <data android:scheme="package"/> | ||
| 95 | + </intent-filter> | ||
| 96 | + <intent-filter> | ||
| 97 | + <action android:name="android.intent.action.PACKAGE_ADDED"/> | ||
| 98 | + <data android:scheme="package"/> | ||
| 99 | + </intent-filter> | ||
| 100 | + <intent-filter> | ||
| 101 | + <action android:name="android.intent.action.PACKAGE_INSTALL"/> | ||
| 102 | + <data android:scheme="package"/> | ||
| 103 | + </intent-filter> | ||
| 104 | + <intent-filter> | ||
| 105 | + <action android:name="android.intent.action.PACKAGE_CHANGED"/> | ||
| 106 | + <data android:scheme="package"/> | ||
| 107 | + </intent-filter> | ||
| 108 | + <intent-filter> | ||
| 109 | + <action android:name="android.intent.action.PACKAGE_REPLACED"/> | ||
| 110 | + <data android:scheme="package"/> | ||
| 111 | + </intent-filter> | ||
| 112 | + </receiver> | ||
| 88 | <receiver android:name=".service.MovieCompleteReceiver"> | 113 | <receiver android:name=".service.MovieCompleteReceiver"> |
| 89 | <intent-filter> | 114 | <intent-filter> |
| 90 | <action android:name="com.xgimi.gimicinema.get_data.movie_complete"/> | 115 | <action android:name="com.xgimi.gimicinema.get_data.movie_complete"/> |
| @@ -173,6 +173,7 @@ public class OkHttpClientManager { | @@ -173,6 +173,7 @@ public class OkHttpClientManager { | ||
| 173 | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 173 | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| 174 | Date parse = new Date(date); | 174 | Date parse = new Date(date); |
| 175 | return parse.getTime() / 1000; | 175 | return parse.getTime() / 1000; |
| 176 | + | ||
| 176 | } | 177 | } |
| 177 | 178 | ||
| 178 | 179 |
| @@ -40,6 +40,10 @@ public interface SmartControlContract { | @@ -40,6 +40,10 @@ public interface SmartControlContract { | ||
| 40 | void updateOrderInfo(RoomStatusInfo oderInfo); | 40 | void updateOrderInfo(RoomStatusInfo oderInfo); |
| 41 | 41 | ||
| 42 | void prepareRoomQrCodeInfo(RoomQrCodeInfo qrCodeInfo); | 42 | void prepareRoomQrCodeInfo(RoomQrCodeInfo qrCodeInfo); |
| 43 | + | ||
| 44 | + void updateInitGetOrderInfo(boolean b); | ||
| 45 | + | ||
| 46 | + void setOpenDoorTime(int i); | ||
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | interface Presenter extends BasePresenter { | 49 | interface Presenter extends BasePresenter { |
| @@ -51,5 +55,7 @@ public interface SmartControlContract { | @@ -51,5 +55,7 @@ public interface SmartControlContract { | ||
| 51 | void reportOpenDoorStatus(String oderSn); | 55 | void reportOpenDoorStatus(String oderSn); |
| 52 | 56 | ||
| 53 | void getCleanQrCode(String orderSn, String roomSn); | 57 | void getCleanQrCode(String orderSn, String roomSn); |
| 58 | + | ||
| 59 | + void getSysTime(Context context); | ||
| 54 | } | 60 | } |
| 55 | } | 61 | } |
| @@ -14,6 +14,8 @@ import com.xgimi.gimicinema.application.FangTangApplication; | @@ -14,6 +14,8 @@ import com.xgimi.gimicinema.application.FangTangApplication; | ||
| 14 | import com.xgimi.gimicinema.model.IRoomInfoModel; | 14 | import com.xgimi.gimicinema.model.IRoomInfoModel; |
| 15 | import com.xgimi.gimicinema.model.RoomInfoModelImpl; | 15 | import com.xgimi.gimicinema.model.RoomInfoModelImpl; |
| 16 | 16 | ||
| 17 | +import java.util.Calendar; | ||
| 18 | + | ||
| 17 | /** | 19 | /** |
| 18 | * Created by zyh on 2017/5/19 | 20 | * Created by zyh on 2017/5/19 |
| 19 | */ | 21 | */ |
| @@ -96,11 +98,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | @@ -96,11 +98,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | ||
| 96 | public void onGetRoomStatusSuccess(RoomStatusInfo info) { | 98 | public void onGetRoomStatusSuccess(RoomStatusInfo info) { |
| 97 | Log.d("room-info", "getOrderInfo#onGetRoomStatusSuccess:" + info.toString()); | 99 | Log.d("room-info", "getOrderInfo#onGetRoomStatusSuccess:" + info.toString()); |
| 98 | mainView.updateOrderInfo(info); | 100 | mainView.updateOrderInfo(info); |
| 101 | + mainView.updateInitGetOrderInfo(false); | ||
| 99 | } | 102 | } |
| 100 | 103 | ||
| 101 | @Override | 104 | @Override |
| 102 | public void onGetRoomStatusFailure(WrongMsg wrongMsg) { | 105 | public void onGetRoomStatusFailure(WrongMsg wrongMsg) { |
| 103 | Log.d("room-info", "onGetRoomStatusFailure :" + wrongMsg.toString()); | 106 | Log.d("room-info", "onGetRoomStatusFailure :" + wrongMsg.toString()); |
| 107 | + mainView.updateInitGetOrderInfo(false); | ||
| 104 | } | 108 | } |
| 105 | }); | 109 | }); |
| 106 | } | 110 | } |
| @@ -149,4 +153,36 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | @@ -149,4 +153,36 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { | ||
| 149 | } | 153 | } |
| 150 | }); | 154 | }); |
| 151 | } | 155 | } |
| 156 | + | ||
| 157 | + @Override | ||
| 158 | + public void getSysTime(Context context) { | ||
| 159 | + String imei = SystemUtils.getPid(context, BuildConfig.BUILD_TYPE); | ||
| 160 | + roomInfoModel.getRoomSysTime(imei, new RoomInfoModelImpl.GetServerTimeListener() { | ||
| 161 | + @Override | ||
| 162 | + public void onGetTimeSuccess(long time) { | ||
| 163 | + Calendar instance = Calendar.getInstance(); | ||
| 164 | + instance.setTimeInMillis(time * 1000); | ||
| 165 | + int hour = instance.get(Calendar.HOUR_OF_DAY); | ||
| 166 | + int minute = instance.get(Calendar.MINUTE); | ||
| 167 | + Log.d("getSysTime", "current minute:" + (hour * 60 + minute) + ""); | ||
| 168 | + mainView.setOpenDoorTime(hour * 60 + minute); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public void onGetTimeFailure(WrongMsg wrongMsg) { | ||
| 173 | + Log.d("getSysTime", calServerTimeMin() + ""); | ||
| 174 | + mainView.setOpenDoorTime(calServerTimeMin()); | ||
| 175 | + | ||
| 176 | + } | ||
| 177 | + }); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + private int calServerTimeMin() { | ||
| 181 | + Calendar cal = Calendar.getInstance(); | ||
| 182 | + int hour = cal.get(Calendar.HOUR_OF_DAY);//小时 | ||
| 183 | + int minute = cal.get(Calendar.MINUTE);//分 | ||
| 184 | + int serverTimeMin = (hour * 60 + minute); | ||
| 185 | + Log.d("room-info", "current minute:" + (hour * 60 + minute) + ""); | ||
| 186 | + return serverTimeMin; | ||
| 187 | + } | ||
| 152 | } | 188 | } |
| @@ -6,6 +6,7 @@ import android.content.ComponentName; | @@ -6,6 +6,7 @@ import android.content.ComponentName; | ||
| 6 | import android.content.Context; | 6 | import android.content.Context; |
| 7 | import android.content.Intent; | 7 | import android.content.Intent; |
| 8 | import android.content.IntentFilter; | 8 | import android.content.IntentFilter; |
| 9 | +import android.content.SharedPreferences; | ||
| 9 | import android.content.pm.PackageManager; | 10 | import android.content.pm.PackageManager; |
| 10 | import android.os.Handler; | 11 | import android.os.Handler; |
| 11 | import android.os.IBinder; | 12 | import android.os.IBinder; |
| @@ -23,8 +24,14 @@ import com.gimi.common.cinema.model.MessageEvent; | @@ -23,8 +24,14 @@ import com.gimi.common.cinema.model.MessageEvent; | ||
| 23 | import com.gimi.common.cinema.model.RoomInfo; | 24 | import com.gimi.common.cinema.model.RoomInfo; |
| 24 | import com.gimi.common.cinema.model.RoomQrCodeInfo; | 25 | import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 25 | import com.gimi.common.cinema.model.RoomStatusInfo; | 26 | import com.gimi.common.cinema.model.RoomStatusInfo; |
| 27 | +import com.gimi.common.cinema.model.SambaMsg; | ||
| 28 | +import com.gimi.common.cinema.utils.ActivityCollector; | ||
| 26 | import com.gimi.common.cinema.utils.CToast; | 29 | import com.gimi.common.cinema.utils.CToast; |
| 27 | import com.gimi.common.cinema.utils.OpenMMUtils; | 30 | import com.gimi.common.cinema.utils.OpenMMUtils; |
| 31 | +import com.gimi.common.cinema.utils.SambaFileCharge; | ||
| 32 | +import com.gimi.common.cinema.utils.Utils; | ||
| 33 | +import com.google.gson.Gson; | ||
| 34 | +import com.google.gson.JsonSyntaxException; | ||
| 28 | import com.qnbar.smc.model.Light; | 35 | import com.qnbar.smc.model.Light; |
| 29 | import com.qnbar.smc.model.Lights; | 36 | import com.qnbar.smc.model.Lights; |
| 30 | import com.telink.bluetooth.LeBluetooth; | 37 | import com.telink.bluetooth.LeBluetooth; |
| @@ -43,7 +50,9 @@ import com.telink.bluetooth.light.Parameters; | @@ -43,7 +50,9 @@ import com.telink.bluetooth.light.Parameters; | ||
| 43 | import com.telink.bluetooth.light.model.Mesh; | 50 | import com.telink.bluetooth.light.model.Mesh; |
| 44 | import com.telink.util.Event; | 51 | import com.telink.util.Event; |
| 45 | import com.telink.util.EventListener; | 52 | import com.telink.util.EventListener; |
| 53 | +import com.xgimi.gimicinema.activity.AdsPreVideoPlayerActivity; | ||
| 46 | import com.xgimi.gimicinema.activity.QrCodeShowActivity; | 54 | import com.xgimi.gimicinema.activity.QrCodeShowActivity; |
| 55 | +import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; | ||
| 47 | import com.xgimi.gimicinema.application.FangTangApplication; | 56 | import com.xgimi.gimicinema.application.FangTangApplication; |
| 48 | import com.xgimi.gimicinema.poll.PollingUtils; | 57 | import com.xgimi.gimicinema.poll.PollingUtils; |
| 49 | import com.xgimi.gimicinema.service.CountService; | 58 | import com.xgimi.gimicinema.service.CountService; |
| @@ -56,6 +65,8 @@ import java.util.List; | @@ -56,6 +65,8 @@ import java.util.List; | ||
| 56 | public class SmartControlService extends BaseService implements EventListener<String>, SmartControlContract.View { | 65 | public class SmartControlService extends BaseService implements EventListener<String>, SmartControlContract.View { |
| 57 | public static final String TAG = "SmartControlService"; | 66 | public static final String TAG = "SmartControlService"; |
| 58 | 67 | ||
| 68 | + public static final int ORDER_PLAY_COMPLETE = 0x1101; | ||
| 69 | + | ||
| 59 | private boolean hasSystemFeatureBluetoothLe = true; | 70 | private boolean hasSystemFeatureBluetoothLe = true; |
| 60 | private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver(); | 71 | private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver(); |
| 61 | private SmartControlContract.Presenter presenter; | 72 | private SmartControlContract.Presenter presenter; |
| @@ -63,10 +74,12 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -63,10 +74,12 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 63 | private RoomStatusInfo roomStatusInfo; | 74 | private RoomStatusInfo roomStatusInfo; |
| 64 | private RoomInfo roomInfo; | 75 | private RoomInfo roomInfo; |
| 65 | private RoomQrCodeInfo info; | 76 | private RoomQrCodeInfo info; |
| 66 | - | ||
| 67 | private String lockMac = "CA:EC:56:60:CA:79"; | 77 | private String lockMac = "CA:EC:56:60:CA:79"; |
| 68 | private boolean needReport = false; | 78 | private boolean needReport = false; |
| 69 | //___________________________________________ | 79 | //___________________________________________ |
| 80 | + private boolean initGetOderInfo; | ||
| 81 | + private RoomStatusInfo lastCompleteRoomStatusInfo; | ||
| 82 | + private int openDoorServerTime = 0; | ||
| 70 | 83 | ||
| 71 | private void initLock() { | 84 | private void initLock() { |
| 72 | // 检查当前手机是否支持ble 蓝牙,如果不支持退出程序 | 85 | // 检查当前手机是否支持ble 蓝牙,如果不支持退出程序 |
| @@ -78,6 +91,7 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -78,6 +91,7 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 78 | } | 91 | } |
| 79 | } | 92 | } |
| 80 | 93 | ||
| 94 | + | ||
| 81 | @Override | 95 | @Override |
| 82 | public void onCreate() { | 96 | public void onCreate() { |
| 83 | super.onCreate(); | 97 | super.onCreate(); |
| @@ -111,6 +125,7 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -111,6 +125,7 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 111 | if (!LeBluetooth.getInstance().isEnabled()) { | 125 | if (!LeBluetooth.getInstance().isEnabled()) { |
| 112 | LeBluetooth.getInstance().enable(getApplicationContext()); | 126 | LeBluetooth.getInstance().enable(getApplicationContext()); |
| 113 | } | 127 | } |
| 128 | + updateLastCompleteMovieInfo(); | ||
| 114 | 129 | ||
| 115 | // 监听各种事件 | 130 | // 监听各种事件 |
| 116 | mApplication.addEventListener(DeviceEvent.STATUS_CHANGED, this); | 131 | mApplication.addEventListener(DeviceEvent.STATUS_CHANGED, this); |
| @@ -125,9 +140,19 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -125,9 +140,19 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 125 | } | 140 | } |
| 126 | }, 3 * 1000); | 141 | }, 3 * 1000); |
| 127 | presenter.updateRoomInfo(this); | 142 | presenter.updateRoomInfo(this); |
| 143 | +// presenter.getOrderInfo(this); | ||
| 128 | return START_STICKY; | 144 | return START_STICKY; |
| 129 | } | 145 | } |
| 130 | 146 | ||
| 147 | + private void updateLastCompleteMovieInfo() { | ||
| 148 | + try { | ||
| 149 | + lastCompleteRoomStatusInfo = new Gson().fromJson(Utils.getString(this, "oder-play-completed"), RoomStatusInfo.class); | ||
| 150 | + } catch (JsonSyntaxException e) { | ||
| 151 | + e.printStackTrace(); | ||
| 152 | + } | ||
| 153 | + Log.d("room-info", "lastCompleteRoomStatusInfo null:" + (lastCompleteRoomStatusInfo == null)); | ||
| 154 | + } | ||
| 155 | + | ||
| 131 | @Override | 156 | @Override |
| 132 | public void onDestroy() { | 157 | public void onDestroy() { |
| 133 | Log.d("room-info", "SmartControlService onDestroy"); | 158 | Log.d("room-info", "SmartControlService onDestroy"); |
| @@ -173,6 +198,8 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -173,6 +198,8 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 173 | }; | 198 | }; |
| 174 | 199 | ||
| 175 | private void openDoor() { | 200 | private void openDoor() { |
| 201 | + updateLastCompleteMovieInfo(); | ||
| 202 | + presenter.getSysTime(this); | ||
| 176 | Log.d("room-info", "openDoor called"); | 203 | Log.d("room-info", "openDoor called"); |
| 177 | bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() { | 204 | bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() { |
| 178 | @Override | 205 | @Override |
| @@ -202,8 +229,39 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -202,8 +229,39 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 202 | public void onMoonEvent(MessageEvent messageEvent) { | 229 | public void onMoonEvent(MessageEvent messageEvent) { |
| 203 | switch (messageEvent.getEventId()) { | 230 | switch (messageEvent.getEventId()) { |
| 204 | case SocketService.JUST_OPEN_DOOR: | 231 | case SocketService.JUST_OPEN_DOOR: |
| 232 | + //check qr code is showing | ||
| 205 | openDoor(); | 233 | openDoor(); |
| 234 | + if (ActivityCollector.isActivityExist(QrCodeShowActivity.class) | ||
| 235 | + || ActivityCollector.isActivityExist(SimpleAdsPlayer2.class) | ||
| 236 | + || !TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) { | ||
| 237 | + break; | ||
| 238 | + } | ||
| 206 | Log.d("event bus", "open door" + messageEvent.getMessage()); | 239 | Log.d("event bus", "open door" + messageEvent.getMessage()); |
| 240 | + //异常2清理时段管理扫码进入,没有显示清洁码 | ||
| 241 | + if (messageEvent.getMessage().startsWith("administrator")) { | ||
| 242 | + if (roomStatusInfo != null) { | ||
| 243 | + int spaceTime = openDoorServerTime - roomStatusInfo.getData().getEnd_time(); | ||
| 244 | + if (spaceTime < 20 && spaceTime > 0) { | ||
| 245 | + if (!ActivityCollector.isActivityExist(QrCodeShowActivity.class)) { | ||
| 246 | + Intent intent = new Intent(this, QrCodeShowActivity.class) | ||
| 247 | + .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | ||
| 248 | + .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); | ||
| 249 | + if ("count_service".equals(countMsg)) { | ||
| 250 | + intent.putExtra("count_call", true); | ||
| 251 | + } | ||
| 252 | + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 253 | + startActivity(intent); | ||
| 254 | + break; | ||
| 255 | + } | ||
| 256 | + //异常3 观景时段内 没有放电影 | ||
| 257 | + if (roomStatusInfo.getData().getEnd_time() > openDoorServerTime | ||
| 258 | + && openDoorServerTime > roomStatusInfo.getData().getBegin_time() | ||
| 259 | + && TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) { | ||
| 260 | + presenter.getOrderInfo(this); | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + } | ||
| 207 | break; | 265 | break; |
| 208 | case SocketService.USER_OPEN_DOOR_AND_GET_MOVIE: | 266 | case SocketService.USER_OPEN_DOOR_AND_GET_MOVIE: |
| 209 | needReport = true; | 267 | needReport = true; |
| @@ -217,6 +275,11 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -217,6 +275,11 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 217 | // if (rightSn) { | 275 | // if (rightSn) { |
| 218 | // down(); | 276 | // down(); |
| 219 | // } | 277 | // } |
| 278 | + //用户时段已在播放映后广告,不再获取订单信息 | ||
| 279 | + if (ActivityCollector.isActivityExist(SimpleAdsPlayer2.class) | ||
| 280 | + || ActivityCollector.isActivityExist(AdsPreVideoPlayerActivity.class)) { | ||
| 281 | + break; | ||
| 282 | + } | ||
| 220 | //check the movie | 283 | //check the movie |
| 221 | if (TextUtils.isEmpty(mApplication.getCurrentPlayUrl())) { | 284 | if (TextUtils.isEmpty(mApplication.getCurrentPlayUrl())) { |
| 222 | presenter.getOrderInfo(this); | 285 | presenter.getOrderInfo(this); |
| @@ -251,19 +314,41 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -251,19 +314,41 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 251 | } catch (Exception e) { | 314 | } catch (Exception e) { |
| 252 | e.printStackTrace(); | 315 | e.printStackTrace(); |
| 253 | } | 316 | } |
| 254 | - if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { | ||
| 255 | - if (System.currentTimeMillis() - lastRequest > 3000) { | ||
| 256 | - lastRequest = System.currentTimeMillis(); | ||
| 257 | - countMsg = messageEvent.getMessage(); | ||
| 258 | - presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn()); | ||
| 259 | - } | ||
| 260 | - } else { | ||
| 261 | - String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) + | ||
| 262 | - ",roomInfo is Null:" + (roomInfo == null); | ||
| 263 | - Log.d("room-info", msg); | ||
| 264 | - Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | 317 | + if (ActivityCollector.isActivityExist(SimpleAdsPlayer2.class)) { |
| 318 | + ActivityCollector.getActivity(SimpleAdsPlayer2.class).finish(); | ||
| 319 | + } | ||
| 320 | +// cc | ||
| 321 | + Intent intent = new Intent(this, QrCodeShowActivity.class) | ||
| 322 | +// .putExtra("qr", info.getData().getCode()) | ||
| 323 | + .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | ||
| 324 | + .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); | ||
| 325 | + if ("count_service".equals(countMsg)) { | ||
| 326 | + intent.putExtra("count_call", true); | ||
| 265 | } | 327 | } |
| 328 | + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 329 | + startActivity(intent); | ||
| 330 | + roomStatusInfo = null; | ||
| 331 | + Log.d("room-info", "into clean activity clear oder info"); | ||
| 332 | +// if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { | ||
| 333 | +// if (System.currentTimeMillis() - lastRequest > 3000) { | ||
| 334 | +// lastRequest = System.currentTimeMillis(); | ||
| 335 | +// countMsg = messageEvent.getMessage(); | ||
| 336 | +// presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn()); | ||
| 337 | +// } | ||
| 338 | +// } else { | ||
| 339 | +// String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) + | ||
| 340 | +// ",roomInfo is Null:" + (roomInfo == null); | ||
| 341 | +// Log.d("room-info", msg); | ||
| 342 | +// Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); | ||
| 343 | +// } | ||
| 266 | break; | 344 | break; |
| 345 | + case ORDER_PLAY_COMPLETE: | ||
| 346 | + Log.d("room-info", messageEvent.getMessage()); | ||
| 347 | + Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo)); | ||
| 348 | + playEndAds(); | ||
| 349 | + break; | ||
| 350 | + default: | ||
| 351 | + Log.d("room-info", messageEvent.getMessage()); | ||
| 267 | } | 352 | } |
| 268 | } | 353 | } |
| 269 | 354 | ||
| @@ -485,7 +570,6 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -485,7 +570,6 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 485 | public void updateOrderInfo(RoomStatusInfo orderInfo) { | 570 | public void updateOrderInfo(RoomStatusInfo orderInfo) { |
| 486 | this.roomStatusInfo = orderInfo; | 571 | this.roomStatusInfo = orderInfo; |
| 487 | Log.d("room-info", "update order info"); | 572 | Log.d("room-info", "update order info"); |
| 488 | - roomStatusInfo = orderInfo; | ||
| 489 | RoomStatusInfo.DataEntity data = orderInfo.getData(); | 573 | RoomStatusInfo.DataEntity data = orderInfo.getData(); |
| 490 | int offset = data.getNow_time() - data.getBegin_time(); | 574 | int offset = data.getNow_time() - data.getBegin_time(); |
| 491 | if (offset > 3) { | 575 | if (offset > 3) { |
| @@ -499,18 +583,34 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -499,18 +583,34 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 499 | Constant.count = durationMinutes + 1; | 583 | Constant.count = durationMinutes + 1; |
| 500 | PollingUtils.startPollingService(this, 60, CountService.class, CountService.STATUS_ACTION); | 584 | PollingUtils.startPollingService(this, 60, CountService.class, CountService.STATUS_ACTION); |
| 501 | 585 | ||
| 586 | + //异常1,若在观影时间内,非正常关闭,扫描更新订单后播放广告,显示清洁码 | ||
| 587 | + if (lastCompleteRoomStatusInfo != null) { | ||
| 588 | + if (lastCompleteRoomStatusInfo.getData().getOrder_sn().equals(roomStatusInfo.getData().getOrder_sn())) { | ||
| 589 | + if (openDoorServerTime > roomStatusInfo.getData().getBegin_time() && openDoorServerTime < roomStatusInfo.getData().getEnd_time()) { | ||
| 590 | + playEndAds(); | ||
| 591 | + | ||
| 592 | + } | ||
| 593 | + return; | ||
| 594 | + } | ||
| 595 | + } | ||
| 596 | + | ||
| 502 | LocalMovieMessage localMovieMessages = null; | 597 | LocalMovieMessage localMovieMessages = null; |
| 503 | if (!TextUtils.isEmpty(data.getFilm_hash())) { | 598 | if (!TextUtils.isEmpty(data.getFilm_hash())) { |
| 504 | localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash()); | 599 | localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash()); |
| 505 | if (localMovieMessages == null) { | 600 | if (localMovieMessages == null) { |
| 506 | show("电影信息出错,找不到相关电影"); | 601 | show("电影信息出错,找不到相关电影"); |
| 602 | + if (offset > 3) { | ||
| 603 | + CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间,没有找到电影输电网信息,请联系客服", 90 * 1000).show(); | ||
| 604 | + } else { | ||
| 605 | + CToast.makeText(this, "没有找到电影输电网信息,请联系客服", 90 * 1000).show(); | ||
| 606 | + } | ||
| 507 | } | 607 | } |
| 508 | } | 608 | } |
| 509 | - if (localMovieMessages == null) { | ||
| 510 | - show("没有获取到相应订单信息,即将为您播放银河护卫队"); | ||
| 511 | - localMovieMessages = new NewDBManager(this).queryPlayMovie("f1ebaee0a7fe50c7c5ce786b2eb9e753"); | ||
| 512 | - } | ||
| 513 | - | 609 | +// if (localMovieMessages == null) { |
| 610 | +// show("没有获取到相应订单信息,即将为您播放银河护卫队"); | ||
| 611 | +// localMovieMessages = new NewDBManager(this).queryPlayMovie("f1ebaee0a7fe50c7c5ce786b2eb9e753"); | ||
| 612 | +// } | ||
| 613 | +// | ||
| 514 | if (localMovieMessages != null) { | 614 | if (localMovieMessages != null) { |
| 515 | OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null); | 615 | OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null); |
| 516 | } else { | 616 | } else { |
| @@ -531,4 +631,38 @@ public class SmartControlService extends BaseService implements EventListener<St | @@ -531,4 +631,38 @@ public class SmartControlService extends BaseService implements EventListener<St | ||
| 531 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 631 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 532 | startActivity(intent); | 632 | startActivity(intent); |
| 533 | } | 633 | } |
| 634 | + | ||
| 635 | + @Override | ||
| 636 | + public void updateInitGetOrderInfo(boolean b) { | ||
| 637 | + initGetOderInfo = b; | ||
| 638 | + } | ||
| 639 | + | ||
| 640 | + @Override | ||
| 641 | + public void setOpenDoorTime(int i) { | ||
| 642 | + openDoorServerTime = i; | ||
| 643 | + } | ||
| 644 | + | ||
| 645 | + private void playEndAds() { | ||
| 646 | + SharedPreferences sharedPreferences = getSharedPreferences(Constant.XML_NAME, Context.MODE_PRIVATE); | ||
| 647 | + SambaMsg sambaMsg = Utils.getSambaMsg(sharedPreferences); | ||
| 648 | + String adsVideoPath; | ||
| 649 | + try { | ||
| 650 | + Thread.sleep(2000); | ||
| 651 | + } catch (InterruptedException e) { | ||
| 652 | + e.printStackTrace(); | ||
| 653 | + } | ||
| 654 | + adsVideoPath = sambaMsg.getLocalPath() + "qnyk.mp4"; | ||
| 655 | + if (!SambaFileCharge.fileExist(adsVideoPath)) { | ||
| 656 | + return; | ||
| 657 | + } | ||
| 658 | + if (roomStatusInfo != null && roomStatusInfo.getData() != null && roomInfo != null && roomInfo.getData() != null) { | ||
| 659 | + Intent intentAds = new Intent(this.getApplicationContext(), SimpleAdsPlayer2.class); | ||
| 660 | + intentAds.putExtra("ads_path", adsVideoPath); | ||
| 661 | + intentAds | ||
| 662 | + .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | ||
| 663 | + .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); | ||
| 664 | + intentAds.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 665 | + startActivity(intentAds); | ||
| 666 | + } | ||
| 667 | + } | ||
| 534 | } | 668 | } |
| @@ -146,8 +146,6 @@ public class SocketService1 extends BaseService { | @@ -146,8 +146,6 @@ public class SocketService1 extends BaseService { | ||
| 146 | @Override | 146 | @Override |
| 147 | public int onStartCommand(Intent intent, int flags, int startId) { | 147 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 148 | super.onStartCommand(intent, flags, startId); | 148 | super.onStartCommand(intent, flags, startId); |
| 149 | -// ServiceCommandCollector.addService(this, this.getClass()); | ||
| 150 | -// Log.d("BaseService1", this.getClass().toString() + ""); | ||
| 151 | Log.d(TAG, "onStartCommand"); | 149 | Log.d(TAG, "onStartCommand"); |
| 152 | int ftTest = Utils.getInt(this, "ft-test", 0); | 150 | int ftTest = Utils.getInt(this, "ft-test", 0); |
| 153 | switch (ftTest) { | 151 | switch (ftTest) { |
| @@ -3,22 +3,28 @@ package com.xgimi.gimicinema.activity; | @@ -3,22 +3,28 @@ package com.xgimi.gimicinema.activity; | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.os.Handler; | 5 | import android.os.Handler; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.util.Log; | 7 | import android.util.Log; |
| 7 | import android.view.KeyEvent; | 8 | import android.view.KeyEvent; |
| 8 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
| 9 | import android.widget.Toast; | 10 | import android.widget.Toast; |
| 10 | import com.gimi.common.cinema.model.MessageEvent; | 11 | import com.gimi.common.cinema.model.MessageEvent; |
| 12 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 13 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 11 | import com.gimi.common.cinema.utils.QRCodeUtils; | 14 | import com.gimi.common.cinema.utils.QRCodeUtils; |
| 12 | import com.gimi.common.cinema.utils.SystemUtils; | 15 | import com.gimi.common.cinema.utils.SystemUtils; |
| 13 | import com.google.zxing.WriterException; | 16 | import com.google.zxing.WriterException; |
| 14 | import com.qnbar.smc.utils.LightOperationUtils; | 17 | import com.qnbar.smc.utils.LightOperationUtils; |
| 15 | import com.xgimi.gimicinema.R; | 18 | import com.xgimi.gimicinema.R; |
| 19 | +import com.xgimi.gimicinema.mview.IUpdateQrCodeView; | ||
| 16 | import com.xgimi.gimicinema.presenter.QrCodeShowPresent; | 20 | import com.xgimi.gimicinema.presenter.QrCodeShowPresent; |
| 17 | import org.greenrobot.eventbus.EventBus; | 21 | import org.greenrobot.eventbus.EventBus; |
| 18 | import org.greenrobot.eventbus.Subscribe; | 22 | import org.greenrobot.eventbus.Subscribe; |
| 19 | import org.greenrobot.eventbus.ThreadMode; | 23 | import org.greenrobot.eventbus.ThreadMode; |
| 20 | 24 | ||
| 21 | -public class QrCodeShowActivity extends Activity { | 25 | +import static com.xgimi.gimicinema.R.id.qrCodeIv; |
| 26 | + | ||
| 27 | +public class QrCodeShowActivity extends Activity implements IUpdateQrCodeView { | ||
| 22 | public static final int KILL_SELF = 0x9983; | 28 | public static final int KILL_SELF = 0x9983; |
| 23 | private Handler handler = new Handler(); | 29 | private Handler handler = new Handler(); |
| 24 | private QrCodeShowPresent present; | 30 | private QrCodeShowPresent present; |
| @@ -28,11 +34,21 @@ public class QrCodeShowActivity extends Activity { | @@ -28,11 +34,21 @@ public class QrCodeShowActivity extends Activity { | ||
| 28 | LightOperationUtils.close(); | 34 | LightOperationUtils.close(); |
| 29 | LightOperationUtils.setLightValue(5); | 35 | LightOperationUtils.setLightValue(5); |
| 30 | new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); | 36 | new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); |
| 31 | - present.reportSleepStatus(oderSn, roomSn); | 37 | + present.reportSleepStatus(orderSn, roomSn); |
| 32 | QrCodeShowActivity.this.finish(); | 38 | QrCodeShowActivity.this.finish(); |
| 33 | } | 39 | } |
| 34 | }; | 40 | }; |
| 35 | - private String oderSn, roomSn; | 41 | + private String orderSn; |
| 42 | + private String roomSn; | ||
| 43 | + private ImageView iv; | ||
| 44 | + private Runnable updateQrCodeRunnable = new Runnable() { | ||
| 45 | + @Override | ||
| 46 | + public void run() { | ||
| 47 | + Log.d("room-info", "QrCodeShowActivity update qr code runnable run"); | ||
| 48 | + handler.postDelayed(this, 10 * 60 * 1000); | ||
| 49 | + present.getQrCode(roomSn, orderSn); | ||
| 50 | + } | ||
| 51 | + }; | ||
| 36 | 52 | ||
| 37 | @Override | 53 | @Override |
| 38 | protected void onCreate(Bundle savedInstanceState) { | 54 | protected void onCreate(Bundle savedInstanceState) { |
| @@ -40,25 +56,24 @@ public class QrCodeShowActivity extends Activity { | @@ -40,25 +56,24 @@ public class QrCodeShowActivity extends Activity { | ||
| 40 | setContentView(R.layout.activity_qr_code_show); | 56 | setContentView(R.layout.activity_qr_code_show); |
| 41 | EventBus.getDefault().register(this); | 57 | EventBus.getDefault().register(this); |
| 42 | //back press,movie length | 58 | //back press,movie length |
| 43 | - present = new QrCodeShowPresent(); | ||
| 44 | - | ||
| 45 | - final String qr = getIntent().getStringExtra("qr"); | ||
| 46 | - oderSn = getIntent().getStringExtra("order_sn"); | 59 | + present = new QrCodeShowPresent(this); |
| 60 | +// final String qr = getIntent().getStringExtra("qr"); | ||
| 61 | + orderSn = getIntent().getStringExtra("order_sn"); | ||
| 47 | roomSn = getIntent().getStringExtra("room_sn"); | 62 | roomSn = getIntent().getStringExtra("room_sn"); |
| 48 | - boolean countCall = getIntent().getBooleanExtra("count_call", false); | ||
| 49 | - if (countCall) { | ||
| 50 | - Toast.makeText(this, "你预定的时段已结束,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show(); | 63 | +// boolean countCall = getIntent().getBooleanExtra("count_call", false); |
| 64 | +// if (countCall) { | ||
| 65 | +// Toast.makeText(this, "你预定的时段已结束,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show(); | ||
| 66 | +// } else { | ||
| 67 | +// Toast.makeText(this, "电影观看完成,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show(); | ||
| 68 | +// } | ||
| 69 | + iv = (ImageView) findViewById(qrCodeIv); | ||
| 70 | + handler.postDelayed(r, 20 * 60 * 1000); | ||
| 71 | + | ||
| 72 | + if (!TextUtils.isEmpty(roomSn) && !TextUtils.isEmpty(orderSn)) { | ||
| 73 | + handler.post(updateQrCodeRunnable); | ||
| 51 | } else { | 74 | } else { |
| 52 | - Toast.makeText(this, "电影观看完成,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show(); | ||
| 53 | - } | ||
| 54 | - ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); | ||
| 55 | - try { | ||
| 56 | - iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); | ||
| 57 | - } catch (WriterException e) { | ||
| 58 | - e.printStackTrace(); | 75 | + Log.d("room-info", "roomSn:" + roomSn + ",orderSn:" + orderSn); |
| 59 | } | 76 | } |
| 60 | - | ||
| 61 | - handler.postDelayed(r, 20 * 60 * 1000); | ||
| 62 | } | 77 | } |
| 63 | 78 | ||
| 64 | @Override | 79 | @Override |
| @@ -84,7 +99,7 @@ public class QrCodeShowActivity extends Activity { | @@ -84,7 +99,7 @@ public class QrCodeShowActivity extends Activity { | ||
| 84 | @Override | 99 | @Override |
| 85 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 100 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 86 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 101 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 87 | - Toast.makeText(this,"请用管理端扫描或者等待清理时间结束",Toast.LENGTH_SHORT).show(); | 102 | + Toast.makeText(this, "请用管理端扫描或者等待清理时间结束", Toast.LENGTH_SHORT).show(); |
| 88 | return true; | 103 | return true; |
| 89 | } | 104 | } |
| 90 | return super.onKeyDown(keyCode, event); | 105 | return super.onKeyDown(keyCode, event); |
| @@ -99,4 +114,19 @@ public class QrCodeShowActivity extends Activity { | @@ -99,4 +114,19 @@ public class QrCodeShowActivity extends Activity { | ||
| 99 | break; | 114 | break; |
| 100 | } | 115 | } |
| 101 | } | 116 | } |
| 117 | + | ||
| 118 | + @Override | ||
| 119 | + public void getQrCodeSuccess(RoomQrCodeInfo info) { | ||
| 120 | + try { | ||
| 121 | + Log.d("QrCodeShowActivity", info.getData().getCode()); | ||
| 122 | + iv.setImageBitmap(QRCodeUtils.createQRCode(info.getData().getCode(), 400)); | ||
| 123 | + } catch (WriterException e) { | ||
| 124 | + e.printStackTrace(); | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + @Override | ||
| 129 | + public void getQrCodeFailure(WrongMsg wrongMsg) { | ||
| 130 | + Toast.makeText(this, wrongMsg.getMsg(), Toast.LENGTH_SHORT).show(); | ||
| 131 | + } | ||
| 102 | } | 132 | } |
| 1 | package com.xgimi.gimicinema.activity; | 1 | package com.xgimi.gimicinema.activity; |
| 2 | 2 | ||
| 3 | -import android.app.Activity; | ||
| 4 | -import android.content.BroadcastReceiver; | ||
| 5 | import android.content.Context; | 3 | import android.content.Context; |
| 6 | -import android.content.Intent; | ||
| 7 | -import android.content.IntentFilter; | ||
| 8 | import android.media.AudioManager; | 4 | import android.media.AudioManager; |
| 9 | import android.media.MediaPlayer; | 5 | import android.media.MediaPlayer; |
| 10 | import android.net.Uri; | 6 | import android.net.Uri; |
| 11 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 12 | import android.os.Handler; | 8 | import android.os.Handler; |
| 9 | +import android.text.TextUtils; | ||
| 10 | +import android.util.Log; | ||
| 13 | import android.view.KeyEvent; | 11 | import android.view.KeyEvent; |
| 12 | +import android.view.View; | ||
| 13 | +import android.widget.ImageView; | ||
| 14 | +import android.widget.LinearLayout; | ||
| 15 | +import android.widget.Toast; | ||
| 14 | import android.widget.VideoView; | 16 | import android.widget.VideoView; |
| 15 | import com.gimi.common.cinema.model.Constant; | 17 | import com.gimi.common.cinema.model.Constant; |
| 18 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 19 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 20 | +import com.gimi.common.cinema.utils.QRCodeUtils; | ||
| 21 | +import com.google.zxing.WriterException; | ||
| 16 | import com.xgimi.gimicinema.R; | 22 | import com.xgimi.gimicinema.R; |
| 23 | +import com.xgimi.gimicinema.mview.IUpdateQrCodeView; | ||
| 24 | +import com.xgimi.gimicinema.presenter.UpdateQrCodePresenter; | ||
| 17 | 25 | ||
| 18 | -public class SimpleAdsPlayer2 extends Activity { | 26 | +public class SimpleAdsPlayer2 extends BaseActivity implements IUpdateQrCodeView { |
| 27 | + | ||
| 28 | + private UpdateQrCodePresenter presenter; | ||
| 19 | private VideoView videoView; | 29 | private VideoView videoView; |
| 20 | - // private TextView textviewP; | 30 | + private ImageView cleanQrCodeIv; |
| 31 | + private LinearLayout qrCodeIv; | ||
| 21 | public String playUrl; | 32 | public String playUrl; |
| 22 | - private Handler handler = new Handler(); | ||
| 23 | -// private Runnable killSelfRunnable = new Runnable() { | ||
| 24 | -// @Override | ||
| 25 | -// public void run() { | ||
| 26 | -// handler.postDelayed(this, 3 * 1000); | ||
| 27 | -// if (Constant.messageRun) { | ||
| 28 | -// SimpleAdsPlayer2.this.finish(); | ||
| 29 | -// } | ||
| 30 | -// } | ||
| 31 | -// }; | ||
| 32 | - | 33 | + private String roomSn; |
| 34 | + private String orderSn; | ||
| 33 | private AudioManager audioManager; | 35 | private AudioManager audioManager; |
| 34 | private boolean fromService; | 36 | private boolean fromService; |
| 35 | private long startAdsTime = 0; | 37 | private long startAdsTime = 0; |
| 36 | private int streamVolume; | 38 | private int streamVolume; |
| 39 | + private Handler handler = new Handler(); | ||
| 40 | + private Runnable updateQrCodeRunnable = new Runnable() { | ||
| 41 | + @Override | ||
| 42 | + public void run() { | ||
| 43 | + Log.d("room-info", "update qr code runnable run"); | ||
| 44 | + handler.postDelayed(this, 10 * 60 * 1000); | ||
| 45 | + presenter.getQrCode(roomSn, orderSn); | ||
| 46 | + } | ||
| 47 | + }; | ||
| 37 | 48 | ||
| 38 | @Override | 49 | @Override |
| 39 | protected void onCreate(Bundle savedInstanceState) { | 50 | protected void onCreate(Bundle savedInstanceState) { |
| @@ -47,10 +58,12 @@ public class SimpleAdsPlayer2 extends Activity { | @@ -47,10 +58,12 @@ public class SimpleAdsPlayer2 extends Activity { | ||
| 47 | startAdsTime = System.currentTimeMillis(); | 58 | startAdsTime = System.currentTimeMillis(); |
| 48 | Constant.isAdsOn = true; | 59 | Constant.isAdsOn = true; |
| 49 | videoView = (VideoView) findViewById(R.id.videoView); | 60 | videoView = (VideoView) findViewById(R.id.videoView); |
| 50 | -// textviewP = (TextView) findViewById(R.id.promoteTv); | 61 | + cleanQrCodeIv = (ImageView) findViewById(R.id.cleanQrCodeIv); |
| 62 | + qrCodeIv = (LinearLayout) findViewById(R.id.qrCodeIv); | ||
| 51 | playUrl = getIntent().getStringExtra("ads_path"); | 63 | playUrl = getIntent().getStringExtra("ads_path"); |
| 64 | + orderSn = getIntent().getStringExtra("order_sn"); | ||
| 65 | + roomSn = getIntent().getStringExtra("room_sn"); | ||
| 52 | fromService = getIntent().getBooleanExtra("from_service", false); | 66 | fromService = getIntent().getBooleanExtra("from_service", false); |
| 53 | -// playUrl = "/mnt/samba/172.21.16.83/APicture/qnyk.mp4"; | ||
| 54 | Uri videoUri = Uri.parse(playUrl); | 67 | Uri videoUri = Uri.parse(playUrl); |
| 55 | videoView.setVideoURI(videoUri); | 68 | videoView.setVideoURI(videoUri); |
| 56 | videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { | 69 | videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { |
| @@ -58,7 +71,6 @@ public class SimpleAdsPlayer2 extends Activity { | @@ -58,7 +71,6 @@ public class SimpleAdsPlayer2 extends Activity { | ||
| 58 | public void onCompletion(MediaPlayer mp) { | 71 | public void onCompletion(MediaPlayer mp) { |
| 59 | videoView.start(); | 72 | videoView.start(); |
| 60 | videoView.seekTo(0); | 73 | videoView.seekTo(0); |
| 61 | - | ||
| 62 | } | 74 | } |
| 63 | }); | 75 | }); |
| 64 | videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { | 76 | videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { |
| @@ -74,10 +86,12 @@ public class SimpleAdsPlayer2 extends Activity { | @@ -74,10 +86,12 @@ public class SimpleAdsPlayer2 extends Activity { | ||
| 74 | } | 86 | } |
| 75 | } | 87 | } |
| 76 | }); | 88 | }); |
| 77 | -// if (fromService) { | ||
| 78 | -// textviewP.setVisibility(View.VISIBLE); | ||
| 79 | -// handler.postDelayed(killSelfRunnable, 3 * 1000); | ||
| 80 | -// } | 89 | + if (!TextUtils.isEmpty(roomSn) && !TextUtils.isEmpty(orderSn)) { |
| 90 | + presenter = new UpdateQrCodePresenter(this); | ||
| 91 | + handler.post(updateQrCodeRunnable); | ||
| 92 | + } else { | ||
| 93 | + Log.d("room-info", "roomSn:" + roomSn + ",orderSn:" + orderSn); | ||
| 94 | + } | ||
| 81 | } | 95 | } |
| 82 | 96 | ||
| 83 | @Override | 97 | @Override |
| @@ -97,6 +111,7 @@ public class SimpleAdsPlayer2 extends Activity { | @@ -97,6 +111,7 @@ public class SimpleAdsPlayer2 extends Activity { | ||
| 97 | super.onStop(); | 111 | super.onStop(); |
| 98 | Constant.isAdsOn = false; | 112 | Constant.isAdsOn = false; |
| 99 | if (handler != null) { | 113 | if (handler != null) { |
| 114 | + handler.removeCallbacks(null); | ||
| 100 | handler.removeCallbacksAndMessages(null); | 115 | handler.removeCallbacksAndMessages(null); |
| 101 | } | 116 | } |
| 102 | if (audioManager != null) { | 117 | if (audioManager != null) { |
| @@ -104,36 +119,29 @@ public class SimpleAdsPlayer2 extends Activity { | @@ -104,36 +119,29 @@ public class SimpleAdsPlayer2 extends Activity { | ||
| 104 | audioManager = null; | 119 | audioManager = null; |
| 105 | } | 120 | } |
| 106 | handler = null; | 121 | handler = null; |
| 107 | -// Constant.needStartScreenSaver = true; | ||
| 108 | playUrl = null; | 122 | playUrl = null; |
| 109 | videoView = null; | 123 | videoView = null; |
| 110 | System.gc(); | 124 | System.gc(); |
| 111 | } | 125 | } |
| 112 | 126 | ||
| 113 | @Override | 127 | @Override |
| 114 | - protected void onResume() { | ||
| 115 | - super.onResume(); | ||
| 116 | - IntentFilter networkFilter = new IntentFilter( | ||
| 117 | - "com.xgimi.gimicinema_close_led"); | ||
| 118 | - registerReceiver(closeLedReceiver, networkFilter); | 128 | + protected void onDestroy() { |
| 129 | + super.onDestroy(); | ||
| 119 | } | 130 | } |
| 120 | 131 | ||
| 121 | - BroadcastReceiver closeLedReceiver = new BroadcastReceiver() { | ||
| 122 | - @Override | ||
| 123 | - public void onReceive(Context context, Intent intent) { | ||
| 124 | - if (intent.getAction().equals(Constant.ACTION_GET_MESSAGE_CLOSE_LED)) { | ||
| 125 | - SimpleAdsPlayer2.this.finish(); | ||
| 126 | - } | ||
| 127 | - } | ||
| 128 | - }; | ||
| 129 | - | ||
| 130 | @Override | 132 | @Override |
| 131 | - protected void onDestroy() { | ||
| 132 | - super.onDestroy(); | 133 | + public void getQrCodeSuccess(RoomQrCodeInfo info) { |
| 133 | try { | 134 | try { |
| 134 | - unregisterReceiver(closeLedReceiver); | ||
| 135 | - } catch (Exception e) { | 135 | + Log.d("SimpleAdsPlayer2", info.getData().getCode()); |
| 136 | + cleanQrCodeIv.setImageBitmap(QRCodeUtils.createQRCode(info.getData().getCode(), 400)); | ||
| 137 | + qrCodeIv.setVisibility(View.VISIBLE); | ||
| 138 | + } catch (WriterException e) { | ||
| 136 | e.printStackTrace(); | 139 | e.printStackTrace(); |
| 137 | } | 140 | } |
| 138 | } | 141 | } |
| 142 | + | ||
| 143 | + @Override | ||
| 144 | + public void getQrCodeFailure(WrongMsg wrongMsg) { | ||
| 145 | + Toast.makeText(this, wrongMsg.getMsg(), Toast.LENGTH_SHORT).show(); | ||
| 146 | + } | ||
| 139 | } | 147 | } |
| @@ -6,11 +6,13 @@ package com.xgimi.gimicinema.model; | @@ -6,11 +6,13 @@ package com.xgimi.gimicinema.model; | ||
| 6 | public interface IRoomInfoModel { | 6 | public interface IRoomInfoModel { |
| 7 | void getRoomInfo(String imei, boolean needUpdate, RoomInfoModelImpl.GetRoomInfoListener listener); | 7 | void getRoomInfo(String imei, boolean needUpdate, RoomInfoModelImpl.GetRoomInfoListener listener); |
| 8 | 8 | ||
| 9 | + void getRoomSysTime(String imei, RoomInfoModelImpl.GetServerTimeListener listener); | ||
| 10 | + | ||
| 9 | void getRoomStatus(String roomSn, RoomInfoModelImpl.GetRoomStatusListener listener); | 11 | void getRoomStatus(String roomSn, RoomInfoModelImpl.GetRoomStatusListener listener); |
| 10 | 12 | ||
| 11 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); | 13 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); |
| 12 | 14 | ||
| 13 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); | 15 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); |
| 14 | 16 | ||
| 15 | - void reportSleepSysStatus(String orderSn,String roomSn, RoomInfoModelImpl.SleepSysStatusListener listener); | 17 | + void reportSleepSysStatus(String orderSn, String roomSn, RoomInfoModelImpl.SleepSysStatusListener listener); |
| 16 | } | 18 | } |
| @@ -3,7 +3,6 @@ package com.xgimi.gimicinema.model; | @@ -3,7 +3,6 @@ package com.xgimi.gimicinema.model; | ||
| 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; | 5 | import android.util.Log; |
| 6 | - | ||
| 7 | import com.gimi.common.cinema.model.RoomInfo; | 6 | import com.gimi.common.cinema.model.RoomInfo; |
| 8 | import com.gimi.common.cinema.model.RoomQrCodeInfo; | 7 | import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 9 | import com.gimi.common.cinema.model.RoomStatusInfo; | 8 | import com.gimi.common.cinema.model.RoomStatusInfo; |
| @@ -15,6 +14,9 @@ import com.google.gson.JsonSyntaxException; | @@ -15,6 +14,9 @@ import com.google.gson.JsonSyntaxException; | ||
| 15 | import com.squareup.okhttp.Request; | 14 | import com.squareup.okhttp.Request; |
| 16 | import com.xgimi.gimicinema.application.FangTangApplication; | 15 | import com.xgimi.gimicinema.application.FangTangApplication; |
| 17 | 16 | ||
| 17 | +import java.io.IOException; | ||
| 18 | +import java.text.ParseException; | ||
| 19 | + | ||
| 18 | /** | 20 | /** |
| 19 | * Created by wugian on 2017/4/7 | 21 | * Created by wugian on 2017/4/7 |
| 20 | */ | 22 | */ |
| @@ -97,6 +99,31 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -97,6 +99,31 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 97 | }); | 99 | }); |
| 98 | } | 100 | } |
| 99 | 101 | ||
| 102 | + public void getRoomSysTime(final String imei, final GetServerTimeListener listener) { | ||
| 103 | + ThreadUtils.subThread(new ThreadUtils.DoSomeThing() { | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public void doSomeThing() { | ||
| 107 | + long time = -1; | ||
| 108 | + Log.d("room-info", "request:getRoomInfo,url = " + ROOM_INFO_BY_IMEI_URL + imei); | ||
| 109 | + try { | ||
| 110 | + time = OkHttpClientManager.getSysTime(ROOM_INFO_BY_IMEI_URL + imei); | ||
| 111 | + } catch (IOException e) { | ||
| 112 | + e.printStackTrace(); | ||
| 113 | + } catch (ParseException e) { | ||
| 114 | + e.printStackTrace(); | ||
| 115 | + } | ||
| 116 | + if (time != -1) { | ||
| 117 | + listener.onGetTimeSuccess(time); | ||
| 118 | + } else { | ||
| 119 | + listener.onGetTimeFailure(new WrongMsg()); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + }); | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + | ||
| 100 | @Override | 127 | @Override |
| 101 | public void getRoomStatus(String roomSn, final GetRoomStatusListener listener) { | 128 | public void getRoomStatus(String roomSn, final GetRoomStatusListener listener) { |
| 102 | Log.d("room-info", "request:getRoomStatus,url = " + ROOM_STATUS_BY_ROOM_SN_URL + roomSn); | 129 | Log.d("room-info", "request:getRoomStatus,url = " + ROOM_STATUS_BY_ROOM_SN_URL + roomSn); |
| @@ -210,6 +237,12 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -210,6 +237,12 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 210 | void onGetRoomInfoFailure(WrongMsg wrongMsg); | 237 | void onGetRoomInfoFailure(WrongMsg wrongMsg); |
| 211 | } | 238 | } |
| 212 | 239 | ||
| 240 | + public interface GetServerTimeListener { | ||
| 241 | + void onGetTimeSuccess(long time); | ||
| 242 | + | ||
| 243 | + void onGetTimeFailure(WrongMsg wrongMsg); | ||
| 244 | + } | ||
| 245 | + | ||
| 213 | public interface GetRoomStatusListener { | 246 | public interface GetRoomStatusListener { |
| 214 | void onGetRoomStatusSuccess(RoomStatusInfo info); | 247 | void onGetRoomStatusSuccess(RoomStatusInfo info); |
| 215 | 248 |
| 1 | +package com.xgimi.gimicinema.mview; | ||
| 2 | + | ||
| 3 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 4 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by wugian on 2017/5/25. | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +public interface IUpdateQrCodeView { | ||
| 11 | + void getQrCodeSuccess(RoomQrCodeInfo info); | ||
| 12 | + | ||
| 13 | + void getQrCodeFailure(WrongMsg wrongMsg); | ||
| 14 | +} |
| 1 | package com.xgimi.gimicinema.presenter; | 1 | package com.xgimi.gimicinema.presenter; |
| 2 | 2 | ||
| 3 | import android.util.Log; | 3 | import android.util.Log; |
| 4 | - | 4 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 5 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 5 | import com.xgimi.gimicinema.model.IRoomInfoModel; | 6 | import com.xgimi.gimicinema.model.IRoomInfoModel; |
| 6 | import com.xgimi.gimicinema.model.RoomInfoModelImpl; | 7 | import com.xgimi.gimicinema.model.RoomInfoModelImpl; |
| 8 | +import com.xgimi.gimicinema.mview.IUpdateQrCodeView; | ||
| 7 | 9 | ||
| 8 | /** | 10 | /** |
| 9 | * Created by wugian on 2017/5/2 | 11 | * Created by wugian on 2017/5/2 |
| @@ -12,8 +14,9 @@ import com.xgimi.gimicinema.model.RoomInfoModelImpl; | @@ -12,8 +14,9 @@ import com.xgimi.gimicinema.model.RoomInfoModelImpl; | ||
| 12 | public class QrCodeShowPresent { | 14 | public class QrCodeShowPresent { |
| 13 | IRoomInfoModel roomInfoModel; | 15 | IRoomInfoModel roomInfoModel; |
| 14 | 16 | ||
| 15 | - public QrCodeShowPresent() { | 17 | + public QrCodeShowPresent(IUpdateQrCodeView view) { |
| 16 | roomInfoModel = new RoomInfoModelImpl(); | 18 | roomInfoModel = new RoomInfoModelImpl(); |
| 19 | + this.view = view; | ||
| 17 | } | 20 | } |
| 18 | 21 | ||
| 19 | public void reportSleepStatus(String orderSn, String roomSn) { | 22 | public void reportSleepStatus(String orderSn, String roomSn) { |
| @@ -29,4 +32,21 @@ public class QrCodeShowPresent { | @@ -29,4 +32,21 @@ public class QrCodeShowPresent { | ||
| 29 | } | 32 | } |
| 30 | }); | 33 | }); |
| 31 | } | 34 | } |
| 35 | + | ||
| 36 | + private IUpdateQrCodeView view; | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + public void getQrCode(String roomSn, String oderSn) { | ||
| 40 | + roomInfoModel.getRoomQrCode(oderSn, roomSn, new RoomInfoModelImpl.GetRoomQrCodeListener() { | ||
| 41 | + @Override | ||
| 42 | + public void onGetRoomQrCodeSuccess(RoomQrCodeInfo info) { | ||
| 43 | + view.getQrCodeSuccess(info); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public void onGetRoomQrCodeFailure(WrongMsg wrongMsg) { | ||
| 48 | + view.getQrCodeFailure(wrongMsg); | ||
| 49 | + } | ||
| 50 | + }); | ||
| 51 | + } | ||
| 32 | } | 52 | } |
| 1 | +package com.xgimi.gimicinema.presenter; | ||
| 2 | + | ||
| 3 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 4 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 5 | +import com.xgimi.gimicinema.model.IRoomInfoModel; | ||
| 6 | +import com.xgimi.gimicinema.model.RoomInfoModelImpl; | ||
| 7 | +import com.xgimi.gimicinema.mview.IUpdateQrCodeView; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by wugian on 2017/5/25 | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +public class UpdateQrCodePresenter { | ||
| 14 | + private IRoomInfoModel roomInfoModel; | ||
| 15 | + private IUpdateQrCodeView view; | ||
| 16 | + | ||
| 17 | + public UpdateQrCodePresenter(IUpdateQrCodeView updateView) { | ||
| 18 | + this.roomInfoModel = new RoomInfoModelImpl(); | ||
| 19 | + this.view = updateView; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void getQrCode(String roomSn, String oderSn) { | ||
| 23 | + roomInfoModel.getRoomQrCode(oderSn, roomSn, new RoomInfoModelImpl.GetRoomQrCodeListener() { | ||
| 24 | + @Override | ||
| 25 | + public void onGetRoomQrCodeSuccess(RoomQrCodeInfo info) { | ||
| 26 | + view.getQrCodeSuccess(info); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public void onGetRoomQrCodeFailure(WrongMsg wrongMsg) { | ||
| 31 | + view.getQrCodeFailure(wrongMsg); | ||
| 32 | + } | ||
| 33 | + }); | ||
| 34 | + } | ||
| 35 | +} |
| 1 | +package com.xgimi.gimicinema.receiver; | ||
| 2 | + | ||
| 3 | +import android.content.BroadcastReceiver; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.util.Log; | ||
| 7 | + | ||
| 8 | +public class AppInstalledReceiver extends BroadcastReceiver { | ||
| 9 | + | ||
| 10 | + @Override | ||
| 11 | + public void onReceive(Context context, Intent intent) { | ||
| 12 | + | ||
| 13 | + String action = intent.getAction(); | ||
| 14 | + String packageName = intent.getData().getSchemeSpecificPart(); | ||
| 15 | + if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { | ||
| 16 | +// Toast.makeText(context, "添加了新的应用" + packageName, Toast.LENGTH_LONG).show(); | ||
| 17 | + Log.d("install", "Intent.ACTION_PACKAGE_ADDED:" + packageName); | ||
| 18 | +// Intent serviceIntent = new Intent(); | ||
| 19 | +// serviceIntent.setClass(context, Controller.class); | ||
| 20 | +// serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 21 | +// context.startActivity(serviceIntent); | ||
| 22 | + } else { | ||
| 23 | + Log.d("install", "Intent.ACTION_PACKAGE_ADDED:" + packageName + "," + action); | ||
| 24 | + if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) { | ||
| 25 | +// Toast.makeText(context, "添加了新的应用" + action, Toast.LENGTH_LONG).show(); | ||
| 26 | + Log.d("install", "Intent.ACTION_PACKAGE_ADDED:" + packageName); | ||
| 27 | +// Intent serviceIntent = new Intent(); | ||
| 28 | +// serviceIntent.setClass(context, Controller.class); | ||
| 29 | +// serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 30 | +// context.startActivity(serviceIntent); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | +} |
| @@ -24,11 +24,11 @@ import android.os.IBinder; | @@ -24,11 +24,11 @@ import android.os.IBinder; | ||
| 24 | import android.os.RemoteException; | 24 | import android.os.RemoteException; |
| 25 | import android.util.Log; | 25 | import android.util.Log; |
| 26 | import android.widget.Toast; | 26 | import android.widget.Toast; |
| 27 | -import com.gimi.common.cinema.model.Constant; | ||
| 28 | import com.gimi.common.cinema.model.MessageEvent; | 27 | import com.gimi.common.cinema.model.MessageEvent; |
| 29 | import com.gimi.common.cinema.utils.Utils; | 28 | import com.gimi.common.cinema.utils.Utils; |
| 30 | import com.qnbar.smc.model.Light; | 29 | import com.qnbar.smc.model.Light; |
| 31 | import com.qnbar.smc.model.Lights; | 30 | import com.qnbar.smc.model.Lights; |
| 31 | +import com.qnbar.smc.service.SmartControlService; | ||
| 32 | import com.qnbar.smc.service.TelinkLightService; | 32 | import com.qnbar.smc.service.TelinkLightService; |
| 33 | import com.telink.bluetooth.light.ConnectionStatus; | 33 | import com.telink.bluetooth.light.ConnectionStatus; |
| 34 | import com.telink.bluetooth.light.DeviceInfo; | 34 | import com.telink.bluetooth.light.DeviceInfo; |
| @@ -39,8 +39,6 @@ import org.greenrobot.eventbus.EventBus; | @@ -39,8 +39,6 @@ import org.greenrobot.eventbus.EventBus; | ||
| 39 | import java.util.ArrayList; | 39 | import java.util.ArrayList; |
| 40 | import java.util.List; | 40 | import java.util.List; |
| 41 | 41 | ||
| 42 | -import static com.xgimi.gimicinema.service.CountService.COUNT_DOWN_ZERO; | ||
| 43 | - | ||
| 44 | public class CinemaControlService extends Service { | 42 | public class CinemaControlService extends Service { |
| 45 | private static final int LIGHT_MIN_VALUE = 5; | 43 | private static final int LIGHT_MIN_VALUE = 5; |
| 46 | private ArrayList<String> movies = new ArrayList<>(); | 44 | private ArrayList<String> movies = new ArrayList<>(); |
| @@ -108,7 +106,8 @@ public class CinemaControlService extends Service { | @@ -108,7 +106,8 @@ public class CinemaControlService extends Service { | ||
| 108 | } | 106 | } |
| 109 | if (state != currentState) { | 107 | if (state != currentState) { |
| 110 | currentState = state; | 108 | currentState = state; |
| 111 | - Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition); | 109 | +// ShellUtils.execCommand("input keyevent 23", false); |
| 110 | + Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition + ",state:" + state); | ||
| 112 | Log.d("aidl", "state change cinemaSMC not null"); | 111 | Log.d("aidl", "state change cinemaSMC not null"); |
| 113 | // if (true) { | 112 | // if (true) { |
| 114 | // return; | 113 | // return; |
| @@ -338,10 +337,15 @@ public class CinemaControlService extends Service { | @@ -338,10 +337,15 @@ public class CinemaControlService extends Service { | ||
| 338 | 337 | ||
| 339 | private void showQrCodeRightNow() { | 338 | private void showQrCodeRightNow() { |
| 340 | if (duration - currentPosition < 1000 * 60) { | 339 | if (duration - currentPosition < 1000 * 60) { |
| 341 | - Constant.count = -1; | 340 | + //save order complete |
| 341 | +// Constant.count = -1; | ||
| 342 | +// MessageEvent messageEvent = new MessageEvent(); | ||
| 343 | +// messageEvent.setEventId(COUNT_DOWN_ZERO); | ||
| 344 | +// messageEvent.setMessage("CinemaControlService,记数为0"); | ||
| 345 | +// EventBus.getDefault().post(messageEvent); | ||
| 342 | MessageEvent messageEvent = new MessageEvent(); | 346 | MessageEvent messageEvent = new MessageEvent(); |
| 343 | - messageEvent.setEventId(COUNT_DOWN_ZERO); | ||
| 344 | - messageEvent.setMessage("CinemaControlService,记数为0"); | 347 | + messageEvent.setEventId(SmartControlService.ORDER_PLAY_COMPLETE); |
| 348 | + messageEvent.setMessage("电影播放完成,记录完成订单信息"); | ||
| 345 | EventBus.getDefault().post(messageEvent); | 349 | EventBus.getDefault().post(messageEvent); |
| 346 | } else { | 350 | } else { |
| 347 | Log.d("room-info", "stop media but not completed"); | 351 | Log.d("room-info", "stop media but not completed"); |
| @@ -3,13 +3,6 @@ package com.xgimi.gimicinema.service; | @@ -3,13 +3,6 @@ package com.xgimi.gimicinema.service; | ||
| 3 | import android.content.BroadcastReceiver; | 3 | import android.content.BroadcastReceiver; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | -import android.content.SharedPreferences; | ||
| 7 | -import com.gimi.common.cinema.model.Constant; | ||
| 8 | -import com.gimi.common.cinema.model.SambaMsg; | ||
| 9 | -import com.gimi.common.cinema.utils.AdsVideoUtils; | ||
| 10 | -import com.gimi.common.cinema.utils.SambaFileCharge; | ||
| 11 | -import com.gimi.common.cinema.utils.Utils; | ||
| 12 | -import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; | ||
| 13 | 6 | ||
| 14 | /** | 7 | /** |
| 15 | * Created by wugian on 2016/8/22 | 8 | * Created by wugian on 2016/8/22 |
| @@ -17,28 +10,26 @@ import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; | @@ -17,28 +10,26 @@ import com.xgimi.gimicinema.activity.SimpleAdsPlayer2; | ||
| 17 | public class MovieCompleteReceiver extends BroadcastReceiver { | 10 | public class MovieCompleteReceiver extends BroadcastReceiver { |
| 18 | @Override | 11 | @Override |
| 19 | public void onReceive(Context context, Intent intent) { | 12 | public void onReceive(Context context, Intent intent) { |
| 20 | - if (intent.getAction().equals(Constant.ACTION_GET_MESSAGE_MEDIA_PLAYER_MOVIE_COMPLETE)) { | ||
| 21 | - | ||
| 22 | - SharedPreferences sharedPreferences = context.getSharedPreferences(Constant.XML_NAME, Context.MODE_PRIVATE); | ||
| 23 | - SambaMsg sambaMsg = Utils.getSambaMsg(sharedPreferences); | ||
| 24 | - String adsVideoPath; | ||
| 25 | - try { | ||
| 26 | - Thread.sleep(2000); | ||
| 27 | - } catch (InterruptedException e) { | ||
| 28 | - e.printStackTrace(); | ||
| 29 | - } | ||
| 30 | - if (Constant.startAds && Constant.messageRun) { | ||
| 31 | - Constant.startAds = false; | ||
| 32 | - adsVideoPath = AdsVideoUtils.getAdsVideoPath(sambaMsg.getLocalPath()); | ||
| 33 | - if (!SambaFileCharge.fileExist(adsVideoPath)) { | ||
| 34 | - return; | ||
| 35 | - } | ||
| 36 | - Intent intentAds = new Intent(context.getApplicationContext(), SimpleAdsPlayer2.class); | ||
| 37 | - intentAds.putExtra("ads_path", adsVideoPath); | ||
| 38 | - intentAds.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 39 | - context.startActivity(intentAds); | ||
| 40 | - } | ||
| 41 | - } | 13 | +// if (intent.getAction().equals(Constant.ACTION_GET_MESSAGE_MEDIA_PLAYER_MOVIE_COMPLETE)) { |
| 14 | +// | ||
| 15 | +// SharedPreferences sharedPreferences = context.getSharedPreferences(Constant.XML_NAME, Context.MODE_PRIVATE); | ||
| 16 | +// SambaMsg sambaMsg = Utils.getSambaMsg(sharedPreferences); | ||
| 17 | +// String adsVideoPath; | ||
| 18 | +// try { | ||
| 19 | +// Thread.sleep(2000); | ||
| 20 | +// } catch (InterruptedException e) { | ||
| 21 | +// e.printStackTrace(); | ||
| 22 | +// } | ||
| 23 | +// Constant.startAds = false; | ||
| 24 | +// adsVideoPath = sambaMsg.getLocalPath() + "qnyk.mp4"; | ||
| 25 | +// if (!SambaFileCharge.fileExist(adsVideoPath)) { | ||
| 26 | +// return; | ||
| 27 | +// } | ||
| 28 | +// Intent intentAds = new Intent(context.getApplicationContext(), SimpleAdsPlayer2.class); | ||
| 29 | +// intentAds.putExtra("ads_path", adsVideoPath); | ||
| 30 | +// intentAds.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 31 | +// context.startActivity(intentAds); | ||
| 32 | +// } | ||
| 42 | } | 33 | } |
| 43 | 34 | ||
| 44 | } | 35 | } |
| 1 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | - xmlns:tools="http://schemas.android.com/tools" | ||
| 3 | - android:gravity="center" | ||
| 4 | - android:layout_width="match_parent" | ||
| 5 | - android:layout_height="match_parent"> | 2 | + xmlns:tools="http://schemas.android.com/tools" |
| 3 | + android:gravity="center" | ||
| 4 | + android:layout_width="match_parent" | ||
| 5 | + android:layout_height="match_parent"> | ||
| 6 | 6 | ||
| 7 | <com.xgimi.gimicinema.view.FullScreenVideoView | 7 | <com.xgimi.gimicinema.view.FullScreenVideoView |
| 8 | android:id="@+id/videoView" | 8 | android:id="@+id/videoView" |
| 9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
| 10 | android:layout_height="match_parent" | 10 | android:layout_height="match_parent" |
| 11 | android:layout_gravity="center_horizontal" | 11 | android:layout_gravity="center_horizontal" |
| 12 | - android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> | 12 | + android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/> |
| 13 | <TextView | 13 | <TextView |
| 14 | android:layout_width="wrap_content" | 14 | android:layout_width="wrap_content" |
| 15 | android:layout_height="wrap_content" | 15 | android:layout_height="wrap_content" |
| @@ -22,5 +22,20 @@ | @@ -22,5 +22,20 @@ | ||
| 22 | android:padding="5dp" | 22 | android:padding="5dp" |
| 23 | android:background="@color/dark_background" | 23 | android:background="@color/dark_background" |
| 24 | android:layout_gravity="center_horizontal|top"/> | 24 | android:layout_gravity="center_horizontal|top"/> |
| 25 | + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" | ||
| 26 | + android:padding="10dp" | ||
| 27 | + android:gravity="bottom|right"> | ||
| 28 | + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" | ||
| 29 | + android:gravity="center" | ||
| 30 | + android:visibility="gone" | ||
| 31 | + android:id="@+id/qrCodeIv" | ||
| 32 | + android:background="@color/white" | ||
| 33 | + android:orientation="vertical"> | ||
| 34 | + | ||
| 35 | + <ImageView android:layout_width="200dp" android:layout_height="200dp" | ||
| 36 | + android:id="@+id/cleanQrCodeIv"/> | ||
| 37 | + </LinearLayout> | ||
| 38 | + | ||
| 39 | + </LinearLayout> | ||
| 25 | 40 | ||
| 26 | </FrameLayout> | 41 | </FrameLayout> |
| @@ -106,4 +106,11 @@ | @@ -106,4 +106,11 @@ | ||
| 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="ads_promote">青柠影咖,年轻人的奇幻乐园。</string> | ||
| 110 | + <string name="delay_time">您已迟到%d分钟,</string> | ||
| 111 | + <string name="play_movie">即将为你播放%s</string> | ||
| 112 | + <string name="end_ads">本场电影已结束,请观看《青柠电影先锋》</string> | ||
| 113 | + <string name="welcome_again">离场时请携带好随身物品,欢迎下次光临。</string> | ||
| 114 | + <string name="play_next">本场电影已结束,将于广告后为您播放下一部影片%s</string> | ||
| 115 | + | ||
| 109 | </resources> | 116 | </resources> |
Please
register
or
login
to post a comment