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,6 +45,7 @@ import android.widget.ImageView; | ||
| 45 | import android.widget.RelativeLayout; | 45 | import android.widget.RelativeLayout; |
| 46 | import android.widget.ScrollView; | 46 | import android.widget.ScrollView; |
| 47 | import android.widget.Toast; | 47 | import android.widget.Toast; |
| 48 | + | ||
| 48 | import com.adroplat.fist_switch.jni.Device; | 49 | import com.adroplat.fist_switch.jni.Device; |
| 49 | import com.adroplat.fist_switch.jni.FistJni; | 50 | import com.adroplat.fist_switch.jni.FistJni; |
| 50 | import com.adroplat.fist_switch.jni.SubDevice; | 51 | import com.adroplat.fist_switch.jni.SubDevice; |
| @@ -107,6 +108,7 @@ import com.xgimi.gimicinema.view.MovieItem; | @@ -107,6 +108,7 @@ import com.xgimi.gimicinema.view.MovieItem; | ||
| 107 | import com.xgimi.gimicinema.view.OrderRecyclerView; | 108 | import com.xgimi.gimicinema.view.OrderRecyclerView; |
| 108 | import com.xgimi.smartscreen.SmartScreenBean; | 109 | import com.xgimi.smartscreen.SmartScreenBean; |
| 109 | import com.xgimi.smartscreen.service.ConfigService; | 110 | import com.xgimi.smartscreen.service.ConfigService; |
| 111 | + | ||
| 110 | import org.greenrobot.eventbus.EventBus; | 112 | import org.greenrobot.eventbus.EventBus; |
| 111 | import org.greenrobot.eventbus.Subscribe; | 113 | import org.greenrobot.eventbus.Subscribe; |
| 112 | import org.greenrobot.eventbus.ThreadMode; | 114 | import org.greenrobot.eventbus.ThreadMode; |
| @@ -238,8 +240,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -238,8 +240,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 238 | presenter.load(this); | 240 | presenter.load(this); |
| 239 | Intent intent = new Intent(this, SocketService.class); | 241 | Intent intent = new Intent(this, SocketService.class); |
| 240 | startService(intent); | 242 | startService(intent); |
| 241 | -// getTimeByCalendar(); | ||
| 242 | - | ||
| 243 | // initGetOrderInfo = true; | 243 | // initGetOrderInfo = true; |
| 244 | // presenter.getOrderInfo(); | 244 | // presenter.getOrderInfo(); |
| 245 | // new Handler().postDelayed(new Runnable() { | 245 | // new Handler().postDelayed(new Runnable() { |
| @@ -535,7 +535,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -535,7 +535,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 535 | @Override | 535 | @Override |
| 536 | public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) { | 536 | public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) { |
| 537 | this.info = info; | 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 | private RoomInfo roomInfo; | 544 | private RoomInfo roomInfo; |
| @@ -4,12 +4,15 @@ import android.app.Activity; | @@ -4,12 +4,15 @@ 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.widget.ImageView; | 6 | import android.widget.ImageView; |
| 7 | + | ||
| 7 | import com.gimi.common.cinema.model.MessageEvent; | 8 | import com.gimi.common.cinema.model.MessageEvent; |
| 8 | import com.gimi.common.cinema.utils.QRCodeUtils; | 9 | import com.gimi.common.cinema.utils.QRCodeUtils; |
| 9 | import com.gimi.common.cinema.utils.SystemUtils; | 10 | import com.gimi.common.cinema.utils.SystemUtils; |
| 10 | import com.google.zxing.WriterException; | 11 | import com.google.zxing.WriterException; |
| 11 | import com.qnbar.smc.utils.LightOperationUtils; | 12 | import com.qnbar.smc.utils.LightOperationUtils; |
| 12 | import com.xgimi.gimicinema.R; | 13 | import com.xgimi.gimicinema.R; |
| 14 | +import com.xgimi.gimicinema.presenter.QrCodeShowPresent; | ||
| 15 | + | ||
| 13 | import org.greenrobot.eventbus.EventBus; | 16 | import org.greenrobot.eventbus.EventBus; |
| 14 | import org.greenrobot.eventbus.Subscribe; | 17 | import org.greenrobot.eventbus.Subscribe; |
| 15 | import org.greenrobot.eventbus.ThreadMode; | 18 | import org.greenrobot.eventbus.ThreadMode; |
| @@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode; | @@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode; | ||
| 17 | public class QrCodeShowActivity extends Activity { | 20 | public class QrCodeShowActivity extends Activity { |
| 18 | public static final int KILL_SELF = 0x9983; | 21 | public static final int KILL_SELF = 0x9983; |
| 19 | private Handler handler = new Handler(); | 22 | private Handler handler = new Handler(); |
| 23 | + private QrCodeShowPresent present; | ||
| 20 | 24 | ||
| 21 | @Override | 25 | @Override |
| 22 | protected void onCreate(Bundle savedInstanceState) { | 26 | protected void onCreate(Bundle savedInstanceState) { |
| @@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity { | @@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity { | ||
| 24 | setContentView(R.layout.activity_qr_code_show); | 28 | setContentView(R.layout.activity_qr_code_show); |
| 25 | EventBus.getDefault().register(this); | 29 | EventBus.getDefault().register(this); |
| 26 | 30 | ||
| 31 | + present = new QrCodeShowPresent(); | ||
| 32 | + | ||
| 27 | final String qr = getIntent().getStringExtra("qr"); | 33 | final String qr = getIntent().getStringExtra("qr"); |
| 34 | + final String oderSn = getIntent().getStringExtra("order_sn"); | ||
| 35 | + final String roomSn = getIntent().getStringExtra("room_sn"); | ||
| 28 | ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); | 36 | ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); |
| 29 | try { | 37 | try { |
| 30 | iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); | 38 | iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); |
| @@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity { | @@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity { | ||
| 37 | LightOperationUtils.close(); | 45 | LightOperationUtils.close(); |
| 38 | LightOperationUtils.setLightValue(5); | 46 | LightOperationUtils.setLightValue(5); |
| 39 | new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); | 47 | new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); |
| 48 | + present.reportSleepStatus(oderSn, roomSn); | ||
| 49 | + QrCodeShowActivity.this.finish(); | ||
| 40 | } | 50 | } |
| 41 | }, 20 * 60 * 1000); | 51 | }, 20 * 60 * 1000); |
| 42 | } | 52 | } |
| @@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity { | @@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity { | ||
| 44 | @Override | 54 | @Override |
| 45 | protected void onDestroy() { | 55 | protected void onDestroy() { |
| 46 | super.onDestroy(); | 56 | super.onDestroy(); |
| 57 | + handler.removeCallbacks(null); | ||
| 47 | EventBus.getDefault().unregister(this); | 58 | EventBus.getDefault().unregister(this); |
| 48 | } | 59 | } |
| 49 | 60 |
| @@ -11,4 +11,6 @@ public interface IRoomInfoModel { | @@ -11,4 +11,6 @@ public interface IRoomInfoModel { | ||
| 11 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); | 11 | void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); |
| 12 | 12 | ||
| 13 | void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); | 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,6 +3,7 @@ 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 | + | ||
| 6 | import com.gimi.common.cinema.model.RoomInfo; | 7 | import com.gimi.common.cinema.model.RoomInfo; |
| 7 | import com.gimi.common.cinema.model.RoomQrCodeInfo; | 8 | import com.gimi.common.cinema.model.RoomQrCodeInfo; |
| 8 | import com.gimi.common.cinema.model.RoomStatusInfo; | 9 | import com.gimi.common.cinema.model.RoomStatusInfo; |
| @@ -20,31 +21,33 @@ import com.xgimi.gimicinema.application.FangTangApplication; | @@ -20,31 +21,33 @@ import com.xgimi.gimicinema.application.FangTangApplication; | ||
| 20 | public class RoomInfoModelImpl implements IRoomInfoModel { | 21 | public class RoomInfoModelImpl implements IRoomInfoModel { |
| 21 | // private static final String roomUrl = "https://ft.qnbar.cn/develop/api/"; | 22 | // private static final String roomUrl = "https://ft.qnbar.cn/develop/api/"; |
| 22 | private static String roomUrl = "https://ft.qnbar.cn/test/api/"; | 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 | private static final String FT_ROOT_DEVELOP_URL = "https://ft.qnbar.cn/develop/api/"; | 25 | private static final String FT_ROOT_DEVELOP_URL = "https://ft.qnbar.cn/develop/api/"; |
| 25 | private static String ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; | 26 | private static String ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; |
| 26 | private static String ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; | 27 | private static String ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; |
| 27 | private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | 28 | private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 28 | private static String ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | 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 | public RoomInfoModelImpl() { | 32 | public RoomInfoModelImpl() { |
| 31 | Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); | 33 | Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); |
| 32 | int ftTest = Utils.getInt(applicationContext, "ft-test", 0); | 34 | int ftTest = Utils.getInt(applicationContext, "ft-test", 0); |
| 33 | switch (ftTest) { | 35 | switch (ftTest) { |
| 34 | case 0: | 36 | case 0: |
| 35 | - roomUrl = FT_ROOT_URL; | 37 | + roomUrl = FT_ROOT_TEST_URL; |
| 36 | break; | 38 | break; |
| 37 | case 1: | 39 | case 1: |
| 38 | roomUrl = FT_ROOT_DEVELOP_URL; | 40 | roomUrl = FT_ROOT_DEVELOP_URL; |
| 39 | break; | 41 | break; |
| 40 | case 2: | 42 | case 2: |
| 41 | - roomUrl = FT_ROOT_URL; | 43 | + roomUrl = FT_ROOT_TEST_URL; |
| 42 | break; | 44 | break; |
| 43 | } | 45 | } |
| 44 | ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; | 46 | ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; |
| 45 | ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; | 47 | ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; |
| 46 | ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | 48 | ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; |
| 47 | ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | 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 | @Override | 53 | @Override |
| @@ -179,6 +182,25 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -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 | public interface GetRoomInfoListener { | 204 | public interface GetRoomInfoListener { |
| 183 | void onGetRoomInfoSuccess(RoomInfo info); | 205 | void onGetRoomInfoSuccess(RoomInfo info); |
| 184 | 206 | ||
| @@ -204,4 +226,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | @@ -204,4 +226,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 204 | 226 | ||
| 205 | void onOpenDoorFailure(); | 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,13 +93,13 @@ public class MainPresenter extends BasePresenter | ||
| 93 | mountSamba(context); | 93 | mountSamba(context); |
| 94 | loadRecommend(context); | 94 | loadRecommend(context); |
| 95 | loadClassification(context); | 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 | updateAppVersion(context); | 101 | updateAppVersion(context); |
| 102 | - updateClazz(context); | 102 | +// updateClazz(context); |
| 103 | updateDb(context); | 103 | updateDb(context); |
| 104 | updateRoomInfo(context); | 104 | updateRoomInfo(context); |
| 105 | // mainView.showMsg("abc"); | 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,7 +76,15 @@ public class CinemaControlService extends Service { | ||
| 76 | currentPosition = duration; | 76 | currentPosition = duration; |
| 77 | if (saveBeat-- <= 0) { | 77 | if (saveBeat-- <= 0) { |
| 78 | //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 | 78 | //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 |
| 79 | + //TODO 播放一段时间确保状态为关闭 | ||
| 79 | saveBeat = SAVE_BEAT; | 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