Commit 94850fa2615c3964d1285dde942f2f678acaca64
1 parent
7442546aa8
Exists in
master
样机流程更新
Showing
13 changed files
with
196 additions
and
26 deletions
Show diff stats
PersonalCenter/app/src/main/AndroidManifest.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | - package="com.hjx.personalcenter"> | |
3 | + package="com.hjx.personalcenter" | |
4 | + android:configChanges="keyboardHidden|orientation"> | |
4 | 5 | |
5 | 6 | <application |
6 | 7 | android:name=".activity.MyApplication" |
... | ... | @@ -159,5 +160,6 @@ |
159 | 160 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
160 | 161 | <uses-permission android:name="android.permission.READ_LOGS" /> |
161 | 162 | <uses-permission android:name="android.permission.RESTART_PACKAGES\"/> |
163 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
162 | 164 | |
163 | 165 | </manifest> |
164 | 166 | \ No newline at end of file | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
... | ... | @@ -216,7 +216,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen |
216 | 216 | } else if (status.equals("2001")) { |
217 | 217 | tv_yangji.setVisibility(View.GONE); |
218 | 218 | iv_look_card.setVisibility(View.VISIBLE); |
219 | - AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息,请重新登录"); | |
219 | + AlertUtils.showToast(MainActivity.this, "您的机器还没有保卡信息或该机器已置为样机,请重新登录"); | |
220 | 220 | SaveParam.getInstance().clearData(MainActivity.this); |
221 | 221 | Intent settingintent = new Intent(); |
222 | 222 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/IllegalDialog.java
... | ... | @@ -0,0 +1,65 @@ |
1 | +package com.hjx.personalcenter.customdialog; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.content.Context; | |
5 | +import android.content.Intent; | |
6 | +import android.graphics.Color; | |
7 | +import android.os.Bundle; | |
8 | +import android.view.Gravity; | |
9 | +import android.view.LayoutInflater; | |
10 | +import android.view.View; | |
11 | +import android.view.ViewGroup; | |
12 | +import android.widget.TextView; | |
13 | + | |
14 | +import com.hjx.personalcenter.R; | |
15 | +import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | |
16 | +import com.hjx.personalcenter.activity.SysApplication; | |
17 | +import com.mylhyl.circledialog.BaseCircleDialog; | |
18 | +import com.mylhyl.circledialog.res.values.CircleDimen; | |
19 | + | |
20 | +/** | |
21 | + * Created by h on 2017/8/20. | |
22 | + */ | |
23 | +@SuppressLint("ValidFragment") | |
24 | +public class IllegalDialog extends BaseCircleDialog { | |
25 | + private View mView; | |
26 | + private TextView i_know; | |
27 | + | |
28 | + public static IllegalDialog getInstance() { | |
29 | + IllegalDialog dialogFragment = new IllegalDialog(); | |
30 | + dialogFragment.setCanceledBack(true); | |
31 | + dialogFragment.setCanceledOnTouchOutside(false); | |
32 | + dialogFragment.setRadius(CircleDimen.RADIUS); | |
33 | + dialogFragment.setWidth(0.4f); | |
34 | + dialogFragment.setGravity(Gravity.CENTER); | |
35 | + dialogFragment.setBackgroundColor(Color.WHITE); | |
36 | + return dialogFragment; | |
37 | + } | |
38 | + | |
39 | + @Override | |
40 | + public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | |
41 | + if (mView == null) { | |
42 | + mView = inflater.inflate(R.layout.custom_adilog_feifa, container, false); | |
43 | + } | |
44 | + return mView; | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public void onActivityCreated(Bundle savedInstanceState) { | |
49 | + super.onActivityCreated(savedInstanceState); | |
50 | + i_know = (TextView) mView.findViewById(R.id.tv_i_know); | |
51 | + i_know.setOnClickListener(new View.OnClickListener() { | |
52 | + @Override | |
53 | + public void onClick(View v) { | |
54 | + Intent intent = new Intent(); | |
55 | + intent.setClass(getActivity(), LoginAndRegisterActivity.class); | |
56 | + getActivity().startActivity(intent); | |
57 | + getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | |
58 | + SysApplication.getInstance().exit(); | |
59 | + } | |
60 | + }); | |
61 | + | |
62 | + | |
63 | + } | |
64 | + | |
65 | +} | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/db/SaveParam.java
... | ... | @@ -20,6 +20,7 @@ public class SaveParam { |
20 | 20 | public static String GRADENS = "gradens";//年级id |
21 | 21 | public static String SCHOOOlID = "schoolid";//学校id |
22 | 22 | public static String VIEGREADE = "vergrade"; |
23 | + public static String ISYANGJI = "isyangji";//是否样机 | |
23 | 24 | //个人信息 |
24 | 25 | public static String USERNAME = "usernames";//昵称 |
25 | 26 | public static String ADRESS = "adress";//地址 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... | ... | @@ -6,6 +6,7 @@ import android.content.Context; |
6 | 6 | import android.content.Intent; |
7 | 7 | import android.os.Handler; |
8 | 8 | import android.os.Message; |
9 | +import android.support.v4.app.FragmentActivity; | |
9 | 10 | import android.util.Log; |
10 | 11 | import android.view.KeyEvent; |
11 | 12 | import android.widget.Toast; |
... | ... | @@ -16,6 +17,7 @@ import com.hjx.personalcenter.R; |
16 | 17 | import com.hjx.personalcenter.activity.BangDingCode; |
17 | 18 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
18 | 19 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
20 | +import com.hjx.personalcenter.customdialog.IllegalDialog; | |
19 | 21 | import com.hjx.personalcenter.db.Content; |
20 | 22 | import com.hjx.personalcenter.db.SaveParam; |
21 | 23 | import com.hjx.personalcenter.gson.GsonTool; |
... | ... | @@ -319,7 +321,10 @@ public class HttpManager { |
319 | 321 | } |
320 | 322 | |
321 | 323 | |
322 | - } else { | |
324 | + } else if (status.equals("2003")){ | |
325 | + IllegalDialog.getInstance().show(((FragmentActivity) context).getSupportFragmentManager(),"feifa"); | |
326 | + | |
327 | + }else { | |
323 | 328 | Toast.makeText(context, "保卡绑定失败!", Toast.LENGTH_LONG).show(); |
324 | 329 | } |
325 | 330 | } catch (JSONException e) { | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/UserInfoModer.java
... | ... | @@ -15,6 +15,16 @@ public class UserInfoModer implements Serializable { |
15 | 15 | private String grade; |
16 | 16 | private String gradeid; |
17 | 17 | |
18 | + public String getIsprototype() { | |
19 | + return isprototype; | |
20 | + } | |
21 | + | |
22 | + public void setIsprototype(String isprototype) { | |
23 | + this.isprototype = isprototype; | |
24 | + } | |
25 | + | |
26 | + private String isprototype; | |
27 | + | |
18 | 28 | public String getGradeid() { |
19 | 29 | return gradeid; |
20 | 30 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
... | ... | @@ -114,6 +114,7 @@ public class CenterService extends BaseService { |
114 | 114 | userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO)); |
115 | 115 | userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT)); |
116 | 116 | userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS)); |
117 | + userInfoModer.setIsprototype(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ISYANGJI)); | |
117 | 118 | userinfo = gson.toJson(userInfoModer); |
118 | 119 | return userinfo; |
119 | 120 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDevicesUtil.java
1 | 1 | package com.hjx.personalcenter.util; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | -import android.net.wifi.WifiInfo; | |
5 | -import android.net.wifi.WifiManager; | |
6 | 4 | import android.os.Build; |
7 | 5 | import android.util.Log; |
8 | 6 | |
9 | 7 | import com.hjx.personalcenter.model.DeviceInfo; |
10 | 8 | |
9 | +import java.io.FileReader; | |
10 | +import java.io.InputStreamReader; | |
11 | +import java.io.LineNumberReader; | |
12 | +import java.io.Reader; | |
13 | + | |
11 | 14 | |
12 | 15 | public class GetDevicesUtil { |
13 | 16 | private final static String LOG_TAG = "GetDevicesUtil"; |
... | ... | @@ -47,15 +50,52 @@ public class GetDevicesUtil { |
47 | 50 | |
48 | 51 | private static String getMacAddress(Context mContext){ |
49 | 52 | |
50 | - String ret = null; | |
53 | + String str = ""; | |
54 | + String macSerial = ""; | |
51 | 55 | try { |
52 | - WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE); | |
53 | - WifiInfo info = manager.getConnectionInfo(); | |
54 | - ret = info.getMacAddress(); | |
55 | - } catch (Exception e) { | |
56 | - Log.e(LOG_TAG, "get wifi address wrong", e); | |
56 | + Process pp = Runtime.getRuntime().exec( | |
57 | + "cat /sys/class/net/wlan0/address "); | |
58 | + InputStreamReader ir = new InputStreamReader(pp.getInputStream()); | |
59 | + LineNumberReader input = new LineNumberReader(ir); | |
60 | + | |
61 | + for (; null != str;) { | |
62 | + str = input.readLine(); | |
63 | + if (str != null) { | |
64 | + macSerial = str.trim();// 去空格 | |
65 | + break; | |
66 | + } | |
67 | + } | |
68 | + } catch (Exception ex) { | |
69 | + ex.printStackTrace(); | |
70 | + } | |
71 | + if (macSerial == null || "".equals(macSerial)) { | |
72 | + try { | |
73 | + return loadFileAsString("/sys/class/net/eth0/address") | |
74 | + .toUpperCase().substring(0, 17); | |
75 | + } catch (Exception e) { | |
76 | + e.printStackTrace(); | |
77 | + | |
78 | + } | |
79 | + | |
80 | + } | |
81 | + return macSerial; | |
82 | + } | |
83 | + | |
84 | + public static String loadFileAsString(String fileName) throws Exception { | |
85 | + FileReader reader = new FileReader(fileName); | |
86 | + String text = loadReaderAsString(reader); | |
87 | + reader.close(); | |
88 | + return text; | |
89 | + } | |
90 | + | |
91 | + public static String loadReaderAsString(Reader reader) throws Exception { | |
92 | + StringBuilder builder = new StringBuilder(); | |
93 | + char[] buffer = new char[4096]; | |
94 | + int readLength = reader.read(buffer); | |
95 | + while (readLength >= 0) { | |
96 | + builder.append(buffer, 0, readLength); | |
97 | + readLength = reader.read(buffer); | |
57 | 98 | } |
58 | - Log.i(LOG_TAG, "wifi address is" + ret); | |
59 | - return ret; | |
99 | + return builder.toString(); | |
60 | 100 | } |
61 | 101 | } | ... | ... |
PersonalCenter/app/src/main/res/layout/activity_main.xml
... | ... | @@ -307,15 +307,27 @@ |
307 | 307 | android:id="@+id/iv_look_card" |
308 | 308 | android:layout_width="wrap_content" |
309 | 309 | android:layout_height="wrap_content" |
310 | - android:padding="10dp" | |
310 | + android:paddingTop="10dp" | |
311 | + android:paddingLeft="10dp" | |
312 | + android:paddingRight="10dp" | |
311 | 313 | android:layout_gravity="center" |
312 | 314 | android:layout_marginTop="120dp" |
313 | - android:textColor="@color/login_edittext_hint" | |
315 | + android:textColor="@color/login_text_blue" | |
314 | 316 | android:text="好记星电子产品保修卡" /> |
317 | + <View | |
318 | + android:layout_width="135dp" | |
319 | + android:layout_marginTop="2dp" | |
320 | + android:layout_gravity="center" | |
321 | + android:background="@color/login_text_blue" | |
322 | + android:layout_height="0.7dp"> | |
323 | + | |
324 | + </View> | |
315 | 325 | |
316 | 326 | <LinearLayout |
327 | + android:layout_marginTop="10dp" | |
317 | 328 | android:layout_width="match_parent" |
318 | 329 | android:layout_height="100dp" |
330 | + android:gravity="bottom" | |
319 | 331 | android:background="@mipmap/xiaoguanggao"> |
320 | 332 | |
321 | 333 | </LinearLayout> | ... | ... |
PersonalCenter/app/src/main/res/layout/custom_adilog_feifa.xml
... | ... | @@ -0,0 +1,41 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:orientation="vertical" android:layout_width="match_parent" | |
4 | + android:layout_height="match_parent" | |
5 | + android:gravity="center"> | |
6 | + <LinearLayout | |
7 | + android:layout_width="match_parent" | |
8 | + android:layout_height="wrap_content" | |
9 | + android:gravity="center" | |
10 | + android:orientation="vertical" | |
11 | + android:layout_margin="20dp"> | |
12 | + <ImageView | |
13 | + android:layout_width="wrap_content" | |
14 | + android:layout_height="wrap_content" | |
15 | + android:src="@mipmap/feifa"/> | |
16 | + <TextView | |
17 | + android:layout_width="wrap_content" | |
18 | + android:layout_height="wrap_content" | |
19 | + android:textColor="@android:color/black" | |
20 | + android:layout_marginTop="30dp" | |
21 | + android:textSize="22sp" | |
22 | + android:text="该机器为非法机器,请联系销售商!"/> | |
23 | + <View | |
24 | + android:layout_width="match_parent" | |
25 | + android:layout_height="0.7dp" | |
26 | + android:background="@color/cutoff_line" | |
27 | + android:layout_margin="10dp"> | |
28 | + | |
29 | + </View> | |
30 | + <TextView | |
31 | + android:id="@+id/tv_i_know" | |
32 | + android:layout_width="wrap_content" | |
33 | + android:layout_height="wrap_content" | |
34 | + android:textColor="@android:color/black" | |
35 | + android:textSize="20sp" | |
36 | + android:padding="10dp" | |
37 | + android:text="知道了"/> | |
38 | + | |
39 | + </LinearLayout> | |
40 | + | |
41 | +</LinearLayout> | |
0 | 42 | \ No newline at end of file | ... | ... |
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes4.xml
... | ... | @@ -15,7 +15,8 @@ |
15 | 15 | fresco:placeholderImageScaleType="fitCenter" /> |
16 | 16 | |
17 | 17 | |
18 | - <!-- <TextView | |
18 | + <TextView | |
19 | + android:id="@+id/tv_publish" | |
19 | 20 | android:layout_width="80dp" |
20 | 21 | android:layout_height="wrap_content" |
21 | 22 | android:layout_marginTop="5dp" |
... | ... | @@ -25,15 +26,7 @@ |
25 | 26 | android:singleLine="true" |
26 | 27 | android:text="" |
27 | 28 | android:textColor="@color/login_text_black" |
28 | - android:textSize="16sp" />--> | |
29 | - <com.hjx.personalcenter.View.AutoHorizontalScrollTextView | |
30 | - android:layout_marginTop="5dp" | |
31 | - android:textSize="16sp" | |
32 | - android:id="@+id/tv_publish" | |
33 | - android:layout_width="80dp" | |
34 | - android:textColor="@color/login_text_black" | |
35 | - android:layout_height="wrap_content" | |
36 | - android:singleLine="true" | |
37 | - android:padding="5dp"/> | |
29 | + android:textSize="16sp" /> | |
30 | + | |
38 | 31 | |
39 | 32 | </LinearLayout> |
40 | 33 | \ No newline at end of file | ... | ... |
PersonalCenter/app/src/main/res/mipmap-hdpi/feifa.png
18.8 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/bgsubject.png