Showing
6 changed files
with
91 additions
and
19 deletions
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | <activity android:name=".activity.AddCActivity"/> |
| 62 | 62 | <activity android:name=".activity.SimpleAdsPlayActivity"/> |
| 63 | 63 | <activity android:name=".activity.SimpleAdsPlayer2"/> |
| 64 | - <activity android:name=".activity.AdsPreVideoPlayerActivity"/> | |
| 64 | + <activity android:name=".activity.AdsPreVideoPlayerActivity" android:launchMode="singleTop"/> | |
| 65 | 65 | <activity android:name=".activity.ImageShowActivity"/> |
| 66 | 66 | <activity android:name=".activity.CheckActivity"/> |
| 67 | 67 | ... | ... |
| ... | ... | @@ -59,14 +59,17 @@ public class SocketService extends Service { |
| 59 | 59 | private static final int ROOM_NOT_EXIST_M = 1002; |
| 60 | 60 | private static final int HEAT_BEAT_RTN = 1003; |
| 61 | 61 | |
| 62 | -// develop | |
| 63 | -// public static final String SERVER_HOST = "10.10.4.6";// "192.168.1.21";// | |
| 64 | -// public static final int SERVER_PORT = 9501; | |
| 65 | - | |
| 66 | -// test | |
| 62 | + // develop | |
| 63 | + public static final String SERVER_HOST_DEVELOP = "10.10.4.6";// "192.168.1.21";// | |
| 64 | + public static final int SERVER_PORT_DEVELOP = 9501; | |
| 65 | + // test | |
| 67 | 66 | public static final String SERVER_HOST = "10.10.4.6";// "192.168.1.21";// |
| 68 | 67 | public static final int SERVER_PORT = 8899; |
| 69 | 68 | |
| 69 | + private String serverHost = SERVER_HOST; | |
| 70 | + private int serverPort = SERVER_PORT; | |
| 71 | + | |
| 72 | + | |
| 70 | 73 | public static final String END_SYMBOL = "\\r\\n\\r\\n";//心跳包内容 |
| 71 | 74 | // public String testRoomSn = "R170413034374"; |
| 72 | 75 | public String testRoomSn = "c"; |
| ... | ... | @@ -120,6 +123,22 @@ public class SocketService extends Service { |
| 120 | 123 | |
| 121 | 124 | @Override |
| 122 | 125 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 126 | + int ftTest = Utils.getInt(this, "ft-test", 0); | |
| 127 | + switch (ftTest) { | |
| 128 | + case 0: | |
| 129 | + serverHost = SERVER_HOST; | |
| 130 | + serverPort = SERVER_PORT; | |
| 131 | + break; | |
| 132 | + case 1: | |
| 133 | + serverHost = SERVER_HOST_DEVELOP; | |
| 134 | + serverPort = SERVER_PORT_DEVELOP; | |
| 135 | + break; | |
| 136 | + case 2: | |
| 137 | + serverHost = SERVER_HOST; | |
| 138 | + serverPort = SERVER_PORT; | |
| 139 | + break; | |
| 140 | + } | |
| 141 | + | |
| 123 | 142 | String roomInfoStr = Utils.getString(this, "room-info"); |
| 124 | 143 | if (!TextUtils.isEmpty(roomInfoStr)) { |
| 125 | 144 | Log.d("room-info", "room info not null"); |
| ... | ... | @@ -169,7 +188,8 @@ public class SocketService extends Service { |
| 169 | 188 | } |
| 170 | 189 | |
| 171 | 190 | private void initSocket() throws IOException {//初始化Socket |
| 172 | - Socket so = new Socket(SERVER_HOST, SERVER_PORT); | |
| 191 | + Log.d(TAG, "serverHost:serverPort:" + serverHost + ":" + serverPort); | |
| 192 | + Socket so = new Socket(serverHost, serverPort); | |
| 173 | 193 | mSocket = new WeakReference<Socket>(so); |
| 174 | 194 | mReadThread = new ReadThread(so); |
| 175 | 195 | mReadThread.start(); | ... | ... |
| ... | ... | @@ -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,8 @@ 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 | - presenter.getOrderInfo(); | |
| 243 | +// initGetOrderInfo = true; | |
| 244 | +// presenter.getOrderInfo(); | |
| 243 | 245 | // new Handler().postDelayed(new Runnable() { |
| 244 | 246 | // @Override |
| 245 | 247 | // public void run() { |
| ... | ... | @@ -249,6 +251,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 249 | 251 | // }, 5 * 1000); |
| 250 | 252 | } |
| 251 | 253 | |
| 254 | + private boolean initGetOrderInfo; | |
| 255 | + | |
| 252 | 256 | public void getTimeByCalendar() { |
| 253 | 257 | Calendar cal = Calendar.getInstance(); |
| 254 | 258 | int year = cal.get(Calendar.YEAR);//获取年份 |
| ... | ... | @@ -456,7 +460,16 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 456 | 460 | private RoomStatusInfo roomStatusInfo; |
| 457 | 461 | |
| 458 | 462 | @Override |
| 463 | + public void updateInitGetOrder(boolean b) { | |
| 464 | + initGetOrderInfo = false; | |
| 465 | + } | |
| 466 | + | |
| 467 | + @Override | |
| 459 | 468 | public void updateOrderInfo(RoomStatusInfo info) { |
| 469 | + if (initGetOrderInfo) { | |
| 470 | + show("你已有订单存在,正在为你播放"); | |
| 471 | + initGetOrderInfo = false; | |
| 472 | + } | |
| 460 | 473 | roomStatusInfo = info; |
| 461 | 474 | RoomStatusInfo.DataEntity data = info.getData(); |
| 462 | 475 | int offset = data.getNow_time() - data.getBegin_time(); |
| ... | ... | @@ -524,8 +537,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 524 | 537 | this.info = info; |
| 525 | 538 | startActivity(new Intent(this, QrCodeShowActivity.class) |
| 526 | 539 | .putExtra("qr", info.getData().getCode()) |
| 527 | - .putExtra("room_sn",roomInfo.getData().getRoom_sn()) | |
| 528 | - .putExtra("order_sn",roomStatusInfo.getData().getOrder_sn())); | |
| 540 | + .putExtra("room_sn", roomInfo.getData().getRoom_sn()) | |
| 541 | + .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn())); | |
| 529 | 542 | } |
| 530 | 543 | |
| 531 | 544 | private RoomInfo roomInfo; | ... | ... |
| ... | ... | @@ -19,13 +19,36 @@ import com.xgimi.gimicinema.application.FangTangApplication; |
| 19 | 19 | * Created by wugian on 2017/4/7 |
| 20 | 20 | */ |
| 21 | 21 | public class RoomInfoModelImpl implements IRoomInfoModel { |
| 22 | - // private static final String ROOT_URL = "https://ft.qnbar.cn/develop/api/"; | |
| 23 | - private static final String ROOT_URL = "https://ft.qnbar.cn/test/api/"; | |
| 24 | - private static final String ROOM_INFO_BY_IMEI_URL = ROOT_URL + "tcp/getRoomInfoByimei?imei="; | |
| 25 | - private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn="; | |
| 26 | - private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn="; | |
| 27 | - private static final String ROOM_REPORT_ROOM_STATUS = ROOT_URL + "tcp/reportRoomStatus?order_sn="; | |
| 28 | - private static final String ROOM_REPORT_SLEEP_STATUS = ROOT_URL + "tcp/recvSleepCmdTimeout?order_sn="; | |
| 22 | + // private static final String roomUrl = "https://ft.qnbar.cn/develop/api/"; | |
| 23 | + private static String roomUrl = "https://ft.qnbar.cn/test/api/"; | |
| 24 | + private static final String FT_ROOT_TEST_URL = "https://ft.qnbar.cn/test/api/"; | |
| 25 | + private static final String FT_ROOT_DEVELOP_URL = "https://ft.qnbar.cn/develop/api/"; | |
| 26 | + private static String ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; | |
| 27 | + private static String ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; | |
| 28 | + private static String ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?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="; | |
| 31 | + | |
| 32 | + public RoomInfoModelImpl() { | |
| 33 | + Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); | |
| 34 | + int ftTest = Utils.getInt(applicationContext, "ft-test", 0); | |
| 35 | + switch (ftTest) { | |
| 36 | + case 0: | |
| 37 | + roomUrl = FT_ROOT_TEST_URL; | |
| 38 | + break; | |
| 39 | + case 1: | |
| 40 | + roomUrl = FT_ROOT_DEVELOP_URL; | |
| 41 | + break; | |
| 42 | + case 2: | |
| 43 | + roomUrl = FT_ROOT_TEST_URL; | |
| 44 | + break; | |
| 45 | + } | |
| 46 | + ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; | |
| 47 | + ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; | |
| 48 | + ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | |
| 49 | + ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | |
| 50 | + ROOM_REPORT_SLEEP_STATUS = roomUrl + "tcp/recvSleepCmdTimeout?order_sn="; | |
| 51 | + } | |
| 29 | 52 | |
| 30 | 53 | @Override |
| 31 | 54 | public void getRoomInfo(String imei, boolean needUpdate, final GetRoomInfoListener listener) { | ... | ... |
| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 | package com.xgimi.gimicinema.mview; |
| 17 | 17 | |
| 18 | 18 | import android.graphics.Bitmap; |
| 19 | - | |
| 20 | 19 | import com.gimi.common.cinema.model.ClassificationItem; |
| 21 | 20 | import com.gimi.common.cinema.model.LocalMovieMessage; |
| 22 | 21 | import com.gimi.common.cinema.model.RoomInfo; |
| ... | ... | @@ -59,6 +58,8 @@ public interface IMainView { |
| 59 | 58 | |
| 60 | 59 | void updateOrderInfo(RoomStatusInfo info); |
| 61 | 60 | |
| 61 | + void updateInitGetOrder(boolean b); | |
| 62 | + | |
| 62 | 63 | void prepareRoomQrCodeInfo(RoomQrCodeInfo info); |
| 63 | 64 | |
| 64 | 65 | void notifyGetRoomInfo(RoomInfo info); | ... | ... |
| ... | ... | @@ -48,6 +48,9 @@ public class CinemaControlService extends Service { |
| 48 | 48 | private long currentPosition = 0; |
| 49 | 49 | private int currentState = 0; |
| 50 | 50 | private String currentPath = null; |
| 51 | + // private static final int SAVE_BEAT = 500; | |
| 52 | + private static final int SAVE_BEAT = 100;//default 500 | |
| 53 | + private int saveBeat = SAVE_BEAT; | |
| 51 | 54 | |
| 52 | 55 | private final ICinemaControl.Stub cinemaControl = new ICinemaControl.Stub() { |
| 53 | 56 | |
| ... | ... | @@ -71,6 +74,18 @@ public class CinemaControlService extends Service { |
| 71 | 74 | public void setCurrentMoviePosition(long duration) throws RemoteException { |
| 72 | 75 | // Log.d("aidl", "setCurrentMoviePosition: " + duration); |
| 73 | 76 | currentPosition = duration; |
| 77 | + if (saveBeat-- <= 0) { | |
| 78 | + //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 | |
| 79 | + //TODO 播放一段时间确保状态为关闭 | |
| 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 | + } | |
| 88 | + } | |
| 74 | 89 | } |
| 75 | 90 | |
| 76 | 91 | @Override | ... | ... |
Please
register
or
login
to post a comment