Commit 398e28896128824a5dd6a05cc025706b43c3b233

Authored by wugian
1 parent e099c4c1

udpate md5 of movie,fix qr code not update

... ... @@ -147,7 +147,7 @@
147 147 <service android:name="com.xgimi.smartscreen.service.ConfigService"/>
148 148 <service android:name=".poll.PollingServiceDemo"/>
149 149
150   - <activity android:name=".activity.QrCodeShowActivity"><!-- android:launchMode="singleTop"-->
  150 + <activity android:name=".activity.QrCodeShowActivity" android:launchMode="singleTop"><!-- android:launchMode="singleTop"-->
151 151 </activity>
152 152 <activity android:name=".activity.ConfigWifiActivity">
153 153 </activity>
... ...
... ... @@ -283,7 +283,7 @@ public class LocalMovieScanUtils {
283 283 if (!TextUtils.isEmpty(media)) {
284 284 File mFile = new File(media);
285 285 long length = mFile.length();
286   - moviesItem.setMd5(MD5Utils.stringMD5(length + ""));
  286 + moviesItem.setMd5(MD5Utils.stringMD5(FileHashUtils.getFileHash(media)));
287 287 //read douban id and douban msg,至于name id 信息另外做,没有必要每次更新时都去添加
288 288 try {
289 289 setDoubanMsg(curPath, moviesItem);
... ...
... ... @@ -23,7 +23,7 @@ public class MD5Utils {
23 23
24 24 public static String byteArrayToHex(byte[] byteArray) {
25 25 // 首先初始化一个字符数组,用来存放每个16进制字符
26   - char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  26 + char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
27 27 // new一个字符数组,这个就是用来组成结果字符串的(解释一下:一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方))
28 28 char[] resultCharArray = new char[byteArray.length * 2];
29 29 // 遍历字节数组,通过位运算(位运算效率高),转换成字符放到字符数组中去
... ...
... ... @@ -7,7 +7,6 @@ import android.os.IBinder;
7 7 import android.text.TextUtils;
8 8 import android.util.Log;
9 9 import android.widget.Toast;
10   -
11 10 import com.gimi.common.cinema.model.MessageEvent;
12 11 import com.gimi.common.cinema.model.RoomInfo;
13 12 import com.gimi.common.cinema.utils.SystemUtils;
... ... @@ -18,7 +17,6 @@ import com.qnbar.smc.utils.LightOperationUtils;
18 17 import com.xgimi.gimicinema.activity.QrCodeShowActivity;
19 18 import com.xgimi.gimicinema.application.FangTangApplication;
20 19 import com.xgimi.smartscreen.encrypt.AuthCode;
21   -
22 20 import org.greenrobot.eventbus.EventBus;
23 21
24 22 import java.io.IOException;
... ... @@ -63,7 +61,7 @@ public class SocketService extends Service {
63 61
64 62 // online
65 63 public static final String SERVER_HOST_ONLINE = "conn.ft.qnbar.com";// "192.168.1.21";//
66   - public static final int SERVER_PORT_ONLINE= 8899;
  64 + public static final int SERVER_PORT_ONLINE = 8899;
67 65
68 66 // develop
69 67 public static final String SERVER_HOST_DEVELOP = "10.10.4.6";// "192.168.1.21";//
... ... @@ -307,8 +305,8 @@ public class SocketService extends Service {
307 305 LightOperationUtils.open();
308 306 LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
309 307 }
  308 + sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when new user come in");
310 309 if (socketResponse.getData().getFirst() == 1) {
311   - sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when new user come in");
312 310 // LightOperationUtils.open();
313 311 // LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
314 312 sendMessage(USER_OPEN_DOOR_AND_GET_MOVIE, "user first open the door");
... ... @@ -318,6 +316,7 @@ public class SocketService extends Service {
318 316 break;
319 317 case 20:
320 318 if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {
  319 + Log.d("LightOperationUtils", "admin open light");
321 320 LightOperationUtils.open();
322 321 LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
323 322 }
... ... @@ -331,8 +330,9 @@ public class SocketService extends Service {
331 330 break;
332 331 }
333 332 } else if (socketResponse.getCmd() == CLEAN_OVER) {
334   - LightOperationUtils.close();
  333 + Log.d("LightOperationUtils", "admin clean over close light");
335 334 LightOperationUtils.setLightValue(5);
  335 + LightOperationUtils.close();
336 336 new SystemUtils().closeFtLed(context.getApplicationContext());
337 337 sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when clean over");
338 338 }
... ...
... ... @@ -45,7 +45,6 @@ import android.widget.ImageView;
45 45 import android.widget.RelativeLayout;
46 46 import android.widget.ScrollView;
47 47 import android.widget.Toast;
48   -
49 48 import com.adroplat.fist_switch.jni.Device;
50 49 import com.adroplat.fist_switch.jni.FistJni;
51 50 import com.adroplat.fist_switch.jni.SubDevice;
... ... @@ -108,7 +107,6 @@ import com.xgimi.gimicinema.view.MovieItem;
108 107 import com.xgimi.gimicinema.view.OrderRecyclerView;
109 108 import com.xgimi.smartscreen.SmartScreenBean;
110 109 import com.xgimi.smartscreen.service.ConfigService;
111   -
112 110 import org.greenrobot.eventbus.EventBus;
113 111 import org.greenrobot.eventbus.Subscribe;
114 112 import org.greenrobot.eventbus.ThreadMode;
... ... @@ -249,6 +247,9 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
249 247 // openDoor();
250 248 // }
251 249 // }, 5 * 1000);
  250 +
  251 +// Constant.count = 3;
  252 +// PollingUtils.startPollingService(context, 60, CountService.class, CountService.STATUS_ACTION);
252 253 }
253 254
254 255 private boolean initGetOrderInfo;
... ... @@ -535,11 +536,12 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
535 536 @Override
536 537 public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) {
537 538 this.info = info;
538   - try {
539   - new SystemUtils().stopMediaPlayer(context.getApplicationContext());
540   - } catch (Exception e) {
541   - e.printStackTrace();
542   - }
  539 +// try {
  540 +// PollingUtils.startPollingService(context, 60, CountService.class, CountService.STATUS_ACTION);
  541 +//// new SystemUtils().stopMediaPlayer(context.getApplicationContext());
  542 +// } catch (Exception e) {
  543 +// e.printStackTrace();
  544 +// }
543 545 Intent intent = new Intent(this, QrCodeShowActivity.class)
544 546 .putExtra("qr", info.getData().getCode())
545 547 .putExtra("room_sn", roomInfo.getData().getRoom_sn())
... ... @@ -547,8 +549,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
547 549 if ("count_service".equals(countMsg)) {
548 550 intent.putExtra("count_call", true);
549 551 }
550   - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
551   - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  552 +// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  553 +// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
552 554 startActivity(intent);
553 555 }
554 556
... ... @@ -1076,6 +1078,11 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
1076 1078 // if (info == null || info.getData() == null) {
1077 1079 // break;
1078 1080 // }
  1081 + try {
  1082 + PollingUtils.stopPollingService(context, CountService.class, CountService.STATUS_ACTION);
  1083 + } catch (Exception e) {
  1084 + e.printStackTrace();
  1085 + }
1079 1086 if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) {
1080 1087 if (System.currentTimeMillis() - lastRequest > 3000) {
1081 1088 lastRequest = System.currentTimeMillis();
... ... @@ -1083,8 +1090,22 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
1083 1090 presenter.getCleanQrCode(roomStatusInfo.getData().getOrder_sn(), roomInfo.getData().getRoom_sn());
1084 1091 }
1085 1092 } else {
1086   - Log.d("room-info", "roomStatusInfo is Null:" + (roomStatusInfo == null) +
1087   - ",roomInfo is Null:" + (roomInfo == null));
  1093 + String msg = "roomStatusInfo is Null:" + (roomStatusInfo == null) +
  1094 + ",roomInfo is Null:" + (roomInfo == null);
  1095 + Log.d("room-info", msg);
  1096 + Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
  1097 +//
  1098 +// Intent intent = new Intent(this, QrCodeShowActivity.class)
  1099 +// .putExtra("qr", "info.getData().getCode()")
  1100 +// .putExtra("room_sn", "roomInfo.getData().getRoom_sn()")
  1101 +// .putExtra("order_sn", "roomStatusInfo.getData().getOrder_sn()");
  1102 +// countMsg = messageEvent.getMessage();
  1103 +// if ("count_service".equals(countMsg)) {
  1104 +// intent.putExtra("count_call", true);
  1105 +// }
  1106 +//// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  1107 +//// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  1108 +// startActivity(intent);
1088 1109 }
1089 1110 // startActivity(new Intent(this, QrCodeShowActivity.class).putExtra("qr", "updateOrderInfo"));
1090 1111 break;
... ...
... ... @@ -21,7 +21,6 @@ import android.graphics.Bitmap;
21 21 import android.text.TextUtils;
22 22 import android.util.Log;
23 23 import android.widget.Toast;
24   -
25 24 import com.gimi.common.cinema.model.ClassificationItem;
26 25 import com.gimi.common.cinema.model.LocalMovieMessage;
27 26 import com.gimi.common.cinema.model.RoomInfo;
... ... @@ -103,9 +102,12 @@ public class MainPresenter extends BasePresenter
103 102 // updateAgentInfo(context);
104 103 updateAppVersion(context);
105 104 // updateClazz(context);
106   -// updateDb(context);
  105 + updateDb(context);
107 106 updateRoomInfo(context);
108 107 // mainView.showMsg("abc");
  108 +// Log.d("md5",
  109 +// MD5Utils.stringMD5("33a73b00a8c75c84b293f6315bf2fb4a;90da84523af883703445dc2f9d0c0ebf;aad66db552528b20498574b78eeabda7;bdda96604884f57b33c48c5105faa53ca"))
  110 +// ;
109 111 }
110 112
111 113 private void updateAgentInfo(Context context) {
... ...
... ... @@ -24,7 +24,6 @@ import android.os.IBinder;
24 24 import android.os.RemoteException;
25 25 import android.util.Log;
26 26 import android.widget.Toast;
27   -
28 27 import com.gimi.common.cinema.model.Constant;
29 28 import com.gimi.common.cinema.model.MessageEvent;
30 29 import com.gimi.common.cinema.utils.Utils;
... ... @@ -35,7 +34,6 @@ import com.telink.bluetooth.light.ConnectionStatus;
35 34 import com.telink.bluetooth.light.DeviceInfo;
36 35 import com.xgimi.gimicinema.ICinemaControl;
37 36 import com.xgimi.gimicinema.application.FangTangApplication;
38   -
39 37 import org.greenrobot.eventbus.EventBus;
40 38
41 39 import java.util.ArrayList;
... ... @@ -331,11 +329,14 @@ public class CinemaControlService extends Service {
331 329 }
332 330
333 331 private void showQrCodeRightNow() {
334   - Constant.count = -1;
335   -// PollingUtils.stopPollingService();
336   - MessageEvent messageEvent = new MessageEvent();
337   - messageEvent.setEventId(COUNT_DOWN_ZERO);
338   - messageEvent.setMessage("CinemaControlService,记数为0");
339   - EventBus.getDefault().post(messageEvent);
  332 + if (duration - currentPosition < 1000 * 60) {
  333 + Constant.count = -1;
  334 + MessageEvent messageEvent = new MessageEvent();
  335 + messageEvent.setEventId(COUNT_DOWN_ZERO);
  336 + messageEvent.setMessage("CinemaControlService,记数为0");
  337 + EventBus.getDefault().post(messageEvent);
  338 + } else {
  339 + Log.d("room-info", "stop media but not completed");
  340 + }
340 341 }
341 342 }
... ...
Please register or login to post a comment