Commit d96a7aebea9b06b60752b3c20c049eb570f45441
1 parent
1a085af7
Exists in
yxb_dev
and in
2 other branches
no message
Showing
14 changed files
with
575 additions
and
71 deletions
Show diff stats
.gitignore
@@ -2,8 +2,11 @@ | @@ -2,8 +2,11 @@ | ||
2 | .gradle | 2 | .gradle |
3 | /local.properties | 3 | /local.properties |
4 | /.idea | 4 | /.idea |
5 | +.idea/ | ||
5 | .DS_Store | 6 | .DS_Store |
6 | /build | 7 | /build |
7 | /captures | 8 | /captures |
8 | .externalNativeBuild | 9 | .externalNativeBuild |
9 | app/release/app-release.apk | 10 | app/release/app-release.apk |
11 | +app/src/main/java/com/shunzhi/parent/DataBaseTestActivity.java | ||
12 | +app/src/main/res/layout/activity_data_base_test.xml |
app/build.gradle
app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | - package="com.shunzhi.parent"> | 3 | + package="com.shunzhi.parent"> |
4 | 4 | ||
5 | <!-- 用于进行网络定位 --> | 5 | <!-- 用于进行网络定位 --> |
6 | - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 6 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> |
7 | <!-- 用于访问GPS定位 --> | 7 | <!-- 用于访问GPS定位 --> |
8 | - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
9 | - <uses-permission android:name="android.permission.GET_TASKS" /> | ||
10 | - <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> | ||
11 | - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | 8 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> |
9 | + <uses-permission android:name="android.permission.GET_TASKS"/> | ||
10 | + <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> | ||
11 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | ||
12 | <!-- Android 6.0版本可去除,用于选举信息(通道复用)的同步 --> | 12 | <!-- Android 6.0版本可去除,用于选举信息(通道复用)的同步 --> |
13 | - <uses-permission android:name="android.permission.WRITE_SETTINGS" /> | 13 | + <uses-permission android:name="android.permission.WRITE_SETTINGS"/> |
14 | <!-- 进行网络访问和网络状态监控相关的权限声明 --> | 14 | <!-- 进行网络访问和网络状态监控相关的权限声明 --> |
15 | - <uses-permission android:name="android.permission.INTERNET" /> | 15 | + <uses-permission android:name="android.permission.INTERNET"/> |
16 | <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 --> | 16 | <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 --> |
17 | - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 17 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
18 | <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 --> | 18 | <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 --> |
19 | - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 19 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> |
20 | <!-- 用于获取wifi的获取权限,wifi信息会用来进行网络定位 --> | 20 | <!-- 用于获取wifi的获取权限,wifi信息会用来进行网络定位 --> |
21 | - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | 21 | + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> |
22 | <!-- 允许对sd卡进行读写操作 --> | 22 | <!-- 允许对sd卡进行读写操作 --> |
23 | - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | 23 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
24 | <!-- 用于申请调用A-GPS模块 --> | 24 | <!-- 用于申请调用A-GPS模块 --> |
25 | - <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> | 25 | + <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/> |
26 | <!-- 网络库使用,当网络操作时需要确保事务完成不被杀掉 --> | 26 | <!-- 网络库使用,当网络操作时需要确保事务完成不被杀掉 --> |
27 | - <uses-permission android:name="android.permission.WAKE_LOCK" /> | 27 | + <uses-permission android:name="android.permission.WAKE_LOCK"/> |
28 | <!-- 用于读取手机硬件信息等,用于机型过滤 --> | 28 | <!-- 用于读取手机硬件信息等,用于机型过滤 --> |
29 | - <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 29 | + <uses-permission android:name="android.permission.READ_PHONE_STATE"/> |
30 | <!-- 选举使用,当应用有删除或者更新时需要重新选举,复用推送通道 --> | 30 | <!-- 选举使用,当应用有删除或者更新时需要重新选举,复用推送通道 --> |
31 | - <uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED" /> | ||
32 | - <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED" /> | ||
33 | - <uses-permission android:name="android.permission.RESTART_PACKAGES" /> | 31 | + <uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED"/> |
32 | + <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED"/> | ||
33 | + <uses-permission android:name="android.permission.RESTART_PACKAGES"/> | ||
34 | <!-- 补偿通道小米PUSH使用,不用可去除 --> | 34 | <!-- 补偿通道小米PUSH使用,不用可去除 --> |
35 | <!-- <uses-permission android:name="android.permission.GET_TASKS" /> --> | 35 | <!-- <uses-permission android:name="android.permission.GET_TASKS" /> --> |
36 | <!-- 补偿通道GCM使用,不使用可去除 --> | 36 | <!-- 补偿通道GCM使用,不使用可去除 --> |
37 | - <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | 37 | + <uses-permission android:name="android.permission.GET_ACCOUNTS"/> |
38 | <!-- 允许监听启动完成事件 --> | 38 | <!-- 允许监听启动完成事件 --> |
39 | - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | 39 | + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> |
40 | <!-- 允许访问震动器 --> | 40 | <!-- 允许访问震动器 --> |
41 | - <uses-permission android:name="android.permission.VIBRATE" /> | 41 | + <uses-permission android:name="android.permission.VIBRATE"/> |
42 | <!-- 允许task重排序 --> | 42 | <!-- 允许task重排序 --> |
43 | - <uses-permission android:name="android.permission.REORDER_TASKS" /> | 43 | + <uses-permission android:name="android.permission.REORDER_TASKS"/> |
44 | <!-- 用于申请获取蓝牙信息进行室内定位 --> | 44 | <!-- 用于申请获取蓝牙信息进行室内定位 --> |
45 | - <uses-permission android:name="android.permission.BLUETOOTH" /> | ||
46 | - <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | 45 | + <uses-permission android:name="android.permission.BLUETOOTH"/> |
46 | + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> | ||
47 | 47 | ||
48 | <!-- 接收 SDK 消息广播权限, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 --> | 48 | <!-- 接收 SDK 消息广播权限, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 --> |
49 | - <uses-permission android:name="com.shunzhi.parent.permission.RECEIVE_MSG" /> | ||
50 | - <uses-permission android:name="android.permission.CALL_PHONE" /> | 49 | + <uses-permission android:name="com.shunzhi.parent.permission.RECEIVE_MSG"/> |
50 | + <uses-permission android:name="android.permission.CALL_PHONE"/> | ||
51 | 51 | ||
52 | <application | 52 | <application |
53 | android:name=".AppContext" | 53 | android:name=".AppContext" |
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 59 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
60 | 60 | ||
61 | <!-- 高德地图服务 --> | 61 | <!-- 高德地图服务 --> |
62 | - <service android:name="com.amap.api.location.APSService" /> | 62 | + <service android:name="com.amap.api.location.APSService"/> |
63 | <!-- 高德地图密钥 --> | 63 | <!-- 高德地图密钥 --> |
64 | <!-- <meta-data --> | 64 | <!-- <meta-data --> |
65 | <!-- android:name="com.amap.api.v2.apikey" --> | 65 | <!-- android:name="com.amap.api.v2.apikey" --> |
@@ -67,34 +67,34 @@ | @@ -67,34 +67,34 @@ | ||
67 | 67 | ||
68 | 68 | ||
69 | <!-- 家长慧测试APPkey --> | 69 | <!-- 家长慧测试APPkey --> |
70 | - <!--<meta-data--> | ||
71 | - <!--android:name="com.netease.nim.appKey"--> | ||
72 | - <!--android:value="330158c080acdf4dc1092d6a74576c2c" />--> | 70 | + <!-- <meta-data --> |
71 | + <!-- android:name="com.netease.nim.appKey" --> | ||
72 | + <!-- android:value="330158c080acdf4dc1092d6a74576c2c" /> --> | ||
73 | <!-- 家长慧正式APPkey --> | 73 | <!-- 家长慧正式APPkey --> |
74 | 74 | ||
75 | <meta-data | 75 | <meta-data |
76 | android:name="com.netease.nim.appKey" | 76 | android:name="com.netease.nim.appKey" |
77 | - android:value="a1ff0bc08fa0d6f95b480d131e55584b" /> | 77 | + android:value="a1ff0bc08fa0d6f95b480d131e55584b"/> |
78 | <meta-data | 78 | <meta-data |
79 | android:name="android.max_aspect" | 79 | android:name="android.max_aspect" |
80 | - android:value="2.1" /> | 80 | + android:value="2.1"/> |
81 | 81 | ||
82 | <!-- 声明云信后台服务 --> | 82 | <!-- 声明云信后台服务 --> |
83 | <service | 83 | <service |
84 | android:name="com.netease.nimlib.service.NimService" | 84 | android:name="com.netease.nimlib.service.NimService" |
85 | - android:process=":core" /> | 85 | + android:process=":core"/> |
86 | 86 | ||
87 | <!-- 运行后台辅助服务 --> | 87 | <!-- 运行后台辅助服务 --> |
88 | <service | 88 | <service |
89 | android:name="com.netease.nimlib.service.NimService$Aux" | 89 | android:name="com.netease.nimlib.service.NimService$Aux" |
90 | - android:process=":core" /> | 90 | + android:process=":core"/> |
91 | 91 | ||
92 | <!-- 声明云信后台辅助服务 --> | 92 | <!-- 声明云信后台辅助服务 --> |
93 | <service | 93 | <service |
94 | android:name="com.netease.nimlib.job.NIMJobService" | 94 | android:name="com.netease.nimlib.job.NIMJobService" |
95 | android:exported="true" | 95 | android:exported="true" |
96 | android:permission="android.permission.BIND_JOB_SERVICE" | 96 | android:permission="android.permission.BIND_JOB_SERVICE" |
97 | - android:process=":core" /> | 97 | + android:process=":core"/> |
98 | 98 | ||
99 | <!-- 云信SDK的监视系统启动和网络变化的广播接收器,用户开机自启动以及网络变化时候重新登录 --> | 99 | <!-- 云信SDK的监视系统启动和网络变化的广播接收器,用户开机自启动以及网络变化时候重新登录 --> |
100 | <receiver | 100 | <receiver |
@@ -102,50 +102,48 @@ | @@ -102,50 +102,48 @@ | ||
102 | android:exported="false" | 102 | android:exported="false" |
103 | android:process=":core"> | 103 | android:process=":core"> |
104 | <intent-filter> | 104 | <intent-filter> |
105 | - <action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
106 | - <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | 105 | + <action android:name="android.intent.action.BOOT_COMPLETED"/> |
106 | + <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> | ||
107 | </intent-filter> | 107 | </intent-filter> |
108 | </receiver> | 108 | </receiver> |
109 | 109 | ||
110 | <!-- 云信进程间通信receiver --> | 110 | <!-- 云信进程间通信receiver --> |
111 | - <receiver android:name="com.netease.nimlib.service.ResponseReceiver" /> | 111 | + <receiver android:name="com.netease.nimlib.service.ResponseReceiver"/> |
112 | 112 | ||
113 | <!-- 云信进程间通信service --> | 113 | <!-- 云信进程间通信service --> |
114 | - <service android:name="com.netease.nimlib.service.ResponseService" /> | 114 | + <service android:name="com.netease.nimlib.service.ResponseService"/> |
115 | 115 | ||
116 | <meta-data | 116 | <meta-data |
117 | android:name="com.amap.api.v2.apikey" | 117 | android:name="com.amap.api.v2.apikey" |
118 | - android:value="1d130afb822d8a1019e6592cbaf10bcc" /> | 118 | + android:value="1d130afb822d8a1019e6592cbaf10bcc"/> |
119 | 119 | ||
120 | <activity | 120 | <activity |
121 | android:name=".ui.activity.StartActivity" | 121 | android:name=".ui.activity.StartActivity" |
122 | android:launchMode="singleInstance" | 122 | android:launchMode="singleInstance" |
123 | android:windowSoftInputMode="adjustPan|stateAlwaysHidden"> | 123 | android:windowSoftInputMode="adjustPan|stateAlwaysHidden"> |
124 | <intent-filter> | 124 | <intent-filter> |
125 | - <action android:name="android.intent.action.MAIN" /> | 125 | + <action android:name="android.intent.action.MAIN"/> |
126 | 126 | ||
127 | - <category android:name="android.intent.category.LAUNCHER" /> | 127 | + <category android:name="android.intent.category.LAUNCHER"/> |
128 | </intent-filter> | 128 | </intent-filter> |
129 | </activity> | 129 | </activity> |
130 | - <!--<activity--> | ||
131 | - <!--android:name=".ui.MainActivity"--> | ||
132 | - <!--android:screenOrientation="portrait"--> | ||
133 | - <!--android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />--> | 130 | + <!-- <activity --> |
131 | + <!-- android:name=".ui.MainActivity" --> | ||
132 | + <!-- android:screenOrientation="portrait" --> | ||
133 | + <!-- android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> --> | ||
134 | <!-- <activity --> | 134 | <!-- <activity --> |
135 | <!-- android:name=".ui.MainActivity" --> | 135 | <!-- android:name=".ui.MainActivity" --> |
136 | <!-- android:screenOrientation="portrait" --> | 136 | <!-- android:screenOrientation="portrait" --> |
137 | <!-- android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> --> | 137 | <!-- android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> --> |
138 | <activity | 138 | <activity |
139 | android:name=".ui.activity.MyChildActivity" | 139 | android:name=".ui.activity.MyChildActivity" |
140 | - android:screenOrientation="portrait" /> | 140 | + android:screenOrientation="portrait"/> |
141 | <activity | 141 | <activity |
142 | android:name=".ui.activity.consult.ConsultOneLevelActivity" | 142 | android:name=".ui.activity.consult.ConsultOneLevelActivity" |
143 | - android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> | ||
144 | - | 143 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden"/> |
145 | <activity | 144 | <activity |
146 | android:name=".ui.MainActivity" | 145 | android:name=".ui.MainActivity" |
147 | android:screenOrientation="portrait"/> | 146 | android:screenOrientation="portrait"/> |
148 | - | ||
149 | <activity | 147 | <activity |
150 | android:name=".ui.activity.ChildDetialActivity" | 148 | android:name=".ui.activity.ChildDetialActivity" |
151 | android:launchMode="singleInstance" | 149 | android:launchMode="singleInstance" |
@@ -154,27 +152,25 @@ | @@ -154,27 +152,25 @@ | ||
154 | android:name=".ui.activity.binding.CreateChildInfoActivity" | 152 | android:name=".ui.activity.binding.CreateChildInfoActivity" |
155 | android:launchMode="singleInstance" | 153 | android:launchMode="singleInstance" |
156 | android:screenOrientation="portrait" | 154 | android:screenOrientation="portrait" |
157 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | 155 | + android:windowSoftInputMode="adjustPan|stateHidden"/> |
158 | <activity | 156 | <activity |
159 | android:name=".ui.activity.binding.SelectSchoolActivity" | 157 | android:name=".ui.activity.binding.SelectSchoolActivity" |
160 | android:screenOrientation="portrait" | 158 | android:screenOrientation="portrait" |
161 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | ||
162 | - | 159 | + android:windowSoftInputMode="adjustPan|stateHidden"/> |
163 | <activity | 160 | <activity |
164 | android:name=".ui.activity.LoginAndRegistActivity" | 161 | android:name=".ui.activity.LoginAndRegistActivity" |
165 | android:screenOrientation="portrait" | 162 | android:screenOrientation="portrait" |
166 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | 163 | + android:windowSoftInputMode="adjustPan|stateHidden"/> |
167 | <activity | 164 | <activity |
168 | android:name=".ui.activity.PersonInfoActivity" | 165 | android:name=".ui.activity.PersonInfoActivity" |
169 | android:launchMode="singleInstance" | 166 | android:launchMode="singleInstance" |
170 | android:screenOrientation="portrait" | 167 | android:screenOrientation="portrait" |
171 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | 168 | + android:windowSoftInputMode="adjustPan|stateHidden"/> |
172 | <activity | 169 | <activity |
173 | android:name=".ui.activity.binding.CheckInfoActivity" | 170 | android:name=".ui.activity.binding.CheckInfoActivity" |
174 | android:launchMode="singleInstance" | 171 | android:launchMode="singleInstance" |
175 | android:screenOrientation="portrait" | 172 | android:screenOrientation="portrait" |
176 | - android:windowSoftInputMode="adjustPan|stateHidden" /> | ||
177 | - | 173 | + android:windowSoftInputMode="adjustPan|stateHidden"/> |
178 | <activity | 174 | <activity |
179 | android:name=".ui.activity.binding.InviteCodeActivity" | 175 | android:name=".ui.activity.binding.InviteCodeActivity" |
180 | android:launchMode="singleInstance" | 176 | android:launchMode="singleInstance" |
@@ -183,20 +179,21 @@ | @@ -183,20 +179,21 @@ | ||
183 | android:name=".ui.activity.mywebview.WebViewActivity" | 179 | android:name=".ui.activity.mywebview.WebViewActivity" |
184 | android:launchMode="singleInstance" | 180 | android:launchMode="singleInstance" |
185 | android:screenOrientation="portrait"/> | 181 | android:screenOrientation="portrait"/> |
186 | - | ||
187 | <activity | 182 | <activity |
188 | android:name=".ui.activity.consult.ConsultTwoLevelActivity" | 183 | android:name=".ui.activity.consult.ConsultTwoLevelActivity" |
189 | android:launchMode="singleInstance" | 184 | android:launchMode="singleInstance" |
190 | - android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> | ||
191 | - | 185 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden"/> |
192 | <activity | 186 | <activity |
193 | android:name=".ui.activity.orderdetail.OrderDetailActivity" | 187 | android:name=".ui.activity.orderdetail.OrderDetailActivity" |
194 | - android:launchMode="singleInstance" /> | 188 | + android:launchMode="singleInstance"/> |
195 | 189 | ||
196 | <service | 190 | <service |
197 | android:name=".ui.service.BadgeIntentService" | 191 | android:name=".ui.service.BadgeIntentService" |
198 | android:exported="false"> | 192 | android:exported="false"> |
199 | </service> | 193 | </service> |
194 | + | ||
195 | + <activity android:name=".DataBaseTestActivity"> | ||
196 | + </activity> | ||
200 | </application> | 197 | </application> |
201 | 198 | ||
202 | </manifest> | 199 | </manifest> |
203 | \ No newline at end of file | 200 | \ No newline at end of file |
app/src/main/java/com/shunzhi/parent/AppContext.java
@@ -21,10 +21,12 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | @@ -21,10 +21,12 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | ||
21 | import com.shunzhi.parent.bean.message.DaoMaster; | 21 | import com.shunzhi.parent.bean.message.DaoMaster; |
22 | import com.shunzhi.parent.bean.message.DaoMaster.DevOpenHelper; | 22 | import com.shunzhi.parent.bean.message.DaoMaster.DevOpenHelper; |
23 | import com.shunzhi.parent.bean.message.DaoSession; | 23 | import com.shunzhi.parent.bean.message.DaoSession; |
24 | +import com.shunzhi.parent.dbhelper.GreenDaoDatabaseOpenHelper; | ||
24 | import com.shunzhi.parent.manager.MessageManager; | 25 | import com.shunzhi.parent.manager.MessageManager; |
25 | import com.shunzhi.parent.ui.MainActivity; | 26 | import com.shunzhi.parent.ui.MainActivity; |
26 | 27 | ||
27 | import org.greenrobot.greendao.database.Database; | 28 | import org.greenrobot.greendao.database.Database; |
29 | +import org.greenrobot.greendao.database.DatabaseOpenHelper; | ||
28 | 30 | ||
29 | /** | 31 | /** |
30 | * Created by Administrator on 2018/3/7 0007. | 32 | * Created by Administrator on 2018/3/7 0007. |
@@ -79,7 +81,7 @@ public class AppContext extends GlobalApplication { | @@ -79,7 +81,7 @@ public class AppContext extends GlobalApplication { | ||
79 | // 经md5加密后取前n位做密码 | 81 | // 经md5加密后取前n位做密码 |
80 | // DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, ENCRYPTED ? "notes-db-encrypted" : "notes-db"); | 82 | // DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, ENCRYPTED ? "notes-db-encrypted" : "notes-db"); |
81 | // Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb(); | 83 | // Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb(); |
82 | - DevOpenHelper helper = new DevOpenHelper(this, "pw_messages"); | 84 | + DatabaseOpenHelper helper = new GreenDaoDatabaseOpenHelper(this, "pw_messages"); |
83 | Database db = helper.getWritableDb(); | 85 | Database db = helper.getWritableDb(); |
84 | daoSession = new DaoMaster(db).newSession(); | 86 | daoSession = new DaoMaster(db).newSession(); |
85 | } | 87 | } |
app/src/main/java/com/shunzhi/parent/bean/message/PHMessage.java
@@ -34,11 +34,11 @@ public class PHMessage { | @@ -34,11 +34,11 @@ public class PHMessage { | ||
34 | private Integer sendState;//消息发送的状态 1未发送(或者null,不建议使用null) 2发送中 3发送成功 4发送失败 | 34 | private Integer sendState;//消息发送的状态 1未发送(或者null,不建议使用null) 2发送中 3发送成功 4发送失败 |
35 | private Integer sessionType; | 35 | private Integer sessionType; |
36 | 36 | ||
37 | + | ||
37 | @Generated(hash = 1935192071) | 38 | @Generated(hash = 1935192071) |
38 | public PHMessage(Long id, Date date, String messageId, String sessionId, | 39 | public PHMessage(Long id, Date date, String messageId, String sessionId, |
39 | - @NotNull String messageText, String exValue, String filePath, | ||
40 | - String fileUrl, String messageType, Integer sendState, | ||
41 | - Integer sessionType) { | 40 | + @NotNull String messageText, String exValue, String filePath, String fileUrl, |
41 | + String messageType, Integer sendState, Integer sessionType) { | ||
42 | this.id = id; | 42 | this.id = id; |
43 | this.date = date; | 43 | this.date = date; |
44 | this.messageId = messageId; | 44 | this.messageId = messageId; |
@@ -160,4 +160,5 @@ public class PHMessage { | @@ -160,4 +160,5 @@ public class PHMessage { | ||
160 | public void setSessionType(Integer sessionType) { | 160 | public void setSessionType(Integer sessionType) { |
161 | this.sessionType = sessionType; | 161 | this.sessionType = sessionType; |
162 | } | 162 | } |
163 | + | ||
163 | } | 164 | } |
app/src/main/java/com/shunzhi/parent/dbhelper/DBUpdateHelper.java
0 → 100644
@@ -0,0 +1,137 @@ | @@ -0,0 +1,137 @@ | ||
1 | +package com.shunzhi.parent.dbhelper; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.database.sqlite.SQLiteDatabase; | ||
5 | +import android.support.annotation.StringDef; | ||
6 | +import android.text.TextUtils; | ||
7 | +import android.util.Log; | ||
8 | + | ||
9 | +import com.shunzhi.parent.dbhelper.utils.IOUtils; | ||
10 | +import com.shunzhi.parent.dbhelper.utils.NaturalOrderComparator; | ||
11 | +import com.shunzhi.parent.dbhelper.utils.SqlParser; | ||
12 | + | ||
13 | +import org.greenrobot.greendao.database.Database; | ||
14 | + | ||
15 | +import java.io.BufferedReader; | ||
16 | +import java.io.IOException; | ||
17 | +import java.io.InputStream; | ||
18 | +import java.io.InputStreamReader; | ||
19 | +import java.lang.annotation.Retention; | ||
20 | +import java.lang.annotation.RetentionPolicy; | ||
21 | +import java.util.Arrays; | ||
22 | +import java.util.Collections; | ||
23 | +import java.util.List; | ||
24 | + | ||
25 | +import timber.log.Timber; | ||
26 | + | ||
27 | +public class DBUpdateHelper { | ||
28 | + | ||
29 | + private Context context; | ||
30 | + public final static String SQL_PARSER_LEGACY = "legacy"; | ||
31 | + public final static String SQL_PARSER_DELIMITED = "delimited"; | ||
32 | + | ||
33 | + private final String mSqlParser; | ||
34 | + | ||
35 | + @StringDef({SQL_PARSER_DELIMITED, SQL_PARSER_LEGACY}) | ||
36 | + @Retention(RetentionPolicy.SOURCE) | ||
37 | + public @interface SQLParser { | ||
38 | + | ||
39 | + } | ||
40 | + | ||
41 | + public DBUpdateHelper(Context context, @SQLParser String sqlParser) { | ||
42 | + this.context = context.getApplicationContext(); | ||
43 | + mSqlParser = sqlParser; | ||
44 | + } | ||
45 | + | ||
46 | + public boolean onUpdate(Database db, int oldVersion, int newVersion) { | ||
47 | + return executeMigrations(db, oldVersion, newVersion); | ||
48 | + } | ||
49 | + | ||
50 | + private boolean executeMigrations(Database db, int oldVersion, int newVersion) { | ||
51 | + boolean migrationExecuted = false; | ||
52 | + try { | ||
53 | + final List<String> files = Arrays.asList(context.getAssets().list("migrations")); | ||
54 | + Collections.sort(files, new NaturalOrderComparator()); | ||
55 | + | ||
56 | + db.beginTransaction(); | ||
57 | + try { | ||
58 | + for (String file : files) { | ||
59 | + try { | ||
60 | + final int version = Integer.valueOf(file.replace(".sql", "")); | ||
61 | + | ||
62 | + if (version > oldVersion && version <= newVersion) { | ||
63 | + executeSqlScript(db, file); | ||
64 | + migrationExecuted = true; | ||
65 | + Timber.i("---==="+file + " executed succesfully."); | ||
66 | + } | ||
67 | + } catch (NumberFormatException e) { | ||
68 | + e.printStackTrace(); | ||
69 | + } | ||
70 | + } | ||
71 | + db.setTransactionSuccessful(); | ||
72 | + } finally { | ||
73 | + db.endTransaction(); | ||
74 | + } | ||
75 | + } catch (IOException e) { | ||
76 | + e.printStackTrace(); | ||
77 | + } | ||
78 | + | ||
79 | + return migrationExecuted; | ||
80 | + } | ||
81 | + | ||
82 | + private final static String MIGRATION_PATH = "migrations"; | ||
83 | + | ||
84 | + private void executeSqlScript(Database db, String file) { | ||
85 | + | ||
86 | + InputStream stream = null; | ||
87 | + | ||
88 | + try { | ||
89 | + stream = context.getAssets().open(MIGRATION_PATH + "/" + file); | ||
90 | + //因为我懒,不允许自定义解析方式 | ||
91 | + //算了,还是加上吧 突然忘了类型限定怎么写了 就当练练手 | ||
92 | + if (SQL_PARSER_DELIMITED.equalsIgnoreCase(mSqlParser)) { | ||
93 | + executeDelimitedSqlScript(db, stream); | ||
94 | + } else { | ||
95 | + executeLegacySqlScript(db, stream); | ||
96 | + } | ||
97 | + } catch (IOException e) { | ||
98 | + e.printStackTrace(); | ||
99 | + } finally { | ||
100 | + IOUtils.closeQuietly(stream); | ||
101 | + | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + private void executeDelimitedSqlScript(Database db, InputStream stream) throws IOException { | ||
106 | + | ||
107 | + List<String> commands = SqlParser.parse(stream); | ||
108 | + | ||
109 | + for (String command : commands) { | ||
110 | + db.execSQL(command); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + private void executeLegacySqlScript(Database db, InputStream stream) throws IOException { | ||
115 | + | ||
116 | + InputStreamReader reader = null; | ||
117 | + BufferedReader buffer = null; | ||
118 | + | ||
119 | + try { | ||
120 | + reader = new InputStreamReader(stream); | ||
121 | + buffer = new BufferedReader(reader); | ||
122 | + String line = null; | ||
123 | + | ||
124 | + while ((line = buffer.readLine()) != null) { | ||
125 | + line = line.replace(";", "").trim(); | ||
126 | + if (!TextUtils.isEmpty(line)) { | ||
127 | + db.execSQL(line); | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | + } finally { | ||
132 | + IOUtils.closeQuietly(buffer); | ||
133 | + IOUtils.closeQuietly(reader); | ||
134 | + | ||
135 | + } | ||
136 | + } | ||
137 | +} |
app/src/main/java/com/shunzhi/parent/dbhelper/GreenDaoDatabaseOpenHelper.java
0 → 100644
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +package com.shunzhi.parent.dbhelper; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.database.sqlite.SQLiteDatabase; | ||
5 | + | ||
6 | +import com.shunzhi.parent.bean.message.DaoMaster; | ||
7 | + | ||
8 | +import org.greenrobot.greendao.database.Database; | ||
9 | + | ||
10 | +import timber.log.Timber; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by 10501 on 2018/3/27. | ||
14 | + */ | ||
15 | + | ||
16 | +public class GreenDaoDatabaseOpenHelper extends DaoMaster.OpenHelper { | ||
17 | + private Context context; | ||
18 | + | ||
19 | + public GreenDaoDatabaseOpenHelper(Context context, String name) { | ||
20 | + super(context, name); | ||
21 | + this.context = context; | ||
22 | + } | ||
23 | + | ||
24 | + public GreenDaoDatabaseOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) { | ||
25 | + super(context, name, factory); | ||
26 | + this.context = context; | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public void onUpgrade(Database db, int oldVersion, int newVersion) { | ||
31 | + super.onUpgrade(db, oldVersion, newVersion); | ||
32 | + DBUpdateHelper updateHelper = new DBUpdateHelper(context, DBUpdateHelper.SQL_PARSER_LEGACY); | ||
33 | + boolean isSuccess = updateHelper.onUpdate(db, oldVersion, newVersion); | ||
34 | + Timber.i("---===onUpgrade isSuccess : ", isSuccess); | ||
35 | + } | ||
36 | +} |
app/src/main/java/com/shunzhi/parent/dbhelper/utils/IOUtils.java
0 → 100644
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +package com.shunzhi.parent.dbhelper.utils; | ||
2 | + | ||
3 | +import android.database.Cursor; | ||
4 | +import android.util.Log; | ||
5 | + | ||
6 | +import java.io.Closeable; | ||
7 | +import java.io.IOException; | ||
8 | + | ||
9 | +/** | ||
10 | + * Created by 10501 on 2018/3/26. | ||
11 | + */ | ||
12 | + | ||
13 | +public class IOUtils { | ||
14 | + public static void closeQuietly(Closeable closeable) { | ||
15 | + if(closeable != null) { | ||
16 | + try { | ||
17 | + closeable.close(); | ||
18 | + } catch (IOException var2) { | ||
19 | + var2.printStackTrace(); | ||
20 | + } | ||
21 | + | ||
22 | + } | ||
23 | + } | ||
24 | + | ||
25 | + public static void closeQuietly(Cursor cursor) { | ||
26 | + if(cursor != null) { | ||
27 | + try { | ||
28 | + cursor.close(); | ||
29 | + } catch (Exception var2) { | ||
30 | + var2.printStackTrace(); | ||
31 | + } | ||
32 | + | ||
33 | + } | ||
34 | + } | ||
35 | +} |
app/src/main/java/com/shunzhi/parent/dbhelper/utils/NaturalOrderComparator.java
0 → 100644
@@ -0,0 +1,117 @@ | @@ -0,0 +1,117 @@ | ||
1 | +package com.shunzhi.parent.dbhelper.utils; | ||
2 | + | ||
3 | +import java.util.Comparator; | ||
4 | + | ||
5 | +public class NaturalOrderComparator implements Comparator<Object> { | ||
6 | + int compareRight(String a, String b) { | ||
7 | + int bias = 0; | ||
8 | + int ia = 0; | ||
9 | + int ib = 0; | ||
10 | + | ||
11 | + // The longest run of digits wins. That aside, the greatest | ||
12 | + // value wins, but we can't know that it will until we've scanned | ||
13 | + // both numbers to know that they have the same magnitude, so we | ||
14 | + // remember it in BIAS. | ||
15 | + for (;; ia++, ib++) { | ||
16 | + char ca = charAt(a, ia); | ||
17 | + char cb = charAt(b, ib); | ||
18 | + | ||
19 | + if (!Character.isDigit(ca) && !Character.isDigit(cb)) { | ||
20 | + return bias; | ||
21 | + } | ||
22 | + else if (!Character.isDigit(ca)) { | ||
23 | + return -1; | ||
24 | + } | ||
25 | + else if (!Character.isDigit(cb)) { | ||
26 | + return +1; | ||
27 | + } | ||
28 | + else if (ca < cb) { | ||
29 | + if (bias == 0) { | ||
30 | + bias = -1; | ||
31 | + } | ||
32 | + } | ||
33 | + else if (ca > cb) { | ||
34 | + if (bias == 0) | ||
35 | + bias = +1; | ||
36 | + } | ||
37 | + else if (ca == 0 && cb == 0) { | ||
38 | + return bias; | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + | ||
43 | + public int compare(Object o1, Object o2) { | ||
44 | + String a = o1.toString(); | ||
45 | + String b = o2.toString(); | ||
46 | + | ||
47 | + int ia = 0, ib = 0; | ||
48 | + int nza = 0, nzb = 0; | ||
49 | + char ca, cb; | ||
50 | + int result; | ||
51 | + | ||
52 | + while (true) { | ||
53 | + // only count the number of zeroes leading the last number compared | ||
54 | + nza = nzb = 0; | ||
55 | + | ||
56 | + ca = charAt(a, ia); | ||
57 | + cb = charAt(b, ib); | ||
58 | + | ||
59 | + // skip over leading spaces or zeros | ||
60 | + while (Character.isSpaceChar(ca) || ca == '0') { | ||
61 | + if (ca == '0') { | ||
62 | + nza++; | ||
63 | + } | ||
64 | + else { | ||
65 | + // only count consecutive zeroes | ||
66 | + nza = 0; | ||
67 | + } | ||
68 | + | ||
69 | + ca = charAt(a, ++ia); | ||
70 | + } | ||
71 | + | ||
72 | + while (Character.isSpaceChar(cb) || cb == '0') { | ||
73 | + if (cb == '0') { | ||
74 | + nzb++; | ||
75 | + } | ||
76 | + else { | ||
77 | + // only count consecutive zeroes | ||
78 | + nzb = 0; | ||
79 | + } | ||
80 | + | ||
81 | + cb = charAt(b, ++ib); | ||
82 | + } | ||
83 | + | ||
84 | + // process run of digits | ||
85 | + if (Character.isDigit(ca) && Character.isDigit(cb)) { | ||
86 | + if ((result = compareRight(a.substring(ia), b.substring(ib))) != 0) { | ||
87 | + return result; | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + if (ca == 0 && cb == 0) { | ||
92 | + // The strings compare the same. Perhaps the caller | ||
93 | + // will want to call strcmp to break the tie. | ||
94 | + return nza - nzb; | ||
95 | + } | ||
96 | + | ||
97 | + if (ca < cb) { | ||
98 | + return -1; | ||
99 | + } | ||
100 | + else if (ca > cb) { | ||
101 | + return +1; | ||
102 | + } | ||
103 | + | ||
104 | + ++ia; | ||
105 | + ++ib; | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + static char charAt(String s, int i) { | ||
110 | + if (i >= s.length()) { | ||
111 | + return 0; | ||
112 | + } | ||
113 | + else { | ||
114 | + return s.charAt(i); | ||
115 | + } | ||
116 | + } | ||
117 | +} | ||
0 | \ No newline at end of file | 118 | \ No newline at end of file |
app/src/main/java/com/shunzhi/parent/dbhelper/utils/SqlParser.java
0 → 100644
@@ -0,0 +1,93 @@ | @@ -0,0 +1,93 @@ | ||
1 | +package com.shunzhi.parent.dbhelper.utils; | ||
2 | + | ||
3 | +import java.io.BufferedInputStream; | ||
4 | +import java.io.IOException; | ||
5 | +import java.io.InputStream; | ||
6 | +import java.util.ArrayList; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | + | ||
10 | +public class SqlParser { | ||
11 | + | ||
12 | + public final static int STATE_NONE = 0; | ||
13 | + public final static int STATE_STRING = 1; | ||
14 | + public final static int STATE_COMMENT = 2; | ||
15 | + public final static int STATE_COMMENT_BLOCK = 3; | ||
16 | + | ||
17 | + public static List<String> parse(final InputStream stream) throws IOException { | ||
18 | + | ||
19 | + final BufferedInputStream buffer = new BufferedInputStream(stream); | ||
20 | + final List<String> commands = new ArrayList<String>(); | ||
21 | + final StringBuffer sb = new StringBuffer(); | ||
22 | + | ||
23 | + try { | ||
24 | + final Tokenizer tokenizer = new Tokenizer(buffer); | ||
25 | + int state = STATE_NONE; | ||
26 | + | ||
27 | + while (tokenizer.hasNext()) { | ||
28 | + final char c = (char) tokenizer.next(); | ||
29 | + | ||
30 | + if (state == STATE_COMMENT_BLOCK) { | ||
31 | + if (tokenizer.skip("*/")) { | ||
32 | + state = STATE_NONE; | ||
33 | + } | ||
34 | + continue; | ||
35 | + | ||
36 | + } else if (state == STATE_COMMENT) { | ||
37 | + if (isNewLine(c)) { | ||
38 | + state = STATE_NONE; | ||
39 | + } | ||
40 | + continue; | ||
41 | + | ||
42 | + } else if (state == STATE_NONE && tokenizer.skip("/*")) { | ||
43 | + state = STATE_COMMENT_BLOCK; | ||
44 | + continue; | ||
45 | + | ||
46 | + } else if (state == STATE_NONE && tokenizer.skip("--")) { | ||
47 | + state = STATE_COMMENT; | ||
48 | + continue; | ||
49 | + | ||
50 | + } else if (state == STATE_NONE && c == ';') { | ||
51 | + final String command = sb.toString().trim(); | ||
52 | + commands.add(command); | ||
53 | + sb.setLength(0); | ||
54 | + continue; | ||
55 | + | ||
56 | + } else if (state == STATE_NONE && c == '\'') { | ||
57 | + state = STATE_STRING; | ||
58 | + | ||
59 | + } else if (state == STATE_STRING && c == '\'') { | ||
60 | + state = STATE_NONE; | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + if (state == STATE_NONE || state == STATE_STRING) { | ||
65 | + if (state == STATE_NONE && isWhitespace(c)) { | ||
66 | + if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ') { | ||
67 | + sb.append(' '); | ||
68 | + } | ||
69 | + } else { | ||
70 | + sb.append(c); | ||
71 | + } | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + } finally { | ||
76 | + IOUtils.closeQuietly(buffer); | ||
77 | + } | ||
78 | + | ||
79 | + if (sb.length() > 0) { | ||
80 | + commands.add(sb.toString().trim()); | ||
81 | + } | ||
82 | + | ||
83 | + return commands; | ||
84 | + } | ||
85 | + | ||
86 | + private static boolean isNewLine(final char c) { | ||
87 | + return c == '\r' || c == '\n'; | ||
88 | + } | ||
89 | + | ||
90 | + private static boolean isWhitespace(final char c) { | ||
91 | + return c == '\r' || c == '\n' || c == '\t' || c == ' '; | ||
92 | + } | ||
93 | +} |
app/src/main/java/com/shunzhi/parent/dbhelper/utils/Tokenizer.java
0 → 100644
@@ -0,0 +1,59 @@ | @@ -0,0 +1,59 @@ | ||
1 | +package com.shunzhi.parent.dbhelper.utils; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.io.InputStream; | ||
5 | + | ||
6 | + | ||
7 | +public class Tokenizer { | ||
8 | + | ||
9 | + private final InputStream mStream; | ||
10 | + | ||
11 | + private boolean mIsNext; | ||
12 | + private int mCurrent; | ||
13 | + | ||
14 | + public Tokenizer(final InputStream in) { | ||
15 | + this.mStream = in; | ||
16 | + } | ||
17 | + | ||
18 | + public boolean hasNext() throws IOException { | ||
19 | + | ||
20 | + if (!this.mIsNext) { | ||
21 | + this.mIsNext = true; | ||
22 | + this.mCurrent = this.mStream.read(); | ||
23 | + } | ||
24 | + return this.mCurrent != -1; | ||
25 | + } | ||
26 | + | ||
27 | + public int next() throws IOException { | ||
28 | + | ||
29 | + if (!this.mIsNext) { | ||
30 | + this.mCurrent = this.mStream.read(); | ||
31 | + } | ||
32 | + this.mIsNext = false; | ||
33 | + return this.mCurrent; | ||
34 | + } | ||
35 | + | ||
36 | + public boolean skip(final String s) throws IOException { | ||
37 | + | ||
38 | + if (s == null || s.length() == 0) { | ||
39 | + return false; | ||
40 | + } | ||
41 | + | ||
42 | + if (s.charAt(0) != this.mCurrent) { | ||
43 | + return false; | ||
44 | + } | ||
45 | + | ||
46 | + final int len = s.length(); | ||
47 | + this.mStream.mark(len - 1); | ||
48 | + | ||
49 | + for (int n = 1; n < len; n++) { | ||
50 | + final int value = this.mStream.read(); | ||
51 | + | ||
52 | + if (value != s.charAt(n)) { | ||
53 | + this.mStream.reset(); | ||
54 | + return false; | ||
55 | + } | ||
56 | + } | ||
57 | + return true; | ||
58 | + } | ||
59 | +} |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
@@ -18,6 +18,8 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | @@ -18,6 +18,8 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
18 | import com.share.mvpsdk.utils.CacheUtils; | 18 | import com.share.mvpsdk.utils.CacheUtils; |
19 | import com.shunzhi.parent.AppConfig; | 19 | import com.shunzhi.parent.AppConfig; |
20 | import com.shunzhi.parent.AppContext; | 20 | import com.shunzhi.parent.AppContext; |
21 | +import com.shunzhi.parent.BuildConfig; | ||
22 | +import com.shunzhi.parent.DataBaseTestActivity; | ||
21 | import com.shunzhi.parent.R; | 23 | import com.shunzhi.parent.R; |
22 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; | 24 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
23 | import com.shunzhi.parent.contract.mine.MineContract; | 25 | import com.shunzhi.parent.contract.mine.MineContract; |
@@ -73,15 +75,19 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | @@ -73,15 +75,19 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | ||
73 | tvExit.setOnClickListener(this); | 75 | tvExit.setOnClickListener(this); |
74 | binding_state = view.findViewById(R.id.binding_state); | 76 | binding_state = view.findViewById(R.id.binding_state); |
75 | layout_afterLogin.setVisibility(View.GONE); | 77 | layout_afterLogin.setVisibility(View.GONE); |
76 | - | 78 | + if (BuildConfig.DEBUG) { |
79 | + View enter = view.findViewById(R.id.testEnter); | ||
80 | + enter.setVisibility(View.VISIBLE); | ||
81 | + enter.setOnClickListener(this); | ||
82 | + } else view.findViewById(R.id.testEnter).setVisibility(View.GONE); | ||
77 | 83 | ||
78 | } | 84 | } |
79 | 85 | ||
80 | private void setPersonInfo() { | 86 | private void setPersonInfo() { |
81 | 87 | ||
82 | - String useName=AppConfig.getAppConfig(getContext()).get(AppConfig.USER_NAME); | ||
83 | - if (!TextUtils.isEmpty(useName))AppConfig.ISLOGIN=true; | ||
84 | - else AppConfig.ISLOGIN=false; | 88 | + String useName = AppConfig.getAppConfig(getContext()).get(AppConfig.USER_NAME); |
89 | + if (!TextUtils.isEmpty(useName)) AppConfig.ISLOGIN = true; | ||
90 | + else AppConfig.ISLOGIN = false; | ||
85 | 91 | ||
86 | if (TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.ISBINDING))) { | 92 | if (TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.ISBINDING))) { |
87 | binding_state.setText(""); | 93 | binding_state.setText(""); |
@@ -148,7 +154,9 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | @@ -148,7 +154,9 @@ public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract | ||
148 | 154 | ||
149 | case R.id.layout_feedback: | 155 | case R.id.layout_feedback: |
150 | WebViewActivity.getInstance(getActivity(), AppConfig.BASE_URL_ORDER + "FeedBack.aspx?userid=" + AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_ID), -1); | 156 | WebViewActivity.getInstance(getActivity(), AppConfig.BASE_URL_ORDER + "FeedBack.aspx?userid=" + AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_ID), -1); |
151 | - | 157 | + break; |
158 | + case R.id.testEnter: | ||
159 | + DataBaseTestActivity.start(this); | ||
152 | break; | 160 | break; |
153 | default: | 161 | default: |
154 | break; | 162 | break; |
app/src/main/res/layout/fragment_mine.xml
@@ -339,6 +339,20 @@ | @@ -339,6 +339,20 @@ | ||
339 | android:textColor="@color/white" | 339 | android:textColor="@color/white" |
340 | android:textSize="@dimen/size_dp_16" /> | 340 | android:textSize="@dimen/size_dp_16" /> |
341 | 341 | ||
342 | + <TextView | ||
343 | + android:id="@+id/testEnter" | ||
344 | + android:layout_width="match_parent" | ||
345 | + android:layout_height="?android:actionBarSize" | ||
346 | + android:layout_gravity="center_vertical" | ||
347 | + android:gravity="center" | ||
348 | + android:layout_weight="1" | ||
349 | + android:layout_marginTop="@dimen/size_dp_15" | ||
350 | + android:layout_marginBottom="@dimen/size_dp_15" | ||
351 | + android:background="@drawable/shape_xueqing_radius8" | ||
352 | + android:text="测试入口" | ||
353 | + android:textColor="@color/white" | ||
354 | + android:textSize="@dimen/size_dp_16" /> | ||
355 | + | ||
342 | </LinearLayout> | 356 | </LinearLayout> |
343 | </ScrollView> | 357 | </ScrollView> |
344 | 358 |