Showing
6 changed files
with
77 additions
and
14 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(); | ... | ... |
| ... | ... | @@ -239,6 +239,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen |
| 239 | 239 | Intent intent = new Intent(this, SocketService.class); |
| 240 | 240 | startService(intent); |
| 241 | 241 | // getTimeByCalendar(); |
| 242 | + | |
| 243 | +// initGetOrderInfo = true; | |
| 242 | 244 | // presenter.getOrderInfo(); |
| 243 | 245 | // new Handler().postDelayed(new Runnable() { |
| 244 | 246 | // @Override |
| ... | ... | @@ -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(); | ... | ... |
| ... | ... | @@ -18,12 +18,34 @@ import com.xgimi.gimicinema.application.FangTangApplication; |
| 18 | 18 | * Created by wugian on 2017/4/7 |
| 19 | 19 | */ |
| 20 | 20 | public class RoomInfoModelImpl implements IRoomInfoModel { |
| 21 | - // private static final String ROOT_URL = "https://ft.qnbar.cn/develop/api/"; | |
| 22 | - private static final String ROOT_URL = "https://ft.qnbar.cn/test/api/"; | |
| 23 | - private static final String ROOM_INFO_BY_IMEI_URL = ROOT_URL + "tcp/getRoomInfoByimei?imei="; | |
| 24 | - private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn="; | |
| 25 | - private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn="; | |
| 26 | - private static final String ROOM_REPORT_ROOM_STATUS = ROOT_URL + "tcp/reportRoomStatus?order_sn="; | |
| 21 | + // 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 final String FT_ROOT_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 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_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | |
| 28 | + private static String ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | |
| 29 | + | |
| 30 | + public RoomInfoModelImpl() { | |
| 31 | + Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); | |
| 32 | + int ftTest = Utils.getInt(applicationContext, "ft-test", 0); | |
| 33 | + switch (ftTest) { | |
| 34 | + case 0: | |
| 35 | + roomUrl = FT_ROOT_URL; | |
| 36 | + break; | |
| 37 | + case 1: | |
| 38 | + roomUrl = FT_ROOT_DEVELOP_URL; | |
| 39 | + break; | |
| 40 | + case 2: | |
| 41 | + roomUrl = FT_ROOT_URL; | |
| 42 | + break; | |
| 43 | + } | |
| 44 | + ROOM_INFO_BY_IMEI_URL = roomUrl + "tcp/getRoomInfoByimei?imei="; | |
| 45 | + ROOM_STATUS_BY_ROOM_SN_URL = roomUrl + "tcp/getRoomStatus?room_sn="; | |
| 46 | + ROOM_QRCODE_BY_ORDER_SN = roomUrl + "tcp/getEndQRCode?order_sn="; | |
| 47 | + ROOM_REPORT_ROOM_STATUS = roomUrl + "tcp/reportRoomStatus?order_sn="; | |
| 48 | + } | |
| 27 | 49 | |
| 28 | 50 | @Override |
| 29 | 51 | 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,10 @@ 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 | + saveBeat = SAVE_BEAT; | |
| 80 | + } | |
| 74 | 81 | } |
| 75 | 82 | |
| 76 | 83 | @Override | ... | ... |
Please
register
or
login
to post a comment