Commit dec84d107d05c596307c59fc41a0a4d65df58643
1 parent
456ba80d
Exists in
master
no message
Showing
38 changed files
with
1304 additions
and
65 deletions
Show diff stats
No preview for this file type
... | ... | @@ -0,0 +1,29 @@ |
1 | +<component name="ProjectCodeStyleConfiguration"> | |
2 | + <code_scheme name="Project" version="173"> | |
3 | + <Objective-C-extensions> | |
4 | + <file> | |
5 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> | |
6 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> | |
7 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> | |
8 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> | |
9 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> | |
10 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> | |
11 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> | |
12 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> | |
13 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> | |
14 | + </file> | |
15 | + <class> | |
16 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> | |
17 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> | |
18 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> | |
19 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> | |
20 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> | |
21 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> | |
22 | + </class> | |
23 | + <extensions> | |
24 | + <pair source="cpp" header="h" fileNamingConvention="NONE" /> | |
25 | + <pair source="c" header="h" fileNamingConvention="NONE" /> | |
26 | + </extensions> | |
27 | + </Objective-C-extensions> | |
28 | + </code_scheme> | |
29 | +</component> | |
0 | 30 | \ No newline at end of file | ... | ... |
app/build.gradle
1 | 1 | apply plugin: 'com.android.application' |
2 | 2 | |
3 | 3 | android { |
4 | + signingConfigs { | |
5 | + config { | |
6 | + keyAlias 'key0' | |
7 | + keyPassword '123456' | |
8 | + storeFile file('../expressscanner.jks') | |
9 | + storePassword '123456' | |
10 | + } | |
11 | + } | |
4 | 12 | compileSdkVersion 26 |
5 | 13 | defaultConfig { |
6 | 14 | applicationId "com.shunzhi.expressscanner" |
7 | 15 | minSdkVersion 16 |
8 | 16 | targetSdkVersion 26 |
9 | - versionCode 1 | |
10 | - versionName "1.0" | |
17 | + versionCode 101 | |
18 | + versionName "1.0.1" | |
11 | 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
12 | 20 | } |
13 | 21 | buildTypes { |
14 | 22 | release { |
15 | 23 | minifyEnabled false |
16 | 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
25 | + signingConfig signingConfigs.config | |
17 | 26 | } |
18 | 27 | } |
19 | 28 | } | ... | ... |
No preview for this file type
... | ... | @@ -0,0 +1 @@ |
1 | +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":102,"versionName":"1.0.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] | |
0 | 2 | \ No newline at end of file | ... | ... |
app/src/main/AndroidManifest.xml
... | ... | @@ -3,13 +3,15 @@ |
3 | 3 | package="com.shunzhi.expressscanner"> |
4 | 4 | |
5 | 5 | <uses-permission android:name="android.permission.INTERNET" /> |
6 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | |
7 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |
6 | 8 | |
7 | 9 | <application |
8 | 10 | android:name=".AppContext" |
9 | 11 | android:allowBackup="true" |
10 | - android:icon="@mipmap/ic_launcher" | |
12 | + android:icon="@mipmap/logo" | |
11 | 13 | android:label="@string/app_name" |
12 | - android:roundIcon="@mipmap/ic_launcher_round" | |
14 | + android:roundIcon="@mipmap/logo" | |
13 | 15 | android:supportsRtl="true" |
14 | 16 | android:theme="@style/AppTheme"> |
15 | 17 | <activity | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/AppConfig.java
... | ... | @@ -12,16 +12,17 @@ import android.text.TextUtils; |
12 | 12 | public class AppConfig { |
13 | 13 | |
14 | 14 | // public static String BASE_URL="http://ecampus.zjyzzx.net/"; |
15 | +// | |
16 | + public static String BASE_URL="http://campus.myjxt.com/"; | |
15 | 17 | |
16 | - public static String BASE_URL="http://60.190.202.57:1000/"; | |
17 | - | |
18 | - public static String LOGIN_NAME="15305755683"; | |
19 | - public static String LOGIN_PWD="755683"; | |
18 | + public static String LOGIN_NAME="18358585337"; | |
19 | + public static String LOGIN_PWD="585337"; | |
20 | 20 | |
21 | 21 | public static String ACCESS_TOKEN = "access_token"; |
22 | 22 | public static final String OPEN_SCAN = "open_scan"; |
23 | 23 | public static String CURRENT_USERID = "current_userid"; |
24 | 24 | public static String SCHOOL_ID="school_id"; |
25 | + public static String url_apk = "http://update.myjxt.com/express.apk"; | |
25 | 26 | |
26 | 27 | private static AppConfig appConfig = null; |
27 | 28 | public static AppConfig getAppConfig() { | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/AppContext.java
app/src/main/java/com/shunzhi/expressscanner/api/MainApi.java
... | ... | @@ -39,4 +39,7 @@ public interface MainApi { |
39 | 39 | @GET("api/NewAssets/UpdateIsReceive") |
40 | 40 | Observable<JsonObject> UpdateIsReceive(@Query("ExpressNumber") String ExpressNumber,@Query("schoolId") String schoolId); |
41 | 41 | |
42 | + @GET("api/Common/AppVersion?appType=5") | |
43 | + Observable<JsonObject> isUpdateVersion(); | |
44 | + | |
42 | 45 | } | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/bean/Version.java
0 → 100644
... | ... | @@ -0,0 +1,14 @@ |
1 | +package com.shunzhi.expressscanner.bean; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +/** | |
6 | + * Created by xf on 2015/9/23. | |
7 | + */ | |
8 | +public class Version implements Serializable { | |
9 | + public String verNo; | |
10 | + public String content; | |
11 | + public String inTime; | |
12 | + | |
13 | +} | |
14 | + | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/contract/MainContract.java
app/src/main/java/com/shunzhi/expressscanner/fragment/MainFragment.java
... | ... | @@ -34,9 +34,11 @@ import com.share.mvpsdk.utils.NetworkConnectionUtils; |
34 | 34 | import com.share.mvpsdk.utils.StringUtils; |
35 | 35 | import com.share.mvpsdk.utils.ToastUtils; |
36 | 36 | import com.shunzhi.expressscanner.AppConfig; |
37 | +import com.shunzhi.expressscanner.AppContext; | |
37 | 38 | import com.shunzhi.expressscanner.R; |
38 | 39 | import com.shunzhi.expressscanner.bean.ExpressBean; |
39 | 40 | import com.shunzhi.expressscanner.contract.MainContract; |
41 | +import com.shunzhi.expressscanner.manager.UpdateManager; | |
40 | 42 | import com.shunzhi.expressscanner.present.MainPresenter; |
41 | 43 | import com.smartdevice.aidl.ICallBack; |
42 | 44 | import com.smartdevice.aidl.IZKCService; |
... | ... | @@ -226,6 +228,18 @@ public class MainFragment extends BaseMVPCompatFragment<MainContract.MainPresent |
226 | 228 | } |
227 | 229 | |
228 | 230 | @Override |
231 | + public void showUserInfo() { | |
232 | + UpdateManager.getInstance().setContext(getActivity()).isUpdate(false); | |
233 | + } | |
234 | + | |
235 | + @Override | |
236 | + public void onResume() { | |
237 | + super.onResume(); | |
238 | + if (AppConfig.getAppConfig().get(AppConfig.ACCESS_TOKEN)!=null) | |
239 | + UpdateManager.getInstance().setContext(getActivity()).isUpdate(false); | |
240 | + } | |
241 | + | |
242 | + @Override | |
229 | 243 | public void onClick(View view) { |
230 | 244 | switch (view.getId()) { |
231 | 245 | case R.id.tvCommint: | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/manager/CloseUtils.java
0 → 100644
... | ... | @@ -0,0 +1,33 @@ |
1 | +package com.shunzhi.expressscanner.manager; | |
2 | + | |
3 | +import android.support.annotation.Nullable; | |
4 | + | |
5 | +import java.io.Closeable; | |
6 | +import java.io.IOException; | |
7 | + | |
8 | +/** | |
9 | + * Created by zdf on 2016/1/20. | |
10 | + */ | |
11 | +public class CloseUtils { | |
12 | + private CloseUtils() { | |
13 | + } | |
14 | + | |
15 | + /** | |
16 | + * | |
17 | + * @param closeable 所有实现Closeable接口的类的实例(常用有输入、输出流、Cursor等) | |
18 | + * @return 关闭成功 | |
19 | + */ | |
20 | + public static boolean closeQuietly(@Nullable Closeable... closeable) { | |
21 | + if (closeable != null && closeable.length > 0) { | |
22 | + try { | |
23 | + for (Closeable c : closeable) { | |
24 | + if (c != null) c.close(); | |
25 | + } | |
26 | + } catch (IOException e) { | |
27 | + e.printStackTrace(); | |
28 | + return false; | |
29 | + } | |
30 | + } | |
31 | + return true; | |
32 | + } | |
33 | +} | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/manager/SystemHelper.java
0 → 100644
... | ... | @@ -0,0 +1,435 @@ |
1 | +/** | |
2 | + * ClassName: MyApp.java | |
3 | + * created on 2013-1-24 | |
4 | + * Copyrights 2013-1-24 hjgang All rights reserved. | |
5 | + * site: http://t.qq.com/hjgang2012 | |
6 | + * email: hjgang@yahoo.cn | |
7 | + */ | |
8 | +package com.shunzhi.expressscanner.manager; | |
9 | + | |
10 | +import android.Manifest; | |
11 | +import android.annotation.TargetApi; | |
12 | +import android.app.Activity; | |
13 | +import android.content.ContentResolver; | |
14 | +import android.content.Context; | |
15 | +import android.content.Intent; | |
16 | +import android.content.Intent.ShortcutIconResource; | |
17 | +import android.content.pm.PackageInfo; | |
18 | +import android.content.pm.PackageManager; | |
19 | +import android.database.Cursor; | |
20 | +import android.net.ConnectivityManager; | |
21 | +import android.net.NetworkInfo; | |
22 | +import android.net.NetworkInfo.State; | |
23 | +import android.net.Uri; | |
24 | +import android.os.Build; | |
25 | +import android.support.v4.app.ActivityCompat; | |
26 | +import android.support.v4.content.FileProvider; | |
27 | +import android.telephony.TelephonyManager; | |
28 | +import android.util.DisplayMetrics; | |
29 | +import android.util.Log; | |
30 | +import android.view.Window; | |
31 | +import android.view.WindowManager; | |
32 | + | |
33 | + | |
34 | +import com.shunzhi.expressscanner.R; | |
35 | + | |
36 | +import java.io.File; | |
37 | +import java.sql.Timestamp; | |
38 | +import java.text.ParseException; | |
39 | +import java.text.SimpleDateFormat; | |
40 | +import java.util.Date; | |
41 | + | |
42 | +import timber.log.Timber; | |
43 | + | |
44 | + | |
45 | +/** | |
46 | + * 获取系统信息的工具类 | |
47 | + * | |
48 | + * @author hjgang | |
49 | + */ | |
50 | +public class SystemHelper { | |
51 | + private SystemHelper() { | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 创建本应用的桌面快捷方式<br/> | |
56 | + * 注意:需要添加权限<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/> | |
57 | + * | |
58 | + * @param | |
59 | + */ | |
60 | + public static void createShortcut(Context context, Class<?> clazz) { | |
61 | + Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); | |
62 | + | |
63 | + //快捷方式的名称 | |
64 | + shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.app_name)); | |
65 | + shortcut.putExtra("duplicate", false); //不允许重复创建 | |
66 | + | |
67 | + Intent localIntent2 = new Intent(context, clazz); | |
68 | + localIntent2.setAction(Intent.ACTION_MAIN); | |
69 | + localIntent2.addCategory(Intent.CATEGORY_LAUNCHER); | |
70 | + | |
71 | + shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, localIntent2);//指定快捷方式要启动的Activity类型 | |
72 | + | |
73 | + //快捷方式的图标 | |
74 | + ShortcutIconResource iconResource = ShortcutIconResource.fromContext(context, R.drawable.logo); | |
75 | + shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); | |
76 | + | |
77 | + context.sendBroadcast(shortcut); | |
78 | + } | |
79 | + | |
80 | + /** | |
81 | + * 字符串转换成date | |
82 | + * | |
83 | + * @param time | |
84 | + * @return | |
85 | + */ | |
86 | + public static Date getDateTime1(String time) { | |
87 | + Date newtime = null; | |
88 | + SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
89 | + try { | |
90 | + if (time != null && !time.equals("0")) { | |
91 | + newtime = sdfDateFormat.parse(time); | |
92 | + } | |
93 | + } catch (Exception err) { | |
94 | + | |
95 | + } | |
96 | + return newtime; | |
97 | + } | |
98 | + | |
99 | + /** | |
100 | + * 将字符串转为 时间戳 | |
101 | + * | |
102 | + * @param time | |
103 | + * @return | |
104 | + */ | |
105 | + public static String getTimestamp(String time) { | |
106 | + Date newtime = null; | |
107 | + SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
108 | + try { | |
109 | + if (time != null && !time.equals("0")) { | |
110 | + newtime = sdfDateFormat.parse(time); | |
111 | + } | |
112 | + } catch (Exception err) { | |
113 | + | |
114 | + } | |
115 | + return newtime.getTime() + ""; | |
116 | + } | |
117 | + | |
118 | + /** | |
119 | + * 将时间戳转为 字符串 | |
120 | + * yyyy-MM-dd HH:mm | |
121 | + */ | |
122 | + public static String getTimeStr(String time) { | |
123 | + | |
124 | + String newtime = null; | |
125 | + SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
126 | + if (time != null && !time.equals("0")) { | |
127 | + newtime = sdfDateFormat.format(new Timestamp(Long.parseLong(time))); | |
128 | + } | |
129 | + return newtime; | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * 将时间戳转为 字符串 | |
134 | + * yyyy-MM-dd | |
135 | + */ | |
136 | + public static String getTimeStr3(String time) { | |
137 | + String newtime = null; | |
138 | + SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
139 | + if (time != null && !time.equals("0")) { | |
140 | + newtime = sdfDateFormat.format(new Date(Long.parseLong(time) * 1000)); | |
141 | + } | |
142 | + return newtime; | |
143 | + } | |
144 | + | |
145 | + // 将字符串转为时间戳 | |
146 | + public static String getTime(String time) { | |
147 | + SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日hh时mm分"); | |
148 | + Date date = null; | |
149 | + if (time == null || "".equals(time) || "null".equals(time)) { | |
150 | + return "0"; | |
151 | + } | |
152 | + if (time.contains("年")) { | |
153 | + int year = Integer.parseInt(time.substring(0, time.indexOf("年"))); | |
154 | + if (year <= 1970) { | |
155 | + return "0"; | |
156 | + } | |
157 | + } | |
158 | + try { | |
159 | + date = format.parse(time); | |
160 | + } catch (ParseException e) { | |
161 | + e.printStackTrace(); | |
162 | + return null; | |
163 | + } | |
164 | + return date.getTime() / 1000 + ""; | |
165 | + } | |
166 | + | |
167 | + // 将字符串转为时间戳 | |
168 | + public static String getTime2(String time) { | |
169 | + SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日"); | |
170 | + Date date = null; | |
171 | + if (time == null || "".equals(time) || "null".equals(time)) { | |
172 | + return "0"; | |
173 | + } | |
174 | + int year = Integer.parseInt(time.substring(0, time.indexOf("年"))); | |
175 | + if (year <= 1970) { | |
176 | + return "0"; | |
177 | + } | |
178 | + try { | |
179 | + date = format.parse(time); | |
180 | + } catch (ParseException e) { | |
181 | + e.printStackTrace(); | |
182 | + } | |
183 | + return date.getTime() / 1000 + ""; | |
184 | + } | |
185 | + | |
186 | + /** | |
187 | + * @param oldTime 较小的时间 | |
188 | + * @param newTime 较大的时间 (如果为空 默认当前时间 ,表示和当前时间相比) | |
189 | + * @return -1 :同一天. 0:昨天 . 1 :至少是前天. | |
190 | + * @throws ParseException 转换异常 | |
191 | + * @author LuoB. | |
192 | + */ | |
193 | + public static int isYeaterday(Date oldTime, Date newTime) throws ParseException { | |
194 | + if (newTime == null) { | |
195 | + newTime = new Date(); | |
196 | + } | |
197 | + //将下面的 理解成 yyyy-MM-dd 00:00:00 更好理解点 | |
198 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
199 | + String todayStr = format.format(newTime); | |
200 | + Date today = format.parse(todayStr); | |
201 | + //昨天 86400000=24*60*60*1000 一天 | |
202 | + if ((today.getTime() - oldTime.getTime()) > 0 && (today.getTime() - oldTime.getTime()) <= 86400000) { | |
203 | + return 0; | |
204 | + } else if ((today.getTime() - oldTime.getTime()) <= 0) { //至少是今天 | |
205 | + return -1; | |
206 | + } else { //至少是前天 | |
207 | + return 1; | |
208 | + } | |
209 | + } | |
210 | + | |
211 | + /** | |
212 | + * 检查是否已经创建了桌面快捷方式<br/> | |
213 | + * 注意:需要添加权限<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/> | |
214 | + * | |
215 | + * @param context | |
216 | + * @return | |
217 | + */ | |
218 | + public static boolean hasShortCut(Context context) { | |
219 | + String url = ""; | |
220 | + if (Build.VERSION.SDK_INT < 8) { | |
221 | + url = "content://com.android.launcher.settings/favorites?notify=true"; | |
222 | + } else { | |
223 | + url = "content://com.android.launcher2.settings/favorites?notify=true"; | |
224 | + } | |
225 | + ContentResolver resolver = context.getContentResolver(); | |
226 | + Cursor cursor = resolver.query(Uri.parse(url), null, "title=?", | |
227 | + new String[]{context.getString(R.string.app_name)}, null); | |
228 | + | |
229 | + if (cursor != null && cursor.moveToFirst()) { | |
230 | + cursor.close(); | |
231 | + return true; | |
232 | + } | |
233 | + | |
234 | + return false; | |
235 | + } | |
236 | + | |
237 | + /** | |
238 | + * 获取当前机器的屏幕信息对象<br/> | |
239 | + * 另外:通过android.os.Build类可以获取当前系统的相关信息 | |
240 | + * | |
241 | + * @param context | |
242 | + * @return | |
243 | + */ | |
244 | + public static DisplayMetrics getScreenInfo(Context context) { | |
245 | + WindowManager windowManager = (WindowManager) context | |
246 | + .getSystemService(Context.WINDOW_SERVICE); | |
247 | + DisplayMetrics dm = new DisplayMetrics(); | |
248 | + windowManager.getDefaultDisplay().getMetrics(dm); | |
249 | + // dm.widthPixels;//寬度 | |
250 | + // dm.heightPixels; //高度 | |
251 | + // dm.density; //密度 | |
252 | + return dm; | |
253 | + } | |
254 | + | |
255 | + public static int dip2px(Context context, double dipValue) { | |
256 | + final float scale = context.getResources().getDisplayMetrics().density; | |
257 | + return (int) (dipValue * scale + 0.5f); | |
258 | + } | |
259 | + | |
260 | + public static int px2dip(Context context, double pxValue) { | |
261 | + final float scale = context.getResources().getDisplayMetrics().density; | |
262 | + return (int) (pxValue / scale + 0.5f); | |
263 | + } | |
264 | + | |
265 | + /** | |
266 | + * 获取手机号<br/> | |
267 | + * 注意:需要添加权限<uses-permission | |
268 | + * android:name="android.permission.READ_PHONE_STATE"/>。另外很多手机不能获取到当前手机号 | |
269 | + * | |
270 | + * @param context | |
271 | + * @return | |
272 | + */ | |
273 | + public static String getMobileNumber(Context context) { | |
274 | + TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |
275 | + if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { | |
276 | + // TODO: Consider calling | |
277 | + // ActivityCompat#requestPermissions | |
278 | + // here to request the missing permissions, and then overriding | |
279 | + // public void onRequestPermissionsResult(int requestCode, String[] permissions, | |
280 | + // int[] grantResults) | |
281 | + // to handle the case where the user grants the permission. See the documentation | |
282 | + // for ActivityCompat#requestPermissions for more details. | |
283 | + } | |
284 | + String deviceid = tm.getDeviceId();//获取智能设备唯一编号 | |
285 | + String te1 = tm.getLine1Number();//获取本机号码 | |
286 | + String imei = tm.getSimSerialNumber();//获得SIM卡的序号 | |
287 | + String imsi = tm.getSubscriberId();//得到用户Id | |
288 | + return tm.getLine1Number(); | |
289 | + } | |
290 | + | |
291 | + /** | |
292 | + * 检测当前的网络连接是否可用<br/> | |
293 | + * 注意:需要添加权限<uses-permission | |
294 | + * android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
295 | + * | |
296 | + * @param context | |
297 | + * @return | |
298 | + */ | |
299 | + public static boolean isConnected(Context context) { | |
300 | + boolean flag = false; | |
301 | + try { | |
302 | + ConnectivityManager connManager = (ConnectivityManager) context | |
303 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
304 | + if (null != connManager) { | |
305 | + NetworkInfo info = connManager.getActiveNetworkInfo(); | |
306 | + if (null != info && info.isAvailable()) { | |
307 | + flag = true; | |
308 | + } | |
309 | + } | |
310 | + } catch (Exception e) { | |
311 | + Timber.d(e + ""); | |
312 | + } | |
313 | + return flag; | |
314 | + } | |
315 | + | |
316 | + /** | |
317 | + * 检测当前网络连接的类型<br/> | |
318 | + * 注意:需要添加权限<uses-permission | |
319 | + * android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
320 | + * | |
321 | + * @param context | |
322 | + * @return 返回0代表GPRS网络;返回1,代表WIFI网络;返回-1代表网络不可用 | |
323 | + */ | |
324 | + public static int getNetworkType(Context context) { | |
325 | + int code = -1; | |
326 | + try { | |
327 | + ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
328 | + if (null != connManager) { | |
329 | + State state = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState(); | |
330 | + if (State.CONNECTED == state) { | |
331 | + code = ConnectivityManager.TYPE_WIFI; | |
332 | + } else { | |
333 | + state = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState(); | |
334 | + if (State.CONNECTED == state) { | |
335 | + code = ConnectivityManager.TYPE_MOBILE; | |
336 | + } | |
337 | + } | |
338 | + } | |
339 | + } catch (Exception e) { | |
340 | + Timber.d(e + ""); | |
341 | + } | |
342 | + return code; | |
343 | + } | |
344 | + | |
345 | + /** | |
346 | + * 返回当前程序版本代码,如:1 | |
347 | + * | |
348 | + * @param context | |
349 | + * @return 当前程序版本代码 | |
350 | + */ | |
351 | + public static int getAppVersionCode(Context context) { | |
352 | + int versionCode = -1; | |
353 | + try { | |
354 | + PackageManager pm = context.getApplicationContext().getPackageManager(); | |
355 | + PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); | |
356 | + versionCode = pi.versionCode; | |
357 | + | |
358 | + } catch (Exception e) { | |
359 | + Timber.d("66666%s", e.toString() + ""); | |
360 | + } | |
361 | + return versionCode; | |
362 | + } | |
363 | + | |
364 | + /** | |
365 | + * 返回当前程序版本名,如:1.0.1 | |
366 | + * | |
367 | + * @param context | |
368 | + * @return 当前程序版本名 | |
369 | + */ | |
370 | + public static String getAppVersionName(Context context) { | |
371 | + String versionName = ""; | |
372 | + try { | |
373 | + PackageManager pm = context.getPackageManager(); | |
374 | + PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); | |
375 | + versionName = pi.versionName; | |
376 | + | |
377 | + } catch (Exception e) { | |
378 | + e.printStackTrace(); | |
379 | + } | |
380 | + return versionName; | |
381 | + } | |
382 | + | |
383 | + /** | |
384 | + * 安装指定的APK文件,主要用于本应用程序的更新 | |
385 | + * | |
386 | + * @param context | |
387 | + * @param apk apk文件的全路径名 | |
388 | + */ | |
389 | + public static void installAPK(Context context, String apk) { | |
390 | + Intent intent = new Intent(Intent.ACTION_VIEW); | |
391 | + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
392 | + Uri data; | |
393 | + | |
394 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |
395 | + data = FileProvider.getUriForFile(context, "com.shunzhi.parent.fileprovider", new File(apk)); | |
396 | +// 给目标应用一个临时授权 | |
397 | + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |
398 | + } else data = Uri.fromFile(new File(apk)); | |
399 | + intent.setDataAndType(data, "application/vnd.android.package-archive"); | |
400 | + context.startActivity(intent); | |
401 | + android.os.Process.killProcess(android.os.Process.myPid()); | |
402 | + } | |
403 | + | |
404 | + public static void remoteAPK(Context context) { | |
405 | + Uri packageURI = Uri.parse("package:net.shunzhi"); | |
406 | + Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); | |
407 | + context.startActivity(uninstallIntent); | |
408 | + } | |
409 | + | |
410 | +// public static void setSystemBar(Context context, boolean on, int color) { | |
411 | +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | |
412 | +// SystemHelper.setTranslucentStatus(context, on); | |
413 | +// SystemBarTintManager mTintManager = new SystemBarTintManager((Activity) context); | |
414 | +// mTintManager.setStatusBarTintEnabled(true); | |
415 | +// //mTintManager.setNavigationBarTintEnabled(true); | |
416 | +// mTintManager.setStatusBarTintResource(color); | |
417 | +// | |
418 | +// //SystemBarTintManager.SystemBarConfig config = mTintManager.getConfig(); | |
419 | +// //listViewDrawer.setPadding(0, config.getPixelInsetTop(true), 0, config.getPixelInsetBottom()); | |
420 | +// } | |
421 | +// } | |
422 | + | |
423 | + @TargetApi(19) | |
424 | + public static void setTranslucentStatus(Context context, boolean on) { | |
425 | + Window win = ((Activity) context).getWindow(); | |
426 | + WindowManager.LayoutParams winParams = win.getAttributes(); | |
427 | + final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; | |
428 | + if (on) { | |
429 | + winParams.flags |= bits; | |
430 | + } else { | |
431 | + winParams.flags &= ~bits; | |
432 | + } | |
433 | + win.setAttributes(winParams); | |
434 | + } | |
435 | +} | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/manager/UpdateManager.java
0 → 100644
... | ... | @@ -0,0 +1,374 @@ |
1 | +package com.shunzhi.expressscanner.manager; | |
2 | + | |
3 | +import android.app.Dialog; | |
4 | +import android.content.Context; | |
5 | +import android.content.DialogInterface; | |
6 | +import android.content.DialogInterface.OnClickListener; | |
7 | +import android.os.Environment; | |
8 | +import android.os.Handler; | |
9 | +import android.os.Message; | |
10 | +import android.support.v7.app.AlertDialog; | |
11 | +import android.view.LayoutInflater; | |
12 | +import android.view.View; | |
13 | +import android.widget.ProgressBar; | |
14 | +import android.widget.TextView; | |
15 | +import android.widget.Toast; | |
16 | + | |
17 | +import com.google.gson.Gson; | |
18 | +import com.google.gson.JsonObject; | |
19 | +import com.share.mvpsdk.RxManager; | |
20 | +import com.share.mvpsdk.helper.RetrofitCreateHelper; | |
21 | +import com.share.mvpsdk.helper.RxHelper; | |
22 | +import com.share.mvpsdk.utils.ToastUtils; | |
23 | +import com.shunzhi.expressscanner.AppConfig; | |
24 | +import com.shunzhi.expressscanner.R; | |
25 | +import com.shunzhi.expressscanner.api.MainApi; | |
26 | +import com.shunzhi.expressscanner.bean.Version; | |
27 | +import com.shunzhi.expressscanner.view.MyVersionDialog; | |
28 | + | |
29 | +import java.io.File; | |
30 | +import java.io.FileOutputStream; | |
31 | +import java.io.IOException; | |
32 | +import java.io.InputStream; | |
33 | +import java.net.HttpURLConnection; | |
34 | +import java.net.MalformedURLException; | |
35 | +import java.net.URL; | |
36 | +import java.text.SimpleDateFormat; | |
37 | +import java.util.HashMap; | |
38 | + | |
39 | +import io.reactivex.functions.Consumer; | |
40 | +import timber.log.Timber; | |
41 | + | |
42 | +public class UpdateManager { | |
43 | + | |
44 | + AlertDialog dialogShowCheckingDialog; | |
45 | + /** | |
46 | + * 是否正在检查更新 | |
47 | + */ | |
48 | + public boolean ischeckingForUpdate = false; | |
49 | + /* 下载中 */ | |
50 | + private static final int DOWNLOAD = 1; | |
51 | + /* 下载结束 */ | |
52 | + private static final int DOWNLOAD_FINISH = 2; | |
53 | + /** | |
54 | + * 是否人为打断检查更新状态 | |
55 | + */ | |
56 | + private boolean isChechingInterrupted = false; | |
57 | + /** | |
58 | + * 结束正在获取更新 | |
59 | + */ | |
60 | + /* 保存解析的XML信息 */ | |
61 | + static HashMap<String, String> mHashMap; | |
62 | + /* 下载保存路径 */ | |
63 | + private String mSavePath; | |
64 | + /* 记录进度条数量 */ | |
65 | + private int progress; | |
66 | + /* 是否取消更新 */ | |
67 | + private static boolean cancelUpdate = false; | |
68 | + | |
69 | + private static Context mContext; | |
70 | + /* 更新进度条 */ | |
71 | + private ProgressBar mProgress; | |
72 | + private TextView mProgressText; | |
73 | + private Dialog mDownloadDialog; | |
74 | + double serviceCode = 1; | |
75 | + int versionCode = 1; | |
76 | + | |
77 | + //mHandler | |
78 | +//region | |
79 | + private Handler mHandler = new Handler() { | |
80 | + public void handleMessage(Message msg) { | |
81 | + switch (msg.what) { | |
82 | + // 正在下载 | |
83 | + case DOWNLOAD: | |
84 | + // 设置进度条位置 | |
85 | + mProgress.setProgress(progress); | |
86 | + mProgressText.setText(progress + "%"); | |
87 | + break; | |
88 | + case DOWNLOAD_FINISH: | |
89 | + mDownloadDialog.dismiss(); | |
90 | + File apkfile = new File(mSavePath, mHashMap.get("name")); | |
91 | + SystemHelper.installAPK(mContext, apkfile.toString()); | |
92 | + break; | |
93 | + default: | |
94 | + break; | |
95 | + } | |
96 | + } | |
97 | + }; | |
98 | + | |
99 | + //endregion | |
100 | + private UpdateManager() { | |
101 | + mHashMap = new HashMap<String, String>(); | |
102 | + mHashMap.put("url", AppConfig.url_apk); | |
103 | + mHashMap.put("name", "XSTApp.apk"); | |
104 | + | |
105 | + } | |
106 | + | |
107 | + public UpdateManager(Context context) { | |
108 | + this.mContext = null; | |
109 | + this.mContext = context; | |
110 | + //获取更新版本和url | |
111 | + mHashMap = new HashMap<String, String>(); | |
112 | + mHashMap.put("url", AppConfig.url_apk); | |
113 | + mHashMap.put("name", "XSTApp.apk"); | |
114 | + | |
115 | + } | |
116 | + | |
117 | + /** | |
118 | + * 检查软件是否有更新版本 | |
119 | + * | |
120 | + * @return | |
121 | + */ | |
122 | + String date = ""; | |
123 | + | |
124 | + /** | |
125 | + * @param shouldInterruptDialogShow 是否显示打断检查更新的对话框 | |
126 | + */ | |
127 | + RxManager rxManager=new RxManager(); | |
128 | + public void isUpdate(final boolean shouldInterruptDialogShow) { | |
129 | + date = new SimpleDateFormat("yyyyMMddHHmmss").format(new java.util.Date()); | |
130 | + // 获取当前软件版本 | |
131 | + if (!ischeckingForUpdate) { | |
132 | + isChechingInterrupted = false; | |
133 | + if (shouldInterruptDialogShow) showCheckingDialog(mContext); | |
134 | + ischeckingForUpdate = true; | |
135 | + versionCode = SystemHelper.getAppVersionCode(mContext); | |
136 | + rxManager.register( RetrofitCreateHelper.getInstance().createApi(MainApi.class,AppConfig.BASE_URL) | |
137 | + .isUpdateVersion().compose(RxHelper.<JsonObject>rxSchedulerHelper()).subscribe(new Consumer<JsonObject>() { | |
138 | + @Override | |
139 | + public void accept(JsonObject jsonObject) throws Exception { | |
140 | + try { | |
141 | + Gson gson=new Gson(); | |
142 | + Version version=gson.fromJson(jsonObject.get("data").getAsJsonObject().toString(),Version.class); | |
143 | + serviceCode = Double.parseDouble(version.verNo); | |
144 | + double currentVersion = serviceCode / 100; | |
145 | + Timber.d("66666%s","currentVersion="+currentVersion+"serviceCode="+serviceCode+"versionCode="+versionCode); | |
146 | + if ((serviceCode > versionCode) && ischeckingForUpdate && !isChechingInterrupted) { | |
147 | + showNoticeDialog(currentVersion, version.content, isChechingInterrupted); | |
148 | + } else if (!(serviceCode > versionCode) && !isChechingInterrupted) { | |
149 | + Toast.makeText(mContext, "已经是最新版本啦!", Toast.LENGTH_SHORT).show(); | |
150 | + mContext = null; | |
151 | + } | |
152 | + | |
153 | + }catch (Exception e){ | |
154 | + e.printStackTrace(); | |
155 | + }finally { | |
156 | + ischeckingForUpdate = false; | |
157 | + } | |
158 | + } | |
159 | + }, new Consumer<Throwable>() { | |
160 | + @Override | |
161 | + public void accept(Throwable throwable) throws Exception { | |
162 | + ToastUtils.showToast("更新失败:"+throwable.toString()); | |
163 | + } | |
164 | + })); | |
165 | + | |
166 | +// Timber.d("sign:%s", Utils.getSignStr()); | |
167 | + /*Ion.with(mContext) | |
168 | + .load(Constants.url_version) | |
169 | + .setHeader("sign", Utils.getSignStr()) | |
170 | + .setTimeout(5000) | |
171 | + .asJsonObject() | |
172 | + .setCallback(new FutureCallback<JsonObject>() { | |
173 | + @Override | |
174 | + public void onCompleted(Exception e, JsonObject result) { | |
175 | + try { | |
176 | + Timber.i("exception : %s",e); | |
177 | + Timber.i("result : %s", result); | |
178 | + if (dialogShowCheckingDialog != null) | |
179 | + dialogShowCheckingDialog.dismiss(); | |
180 | + Gson gson = new Gson(); | |
181 | + String s = gson.toJson(result.getAsJsonObject("data")); | |
182 | + Version serverVersion = gson.fromJson(s, new TypeToken<Version>() { | |
183 | + }.getType()); | |
184 | + serviceCode = Double.parseDouble(serverVersion.verNo); | |
185 | + double currentVersion = serviceCode / 100; | |
186 | + if ((serviceCode > versionCode) && ischeckingForUpdate && !isChechingInterrupted) { | |
187 | + showNoticeDialog(currentVersion, serverVersion.content, isChechingInterrupted); | |
188 | + } else if (!(serviceCode > versionCode) && shouldInterruptDialogShow && !isChechingInterrupted) { | |
189 | + Toast.makeText(mContext, "已经是最新版本啦!", Toast.LENGTH_SHORT).show(); | |
190 | + mContext = null; | |
191 | + } | |
192 | + } catch (Exception ee) { | |
193 | + ee.printStackTrace(); | |
194 | + if (shouldInterruptDialogShow) | |
195 | + Toast.makeText(mContext, "版本检测失败", Toast.LENGTH_LONG).show(); | |
196 | + mContext = null; | |
197 | + } finally { | |
198 | + ischeckingForUpdate = false; | |
199 | + } | |
200 | + } | |
201 | + });*/ | |
202 | + } | |
203 | + } | |
204 | + | |
205 | + | |
206 | + public UpdateManager setContext(Context ctx) { | |
207 | + mContext = ctx; | |
208 | + return this; | |
209 | + } | |
210 | + | |
211 | + public static UpdateManager getInstance() { | |
212 | + | |
213 | + return SingletonHolder.sInstance; | |
214 | + } | |
215 | + | |
216 | + private static class SingletonHolder { | |
217 | + private static final UpdateManager sInstance = new UpdateManager(); | |
218 | + } | |
219 | + | |
220 | + /** | |
221 | + * 显示软件更新对话框 | |
222 | + */ | |
223 | + public void showNoticeDialog(double serviceCode, String content, Boolean isInterrupted) { | |
224 | + final MyVersionDialog dialog = new MyVersionDialog(mContext, "V" + serviceCode, "10.1M", | |
225 | + content, R.style.dialog, new MyVersionDialog.OnCustomDialogListener() { | |
226 | + @Override | |
227 | + public void clickSure() { | |
228 | + showDownloadDialog(); | |
229 | + } | |
230 | + | |
231 | + @Override | |
232 | + public void clickCancel() { | |
233 | + mContext = null; | |
234 | + } | |
235 | + }); | |
236 | + dialog.setCanceledOnTouchOutside(false); | |
237 | + if (!dialog.isShowing()) | |
238 | + dialog.show(); | |
239 | + ischeckingForUpdate = false; | |
240 | + } | |
241 | + | |
242 | + private void showCheckingDialog(Context ctx) { | |
243 | + dialogShowCheckingDialog = styleDialogBuilder(ctx) | |
244 | + .setMessage("正在检查更新...") | |
245 | + .setTitle("提示") | |
246 | + .setNegativeButton("取消", new OnClickListener() { | |
247 | + @Override | |
248 | + public void onClick(DialogInterface dialog, int which) { | |
249 | + isChechingInterrupted = true; | |
250 | + mContext = null; | |
251 | + dialog.dismiss(); | |
252 | + } | |
253 | + }).create(); | |
254 | + dialogShowCheckingDialog.setCanceledOnTouchOutside(false); | |
255 | + if (!dialogShowCheckingDialog.isShowing()) { | |
256 | + dialogShowCheckingDialog.show(); | |
257 | + } | |
258 | + } | |
259 | + | |
260 | + /** | |
261 | + * 显示软件下载对话框 | |
262 | + */ | |
263 | + private void showDownloadDialog() { | |
264 | + // 构造软件下载对话框 | |
265 | + AlertDialog.Builder builder = styleDialogBuilder(mContext); | |
266 | + builder.setTitle("更新中"); | |
267 | + // 给下载对话框增加进度条 | |
268 | + final LayoutInflater inflater = LayoutInflater.from(mContext); | |
269 | + View v = inflater.inflate(R.layout.progress_dialog, null); | |
270 | + mProgress = (ProgressBar) v.findViewById(R.id.pbar); | |
271 | + mProgressText = (TextView) v.findViewById(R.id.txt_wait); | |
272 | + builder.setView(v); | |
273 | + // 取消更新 | |
274 | + builder.setNegativeButton("取消", new OnClickListener() { | |
275 | + @Override | |
276 | + public void onClick(DialogInterface dialog, int which) { | |
277 | + dialog.dismiss(); | |
278 | + // 设置取消状态 | |
279 | + File APKfile = new File(mSavePath); | |
280 | + //FileUtil.deleteFile(APKfile, APKfile + "/" + mHashMap.get("name")); | |
281 | + cancelUpdate = true; | |
282 | + } | |
283 | + }); | |
284 | + mDownloadDialog = builder.create(); | |
285 | + mDownloadDialog.setCanceledOnTouchOutside(false); | |
286 | + mDownloadDialog.show(); | |
287 | + // 现在文件 | |
288 | + downloadApk(); | |
289 | + } | |
290 | + public AlertDialog.Builder styleDialogBuilder(Context context) { | |
291 | + return new AlertDialog.Builder(context, R.style.AlertDialogCustom); | |
292 | + } | |
293 | + /** | |
294 | + * 下载apk文件 | |
295 | + */ | |
296 | + private void downloadApk() { | |
297 | + // 启动新线程下载软件 | |
298 | + cancelUpdate = false; | |
299 | + downloadApkThread downloadThread = new downloadApkThread(); | |
300 | + downloadThread.start(); | |
301 | + } | |
302 | + | |
303 | + /** | |
304 | + * 下载文件线程 | |
305 | + * | |
306 | + * @author coolszy | |
307 | + * @date 2012-4-26 | |
308 | + * @blog http://blog.92coding.com | |
309 | + */ | |
310 | + private class downloadApkThread extends Thread { | |
311 | + HttpURLConnection conn = null; | |
312 | + InputStream is = null; | |
313 | + FileOutputStream fos = null; | |
314 | + | |
315 | + @Override | |
316 | + public void run() { | |
317 | + //cancelUpdate = false; | |
318 | + try { | |
319 | + // 判断SD卡是否存在,并且是否具有读写权限 | |
320 | + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { | |
321 | + // 获得存储卡的路径 | |
322 | + String sdpath = Environment.getExternalStorageDirectory() + "/"; | |
323 | + mSavePath = sdpath + "download"; | |
324 | + URL url = new URL(mHashMap.get("url")); | |
325 | + // 创建连接 | |
326 | + conn = (HttpURLConnection) url.openConnection(); | |
327 | + conn.connect(); | |
328 | + // 获取文件大小 | |
329 | + int length = conn.getContentLength();//服务端要设置 content length属性 | |
330 | + // 创建输入流 | |
331 | + is = conn.getInputStream(); | |
332 | + | |
333 | + File file = new File(mSavePath); | |
334 | + // 判断文件目录是否存在 | |
335 | + if (!file.exists()) { | |
336 | + if (!file.mkdir()) file.mkdirs();//创建文件失败,则创建文件夹 | |
337 | + } | |
338 | + File apkFile = new File(mSavePath, mHashMap.get("name")); | |
339 | + fos = new FileOutputStream(apkFile); | |
340 | + int count = 0; | |
341 | + // 缓存 | |
342 | + byte buf[] = new byte[1024]; | |
343 | + // 写入到文件中 | |
344 | + while (!cancelUpdate) { | |
345 | + int numread = is.read(buf); | |
346 | + count += numread; | |
347 | + progress = (int) (((float) count / length) * 100);// 计算进度条位置 | |
348 | + mHandler.sendEmptyMessage(DOWNLOAD);// 更新进度 | |
349 | + if (numread <= 0) { | |
350 | + // 下载完成 | |
351 | + mHandler.sendEmptyMessage(DOWNLOAD_FINISH); | |
352 | + break; | |
353 | + } | |
354 | + // 写入文件 | |
355 | + fos.write(buf, 0, numread); | |
356 | + } // 点击取消就停止下载. | |
357 | + | |
358 | + } | |
359 | + } catch (MalformedURLException e) { | |
360 | + Timber.d("MalformedURLException=%s"+e + ""); | |
361 | + e.printStackTrace(); | |
362 | + } catch (IOException e) { | |
363 | + Timber.d("MalformedURLException=%s"+e + ""); | |
364 | + e.printStackTrace(); | |
365 | + } finally { | |
366 | + conn.disconnect(); | |
367 | + CloseUtils.closeQuietly(fos, is); | |
368 | + } | |
369 | + // 取消下载对话框显示 | |
370 | + Thread.currentThread().interrupt(); | |
371 | + rxManager.unSubscribe(); | |
372 | + } | |
373 | + } | |
374 | +} | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/present/MainPresenter.java
... | ... | @@ -5,11 +5,14 @@ import android.util.Log; |
5 | 5 | import com.google.gson.JsonArray; |
6 | 6 | import com.google.gson.JsonObject; |
7 | 7 | import com.share.mvpsdk.RxManager; |
8 | +import com.share.mvpsdk.helper.RetrofitCreateHelper; | |
8 | 9 | import com.share.mvpsdk.utils.OkHttpExceptionUtil; |
9 | 10 | import com.share.mvpsdk.utils.ToastUtils; |
10 | 11 | import com.shunzhi.expressscanner.AppConfig; |
12 | +import com.shunzhi.expressscanner.AppContext; | |
11 | 13 | import com.shunzhi.expressscanner.bean.ExpressBean; |
12 | 14 | import com.shunzhi.expressscanner.contract.MainContract; |
15 | +import com.shunzhi.expressscanner.manager.UpdateManager; | |
13 | 16 | import com.shunzhi.expressscanner.model.MainModel; |
14 | 17 | |
15 | 18 | import org.json.JSONObject; |
... | ... | @@ -44,6 +47,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
44 | 47 | public void accept(JsonObject jsonObject) throws Exception { |
45 | 48 | String access_token = jsonObject.get("access_token").getAsString(); |
46 | 49 | AppConfig.getAppConfig().set(AppConfig.ACCESS_TOKEN, access_token); |
50 | + RetrofitCreateHelper.getInstance().setAuthorization(access_token); | |
47 | 51 | getCurrentInfo(); |
48 | 52 | } |
49 | 53 | }, new Consumer<Throwable>() { |
... | ... | @@ -71,6 +75,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
71 | 75 | if (teachClass.size() > 0) { |
72 | 76 | JsonObject jsonObject1 = teachClass.get(0).getAsJsonObject(); |
73 | 77 | AppConfig.getAppConfig().set(AppConfig.SCHOOL_ID, jsonObject1.get("schoolId").getAsString()); |
78 | + mIView.showUserInfo(); | |
74 | 79 | } |
75 | 80 | } |
76 | 81 | } |
... | ... | @@ -90,6 +95,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
90 | 95 | mRxManager.register(mIModel.getExpressInfo(expressCode, scholId).subscribe(new Consumer<JsonObject>() { |
91 | 96 | @Override |
92 | 97 | public void accept(JsonObject jsonObject) throws Exception { |
98 | + Log.d("55555","getExpressInfo="+jsonObject.toString()); | |
93 | 99 | if (jsonObject.get("status").getAsInt() == 1) { |
94 | 100 | JsonArray jsonArray = jsonObject.getAsJsonArray("data"); |
95 | 101 | ExpressBean expressBean = new ExpressBean(); |
... | ... | @@ -104,12 +110,11 @@ public class MainPresenter extends MainContract.MainPresenter { |
104 | 110 | } |
105 | 111 | mIView.showExpressInfo(expressBean); |
106 | 112 | } |
107 | - Log.d("55555", "getExpressInfo=" + jsonObject.toString()); | |
108 | 113 | } |
109 | 114 | }, new Consumer<Throwable>() { |
110 | 115 | @Override |
111 | 116 | public void accept(Throwable throwable) throws Exception { |
112 | - Log.d("55555", "getExpressInfo=" + throwable.toString()); | |
117 | + ToastUtils.showToast(throwable.toString()); | |
113 | 118 | } |
114 | 119 | })); |
115 | 120 | |
... | ... | @@ -134,7 +139,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
134 | 139 | }, new Consumer<Throwable>() { |
135 | 140 | @Override |
136 | 141 | public void accept(Throwable throwable) throws Exception { |
137 | - | |
142 | + ToastUtils.showToast(throwable.toString()); | |
138 | 143 | } |
139 | 144 | })); |
140 | 145 | } |
... | ... | @@ -156,6 +161,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
156 | 161 | }, new Consumer<Throwable>() { |
157 | 162 | @Override |
158 | 163 | public void accept(Throwable throwable) throws Exception { |
164 | + ToastUtils.showToast(throwable.toString()); | |
159 | 165 | // Log.d("55555","upExpressInfo="+throwable.toString()); |
160 | 166 | } |
161 | 167 | })); |
... | ... | @@ -167,7 +173,6 @@ public class MainPresenter extends MainContract.MainPresenter { |
167 | 173 | @Override |
168 | 174 | public void accept(JsonObject jsonObject) throws Exception { |
169 | 175 | try { |
170 | - Log.d("55555","SearchExpressPhone="+jsonObject.toString()); | |
171 | 176 | if (jsonObject.get("status").getAsInt() == 1) { |
172 | 177 | List<String> list = new ArrayList<>(); |
173 | 178 | JsonArray data = jsonObject.getAsJsonArray("data"); |
... | ... | @@ -184,7 +189,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
184 | 189 | }, new Consumer<Throwable>() { |
185 | 190 | @Override |
186 | 191 | public void accept(Throwable throwable) throws Exception { |
187 | - Log.d("55555","SearchExpressPhone="+throwable.toString()); | |
192 | + ToastUtils.showToast(throwable.toString()); | |
188 | 193 | } |
189 | 194 | })); |
190 | 195 | } | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/view/MyVersionDialog.java
0 → 100644
... | ... | @@ -0,0 +1,94 @@ |
1 | +package com.shunzhi.expressscanner.view; | |
2 | +import android.app.Dialog; | |
3 | +import android.content.Context; | |
4 | +import android.content.res.Resources; | |
5 | +import android.os.Bundle; | |
6 | +import android.text.method.ScrollingMovementMethod; | |
7 | +import android.util.DisplayMetrics; | |
8 | +import android.view.Gravity; | |
9 | +import android.view.View; | |
10 | +import android.view.Window; | |
11 | +import android.view.WindowManager; | |
12 | +import android.widget.Button; | |
13 | +import android.widget.TextView; | |
14 | + | |
15 | +import com.shunzhi.expressscanner.R; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + * 自定义dialog | |
20 | + * @author Mr.Xu | |
21 | + * | |
22 | + */ | |
23 | +public class MyVersionDialog extends Dialog { | |
24 | + //定义回调事件,用于dialog的点击事件 | |
25 | + public interface OnCustomDialogListener{ | |
26 | + public void clickSure(); | |
27 | + public void clickCancel(); | |
28 | + } | |
29 | + | |
30 | + private OnCustomDialogListener customDialogListener; | |
31 | + String version = "",size="",content =""; | |
32 | + public MyVersionDialog(Context context, String pVerion, String pSize, String pContent, int style, OnCustomDialogListener customDialogListener) { | |
33 | + super(context, style); | |
34 | + this.customDialogListener = customDialogListener; | |
35 | + version = pVerion; | |
36 | + size = pSize; | |
37 | + content = pContent; | |
38 | + Window window = getWindow(); | |
39 | + WindowManager.LayoutParams params = window.getAttributes(); | |
40 | + //set width,height by density and gravity | |
41 | + float density = getDensity(context); | |
42 | + params.width = (int) (300*density); | |
43 | + params.height = (int) (90*density); | |
44 | + params.gravity = Gravity.CENTER; | |
45 | + | |
46 | + | |
47 | + //WindowManager.LayoutParams p = getWindow().getAttributes(); //获取对话框当前的参数值 | |
48 | + //Display d = window.getDefaultDisplay(); //为获取屏幕宽、高 | |
49 | + //p.height = (int) (d.getHeight() * 0.6); //高度设置为屏幕的0.6 | |
50 | + //p.width = (int) (d.getWidth() * 0.95); //宽度设置为屏幕的0.95 | |
51 | + | |
52 | + window.setAttributes(params); | |
53 | + | |
54 | + } | |
55 | + private float getDensity(Context context) { | |
56 | + Resources resources = context.getResources(); | |
57 | + DisplayMetrics dm = resources.getDisplayMetrics(); | |
58 | + return dm.density; | |
59 | + } | |
60 | + @Override | |
61 | + protected void onCreate(Bundle savedInstanceState) { | |
62 | + super.onCreate(savedInstanceState); | |
63 | + setContentView(R.layout.myversiondialog); | |
64 | + Button clickBtn = (Button) findViewById(R.id.btnSure); | |
65 | + clickBtn.setOnClickListener(clickListener); | |
66 | + Button clearBtn = (Button) findViewById(R.id.btnCancel); | |
67 | + clearBtn.setOnClickListener(clearListener); | |
68 | + | |
69 | + TextView txtVersionNum = (TextView) findViewById(R.id.txtVersionNum); | |
70 | + txtVersionNum.setText(version); | |
71 | + | |
72 | + TextView txtSizeNum = (TextView) findViewById(R.id.txtSizeNum); | |
73 | + txtSizeNum.setText(size); | |
74 | + | |
75 | + TextView txtContent = (TextView) findViewById(R.id.txtContent); | |
76 | + txtContent.setText(content); | |
77 | + txtContent.setMovementMethod(ScrollingMovementMethod.getInstance()) ; | |
78 | + } | |
79 | + | |
80 | + private View.OnClickListener clickListener = new View.OnClickListener() { | |
81 | + @Override | |
82 | + public void onClick(View v) { | |
83 | + customDialogListener.clickSure(); | |
84 | + MyVersionDialog.this.dismiss(); | |
85 | + } | |
86 | + }; | |
87 | + private View.OnClickListener clearListener = new View.OnClickListener() { | |
88 | + @Override | |
89 | + public void onClick(View v) { | |
90 | + customDialogListener.clickCancel(); | |
91 | + MyVersionDialog.this.dismiss(); | |
92 | + } | |
93 | + }; | |
94 | +} | ... | ... |
1.21 KB
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
... | ... | @@ -1,34 +0,0 @@ |
1 | -<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | - xmlns:aapt="http://schemas.android.com/aapt" | |
3 | - android:width="108dp" | |
4 | - android:height="108dp" | |
5 | - android:viewportHeight="108" | |
6 | - android:viewportWidth="108"> | |
7 | - <path | |
8 | - android:fillType="evenOdd" | |
9 | - android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" | |
10 | - android:strokeColor="#00000000" | |
11 | - android:strokeWidth="1"> | |
12 | - <aapt:attr name="android:fillColor"> | |
13 | - <gradient | |
14 | - android:endX="78.5885" | |
15 | - android:endY="90.9159" | |
16 | - android:startX="48.7653" | |
17 | - android:startY="61.0927" | |
18 | - android:type="linear"> | |
19 | - <item | |
20 | - android:color="#44000000" | |
21 | - android:offset="0.0" /> | |
22 | - <item | |
23 | - android:color="#00000000" | |
24 | - android:offset="1.0" /> | |
25 | - </gradient> | |
26 | - </aapt:attr> | |
27 | - </path> | |
28 | - <path | |
29 | - android:fillColor="#FFFFFF" | |
30 | - android:fillType="nonZero" | |
31 | - android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" | |
32 | - android:strokeColor="#00000000" | |
33 | - android:strokeWidth="1" /> | |
34 | -</vector> |
1.71 KB
2.36 KB
... | ... | @@ -0,0 +1,7 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + | |
4 | + <corners android:bottomLeftRadius="@dimen/size_dp_8" android:bottomRightRadius="@dimen/size_dp_8"/> | |
5 | + <solid android:color="@color/white"/> | |
6 | + | |
7 | +</shape> | |
0 | 8 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_main.xml
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | android:layout_width="match_parent" |
11 | 11 | android:layout_height="wrap_content" |
12 | 12 | android:layout_gravity="center" |
13 | - android:layout_marginBottom="@dimen/dp_60" | |
13 | + android:layout_marginBottom="20dp" | |
14 | 14 | android:orientation="vertical"> |
15 | 15 | |
16 | 16 | <LinearLayout |
... | ... | @@ -19,6 +19,14 @@ |
19 | 19 | android:layout_height="wrap_content" |
20 | 20 | android:orientation="vertical" |
21 | 21 | > |
22 | + | |
23 | + <ImageView | |
24 | + android:layout_width="wrap_content" | |
25 | + android:layout_height="wrap_content" | |
26 | + android:src="@drawable/logo" | |
27 | + android:layout_marginBottom="@dimen/dp_10" | |
28 | + /> | |
29 | + | |
22 | 30 | <TextView |
23 | 31 | android:layout_width="wrap_content" |
24 | 32 | android:layout_height="wrap_content" |
... | ... | @@ -171,7 +179,7 @@ |
171 | 179 | android:layout_width="wrap_content" |
172 | 180 | android:layout_height="wrap_content" |
173 | 181 | android:layout_gravity="bottom|center" |
174 | - android:layout_marginBottom="60dp" | |
182 | + android:layout_marginBottom="50dp" | |
175 | 183 | android:text="提示:请扫描快递" |
176 | 184 | android:textColor="@color/md_red_500" |
177 | 185 | android:textSize="@dimen/sp_14" /> | ... | ... |
... | ... | @@ -0,0 +1,180 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:id="@+id/layoutRoot" | |
4 | + android:layout_width="250dp" | |
5 | + android:layout_height="wrap_content" | |
6 | + android:background="@drawable/shape_radius8_whit" | |
7 | + android:orientation="vertical" | |
8 | + android:windowIsFloating="true"> | |
9 | + | |
10 | + | |
11 | + <RelativeLayout | |
12 | + android:id="@+id/layoutTitle" | |
13 | + android:layout_width="fill_parent" | |
14 | + android:layout_height="50dp"> | |
15 | + | |
16 | + <TextView | |
17 | + android:id="@+id/txtTitle" | |
18 | + android:layout_width="wrap_content" | |
19 | + android:layout_height="wrap_content" | |
20 | + android:layout_centerInParent="true" | |
21 | + android:text="发现新版本" | |
22 | + android:textColor="@color/textColor" | |
23 | + android:textSize="@dimen/textSize18" /> | |
24 | + | |
25 | + <View | |
26 | + android:layout_width="fill_parent" | |
27 | + android:layout_height="1dp" | |
28 | + android:layout_alignParentBottom="true" | |
29 | + android:layout_alignParentLeft="true" | |
30 | + android:layout_alignParentStart="false" | |
31 | + android:background="@color/textColor" /> | |
32 | + | |
33 | + </RelativeLayout> | |
34 | + | |
35 | + <LinearLayout | |
36 | + android:id="@+id/layoutContent" | |
37 | + android:layout_width="fill_parent" | |
38 | + android:layout_height="wrap_content" | |
39 | + android:orientation="vertical" | |
40 | + android:padding="10dp"> | |
41 | + | |
42 | + | |
43 | + <RelativeLayout | |
44 | + android:id="@+id/layoutVersion" | |
45 | + android:layout_width="match_parent" | |
46 | + android:layout_height="20dp"> | |
47 | + | |
48 | + <TextView | |
49 | + android:id="@+id/txtVersion" | |
50 | + android:layout_width="wrap_content" | |
51 | + android:layout_height="wrap_content" | |
52 | + android:layout_alignParentLeft="true" | |
53 | + android:layout_centerVertical="true" | |
54 | + android:text="新版本:" | |
55 | + android:textColor="@color/textColor" | |
56 | + android:textSize="@dimen/size_dp_14" /> | |
57 | + | |
58 | + <TextView | |
59 | + android:id="@+id/txtVersionNum" | |
60 | + android:layout_width="wrap_content" | |
61 | + android:layout_height="wrap_content" | |
62 | + android:layout_centerVertical="true" | |
63 | + android:layout_toRightOf="@+id/txtVersion" | |
64 | + android:text="V1.1.1" | |
65 | + android:textColor="@color/textColor" | |
66 | + android:textSize="@dimen/size_dp_14" /> | |
67 | + </RelativeLayout> | |
68 | + | |
69 | + <RelativeLayout | |
70 | + android:visibility="gone" | |
71 | + android:id="@+id/layoutSize" | |
72 | + android:layout_width="match_parent" | |
73 | + android:layout_height="20dp"> | |
74 | + | |
75 | + <TextView | |
76 | + android:id="@+id/txtSize" | |
77 | + android:layout_width="wrap_content" | |
78 | + android:layout_height="wrap_content" | |
79 | + android:layout_alignParentLeft="true" | |
80 | + android:layout_centerVertical="true" | |
81 | + android:text="新版本大小:" | |
82 | + android:textColor="@color/textColor" | |
83 | + android:textSize="@dimen/size_dp_14" /> | |
84 | + | |
85 | + <TextView | |
86 | + android:id="@+id/txtSizeNum" | |
87 | + android:layout_width="wrap_content" | |
88 | + android:layout_height="wrap_content" | |
89 | + android:layout_centerVertical="true" | |
90 | + android:layout_toRightOf="@+id/txtSize" | |
91 | + android:text="24.86M" | |
92 | + android:textColor="@color/textColor" | |
93 | + android:textSize="@dimen/size_dp_14" /> | |
94 | + </RelativeLayout> | |
95 | + | |
96 | + <TextView | |
97 | + android:id="@+id/txtUpdate" | |
98 | + android:layout_width="wrap_content" | |
99 | + android:layout_height="wrap_content" | |
100 | + android:layout_below="@+id/dlgTtile" | |
101 | + android:layout_centerHorizontal="true" | |
102 | + android:text="更新内容" | |
103 | + android:textColor="@color/textColor" | |
104 | + android:textSize="@dimen/size_dp_14" /> | |
105 | + | |
106 | + <TextView | |
107 | + android:id="@+id/txtContent" | |
108 | + android:layout_width="fill_parent" | |
109 | + android:layout_height="wrap_content" | |
110 | + android:layout_below="@+id/dlgTtile" | |
111 | + android:layout_centerHorizontal="true" | |
112 | + android:layout_marginTop="5dp" | |
113 | + android:maxHeight="100dp" | |
114 | + android:maxLines="4" | |
115 | + android:scrollbars="vertical" | |
116 | + android:text="这是确定消息" | |
117 | + android:textColor="@color/textColor" | |
118 | + android:textSize="@dimen/size_dp_14" /> | |
119 | + | |
120 | + </LinearLayout> | |
121 | + | |
122 | + <RelativeLayout | |
123 | + android:id="@+id/layoutBottom" | |
124 | + android:layout_width="fill_parent" | |
125 | + android:layout_height="35dp" | |
126 | + android:layout_marginBottom="10dp"> | |
127 | + | |
128 | + <Button | |
129 | + android:id="@+id/btnSure" | |
130 | + android:layout_width="wrap_content" | |
131 | + android:layout_height="wrap_content" | |
132 | + android:layout_centerVertical="true" | |
133 | + android:layout_marginRight="10dp" | |
134 | + android:layout_toLeftOf="@+id/line2" | |
135 | + android:layout_weight="1" | |
136 | + android:background="@color/xueqing_blue" | |
137 | + android:gravity="center" | |
138 | + android:paddingBottom="5dp" | |
139 | + android:paddingLeft="16dp" | |
140 | + android:paddingRight="16dp" | |
141 | + android:paddingTop="5dp" | |
142 | + android:text="立即更新" | |
143 | + android:textColor="@color/white" | |
144 | + android:textSize="@dimen/size_dp_14" /> | |
145 | + | |
146 | + <Button | |
147 | + android:id="@+id/btnCancel" | |
148 | + android:layout_width="wrap_content" | |
149 | + android:layout_height="wrap_content" | |
150 | + android:layout_alignParentBottom="false" | |
151 | + android:layout_alignParentEnd="false" | |
152 | + android:layout_alignParentRight="false" | |
153 | + android:layout_centerVertical="true" | |
154 | + android:layout_marginLeft="10dp" | |
155 | + android:layout_toRightOf="@+id/line2" | |
156 | + android:layout_weight="1" | |
157 | + android:background="@color/textBlue" | |
158 | + android:gravity="center" | |
159 | + android:paddingBottom="5dp" | |
160 | + android:paddingLeft="16dp" | |
161 | + android:paddingRight="16dp" | |
162 | + android:paddingTop="5dp" | |
163 | + android:text="以后再说" | |
164 | + android:textColor="@color/white" | |
165 | + android:textSize="@dimen/size_dp_14" /> | |
166 | + | |
167 | + <View | |
168 | + android:id="@+id/line2" | |
169 | + android:layout_width="0dp" | |
170 | + android:layout_height="50dp" | |
171 | + android:layout_alignParentTop="true" | |
172 | + android:layout_centerHorizontal="true" | |
173 | + android:layout_centerVertical="true" | |
174 | + android:layout_weight="0" | |
175 | + android:background="@color/gray" /> | |
176 | + | |
177 | + </RelativeLayout> | |
178 | + | |
179 | + | |
180 | +</LinearLayout> | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:layout_width="fill_parent" | |
4 | + android:layout_height="fill_parent" | |
5 | + android:layout_gravity="center" | |
6 | + android:gravity="center" | |
7 | + android:orientation="vertical"> | |
8 | + <ProgressBar | |
9 | + android:id="@+id/pbar" | |
10 | + style="?android:attr/progressBarStyleHorizontal" | |
11 | + android:layout_width="300dp" | |
12 | + android:layout_height="wrap_content" | |
13 | + android:max="100" | |
14 | + android:progress="0" /> | |
15 | + | |
16 | + <TextView | |
17 | + android:id="@+id/txt_wait" | |
18 | + android:layout_width="wrap_content" | |
19 | + android:layout_height="wrap_content" | |
20 | + android:layout_gravity="center" | |
21 | + android:layout_marginTop="8.0dip" | |
22 | + android:focusable="false" | |
23 | + android:singleLine="true" | |
24 | + android:text="加载中..." | |
25 | + android:textColor="@color/textColor" | |
26 | + android:textSize="12.0sp" /> | |
27 | + | |
28 | +</LinearLayout> | ... | ... |
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
... | ... | @@ -1,5 +0,0 @@ |
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | - <background android:drawable="@drawable/ic_launcher_background"/> | |
4 | - <foreground android:drawable="@drawable/ic_launcher_foreground"/> | |
5 | -</adaptive-icon> | |
6 | 0 | \ No newline at end of file |
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
... | ... | @@ -1,5 +0,0 @@ |
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | - <background android:drawable="@drawable/ic_launcher_background"/> | |
4 | - <foreground android:drawable="@drawable/ic_launcher_foreground"/> | |
5 | -</adaptive-icon> | |
6 | 0 | \ No newline at end of file |
1.21 KB
1.71 KB
2.36 KB
app/src/main/res/values/colors.xml
... | ... | @@ -3,4 +3,29 @@ |
3 | 3 | <color name="colorPrimary">#3F51B5</color> |
4 | 4 | <color name="colorPrimaryDark">#303F9F</color> |
5 | 5 | <color name="colorAccent">#FF4081</color> |
6 | + | |
7 | + <color name="hintTextColor">#494947</color> | |
8 | + <color name="bottomline">#B8B8B9</color> | |
9 | + <color name="bg_main">#F0EFF5</color> | |
10 | + | |
11 | + <color name="textRed">#FC5B6A</color> | |
12 | + | |
13 | + <color name="blue">#2956FE</color> | |
14 | + <color name="green">#00CB87</color> | |
15 | + <color name="back_top">#6d9bff</color> | |
16 | + <color name="textBlue">#ACC9FC</color> | |
17 | + <color name="titleColor">#6d9bff</color> | |
18 | + <color name="bgColor">#F0EFF5</color> | |
19 | + <color name="textColor">#494947</color> | |
20 | + <color name="xueqing_blue">#ABC9FF</color> | |
21 | + <color name="zxlx">#1BE2E5</color> | |
22 | + <color name="huodong_blue">#ACD1FB</color> | |
23 | + <color name="text_color">#757575</color> | |
24 | + <color name="textGreen">#5FB762</color> | |
25 | + <color name="transparent">#00000000</color> | |
26 | + <color name="deyu_textColor">#60b3f6</color> | |
27 | + <color name="deyu_BlueColor">#2b71c4</color> | |
28 | + <color name="line_color">#80bebebe</color> | |
29 | + | |
30 | + <color name="backgroud_null">#00000000</color> | |
6 | 31 | </resources> | ... | ... |
app/src/main/res/values/dimens.xml
app/src/main/res/values/strings.xml
app/src/main/res/values/styles.xml
... | ... | @@ -17,4 +17,22 @@ |
17 | 17 | |
18 | 18 | <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> |
19 | 19 | |
20 | + <style name="dialog" parent="Theme.AppCompat.Light.Dialog.Alert"> | |
21 | + <item name="colorPrimary">@color/colorPrimary</item> | |
22 | + <item name="colorAccent">@color/colorAccent</item> | |
23 | + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
24 | + <item name="android:windowFrame">@null</item> | |
25 | + <item name="android:windowIsFloating">true</item> | |
26 | + <item name="android:windowIsTranslucent">false</item> | |
27 | + <item name="android:windowNoTitle">true</item> | |
28 | + <item name="android:background">@android:color/transparent</item> | |
29 | + <item name="android:windowBackground">@android:color/transparent</item> | |
30 | + <item name="android:backgroundDimEnabled">true</item> | |
31 | + </style> | |
32 | + | |
33 | + <style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert"> | |
34 | + <item name="colorPrimary">@color/colorPrimary</item> | |
35 | + <item name="colorAccent">@color/colorAccent</item> | |
36 | + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
37 | + </style> | |
20 | 38 | </resources> | ... | ... |
build.gradle
No preview for this file type
gradle/wrapper/gradle-wrapper.properties
1 | -#Tue Apr 24 08:15:31 CST 2018 | |
1 | +#Fri Apr 27 16:52:24 CST 2018 | |
2 | 2 | distributionBase=GRADLE_USER_HOME |
3 | 3 | distributionPath=wrapper/dists |
4 | 4 | zipStoreBase=GRADLE_USER_HOME |
5 | 5 | zipStorePath=wrapper/dists |
6 | -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip | |
6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ... | ... |