Commit 0726b68607624d44f3c76e08d9aad0ea24785798
Merge branch 'master' of gitlab.qnbar.com:pan.li/fangTang
Showing
7 changed files
with
95 additions
and
11 deletions
| ... | ... | @@ -45,6 +45,7 @@ import android.widget.ImageView; |
| 45 | 45 | import android.widget.RelativeLayout; |
| 46 | 46 | import android.widget.ScrollView; |
| 47 | 47 | import android.widget.Toast; |
| 48 | + | |
| 48 | 49 | import com.adroplat.fist_switch.jni.Device; |
| 49 | 50 | import com.adroplat.fist_switch.jni.FistJni; |
| 50 | 51 | import com.adroplat.fist_switch.jni.SubDevice; |
| ... | ... | @@ -107,6 +108,7 @@ import com.xgimi.gimicinema.view.MovieItem; |
| 107 | 108 | import com.xgimi.gimicinema.view.OrderRecyclerView; |
| 108 | 109 | import com.xgimi.smartscreen.SmartScreenBean; |
| 109 | 110 | import com.xgimi.smartscreen.service.ConfigService; |
| 111 | + | |
| 110 | 112 | import org.greenrobot.eventbus.EventBus; |
| 111 | 113 | import org.greenrobot.eventbus.Subscribe; |
| 112 | 114 | import org.greenrobot.eventbus.ThreadMode; |
| ... | ... | @@ -238,8 +240,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 238 | 240 | presenter.load(this); |
| 239 | 241 | Intent intent = new Intent(this, SocketService.class); |
| 240 | 242 | startService(intent); |
| 241 | -// getTimeByCalendar(); | |
| 242 | - | |
| 243 | 243 | // initGetOrderInfo = true; |
| 244 | 244 | // presenter.getOrderInfo(); |
| 245 | 245 | // new Handler().postDelayed(new Runnable() { |
| ... | ... | @@ -535,7 +535,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 535 | 535 | @Override |
| 536 | 536 | public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) { |
| 537 | 537 | this.info = info; |
| 538 | - startActivity(new Intent(this, QrCodeShowActivity.class).putExtra("qr", info.getData().getCode())); | |
| 538 | + startActivity(new Intent(this, QrCodeShowActivity.class) | |
| 539 | + .putExtra("qr", info.getData().getCode()) | |
| 540 | + .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | |
| 541 | + .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn())); | |
| 539 | 542 | } |
| 540 | 543 | |
| 541 | 544 | private RoomInfo roomInfo; | ... | ... |
| ... | ... | @@ -4,12 +4,15 @@ import android.app.Activity; |
| 4 | 4 | import android.os.Bundle; |
| 5 | 5 | import android.os.Handler; |
| 6 | 6 | import android.widget.ImageView; |
| 7 | + | |
| 7 | 8 | import com.gimi.common.cinema.model.MessageEvent; |
| 8 | 9 | import com.gimi.common.cinema.utils.QRCodeUtils; |
| 9 | 10 | import com.gimi.common.cinema.utils.SystemUtils; |
| 10 | 11 | import com.google.zxing.WriterException; |
| 11 | 12 | import com.qnbar.smc.utils.LightOperationUtils; |
| 12 | 13 | import com.xgimi.gimicinema.R; |
| 14 | +import com.xgimi.gimicinema.presenter.QrCodeShowPresent; | |
| 15 | + | |
| 13 | 16 | import org.greenrobot.eventbus.EventBus; |
| 14 | 17 | import org.greenrobot.eventbus.Subscribe; |
| 15 | 18 | import org.greenrobot.eventbus.ThreadMode; |
| ... | ... | @@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode; |
| 17 | 20 | public class QrCodeShowActivity extends Activity { |
| 18 | 21 | public static final int KILL_SELF = 0x9983; |
| 19 | 22 | private Handler handler = new Handler(); |
| 23 | + private QrCodeShowPresent present; | |
| 20 | 24 | |
| 21 | 25 | @Override |
| 22 | 26 | protected void onCreate(Bundle savedInstanceState) { |
| ... | ... | @@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity { |
| 24 | 28 | setContentView(R.layout.activity_qr_code_show); |
| 25 | 29 | EventBus.getDefault().register(this); |
| 26 | 30 | |
| 31 | + present = new QrCodeShowPresent(); | |
| 32 | + | |
| 27 | 33 | final String qr = getIntent().getStringExtra("qr"); |
| 34 | + final String oderSn = getIntent().getStringExtra("order_sn"); | |
| 35 | + final String roomSn = getIntent().getStringExtra("room_sn"); | |
| 28 | 36 | ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); |
| 29 | 37 | try { |
| 30 | 38 | iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); |
| ... | ... | @@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity { |
| 37 | 45 | LightOperationUtils.close(); |
| 38 | 46 | LightOperationUtils.setLightValue(5); |
| 39 | 47 | new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); |
| 48 | + present.reportSleepStatus(oderSn, roomSn); | |
| 49 | + QrCodeShowActivity.this.finish(); | |
| 40 | 50 | } |
| 41 | 51 | }, 20 * 60 * 1000); |
| 42 | 52 | } |
| ... | ... | @@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity { |
| 44 | 54 | @Override |
| 45 | 55 | protected void onDestroy() { |
| 46 | 56 | super.onDestroy(); |
| 57 | + handler.removeCallbacks(null); | |
| 47 | 58 | EventBus.getDefault().unregister(this); |
| 48 | 59 | } |
| 49 | 60 | ... | ... |
| ... | ... | @@ -11,4 +11,6 @@ public interface IRoomInfoModel { |
| 11 | 11 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); |
| 12 | 12 | |
| 13 | 13 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); |
| 14 | + | |
| 15 | + void reportSleepSysStatus(String orderSn,String roomSn, RoomInfoModelImpl.SleepSysStatusListener listener); | |
| 14 | 16 | } | ... | ... |
| ... | ... | @@ -3,6 +3,7 @@ package com.xgimi.gimicinema.model; |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.text.TextUtils; |
| 5 | 5 | import android.util.Log; |
| 6 | + | |
| 6 | 7 | import com.gimi.common.cinema.model.RoomInfo; |
| 7 | 8 | import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 8 | 9 | import com.gimi.common.cinema.model.RoomStatusInfo; |
| ... | ... | @@ -20,31 +21,33 @@ import com.xgimi.gimicinema.application.FangTangApplication; |
| 20 | 21 | public class RoomInfoModelImpl implements IRoomInfoModel { |
| 21 | 22 | // private static final String roomUrl = "https://ft.qnbar.cn/develop/api/"; |
| 22 | 23 | private static String roomUrl = "https://ft.qnbar.cn/test/api/"; |
| 23 | - private static final String FT_ROOT_URL = "https://ft.qnbar.cn/test/api/"; | |
| 24 | + private static final String FT_ROOT_TEST_URL = "https://ft.qnbar.cn/test/api/"; | |
| 24 | 25 | private static final String FT_ROOT_DEVELOP_URL = "https://ft.qnbar.cn/develop/api/"; |
| 25 | 26 | private static String ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; |
| 26 | 27 | private static String ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; |
| 27 | 28 | private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 28 | 29 | private static String ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; |
| 30 | + private static String ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; | |
| 29 | 31 | |
| 30 | 32 | public RoomInfoModelImpl() { |
| 31 | 33 | Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); |
| 32 | 34 | int ftTest = Utils.getInt(applicationContext, "ft-test", 0); |
| 33 | 35 | switch (ftTest) { |
| 34 | 36 | case 0: |
| 35 | - roomUrl = FT_ROOT_URL; | |
| 37 | + roomUrl = FT_ROOT_TEST_URL; | |
| 36 | 38 | break; |
| 37 | 39 | case 1: |
| 38 | 40 | roomUrl = FT_ROOT_DEVELOP_URL; |
| 39 | 41 | break; |
| 40 | 42 | case 2: |
| 41 | - roomUrl = FT_ROOT_URL; | |
| 43 | + roomUrl = FT_ROOT_TEST_URL; | |
| 42 | 44 | break; |
| 43 | 45 | } |
| 44 | 46 | ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; |
| 45 | 47 | ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; |
| 46 | 48 | ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 47 | 49 | ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; |
| 50 | + ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; | |
| 48 | 51 | } |
| 49 | 52 | |
| 50 | 53 | @Override |
| ... | ... | @@ -179,6 +182,25 @@ public class RoomInfoModelImpl implements IRoomInfoModel { |
| 179 | 182 | }); |
| 180 | 183 | } |
| 181 | 184 | |
| 185 | + @Override | |
| 186 | + public void reportSleepSysStatus(String orderSn, String roomSn, final SleepSysStatusListener listener) { | |
| 187 | + Log.d("room-info", "request:reportSleepSysStatus,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn); | |
| 188 | + OkHttpClientManager.getAsyn(ROOM_REPORT_SLEEP_STATUS + orderSn + "&room_sn=" + roomSn, | |
| 189 | + new OkHttpClientManager.ResultCallback<String>() { | |
| 190 | + @Override | |
| 191 | + public void onError(Request request, Exception e) { | |
| 192 | + Log.d("room-info", request.toString() + "," + e.getMessage()); | |
| 193 | + listener.onSleepSuccess(); | |
| 194 | + } | |
| 195 | + | |
| 196 | + @Override | |
| 197 | + public void onResponse(String response) { | |
| 198 | + Log.d("room-info", "reportSleepSysStatus:" + response); | |
| 199 | + listener.onSleepFailure(); | |
| 200 | + } | |
| 201 | + }); | |
| 202 | + } | |
| 203 | + | |
| 182 | 204 | public interface GetRoomInfoListener { |
| 183 | 205 | void onGetRoomInfoSuccess(RoomInfo info); |
| 184 | 206 | |
| ... | ... | @@ -204,4 +226,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { |
| 204 | 226 | |
| 205 | 227 | void onOpenDoorFailure(); |
| 206 | 228 | } |
| 229 | + | |
| 230 | + public interface SleepSysStatusListener { | |
| 231 | + void onSleepSuccess(); | |
| 232 | + | |
| 233 | + void onSleepFailure(); | |
| 234 | + } | |
| 207 | 235 | } | ... | ... |
| ... | ... | @@ -93,13 +93,13 @@ public class MainPresenter extends BasePresenter |
| 93 | 93 | mountSamba(context); |
| 94 | 94 | loadRecommend(context); |
| 95 | 95 | loadClassification(context); |
| 96 | - getVideoAdsPath(context); | |
| 96 | +// getVideoAdsPath(context); | |
| 97 | 97 | |
| 98 | - updatePoster(context); | |
| 99 | - updateVideoInfo(context); | |
| 100 | - updateAgentInfo(context); | |
| 98 | +// updatePoster(context); | |
| 99 | +// updateVideoInfo(context); | |
| 100 | +// updateAgentInfo(context); | |
| 101 | 101 | updateAppVersion(context); |
| 102 | - updateClazz(context); | |
| 102 | +// updateClazz(context); | |
| 103 | 103 | updateDb(context); |
| 104 | 104 | updateRoomInfo(context); |
| 105 | 105 | // mainView.showMsg("abc"); | ... | ... |
| 1 | +package com.xgimi.gimicinema.presenter; | |
| 2 | + | |
| 3 | +import android.util.Log; | |
| 4 | + | |
| 5 | +import com.xgimi.gimicinema.model.IRoomInfoModel; | |
| 6 | +import com.xgimi.gimicinema.model.RoomInfoModelImpl; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by wugian on 2017/5/2 | |
| 10 | + */ | |
| 11 | + | |
| 12 | +public class QrCodeShowPresent { | |
| 13 | + IRoomInfoModel roomInfoModel; | |
| 14 | + | |
| 15 | + public QrCodeShowPresent() { | |
| 16 | + roomInfoModel = new RoomInfoModelImpl(); | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void reportSleepStatus(String orderSn, String roomSn) { | |
| 20 | + roomInfoModel.reportSleepSysStatus(orderSn, roomSn, new RoomInfoModelImpl.SleepSysStatusListener() { | |
| 21 | + @Override | |
| 22 | + public void onSleepSuccess() { | |
| 23 | + Log.d("room-info", "onSleepSuccess"); | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public void onSleepFailure() { | |
| 28 | + Log.d("room-info", "onSleepFailure"); | |
| 29 | + } | |
| 30 | + }); | |
| 31 | + } | |
| 32 | +} | ... | ... |
| ... | ... | @@ -76,7 +76,15 @@ public class CinemaControlService extends Service { |
| 76 | 76 | currentPosition = duration; |
| 77 | 77 | if (saveBeat-- <= 0) { |
| 78 | 78 | //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 |
| 79 | + //TODO 播放一段时间确保状态为关闭 | |
| 79 | 80 | saveBeat = SAVE_BEAT; |
| 81 | + try { | |
| 82 | + if (Lights.getInstance().getByMeshAddress(((FangTangApplication)getApplication()).getConnectDevice().meshAddress).status== ConnectionStatus.ON) { | |
| 83 | + fadeOut(); | |
| 84 | + } | |
| 85 | + } catch (Exception e) { | |
| 86 | + e.printStackTrace(); | |
| 87 | + } | |
| 80 | 88 | } |
| 81 | 89 | } |
| 82 | 90 | ... | ... |
Please
register
or
login
to post a comment