Showing
19 changed files
with
737 additions
and
86 deletions
| @@ -104,7 +104,7 @@ android { | @@ -104,7 +104,7 @@ android { | ||
| 104 | 104 | ||
| 105 | if (variant.buildType.name.equals('release')) { | 105 | if (variant.buildType.name.equals('release')) { |
| 106 | def fileName = output.outputFile.name.replace(output.outputFile.name, | 106 | def fileName = output.outputFile.name.replace(output.outputFile.name, |
| 107 | - /*variant.productFlavors[0].name*/"方糖" + "-v${variant.versionCode}-${releaseTime()}.apk") | 107 | + /*variant.productFlavors[0].name*/ "方糖" + "-v${variant.versionCode}-${releaseTime()}.apk") |
| 108 | output.outputFile = new File(output.outputFile.parent, fileName) | 108 | output.outputFile = new File(output.outputFile.parent, fileName) |
| 109 | // release to test folder | 109 | // release to test folder |
| 110 | println fileName | 110 | println fileName |
| @@ -142,12 +142,13 @@ dependencies { | @@ -142,12 +142,13 @@ dependencies { | ||
| 142 | compile group: 'com.google.code.gson', name: 'gson', version: '2.7' | 142 | compile group: 'com.google.code.gson', name: 'gson', version: '2.7' |
| 143 | compile group: 'com.google.zxing', name: 'core', version: '3.3.0' | 143 | compile group: 'com.google.zxing', name: 'core', version: '3.3.0' |
| 144 | // compile group: 'com.umeng.analytics', name: 'umeng-analytics', version: '5.4.1' | 144 | // compile group: 'com.umeng.analytics', name: 'umeng-analytics', version: '5.4.1' |
| 145 | - compile 'com.umeng.analytics:analytics:latest.integration' | ||
| 146 | compile group: 'com.nineoldandroids', name: 'library', version: '2.4.0' | 145 | compile group: 'com.nineoldandroids', name: 'library', version: '2.4.0' |
| 147 | compile group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.0.2' | 146 | compile group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.0.2' |
| 148 | compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.0.2' | 147 | compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.0.2' |
| 148 | + // compile 'com.android.support:support-v4:25.2.0' | ||
| 149 | + compile 'com.umeng.analytics:analytics:latest.integration' | ||
| 149 | compile 'org.greenrobot:eventbus:3.0.0' | 150 | compile 'org.greenrobot:eventbus:3.0.0' |
| 150 | -// compile 'com.android.support:support-v4:25.2.0' | 151 | + compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4' |
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | def getPwd(modifyPwd) { | 154 | def getPwd(modifyPwd) { |
| @@ -198,7 +199,7 @@ task getType() { | @@ -198,7 +199,7 @@ task getType() { | ||
| 198 | def pwd2 = System.getProperty('os.name').toLowerCase().contains('windows') | 199 | def pwd2 = System.getProperty('os.name').toLowerCase().contains('windows') |
| 199 | 200 | ||
| 200 | 201 | ||
| 201 | - println pwd + " fuck " + windows+" seek "+ pwd1+" seek "+ pwd2 | 202 | + println pwd + " fuck " + windows + " seek " + pwd1 + " seek " + pwd2 |
| 202 | } | 203 | } |
| 203 | 204 | ||
| 204 | task('gitCommit') << { | 205 | task('gitCommit') << { |
| @@ -14,13 +14,11 @@ | @@ -14,13 +14,11 @@ | ||
| 14 | <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/> | 14 | <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/> |
| 15 | <uses-permission android:name="android.permission.BLUETOOTH"/> | 15 | <uses-permission android:name="android.permission.BLUETOOTH"/> |
| 16 | <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | 16 | <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> |
| 17 | - | ||
| 18 | <uses-permission | 17 | <uses-permission |
| 19 | android:name="android.permission.FORCE_STOP_PACKAGES" | 18 | android:name="android.permission.FORCE_STOP_PACKAGES" |
| 20 | tools:ignore="ProtectedPermissions"/> | 19 | tools:ignore="ProtectedPermissions"/> |
| 21 | <uses-permission android:name="android.permission.READ_PHONE_STATE"/> | 20 | <uses-permission android:name="android.permission.READ_PHONE_STATE"/> |
| 22 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | 21 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
| 23 | - | ||
| 24 | <!-- | 22 | <!-- |
| 25 | windows not support lable replace by gradle,just replace by string values | 23 | windows not support lable replace by gradle,just replace by string values |
| 26 | occour error: AndroidMainfest.xml:line:AAPT:Error parsing XML:not well-formed(invalid toke) -v.8.3 | 24 | occour error: AndroidMainfest.xml:line:AAPT:Error parsing XML:not well-formed(invalid toke) -v.8.3 |
| @@ -32,12 +30,12 @@ | @@ -32,12 +30,12 @@ | ||
| 32 | android:icon="@drawable/ic_launcher" | 30 | android:icon="@drawable/ic_launcher" |
| 33 | android:label="@string/app_name" | 31 | android:label="@string/app_name" |
| 34 | android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> | 32 | android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
| 35 | - <meta-data | ||
| 36 | - android:name="UMENG_APPKEY" | ||
| 37 | - android:value="58e70169677baa0510000632" /> | ||
| 38 | - <meta-data | ||
| 39 | - android:name="UMENG_CHANNEL" | ||
| 40 | - android:value="ft" /> | 33 | + <meta-data |
| 34 | + android:name="UMENG_APPKEY" | ||
| 35 | + android:value="58e70169677baa0510000632"/> | ||
| 36 | + <meta-data | ||
| 37 | + android:name="UMENG_CHANNEL" | ||
| 38 | + android:value="ft"/> | ||
| 41 | <!-- <meta-data android:name="com.gimi.common.cinema.utils.CustomCachingGlideModule" android:value="GlideModule" /> --> | 39 | <!-- <meta-data android:name="com.gimi.common.cinema.utils.CustomCachingGlideModule" android:value="GlideModule" /> --> |
| 42 | 40 | ||
| 43 | <activity | 41 | <activity |
| @@ -103,7 +101,7 @@ | @@ -103,7 +101,7 @@ | ||
| 103 | <category android:name="android.intent.category.DEFAULT"/> | 101 | <category android:name="android.intent.category.DEFAULT"/> |
| 104 | </intent-filter> | 102 | </intent-filter> |
| 105 | </service> | 103 | </service> |
| 106 | - <service android:name=".service.ProguardService"> | 104 | + <service android:name=".service.CountService"> |
| 107 | <intent-filter> | 105 | <intent-filter> |
| 108 | <action android:name="com.qnbar.proguard.service"/> | 106 | <action android:name="com.qnbar.proguard.service"/> |
| 109 | </intent-filter> | 107 | </intent-filter> |
| @@ -120,23 +118,36 @@ | @@ -120,23 +118,36 @@ | ||
| 120 | <service android:name="com.qnbar.smc.service.SocketService"/> | 118 | <service android:name="com.qnbar.smc.service.SocketService"/> |
| 121 | 119 | ||
| 122 | <activity android:name="com.qnbar.smc.SimpleLightDemo"> | 120 | <activity android:name="com.qnbar.smc.SimpleLightDemo"> |
| 123 | - <!-- <intent-filter> | 121 | + |
| 122 | + <!-- | ||
| 123 | + <intent-filter> | ||
| 124 | <action android:name="android.intent.action.MAIN" /> | 124 | <action android:name="android.intent.action.MAIN" /> |
| 125 | 125 | ||
| 126 | <category android:name="android.intent.category.LAUNCHER" /> | 126 | <category android:name="android.intent.category.LAUNCHER" /> |
| 127 | - </intent-filter>--> | 127 | + </intent-filter> |
| 128 | + --> | ||
| 128 | </activity> | 129 | </activity> |
| 129 | - <!--门禁相关服务,必要!!!--> | ||
| 130 | - <service android:name="com.bluetoothle.GREENBluetoothLeService" android:enabled="true"/> | 130 | + <!-- 门禁相关服务,必要!!! --> |
| 131 | + <service | ||
| 132 | + android:name="com.bluetoothle.GREENBluetoothLeService" | ||
| 133 | + android:enabled="true"/> | ||
| 131 | 134 | ||
| 132 | <activity android:name="com.xgimi.smartscreen.ConfigActivity"/> | 135 | <activity android:name="com.xgimi.smartscreen.ConfigActivity"/> |
| 133 | <activity android:name="com.xgimi.smartscreen.MainActivity"> | 136 | <activity android:name="com.xgimi.smartscreen.MainActivity"> |
| 134 | - <!-- <intent-filter> | 137 | + |
| 138 | + <!-- | ||
| 139 | + <intent-filter> | ||
| 135 | <action android:name="android.intent.action.MAIN"/> | 140 | <action android:name="android.intent.action.MAIN"/> |
| 136 | 141 | ||
| 137 | <category android:name="android.intent.category.LAUNCHER"/> | 142 | <category android:name="android.intent.category.LAUNCHER"/> |
| 138 | - </intent-filter>--> | 143 | + </intent-filter> |
| 144 | + --> | ||
| 139 | </activity> | 145 | </activity> |
| 146 | + | ||
| 140 | <service android:name="com.xgimi.smartscreen.service.ConfigService"/> | 147 | <service android:name="com.xgimi.smartscreen.service.ConfigService"/> |
| 148 | + | ||
| 149 | + <activity android:name=".activity.QrCodeShowActivity"> | ||
| 150 | + </activity> | ||
| 141 | </application> | 151 | </application> |
| 152 | + | ||
| 142 | </manifest> | 153 | </manifest> |
| 1 | +package com.gimi.common.cinema.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by wugian on 2017/4/7 | ||
| 5 | + */ | ||
| 6 | +public class BaseModel { | ||
| 7 | + private int code; | ||
| 8 | + private String msg; | ||
| 9 | + | ||
| 10 | + public int getCode() { | ||
| 11 | + return code; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public void setCode(int code) { | ||
| 15 | + this.code = code; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public String getMsg() { | ||
| 19 | + return msg; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setMsg(String msg) { | ||
| 23 | + this.msg = msg; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public String toString() { | ||
| 28 | + return "BaseModel{" + | ||
| 29 | + "code=" + code + | ||
| 30 | + ", msg='" + msg + '\'' + | ||
| 31 | + '}'; | ||
| 32 | + } | ||
| 33 | +} |
| @@ -17,6 +17,7 @@ public class Constant { | @@ -17,6 +17,7 @@ public class Constant { | ||
| 17 | public static boolean isAdsOn = false; | 17 | public static boolean isAdsOn = false; |
| 18 | 18 | ||
| 19 | public static boolean gimiAuth = true; | 19 | public static boolean gimiAuth = true; |
| 20 | + public static int count = 2; | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | public static String MOVIE_MESSAGE_NAME_NEW = "/mm.qnt"; | 23 | public static String MOVIE_MESSAGE_NAME_NEW = "/mm.qnt"; |
| 1 | +package com.gimi.common.cinema.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by wugian on 2017/4/7 | ||
| 5 | + */ | ||
| 6 | +public class RoomInfo extends BaseModel { | ||
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * code : 0 | ||
| 10 | + * msg : | ||
| 11 | + * data : {"id":5,"room_sn":"R170321112367","room_name":"海贼王008","create_time":1490067794,"mac_address":"123","imei":"LETEST","store_sn":"S170321113056","qr_code":"83e60eaa5de46498209fe83614cede9c","sort":0,"status":0,"picture":"none.png","create_name":"amdin","info":"海贼王008专用","mesh_name":"","password":""} | ||
| 12 | + */ | ||
| 13 | + private DataEntity data; | ||
| 14 | + | ||
| 15 | + public DataEntity getData() { | ||
| 16 | + return data; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setData(DataEntity data) { | ||
| 20 | + this.data = data; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public static class DataEntity { | ||
| 24 | + /** | ||
| 25 | + * id : 5 | ||
| 26 | + * room_sn : R170321112367 | ||
| 27 | + * room_name : 海贼王008 | ||
| 28 | + * create_time : 1490067794 | ||
| 29 | + * mac_address : 123 | ||
| 30 | + * imei : LETEST | ||
| 31 | + * store_sn : S170321113056 | ||
| 32 | + * qr_code : 83e60eaa5de46498209fe83614cede9c | ||
| 33 | + * sort : 0 | ||
| 34 | + * status : 0 | ||
| 35 | + * picture : none.png | ||
| 36 | + * create_name : amdin | ||
| 37 | + * info : 海贼王008专用 | ||
| 38 | + * mesh_name : | ||
| 39 | + * password : | ||
| 40 | + */ | ||
| 41 | + | ||
| 42 | + private int id; | ||
| 43 | + private String room_sn; | ||
| 44 | + private String room_name; | ||
| 45 | + private int create_time; | ||
| 46 | + private String mac_address; | ||
| 47 | + private String imei; | ||
| 48 | + private String store_sn; | ||
| 49 | + private String qr_code; | ||
| 50 | + private int sort; | ||
| 51 | + private int status; | ||
| 52 | + private String picture; | ||
| 53 | + private String create_name; | ||
| 54 | + private String info; | ||
| 55 | + private String mesh_name; | ||
| 56 | + private String password; | ||
| 57 | + | ||
| 58 | + public int getId() { | ||
| 59 | + return id; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setId(int id) { | ||
| 63 | + this.id = id; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public String getRoom_sn() { | ||
| 67 | + return room_sn; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setRoom_sn(String room_sn) { | ||
| 71 | + this.room_sn = room_sn; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public String getRoom_name() { | ||
| 75 | + return room_name; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public void setRoom_name(String room_name) { | ||
| 79 | + this.room_name = room_name; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public int getCreate_time() { | ||
| 83 | + return create_time; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setCreate_time(int create_time) { | ||
| 87 | + this.create_time = create_time; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public String getMac_address() { | ||
| 91 | + return mac_address; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public void setMac_address(String mac_address) { | ||
| 95 | + this.mac_address = mac_address; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public String getImei() { | ||
| 99 | + return imei; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public void setImei(String imei) { | ||
| 103 | + this.imei = imei; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public String getStore_sn() { | ||
| 107 | + return store_sn; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public void setStore_sn(String store_sn) { | ||
| 111 | + this.store_sn = store_sn; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public String getQr_code() { | ||
| 115 | + return qr_code; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + public void setQr_code(String qr_code) { | ||
| 119 | + this.qr_code = qr_code; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + public int getSort() { | ||
| 123 | + return sort; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + public void setSort(int sort) { | ||
| 127 | + this.sort = sort; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public int getStatus() { | ||
| 131 | + return status; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public void setStatus(int status) { | ||
| 135 | + this.status = status; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + public String getPicture() { | ||
| 139 | + return picture; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public void setPicture(String picture) { | ||
| 143 | + this.picture = picture; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public String getCreate_name() { | ||
| 147 | + return create_name; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + public void setCreate_name(String create_name) { | ||
| 151 | + this.create_name = create_name; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public String getInfo() { | ||
| 155 | + return info; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + public void setInfo(String info) { | ||
| 159 | + this.info = info; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + public String getMesh_name() { | ||
| 163 | + return mesh_name; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + public void setMesh_name(String mesh_name) { | ||
| 167 | + this.mesh_name = mesh_name; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + public String getPassword() { | ||
| 171 | + return password; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + public void setPassword(String password) { | ||
| 175 | + this.password = password; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + @Override | ||
| 179 | + public String toString() { | ||
| 180 | + return "DataEntity{" + | ||
| 181 | + "id=" + id + | ||
| 182 | + ", room_sn='" + room_sn + '\'' + | ||
| 183 | + ", room_name='" + room_name + '\'' + | ||
| 184 | + ", create_time=" + create_time + | ||
| 185 | + ", mac_address='" + mac_address + '\'' + | ||
| 186 | + ", imei='" + imei + '\'' + | ||
| 187 | + ", store_sn='" + store_sn + '\'' + | ||
| 188 | + ", qr_code='" + qr_code + '\'' + | ||
| 189 | + ", sort=" + sort + | ||
| 190 | + ", status=" + status + | ||
| 191 | + ", picture='" + picture + '\'' + | ||
| 192 | + ", create_name='" + create_name + '\'' + | ||
| 193 | + ", info='" + info + '\'' + | ||
| 194 | + ", mesh_name='" + mesh_name + '\'' + | ||
| 195 | + ", password='" + password + '\'' + | ||
| 196 | + '}'; | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | +} |
| 1 | +package com.gimi.common.cinema.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by wugian on 2017/4/7 | ||
| 5 | + */ | ||
| 6 | +public class RoomQrCodeInfo extends BaseModel { | ||
| 7 | + | ||
| 8 | + private DataEntity data; | ||
| 9 | + | ||
| 10 | + public DataEntity getData() { | ||
| 11 | + return data; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public void setData(DataEntity data) { | ||
| 15 | + this.data = data; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public static class DataEntity { | ||
| 19 | + | ||
| 20 | + private String code; | ||
| 21 | + | ||
| 22 | + public String getCode() { | ||
| 23 | + return code; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setCode(String code) { | ||
| 27 | + this.code = code; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public String toString() { | ||
| 32 | + return "DataEntity{" + | ||
| 33 | + "code='" + code + '\'' + | ||
| 34 | + '}'; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} |
| 1 | +package com.gimi.common.cinema.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by wugian on 2017/4/7 | ||
| 5 | + */ | ||
| 6 | +public class RoomStatusInfo extends BaseModel { | ||
| 7 | + | ||
| 8 | + private DataEntity data; | ||
| 9 | + | ||
| 10 | + public DataEntity getData() { | ||
| 11 | + return data; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public void setData(DataEntity data) { | ||
| 15 | + this.data = data; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public static class DataEntity { | ||
| 19 | + | ||
| 20 | + private String order_sn; | ||
| 21 | + private int begin_time; | ||
| 22 | + private int end_time; | ||
| 23 | + private int status; | ||
| 24 | + private String film_hash; | ||
| 25 | + | ||
| 26 | + public String getOrder_sn() { | ||
| 27 | + return order_sn; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setOrder_sn(String order_sn) { | ||
| 31 | + this.order_sn = order_sn; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public int getBegin_time() { | ||
| 35 | + return begin_time; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setBegin_time(int begin_time) { | ||
| 39 | + this.begin_time = begin_time; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public int getEnd_time() { | ||
| 43 | + return end_time; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setEnd_time(int end_time) { | ||
| 47 | + this.end_time = end_time; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public int getStatus() { | ||
| 51 | + return status; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setStatus(int status) { | ||
| 55 | + this.status = status; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getFilm_hash() { | ||
| 59 | + return film_hash; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setFilm_hash(String film_hash) { | ||
| 63 | + this.film_hash = film_hash; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public String toString() { | ||
| 68 | + return "DataEntity{" + | ||
| 69 | + "order_sn='" + order_sn + '\'' + | ||
| 70 | + ", begin_time=" + begin_time + | ||
| 71 | + ", end_time=" + end_time + | ||
| 72 | + ", status=" + status + | ||
| 73 | + ", film_hash='" + film_hash + '\'' + | ||
| 74 | + '}'; | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | +} |
| @@ -41,4 +41,12 @@ public class WrongMsg extends Throwable { | @@ -41,4 +41,12 @@ public class WrongMsg extends Throwable { | ||
| 41 | this.code = code; | 41 | this.code = code; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | + @Override | ||
| 45 | + public String toString() { | ||
| 46 | + return "WrongMsg{" + | ||
| 47 | + "msg='" + msg + '\'' + | ||
| 48 | + ", request='" + request + '\'' + | ||
| 49 | + ", code=" + code + | ||
| 50 | + '}'; | ||
| 51 | + } | ||
| 44 | } | 52 | } |
| @@ -3,9 +3,7 @@ package com.gimi.common.cinema.utils; | @@ -3,9 +3,7 @@ package com.gimi.common.cinema.utils; | ||
| 3 | import android.os.Handler; | 3 | import android.os.Handler; |
| 4 | import android.os.Looper; | 4 | import android.os.Looper; |
| 5 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
| 6 | -import android.text.format.DateFormat; | ||
| 7 | import android.widget.ImageView; | 6 | import android.widget.ImageView; |
| 8 | - | ||
| 9 | import com.google.gson.Gson; | 7 | import com.google.gson.Gson; |
| 10 | import com.google.gson.internal.$Gson$Types; | 8 | import com.google.gson.internal.$Gson$Types; |
| 11 | import com.squareup.okhttp.Call; | 9 | import com.squareup.okhttp.Call; |
| @@ -20,10 +18,11 @@ import com.squareup.okhttp.Request; | @@ -20,10 +18,11 @@ import com.squareup.okhttp.Request; | ||
| 20 | import com.squareup.okhttp.RequestBody; | 18 | import com.squareup.okhttp.RequestBody; |
| 21 | import com.squareup.okhttp.Response; | 19 | import com.squareup.okhttp.Response; |
| 22 | 20 | ||
| 21 | +import javax.net.ssl.HostnameVerifier; | ||
| 23 | import javax.net.ssl.SSLContext; | 22 | import javax.net.ssl.SSLContext; |
| 23 | +import javax.net.ssl.SSLSession; | ||
| 24 | import javax.net.ssl.TrustManager; | 24 | import javax.net.ssl.TrustManager; |
| 25 | import javax.net.ssl.X509TrustManager; | 25 | import javax.net.ssl.X509TrustManager; |
| 26 | - | ||
| 27 | import java.io.ByteArrayOutputStream; | 26 | import java.io.ByteArrayOutputStream; |
| 28 | import java.io.File; | 27 | import java.io.File; |
| 29 | import java.io.FileOutputStream; | 28 | import java.io.FileOutputStream; |
| @@ -39,7 +38,6 @@ import java.security.KeyManagementException; | @@ -39,7 +38,6 @@ import java.security.KeyManagementException; | ||
| 39 | import java.security.NoSuchAlgorithmException; | 38 | import java.security.NoSuchAlgorithmException; |
| 40 | import java.security.cert.CertificateException; | 39 | import java.security.cert.CertificateException; |
| 41 | import java.text.ParseException; | 40 | import java.text.ParseException; |
| 42 | -import java.text.SimpleDateFormat; | ||
| 43 | import java.util.Date; | 41 | import java.util.Date; |
| 44 | import java.util.HashMap; | 42 | import java.util.HashMap; |
| 45 | import java.util.Map; | 43 | import java.util.Map; |
| @@ -88,6 +86,12 @@ public class OkHttpClientManager { | @@ -88,6 +86,12 @@ public class OkHttpClientManager { | ||
| 88 | javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext | 86 | javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext |
| 89 | .getSocketFactory(); | 87 | .getSocketFactory(); |
| 90 | mOkHttpClient.setSslSocketFactory(sslSocketFactory); | 88 | mOkHttpClient.setSslSocketFactory(sslSocketFactory); |
| 89 | + mOkHttpClient.setHostnameVerifier(new HostnameVerifier() { | ||
| 90 | + @Override | ||
| 91 | + public boolean verify(String hostname, SSLSession session) { | ||
| 92 | + return true; | ||
| 93 | + } | ||
| 94 | + }); | ||
| 91 | } catch (NoSuchAlgorithmException | KeyManagementException e) { | 95 | } catch (NoSuchAlgorithmException | KeyManagementException e) { |
| 92 | e.printStackTrace(); | 96 | e.printStackTrace(); |
| 93 | } | 97 | } |
| @@ -59,6 +59,7 @@ import com.gimi.common.cinema.model.Constant; | @@ -59,6 +59,7 @@ import com.gimi.common.cinema.model.Constant; | ||
| 59 | import com.gimi.common.cinema.model.FolderItem; | 59 | import com.gimi.common.cinema.model.FolderItem; |
| 60 | import com.gimi.common.cinema.model.LocalMovieMessage; | 60 | import com.gimi.common.cinema.model.LocalMovieMessage; |
| 61 | import com.gimi.common.cinema.model.MessageEvent; | 61 | import com.gimi.common.cinema.model.MessageEvent; |
| 62 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 62 | import com.gimi.common.cinema.utils.AuthUtils; | 63 | import com.gimi.common.cinema.utils.AuthUtils; |
| 63 | import com.gimi.common.cinema.utils.LeeImageLoader; | 64 | import com.gimi.common.cinema.utils.LeeImageLoader; |
| 64 | import com.gimi.common.cinema.utils.M1905Utils; | 65 | import com.gimi.common.cinema.utils.M1905Utils; |
| @@ -94,7 +95,9 @@ import com.xgimi.gimicinema.BuildConfig; | @@ -94,7 +95,9 @@ import com.xgimi.gimicinema.BuildConfig; | ||
| 94 | import com.xgimi.gimicinema.R; | 95 | import com.xgimi.gimicinema.R; |
| 95 | import com.xgimi.gimicinema.application.FangTangApplication; | 96 | import com.xgimi.gimicinema.application.FangTangApplication; |
| 96 | import com.xgimi.gimicinema.mview.IMainView; | 97 | import com.xgimi.gimicinema.mview.IMainView; |
| 98 | +import com.xgimi.gimicinema.poll.PollingUtils; | ||
| 97 | import com.xgimi.gimicinema.presenter.MainPresenter; | 99 | import com.xgimi.gimicinema.presenter.MainPresenter; |
| 100 | +import com.xgimi.gimicinema.service.CountService; | ||
| 98 | import com.xgimi.gimicinema.view.ClazzItem; | 101 | import com.xgimi.gimicinema.view.ClazzItem; |
| 99 | import com.xgimi.gimicinema.view.MovieItem; | 102 | import com.xgimi.gimicinema.view.MovieItem; |
| 100 | import com.xgimi.gimicinema.view.OrderRecyclerView; | 103 | import com.xgimi.gimicinema.view.OrderRecyclerView; |
| @@ -277,22 +280,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -277,22 +280,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 277 | } | 280 | } |
| 278 | 281 | ||
| 279 | if (!LeBluetooth.getInstance().isEnabled()) { | 282 | if (!LeBluetooth.getInstance().isEnabled()) { |
| 280 | -// AlertDialog.Builder builder = new AlertDialog.Builder(this); | ||
| 281 | -// builder.setMessage("开启蓝牙,体验智能灯!"); | ||
| 282 | -// builder.setNeutralButton("cancel", new DialogInterface.OnClickListener() { | ||
| 283 | -// @Override | ||
| 284 | -// public void onClick(DialogInterface dialog, int which) { | ||
| 285 | -// finish(); | ||
| 286 | -// } | ||
| 287 | -// }); | ||
| 288 | -// builder.setNegativeButton("enable", new DialogInterface.OnClickListener() { | ||
| 289 | -// @Override | ||
| 290 | -// public void onClick(DialogInterface dialog, int which) { | ||
| 291 | LeBluetooth.getInstance().enable(getApplicationContext()); | 283 | LeBluetooth.getInstance().enable(getApplicationContext()); |
| 292 | Log.d(TAG, "开启蓝牙,体验智能灯!"); | 284 | Log.d(TAG, "开启蓝牙,体验智能灯!"); |
| 293 | -// } | ||
| 294 | -// }); | ||
| 295 | -// builder.show(); | ||
| 296 | } | 285 | } |
| 297 | 286 | ||
| 298 | DeviceInfo deviceInfo = mApplication.getConnectDevice(); | 287 | DeviceInfo deviceInfo = mApplication.getConnectDevice(); |
| @@ -310,8 +299,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -310,8 +299,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 310 | } else { | 299 | } else { |
| 311 | Log.d(TAG, "find switch more than 5 times ,there may not exist right switch"); | 300 | Log.d(TAG, "find switch more than 5 times ,there may not exist right switch"); |
| 312 | } | 301 | } |
| 313 | - | ||
| 314 | - | ||
| 315 | Log.d(TAG, "onResume"); | 302 | Log.d(TAG, "onResume"); |
| 316 | } | 303 | } |
| 317 | 304 | ||
| @@ -443,7 +430,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -443,7 +430,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 443 | 430 | ||
| 444 | @Override | 431 | @Override |
| 445 | public void jumpToSearch() { | 432 | public void jumpToSearch() { |
| 446 | -// Intent intentSearch = new Intent(context, com.qnbar.smc.MainActivity.class); | ||
| 447 | Intent intentSearch = new Intent(context, SearchNewActivity.class); | 433 | Intent intentSearch = new Intent(context, SearchNewActivity.class); |
| 448 | context.startActivity(intentSearch); | 434 | context.startActivity(intentSearch); |
| 449 | } | 435 | } |
| @@ -464,6 +450,19 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -464,6 +450,19 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 464 | context.startActivity(intentPlayList1); | 450 | context.startActivity(intentPlayList1); |
| 465 | } | 451 | } |
| 466 | 452 | ||
| 453 | + @Override | ||
| 454 | + public void countDownOrderTime(int durationMinutes) { | ||
| 455 | + Constant.count = durationMinutes + 1; | ||
| 456 | + PollingUtils.startPollingService(context, 60, CountService.class, CountService.STATUS_ACTION); | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + private RoomQrCodeInfo info; | ||
| 460 | + | ||
| 461 | + @Override | ||
| 462 | + public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) { | ||
| 463 | + this.info = info; | ||
| 464 | + } | ||
| 465 | + | ||
| 467 | 466 | ||
| 468 | int findCount = 0; | 467 | int findCount = 0; |
| 469 | 468 | ||
| @@ -476,7 +475,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -476,7 +475,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 476 | public boolean onKeyDown(int keyCode, KeyEvent event) { | 475 | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| 477 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 476 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 478 | Intent i = new Intent(Intent.ACTION_MAIN); | 477 | Intent i = new Intent(Intent.ACTION_MAIN); |
| 479 | -// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 480 | i.addCategory(Intent.CATEGORY_HOME); | 478 | i.addCategory(Intent.CATEGORY_HOME); |
| 481 | startActivity(i); | 479 | startActivity(i); |
| 482 | return true; | 480 | return true; |
| @@ -681,30 +679,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -681,30 +679,6 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 681 | } else { | 679 | } else { |
| 682 | startService(new Intent(this, GREENBluetoothLeService.class)); | 680 | startService(new Intent(this, GREENBluetoothLeService.class)); |
| 683 | } | 681 | } |
| 684 | - | ||
| 685 | - /* bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() { | ||
| 686 | - | ||
| 687 | - @Override | ||
| 688 | - public void writeSuccess() { | ||
| 689 | - bleBroadcastReceiver.setResponseObj(null); | ||
| 690 | - Toast.makeText(MainActivity.this, "开门成功", Toast.LENGTH_SHORT).show(); | ||
| 691 | - | ||
| 692 | - BLEOpenRecord bleOpenRecord = new BLEOpenRecord(); | ||
| 693 | - bleOpenRecord.setLockmac("DC:F6:70:C1:AA:D6"); | ||
| 694 | - bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).leaveTimeFormat(new Date())); | ||
| 695 | - Intent intent = new Intent(); | ||
| 696 | - intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS); | ||
| 697 | - intent.putExtra("openrecord", bleOpenRecord); | ||
| 698 | - sendBroadcast(intent); | ||
| 699 | - } | ||
| 700 | - | ||
| 701 | - @Override | ||
| 702 | - public void writeFailure(String error) { | ||
| 703 | - bleBroadcastReceiver.setResponseObj(null); | ||
| 704 | - Toast.makeText(MainActivity.this, "开门失败," + error, Toast.LENGTH_SHORT).show(); | ||
| 705 | - } | ||
| 706 | - }); | ||
| 707 | - GREENBLE.send(this, "DC:F6:70:C1:AA:D6", openCMD.getBytes());*/ | ||
| 708 | } | 682 | } |
| 709 | 683 | ||
| 710 | //lights | 684 | //lights |
| @@ -896,14 +870,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -896,14 +870,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 896 | if (rightSn) { | 870 | if (rightSn) { |
| 897 | down(); | 871 | down(); |
| 898 | } | 872 | } |
| 873 | + presenter.getOrderInfo(); | ||
| 899 | Log.d("event bus", messageEvent.getMessage()); | 874 | Log.d("event bus", messageEvent.getMessage()); |
| 900 | Log.d("event bus", "open door"); | 875 | Log.d("event bus", "open door"); |
| 901 | -// MessageEvent msgEvent = new MessageEvent(); | ||
| 902 | -// msgEvent.setEventId(0x19910); | ||
| 903 | -// msgEvent.setMessage("open_switch"); | ||
| 904 | -// EventBus.getDefault().post(msgEvent); | ||
| 905 | break; | 876 | break; |
| 906 | - | ||
| 907 | case 0x19910: | 877 | case 0x19910: |
| 908 | if (findHub && findSwitch) { | 878 | if (findHub && findSwitch) { |
| 909 | Device device = null; | 879 | Device device = null; |
| @@ -935,6 +905,13 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -935,6 +905,13 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 935 | Log.d(TAG, "open door and smart switch"); | 905 | Log.d(TAG, "open door and smart switch"); |
| 936 | } | 906 | } |
| 937 | break; | 907 | break; |
| 908 | + case CountService.COUNT_DOWN_ZERO: | ||
| 909 | + if (info == null || info.getData() == null) { | ||
| 910 | + break; | ||
| 911 | + } | ||
| 912 | + startActivity(new Intent(this, QrCodeShowActivity.class).putExtra("qr", info.getData().getCode())); | ||
| 913 | +// startActivity(new Intent(this, QrCodeShowActivity.class).putExtra("qr", "countDownOrderTime")); | ||
| 914 | + break; | ||
| 938 | } | 915 | } |
| 939 | } | 916 | } |
| 940 | 917 |
| 1 | +package com.xgimi.gimicinema.activity; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.os.Bundle; | ||
| 5 | +import android.widget.ImageView; | ||
| 6 | +import com.gimi.common.cinema.utils.QRCodeUitls; | ||
| 7 | +import com.google.zxing.WriterException; | ||
| 8 | +import com.xgimi.gimicinema.R; | ||
| 9 | + | ||
| 10 | +public class QrCodeShowActivity extends Activity { | ||
| 11 | + | ||
| 12 | + @Override | ||
| 13 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 14 | + super.onCreate(savedInstanceState); | ||
| 15 | + setContentView(R.layout.activity_qr_code_show); | ||
| 16 | + final String qr = getIntent().getStringExtra("qr"); | ||
| 17 | + ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); | ||
| 18 | + try { | ||
| 19 | + iv.setImageBitmap(QRCodeUitls.createQRCode(qr, 400)); | ||
| 20 | + } catch (WriterException e) { | ||
| 21 | + e.printStackTrace(); | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +package com.xgimi.gimicinema.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by wugian on 2017/4/7 | ||
| 5 | + */ | ||
| 6 | +public interface IRoomInfoModel { | ||
| 7 | + void getRoomInfo(String imei, boolean needUpdate, RoomInfoModelImpl.GetRoomInfoListener listener); | ||
| 8 | + | ||
| 9 | + void getRoomStatus(String roomSn, RoomInfoModelImpl.GetRoomStatusListener listener); | ||
| 10 | + | ||
| 11 | + void getRoomQrCode(String orderSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); | ||
| 12 | +} |
| 1 | +package com.xgimi.gimicinema.model; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.text.TextUtils; | ||
| 5 | +import com.gimi.common.cinema.model.RoomInfo; | ||
| 6 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 7 | +import com.gimi.common.cinema.model.RoomStatusInfo; | ||
| 8 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 9 | +import com.gimi.common.cinema.utils.OkHttpClientManager; | ||
| 10 | +import com.gimi.common.cinema.utils.Utils; | ||
| 11 | +import com.google.gson.Gson; | ||
| 12 | +import com.google.gson.JsonSyntaxException; | ||
| 13 | +import com.squareup.okhttp.Request; | ||
| 14 | +import com.xgimi.gimicinema.application.FangTangApplication; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * Created by wugian on 2017/4/7 | ||
| 18 | + */ | ||
| 19 | +public class RoomInfoModelImpl implements IRoomInfoModel { | ||
| 20 | + private static final String ROOT_URL = "https:/hulong.nat123.net/"; | ||
| 21 | + private static final String ROOM_INFO_BY_IMEI_URL = ROOT_URL + "tcp/getRoomInfoByimei?imei="; | ||
| 22 | + private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn="; | ||
| 23 | + private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn="; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public void getRoomInfo(String imei, boolean needUpdate, final GetRoomInfoListener listener) { | ||
| 27 | + final Context applicationContext = FangTangApplication.getInstance().getApplicationContext(); | ||
| 28 | + final String roomInfoStr = Utils.getString(applicationContext, "room-info"); | ||
| 29 | + if (!TextUtils.isEmpty(roomInfoStr)) { | ||
| 30 | + RoomInfo roomInfo1 = new Gson().fromJson(roomInfoStr, RoomInfo.class); | ||
| 31 | + if (roomInfo1 != null) { | ||
| 32 | + listener.onGetRoomInfoSuccess(roomInfo1); | ||
| 33 | + if (!needUpdate) { | ||
| 34 | + return; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + OkHttpClientManager.getAsyn(ROOM_INFO_BY_IMEI_URL + imei, | ||
| 40 | + new OkHttpClientManager.ResultCallback<String>() { | ||
| 41 | + @Override | ||
| 42 | + public void onError(Request request, Exception e) { | ||
| 43 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 44 | + wrongMsg.setMsg(e.getMessage()); | ||
| 45 | + listener.onGetRoomInfoFailure(wrongMsg); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void onResponse(String response) { | ||
| 50 | + RoomInfo roomInfo1 = null; | ||
| 51 | + try { | ||
| 52 | + roomInfo1 = new Gson().fromJson(response, RoomInfo.class); | ||
| 53 | + } catch (JsonSyntaxException e) { | ||
| 54 | + e.printStackTrace(); | ||
| 55 | + } | ||
| 56 | + boolean equals = roomInfoStr.equals(response); | ||
| 57 | + if (roomInfo1 != null && !equals) { | ||
| 58 | + Utils.saveString(applicationContext, "room-info", response); | ||
| 59 | + listener.onGetRoomInfoUpdate(roomInfo1); | ||
| 60 | + } else { | ||
| 61 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 62 | + wrongMsg.setMsg("update-info equal with old:" + equals + "," + response); | ||
| 63 | + listener.onGetRoomInfoFailure(wrongMsg); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + }); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public void getRoomStatus(String roomSn, final GetRoomStatusListener listener) { | ||
| 71 | + OkHttpClientManager.getAsyn(ROOM_STATUS_BY_ROOM_SN_URL + roomSn, | ||
| 72 | + new OkHttpClientManager.ResultCallback<String>() { | ||
| 73 | + @Override | ||
| 74 | + public void onError(Request request, Exception e) { | ||
| 75 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 76 | + wrongMsg.setMsg(e.getMessage()); | ||
| 77 | + listener.onGetRoomStatusFailure(wrongMsg); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public void onResponse(String response) { | ||
| 82 | + RoomStatusInfo roomInfo1 = null; | ||
| 83 | + try { | ||
| 84 | + roomInfo1 = new Gson().fromJson(response, RoomStatusInfo.class); | ||
| 85 | + } catch (JsonSyntaxException e) { | ||
| 86 | + e.printStackTrace(); | ||
| 87 | + } | ||
| 88 | + if (roomInfo1 != null) { | ||
| 89 | + listener.onGetRoomStatusSuccess(roomInfo1); | ||
| 90 | + } else { | ||
| 91 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 92 | + wrongMsg.setMsg(response); | ||
| 93 | + listener.onGetRoomStatusFailure(wrongMsg); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + }); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Override | ||
| 100 | + public void getRoomQrCode(String orderSn, final GetRoomQrCodeListener listener) { | ||
| 101 | + OkHttpClientManager.getAsyn(ROOM_QRCODE_BY_ORDER_SN + orderSn, | ||
| 102 | + new OkHttpClientManager.ResultCallback<String>() { | ||
| 103 | + @Override | ||
| 104 | + public void onError(Request request, Exception e) { | ||
| 105 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 106 | + wrongMsg.setMsg(e.getMessage()); | ||
| 107 | + listener.onGetRoomQrCodeFailure(wrongMsg); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public void onResponse(String response) { | ||
| 112 | + RoomQrCodeInfo roomInfo1 = null; | ||
| 113 | + try { | ||
| 114 | + roomInfo1 = new Gson().fromJson(response, RoomQrCodeInfo.class); | ||
| 115 | + } catch (JsonSyntaxException e) { | ||
| 116 | + e.printStackTrace(); | ||
| 117 | + } | ||
| 118 | + if (roomInfo1 != null) { | ||
| 119 | + listener.onGetRoomQrCodeSuccess(roomInfo1); | ||
| 120 | + } else { | ||
| 121 | + WrongMsg wrongMsg = new WrongMsg(); | ||
| 122 | + wrongMsg.setMsg(response); | ||
| 123 | + listener.onGetRoomQrCodeFailure(wrongMsg); | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + }); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + public interface GetRoomInfoListener { | ||
| 131 | + void onGetRoomInfoSuccess(RoomInfo info); | ||
| 132 | + | ||
| 133 | + void onGetRoomInfoUpdate(RoomInfo info); | ||
| 134 | + | ||
| 135 | + void onGetRoomInfoFailure(WrongMsg wrongMsg); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + public interface GetRoomStatusListener { | ||
| 139 | + void onGetRoomStatusSuccess(RoomStatusInfo info); | ||
| 140 | + | ||
| 141 | + void onGetRoomStatusFailure(WrongMsg wrongMsg); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public interface GetRoomQrCodeListener { | ||
| 145 | + void onGetRoomQrCodeSuccess(RoomQrCodeInfo info); | ||
| 146 | + | ||
| 147 | + void onGetRoomQrCodeFailure(WrongMsg wrongMsg); | ||
| 148 | + } | ||
| 149 | +} |
| @@ -19,6 +19,7 @@ import android.graphics.Bitmap; | @@ -19,6 +19,7 @@ import android.graphics.Bitmap; | ||
| 19 | 19 | ||
| 20 | import com.gimi.common.cinema.model.ClassificationItem; | 20 | import com.gimi.common.cinema.model.ClassificationItem; |
| 21 | import com.gimi.common.cinema.model.LocalMovieMessage; | 21 | import com.gimi.common.cinema.model.LocalMovieMessage; |
| 22 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 22 | 23 | ||
| 23 | import java.util.List; | 24 | import java.util.List; |
| 24 | 25 | ||
| @@ -53,4 +54,8 @@ public interface IMainView { | @@ -53,4 +54,8 @@ public interface IMainView { | ||
| 53 | void openPlayList(); | 54 | void openPlayList(); |
| 54 | 55 | ||
| 55 | void openClazz(ClassificationItem classificationItem); | 56 | void openClazz(ClassificationItem classificationItem); |
| 57 | + | ||
| 58 | + void countDownOrderTime(int durationMinutes); | ||
| 59 | + | ||
| 60 | + void prepareRoomQrCodeInfo(RoomQrCodeInfo info); | ||
| 56 | } | 61 | } |
| @@ -31,22 +31,23 @@ public class PollingUtils { | @@ -31,22 +31,23 @@ public class PollingUtils { | ||
| 31 | //获取AlarmManager系统服务 | 31 | //获取AlarmManager系统服务 |
| 32 | AlarmManager manager = (AlarmManager) context | 32 | AlarmManager manager = (AlarmManager) context |
| 33 | .getSystemService(Context.ALARM_SERVICE); | 33 | .getSystemService(Context.ALARM_SERVICE); |
| 34 | - | 34 | + |
| 35 | //包装需要执行Service的Intent | 35 | //包装需要执行Service的Intent |
| 36 | Intent intent = new Intent(context, cls); | 36 | Intent intent = new Intent(context, cls); |
| 37 | intent.setAction(action); | 37 | intent.setAction(action); |
| 38 | PendingIntent pendingIntent = PendingIntent.getService(context, 0, | 38 | PendingIntent pendingIntent = PendingIntent.getService(context, 0, |
| 39 | intent, PendingIntent.FLAG_UPDATE_CURRENT); | 39 | intent, PendingIntent.FLAG_UPDATE_CURRENT); |
| 40 | - | 40 | + |
| 41 | //触发服务的起始时间 | 41 | //触发服务的起始时间 |
| 42 | long triggerAtTime = SystemClock.elapsedRealtime(); | 42 | long triggerAtTime = SystemClock.elapsedRealtime(); |
| 43 | - | 43 | + |
| 44 | //使用AlarmManger的setRepeating方法设置定期执行的时间间隔(seconds秒)和需要执行的Service | 44 | //使用AlarmManger的setRepeating方法设置定期执行的时间间隔(seconds秒)和需要执行的Service |
| 45 | manager.setRepeating(AlarmManager.ELAPSED_REALTIME, triggerAtTime, | 45 | manager.setRepeating(AlarmManager.ELAPSED_REALTIME, triggerAtTime, |
| 46 | seconds * 1000, pendingIntent); | 46 | seconds * 1000, pendingIntent); |
| 47 | } | 47 | } |
| 48 | + | ||
| 48 | //停止轮询服务 | 49 | //停止轮询服务 |
| 49 | - public static void stopPollingService(Context context, Class<?> cls,String action) { | 50 | + public static void stopPollingService(Context context, Class<?> cls, String action) { |
| 50 | AlarmManager manager = (AlarmManager) context | 51 | AlarmManager manager = (AlarmManager) context |
| 51 | .getSystemService(Context.ALARM_SERVICE); | 52 | .getSystemService(Context.ALARM_SERVICE); |
| 52 | Intent intent = new Intent(context, cls); | 53 | Intent intent = new Intent(context, cls); |
| @@ -24,6 +24,10 @@ import android.widget.Toast; | @@ -24,6 +24,10 @@ import android.widget.Toast; | ||
| 24 | import com.gimi.common.cinema.model.ClassificationItem; | 24 | import com.gimi.common.cinema.model.ClassificationItem; |
| 25 | import com.gimi.common.cinema.model.Constant; | 25 | import com.gimi.common.cinema.model.Constant; |
| 26 | import com.gimi.common.cinema.model.LocalMovieMessage; | 26 | import com.gimi.common.cinema.model.LocalMovieMessage; |
| 27 | +import com.gimi.common.cinema.model.RoomInfo; | ||
| 28 | +import com.gimi.common.cinema.model.RoomQrCodeInfo; | ||
| 29 | +import com.gimi.common.cinema.model.RoomStatusInfo; | ||
| 30 | +import com.gimi.common.cinema.model.WrongMsg; | ||
| 27 | import com.gimi.common.cinema.utils.AuthUtils; | 31 | import com.gimi.common.cinema.utils.AuthUtils; |
| 28 | import com.gimi.common.cinema.utils.LocalDataUtils; | 32 | import com.gimi.common.cinema.utils.LocalDataUtils; |
| 29 | import com.gimi.common.cinema.utils.SambaFileCharge; | 33 | import com.gimi.common.cinema.utils.SambaFileCharge; |
| @@ -40,10 +44,12 @@ import com.xgimi.gimicinema.model.AdsModelImpl; | @@ -40,10 +44,12 @@ import com.xgimi.gimicinema.model.AdsModelImpl; | ||
| 40 | import com.xgimi.gimicinema.model.IAdsModel; | 44 | import com.xgimi.gimicinema.model.IAdsModel; |
| 41 | import com.xgimi.gimicinema.model.IMainModel; | 45 | import com.xgimi.gimicinema.model.IMainModel; |
| 42 | import com.xgimi.gimicinema.model.IOtherModel; | 46 | import com.xgimi.gimicinema.model.IOtherModel; |
| 47 | +import com.xgimi.gimicinema.model.IRoomInfoModel; | ||
| 43 | import com.xgimi.gimicinema.model.ISambaModel; | 48 | import com.xgimi.gimicinema.model.ISambaModel; |
| 44 | import com.xgimi.gimicinema.model.IUpdateModel; | 49 | import com.xgimi.gimicinema.model.IUpdateModel; |
| 45 | import com.xgimi.gimicinema.model.MainModelImpl; | 50 | import com.xgimi.gimicinema.model.MainModelImpl; |
| 46 | import com.xgimi.gimicinema.model.OtherModelImpl; | 51 | import com.xgimi.gimicinema.model.OtherModelImpl; |
| 52 | +import com.xgimi.gimicinema.model.RoomInfoModelImpl; | ||
| 47 | import com.xgimi.gimicinema.model.SambaModelImpl; | 53 | import com.xgimi.gimicinema.model.SambaModelImpl; |
| 48 | import com.xgimi.gimicinema.model.UpdateModelImpl; | 54 | import com.xgimi.gimicinema.model.UpdateModelImpl; |
| 49 | import com.xgimi.gimicinema.mview.IMainView; | 55 | import com.xgimi.gimicinema.mview.IMainView; |
| @@ -71,6 +77,8 @@ public class MainPresenter extends BasePresenter | @@ -71,6 +77,8 @@ public class MainPresenter extends BasePresenter | ||
| 71 | private IAdsModel adsModel; | 77 | private IAdsModel adsModel; |
| 72 | private IOtherModel otherModel; | 78 | private IOtherModel otherModel; |
| 73 | 79 | ||
| 80 | + private IRoomInfoModel roomInfoModel; | ||
| 81 | + | ||
| 74 | public MainPresenter(IMainView mainView) { | 82 | public MainPresenter(IMainView mainView) { |
| 75 | this.mainView = mainView; | 83 | this.mainView = mainView; |
| 76 | sambaModel = new SambaModelImpl(); | 84 | sambaModel = new SambaModelImpl(); |
| @@ -78,6 +86,7 @@ public class MainPresenter extends BasePresenter | @@ -78,6 +86,7 @@ public class MainPresenter extends BasePresenter | ||
| 78 | updateModel = new UpdateModelImpl(); | 86 | updateModel = new UpdateModelImpl(); |
| 79 | adsModel = new AdsModelImpl(); | 87 | adsModel = new AdsModelImpl(); |
| 80 | otherModel = new OtherModelImpl(); | 88 | otherModel = new OtherModelImpl(); |
| 89 | + roomInfoModel = new RoomInfoModelImpl(); | ||
| 81 | } | 90 | } |
| 82 | 91 | ||
| 83 | public void load(final Context context) { | 92 | public void load(final Context context) { |
| @@ -94,6 +103,7 @@ public class MainPresenter extends BasePresenter | @@ -94,6 +103,7 @@ public class MainPresenter extends BasePresenter | ||
| 94 | updateAppVersion(context); | 103 | updateAppVersion(context); |
| 95 | updateClazz(context); | 104 | updateClazz(context); |
| 96 | updateDb(context); | 105 | updateDb(context); |
| 106 | + updateRoomInfo(context); | ||
| 97 | // mainView.showMsg("abc"); | 107 | // mainView.showMsg("abc"); |
| 98 | } | 108 | } |
| 99 | 109 | ||
| @@ -199,6 +209,69 @@ public class MainPresenter extends BasePresenter | @@ -199,6 +209,69 @@ public class MainPresenter extends BasePresenter | ||
| 199 | new LocalDataUtils(context).updateDb(); | 209 | new LocalDataUtils(context).updateDb(); |
| 200 | } | 210 | } |
| 201 | 211 | ||
| 212 | + public void updateRoomInfo(Context context) { | ||
| 213 | + String imei = SystemUtils.getPid(context, BuildConfig.BUILD_TYPE); | ||
| 214 | + roomInfoModel.getRoomInfo(imei, true, new RoomInfoModelImpl.GetRoomInfoListener() { | ||
| 215 | + @Override | ||
| 216 | + public void onGetRoomInfoSuccess(RoomInfo info) { | ||
| 217 | + Log.d("room-info", "get success:" + info.toString()); | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + @Override | ||
| 221 | + public void onGetRoomInfoUpdate(RoomInfo info) { | ||
| 222 | + Log.d("room-info", "update success:" + info.toString()); | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + @Override | ||
| 226 | + public void onGetRoomInfoFailure(WrongMsg wrongMsg) { | ||
| 227 | + Log.d("room-info", "get failure:" + wrongMsg.toString()); | ||
| 228 | + } | ||
| 229 | + }); | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + public void getOrderInfo() { | ||
| 233 | + String imei = SystemUtils.getPid(context, BuildConfig.BUILD_TYPE); | ||
| 234 | + roomInfoModel.getRoomInfo(imei, false, new RoomInfoModelImpl.GetRoomInfoListener() { | ||
| 235 | + @Override | ||
| 236 | + public void onGetRoomInfoSuccess(RoomInfo info) { | ||
| 237 | + roomInfoModel.getRoomStatus(info.getData().getRoom_sn(), new RoomInfoModelImpl.GetRoomStatusListener() { | ||
| 238 | + @Override | ||
| 239 | + public void onGetRoomStatusSuccess(RoomStatusInfo info) { | ||
| 240 | + RoomStatusInfo.DataEntity data = info.getData(); | ||
| 241 | + int durationMinutes = data.getEnd_time() - data.getBegin_time(); | ||
| 242 | + mainView.countDownOrderTime(durationMinutes); | ||
| 243 | + roomInfoModel.getRoomQrCode(data.getOrder_sn(), new RoomInfoModelImpl.GetRoomQrCodeListener() { | ||
| 244 | + @Override | ||
| 245 | + public void onGetRoomQrCodeSuccess(RoomQrCodeInfo info) { | ||
| 246 | + mainView.prepareRoomQrCodeInfo(info); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + @Override | ||
| 250 | + public void onGetRoomQrCodeFailure(WrongMsg wrongMsg) { | ||
| 251 | + Log.d("room-info", "onGetRoomQrCodeFailure:" + wrongMsg.toString()); | ||
| 252 | + } | ||
| 253 | + }); | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + @Override | ||
| 257 | + public void onGetRoomStatusFailure(WrongMsg wrongMsg) { | ||
| 258 | + Log.d("room-info", "onGetRoomStatusFailure :" + wrongMsg.toString()); | ||
| 259 | + } | ||
| 260 | + }); | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + @Override | ||
| 264 | + public void onGetRoomInfoUpdate(RoomInfo info) { | ||
| 265 | + Log.d("room-info", "update success:" + info.toString()); | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + @Override | ||
| 269 | + public void onGetRoomInfoFailure(WrongMsg wrongMsg) { | ||
| 270 | + Log.d("room-info", "get failure:" + wrongMsg.toString()); | ||
| 271 | + } | ||
| 272 | + }); | ||
| 273 | + } | ||
| 274 | + | ||
| 202 | @Override | 275 | @Override |
| 203 | public void onGetControlImageSuccess(Bitmap bitmap) { | 276 | public void onGetControlImageSuccess(Bitmap bitmap) { |
| 204 | mainView.loadCtrlImg(bitmap); | 277 | mainView.loadCtrlImg(bitmap); |
| @@ -92,7 +92,7 @@ public class AskService extends Service implements IAskView { | @@ -92,7 +92,7 @@ public class AskService extends Service implements IAskView { | ||
| 92 | 92 | ||
| 93 | askPresenter.load(context); | 93 | askPresenter.load(context); |
| 94 | handler.postDelayed(updateRunnable, 5 * 1000); | 94 | handler.postDelayed(updateRunnable, 5 * 1000); |
| 95 | -// PollingUtils.startPollingService(context, 60, ProguardService.class, ProguardService.STATUS_ACTION); | 95 | +// PollingUtils.startPollingService(context, 60, CountService.class, CountService.STATUS_ACTION); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | private void updateMsg() { | 98 | private void updateMsg() { |
| @@ -20,33 +20,49 @@ import android.app.Service; | @@ -20,33 +20,49 @@ import android.app.Service; | ||
| 20 | import android.content.Intent; | 20 | import android.content.Intent; |
| 21 | import android.os.IBinder; | 21 | import android.os.IBinder; |
| 22 | import android.util.Log; | 22 | import android.util.Log; |
| 23 | +import com.gimi.common.cinema.model.Constant; | ||
| 24 | +import com.gimi.common.cinema.model.MessageEvent; | ||
| 25 | +import org.greenrobot.eventbus.EventBus; | ||
| 23 | 26 | ||
| 24 | -public class ProguardService extends Service { | ||
| 25 | - public static final String TAG = "ProguardService"; | ||
| 26 | - public static final String STATUS_ACTION = "com.qnbar.proguard.service"; | ||
| 27 | - public static long lastHandlerServerMsg; | 27 | +import static com.gimi.common.cinema.model.Constant.count; |
| 28 | + | ||
| 29 | +public class CountService extends Service { | ||
| 30 | + public static final String TAG = "CountService"; | ||
| 31 | + public static final String STATUS_ACTION = "com.qnbar.count.service"; | ||
| 32 | + public static final int COUNT_DOWN_ZERO = 0x801; | ||
| 33 | +// private int count = 0; | ||
| 28 | 34 | ||
| 29 | @Override | 35 | @Override |
| 30 | public IBinder onBind(Intent intent) { | 36 | public IBinder onBind(Intent intent) { |
| 31 | throw null; | 37 | throw null; |
| 32 | } | 38 | } |
| 33 | 39 | ||
| 40 | + | ||
| 34 | @Override | 41 | @Override |
| 35 | public int onStartCommand(Intent intent, int flags, int startId) { | 42 | public int onStartCommand(Intent intent, int flags, int startId) { |
| 36 | - new PollingStatusThread().start(); | 43 | +// count = intent.getIntExtra("countDown", 0); |
| 44 | + Log.d(TAG, "count is :" + count); | ||
| 45 | + if (Constant.count > 0) { | ||
| 46 | + Log.d(TAG, "if"); | ||
| 47 | + new CountDownThread().start(); | ||
| 48 | + } else { | ||
| 49 | + Log.d(TAG, "else"); | ||
| 50 | + CountService.this.onDestroy(); | ||
| 51 | + } | ||
| 37 | return super.onStartCommand(intent, flags, startId); | 52 | return super.onStartCommand(intent, flags, startId); |
| 38 | } | 53 | } |
| 39 | 54 | ||
| 40 | - class PollingStatusThread extends Thread { | 55 | + class CountDownThread extends Thread { |
| 41 | @Override | 56 | @Override |
| 42 | public void run() { | 57 | public void run() { |
| 43 | Log.d(TAG, "Polling..."); | 58 | Log.d(TAG, "Polling..."); |
| 44 | //if true restart AskService polling | 59 | //if true restart AskService polling |
| 45 | - if (System.currentTimeMillis() - lastHandlerServerMsg > 30 * 1000) { | ||
| 46 | - Intent intent = new Intent(); | ||
| 47 | - intent.setAction(AskService.ACTION); | ||
| 48 | - intent.putExtra("reset", true); | ||
| 49 | - sendBroadcast(intent); | 60 | + if (count-- <= 1) { |
| 61 | + MessageEvent messageEvent = new MessageEvent(); | ||
| 62 | + messageEvent.setEventId(COUNT_DOWN_ZERO); | ||
| 63 | + messageEvent.setMessage("记数为0"); | ||
| 64 | + EventBus.getDefault().post(messageEvent); | ||
| 65 | + CountService.this.onDestroy(); | ||
| 50 | } | 66 | } |
| 51 | } | 67 | } |
| 52 | } | 68 | } |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout | ||
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + android:orientation="vertical" | ||
| 8 | + android:gravity="center" | ||
| 9 | + android:background="@color/white" | ||
| 10 | + tools:context="com.xgimi.gimicinema.activity.QrCodeShowActivity"> | ||
| 11 | + | ||
| 12 | + <ImageView android:layout_width="400dp" | ||
| 13 | + android:id="@+id/qrCodeIv" | ||
| 14 | + android:layout_height="400dp"/> | ||
| 15 | + | ||
| 16 | + <TextView android:layout_width="wrap_content" | ||
| 17 | + android:layout_height="wrap_content" | ||
| 18 | + android:textSize="30sp" | ||
| 19 | + android:textColor="@color/black" | ||
| 20 | + android:text="打扫完成后请扫二维码确认"/> | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +</LinearLayout> |
Please
register
or
login
to post a comment