Commit b184aa9cd14e085c28bcbfe80fc14f6e9d148481

Authored by 孙向锦
1 parent c46db941

移除无用代码

Showing 45 changed files with 1 additions and 1643 deletions
C5/settings.gradle
1 -include ':app', ':udpmodule', ':xpadprotocal', ':util', ':sunvoteadapter', 'txpad', 'sunvotesdk','testproject','statusBar' 1 +include ':app', ':udpmodule', ':xpadprotocal', ':util','statusBar'
2 2
3 \ No newline at end of file 3 \ No newline at end of file
C5/sunvoteadapter/.gitignore deleted
1 -/build  
C5/sunvoteadapter/build.gradle deleted
1 -apply plugin: 'com.android.library'  
2 -  
3 -android {  
4 - compileSdkVersion 26  
5 - defaultConfig {  
6 - minSdkVersion 21  
7 - targetSdkVersion 26  
8 - versionCode 1  
9 - versionName "1.0"  
10 -  
11 - }  
12 - buildTypes {  
13 - release {  
14 - minifyEnabled false  
15 - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
16 - }  
17 - }  
18 - buildToolsVersion '26.0.2'  
19 -}  
20 -  
21 -dependencies {  
22 - implementation project(':udpmodule')  
23 -}  
C5/sunvoteadapter/proguard-rules.pro deleted
1 -# Add project specific ProGuard rules here.  
2 -# You can control the set of applied configuration files using the  
3 -# proguardFiles setting in build.gradle.  
4 -#  
5 -# For more details, see  
6 -# http://developer.android.com/guide/developing/tools/proguard.html  
7 -  
8 -# If your project uses WebView with JS, uncomment the following  
9 -# and specify the fully qualified class name to the JavaScript interface  
10 -# class:  
11 -#-keepclassmembers class fqcn.of.javascript.interface.for.webview {  
12 -# public *;  
13 -#}  
14 -  
15 -# Uncomment this to preserve the line number information for  
16 -# debugging stack traces.  
17 -#-keepattributes SourceFile,LineNumberTable  
18 -  
19 -# If you keep the line number information, uncomment this to  
20 -# hide the original source file name.  
21 -#-renamesourcefileattribute SourceFile  
C5/sunvoteadapter/src/main/AndroidManifest.xml deleted
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
2 - package="com.sunvote.sunvoteadapter" />  
C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/IBottomCommandReceiver.java deleted
1 -package com.sunvote.sunvoteadapter;  
2 -  
3 -import com.sunvote.cmd.ICmd;  
4 -  
5 -/**  
6 - * Created by Elvis on 2017/12/4 14:45  
7 - * Email:Eluis@psunsky.com  
8 - * 版权所有:长沙中天电子设计开发有限公司  
9 - * Description: 人大通用版XPadAppRD  
10 - */  
11 -public interface IBottomCommandReceiver {  
12 -  
13 - boolean onReceiverCmd(ICmd cmd);  
14 -  
15 -}  
C5/sunvoteadapter/src/main/java/com/sunvote/sunvoteadapter/SunVoteAdapterManagerFactroy.java deleted
1 -package com.sunvote.sunvoteadapter;  
2 -  
3 -import com.sunvote.cmd.BaseCmd;  
4 -import com.sunvote.cmd.ICmd;  
5 -import com.sunvote.protocal.Protocol;  
6 -import com.sunvote.udptransfer.UDPModule;  
7 -import com.sunvote.udptransfer.work.WorkThread;  
8 -import com.sunvote.util.ByteUtil;  
9 -import com.sunvote.util.LogUtil;  
10 -  
11 -import java.io.ByteArrayOutputStream;  
12 -import java.io.IOException;  
13 -import java.io.InputStream;  
14 -import java.io.OutputStream;  
15 -import java.util.ArrayList;  
16 -import java.util.List;  
17 -  
18 -/**  
19 - * Created by Elvis on 2017/11/29 17:07  
20 - * Email:Eluis@psunsky.com  
21 - * 版权所有:长沙中天电子设计开发有限公司  
22 - * Description: SunVoteAdapterManagerFactroy  
23 - */  
24 -public class SunVoteAdapterManagerFactroy {  
25 - private static volatile SunVoteAdapterManagerFactroy ourInstance = null;  
26 - private static String TAG = "SunVote";  
27 -  
28 - private UDPModule client = null;  
29 -  
30 - private InputStream mInputStream;  
31 - private OutputStream mOutputStream;  
32 - private WorkThread receiverWorkThread;  
33 - private boolean isRunning = false;  
34 -  
35 - private List<IBottomCommandReceiver> mCommandReceivingList = new ArrayList<>();  
36 -  
37 - public boolean isRunning() {  
38 - return isRunning;  
39 - }  
40 -  
41 - public static SunVoteAdapterManagerFactroy getInstance() {  
42 - if(ourInstance == null){  
43 - synchronized (SunVoteAdapterManagerFactroy.class){  
44 - if(ourInstance == null){  
45 - ourInstance = new SunVoteAdapterManagerFactroy();  
46 - }  
47 - }  
48 - }  
49 - return ourInstance;  
50 - }  
51 -  
52 - public void registerCommandReceiverListener(IBottomCommandReceiver receiver){  
53 - mCommandReceivingList.add(receiver);  
54 - }  
55 -  
56 - public void unRegisterCommandReceiverListener(IBottomCommandReceiver receiver){  
57 - mCommandReceivingList.remove(receiver);  
58 - }  
59 -  
60 - public void clearReceiverListener(){  
61 - mCommandReceivingList.clear();  
62 - }  
63 -  
64 - private SunVoteAdapterManagerFactroy() {  
65 - }  
66 -  
67 - public void start(){  
68 - if(!isRunning()) {  
69 - isRunning = true;  
70 - client = new UDPModule();  
71 - mOutputStream = client.getOutputStream();  
72 - mInputStream = client.getInputStream();  
73 - if (receiverWorkThread != null) {  
74 - receiverWorkThread.destroyObject();  
75 - }  
76 - receiverWorkThread = new WorkThread("SunVoteAdapterManagerFactroy");  
77 - reciveMsgBean.executeMethod = executeMethod;  
78 - receiverWorkThread.sendMessage(reciveMsgBean);  
79 - }  
80 - }  
81 -  
82 - public void stop(){  
83 - if(isRunning()){  
84 - isRunning = false;  
85 - if (receiverWorkThread != null) {  
86 - receiverWorkThread.destroyObject();  
87 - }  
88 - if(mInputStream != null) {  
89 - try {  
90 - mInputStream.close();  
91 - } catch (IOException e) {  
92 - LogUtil.e(TAG,e);  
93 - }  
94 - mInputStream = null;  
95 - }  
96 - if(mOutputStream != null){  
97 - try {  
98 - mOutputStream.close();  
99 - } catch (IOException e) {  
100 - LogUtil.e(TAG,e);  
101 - }  
102 - }  
103 - mOutputStream = null;  
104 - client = null;  
105 - }  
106 - }  
107 -  
108 - private WorkThread.MessageBean reciveMsgBean = new WorkThread.MessageBean();  
109 -  
110 - private WorkThread.ExecuteMethod executeMethod = new WorkThread.ExecuteMethod() {  
111 - @Override  
112 - public void execute(WorkThread.MessageBean messageBean) {  
113 - if(mInputStream != null){  
114 - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();  
115 - byte[] bytes = new byte[1024];  
116 - int tmpLength = -1 ;  
117 - while(isRunning()){  
118 - try {  
119 - tmpLength = mInputStream.read(bytes);  
120 - if(tmpLength < 0){  
121 - break;  
122 - }  
123 - // 1. 先检测读取数据到缓冲区  
124 - byteArrayOutputStream.write(bytes,0,tmpLength);  
125 - // 2. 判断缓冲区的数据标志是否存在  
126 - if(byteArrayOutputStream.size() >= 3){  
127 - byte[] temp = byteArrayOutputStream.toByteArray();  
128 - int find = ByteUtil.findBytes(temp,Protocol.HEADER,0);  
129 - if(find >= 0){  
130 - // 3. 标志存在,则继续读取长度  
131 - if(byteArrayOutputStream.size() >= find + 4){  
132 - int length = ByteUtil.byte1ToInt(byteArrayOutputStream.toByteArray()[find+3]);  
133 - if(byteArrayOutputStream.size() >= find + 4 + length){  
134 - ByteArrayOutputStream tmp = new ByteArrayOutputStream();  
135 - // 4. 根据长度读取包的内容  
136 - for(int i = find ; i < find + 4 + length;i++){  
137 - // 5. 截取包的内容,向外抛出,处理,接着读取下一个包  
138 - tmp.write(temp[i]);  
139 - }  
140 - // 6. 抛出处理  
141 - LogUtil.i(TAG,"命令包数据",tmp.toByteArray());  
142 - ICmd cmd = BaseCmd.parse(tmp.toByteArray(),tmp.size());  
143 - sendCmdToCall(cmd);  
144 - // 7. 剩余数据重新打包处理  
145 -// byteArrayOutputStream = new ByteArrayOutputStream();  
146 - byteArrayOutputStream.reset();  
147 - for(int i = find + 4 + length ; i < temp.length ; i++) {  
148 - byteArrayOutputStream.write(temp[i]);  
149 - }  
150 - }  
151 - }  
152 - }  
153 - }  
154 - if(byteArrayOutputStream.size() > 2048){  
155 - LogUtil.i(TAG,"被恶意攻击?或者传输数据错误?丢弃处理!",byteArrayOutputStream.toByteArray());  
156 - byteArrayOutputStream.reset();  
157 - }  
158 - } catch (Exception e) {  
159 - LogUtil.e(TAG,e);  
160 - }  
161 - }  
162 - }  
163 - }  
164 - };  
165 -  
166 - public boolean sendCmd(ICmd cmd){  
167 - if(isRunning()) {  
168 - Protocol<ICmd> protocol = new Protocol<>();  
169 - protocol.setEnableMatchCode(false);  
170 - protocol.setCmd(cmd);  
171 - if (mOutputStream != null) {  
172 - try {  
173 - mOutputStream.write(protocol.toBytes());  
174 - mOutputStream.flush();  
175 - return true;  
176 - } catch (Exception e) {  
177 - LogUtil.e(TAG, e);  
178 - }  
179 - }  
180 - }  
181 - return false;  
182 - }  
183 -  
184 - private void sendCmdToCall(ICmd cmd){  
185 - if(mCommandReceivingList != null && mCommandReceivingList.size() > 0) {  
186 - for (IBottomCommandReceiver receiver : mCommandReceivingList) {  
187 - receiver.onReceiverCmd(cmd);  
188 - }  
189 - }  
190 - }  
191 -  
192 -}  
C5/sunvoteadapter/src/main/res/values/strings.xml deleted
1 -<resources>  
2 - <string name="app_name">SunVoteAdapter</string>  
3 -</resources>  
C5/testproject/.gitignore deleted
1 -/build  
C5/testproject/build.gradle deleted
1 -apply plugin: 'com.android.application'  
2 -  
3 -android {  
4 - compileSdkVersion 26  
5 - buildToolsVersion "26.0.2"  
6 - defaultConfig {  
7 - minSdkVersion 21  
8 - targetSdkVersion 26  
9 - applicationId "com.sunvote.udptest"  
10 - versionCode 1  
11 - versionName "1.0"  
12 - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"  
13 - }  
14 - buildTypes {  
15 - release {  
16 - minifyEnabled false  
17 - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
18 - }  
19 - }  
20 - productFlavors {  
21 - }  
22 -}  
23 -  
24 -dependencies {  
25 - compile fileTree(include: ['*.jar'], dir: 'libs')  
26 - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {  
27 - exclude group: 'com.android.support', module: 'support-annotations'  
28 - })  
29 - compile 'com.android.support:appcompat-v7:26.+'  
30 - compile 'com.android.support.constraint:constraint-layout:1.0.2'  
31 - compile 'com.android.support:design:26.+'  
32 - testCompile 'junit:junit:4.12'  
33 - implementation project(':sunvotesdk')  
34 - implementation 'com.squareup.okhttp3:okhttp:3.11.0'  
35 -}  
C5/testproject/proguard-rules.pro deleted
1 -# Add project specific ProGuard rules here.  
2 -# By default, the flags in this file are appended to flags specified  
3 -# in C:\Users\XXW\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt  
4 -# You can edit the include path and order by changing the proguardFiles  
5 -# directive in build.gradle.  
6 -#  
7 -# For more details, see  
8 -# http://developer.android.com/guide/developing/tools/proguard.html  
9 -  
10 -# Add any project specific keep options here:  
11 -  
12 -# If your project uses WebView with JS, uncomment the following  
13 -# and specify the fully qualified class name to the JavaScript interface  
14 -# class:  
15 -#-keepclassmembers class fqcn.of.javascript.interface.for.webview {  
16 -# public *;  
17 -#}  
18 -  
19 -# Uncomment this to preserve the line number information for  
20 -# debugging stack traces.  
21 -#-keepattributes SourceFile,LineNumberTable  
22 -  
23 -# If you keep the line number information, uncomment this to  
24 -# hide the original source file name.  
25 -#-renamesourcefileattribute SourceFile  
C5/testproject/release/output.json deleted
1 -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"testproject-release.apk","properties":{"packageId":"com.sunvote.udptest","split":"","minSdkVersion":"21"}}]  
2 \ No newline at end of file 0 \ No newline at end of file
C5/testproject/src/androidTest/java/com/sunvote/udptest/ExampleInstrumentedTest.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.content.Context;  
4 -import android.support.test.InstrumentationRegistry;  
5 -import android.support.test.runner.AndroidJUnit4;  
6 -  
7 -import org.junit.Test;  
8 -import org.junit.runner.RunWith;  
9 -  
10 -import static org.junit.Assert.*;  
11 -  
12 -/**  
13 - * Instrumentation test, which will execute on an Android device.  
14 - *  
15 - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>  
16 - */  
17 -@RunWith(AndroidJUnit4.class)  
18 -public class ExampleInstrumentedTest {  
19 - @Test  
20 - public void useAppContext() throws Exception {  
21 - // Context of the app under test.  
22 - Context appContext = InstrumentationRegistry.getTargetContext();  
23 -  
24 - assertEquals("com.sunvote.udptest", appContext.getPackageName());  
25 - }  
26 -}  
C5/testproject/src/main/AndroidManifest.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
3 - package="com.sunvote.udptest">  
4 -  
5 - <uses-permission android:name="android.permission.INTERNET" />  
6 - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
7 -  
8 - <application  
9 - android:allowBackup="true"  
10 - android:icon="@mipmap/ic_launcher"  
11 - android:label="@string/app_name"  
12 - android:roundIcon="@mipmap/ic_launcher_round"  
13 - android:supportsRtl="true"  
14 - android:theme="@style/AppTheme">  
15 - <activity android:name=".MainActivity" />  
16 - <activity  
17 - android:name=".FontSizeActity"  
18 - android:label="@string/title_activity_font_size_actity"  
19 - android:theme="@style/AppTheme.NoActionBar" />  
20 - <activity  
21 - android:name=".WebActivity"  
22 - android:theme="@style/AppTheme.NoActionBar" />  
23 - <activity  
24 - android:name=".ModifyMachCode"  
25 - android:label="@string/title_activity_modify_mach_code"  
26 - android:theme="@style/AppTheme.NoActionBar" />  
27 - <activity android:name=".Main2Activity">  
28 -  
29 - <!--  
30 - <intent-filter>  
31 - <action android:name="android.intent.action.MAIN" />  
32 -  
33 - <category android:name="android.intent.category.LAUNCHER" />  
34 - </intent-filter>  
35 - -->  
36 - </activity>  
37 - <activity android:name=".Main3Activity">  
38 -  
39 - <!--  
40 - <intent-filter>  
41 - <action android:name="android.intent.action.MAIN" />  
42 -  
43 - <category android:name="android.intent.category.LAUNCHER" />  
44 - </intent-filter>  
45 - -->  
46 - </activity>  
47 - <activity android:name=".UploadActivity"  
48 - android:screenOrientation="portrait">  
49 - <intent-filter>  
50 - <action android:name="android.intent.action.MAIN" />  
51 -  
52 - <category android:name="android.intent.category.LAUNCHER" />  
53 - </intent-filter>  
54 - </activity>  
55 - <activity  
56 - android:name=".UnlockActivity"  
57 - android:label="@string/title_activity_unlock"  
58 - android:screenOrientation="landscape"  
59 - android:theme="@style/AppTheme.NoActionBar">  
60 - <intent-filter>  
61 - <action android:name="android.intent.action.MAIN" />  
62 -  
63 - <category android:name="android.intent.category.LAUNCHER" />  
64 - </intent-filter>  
65 - </activity>  
66 - </application>  
67 -  
68 -</manifest>  
69 \ No newline at end of file 0 \ No newline at end of file
C5/testproject/src/main/java/com/sunvote/udptest/FontSizeActity.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.os.Bundle;  
4 -import android.support.design.widget.FloatingActionButton;  
5 -import android.support.design.widget.Snackbar;  
6 -import android.support.v7.app.AppCompatActivity;  
7 -import android.support.v7.widget.Toolbar;  
8 -import android.view.View;  
9 -  
10 -public class FontSizeActity extends AppCompatActivity {  
11 -  
12 - @Override  
13 - protected void onCreate(Bundle savedInstanceState) {  
14 - super.onCreate(savedInstanceState);  
15 - setContentView(R.layout.activity_font_size_actity);  
16 -  
17 - }  
18 -  
19 -}  
C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPDataSender.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import java.net.DatagramSocket;  
4 -import java.net.InetAddress;  
5 -  
6 -/**  
7 - * Created by Elvis on 2017/8/8.  
8 - * Email:Eluis@psunsky.com  
9 - * Description:  
10 - */  
11 -  
12 -public class LocalUDPDataSender {  
13 -  
14 - private final static String TAG = LocalUDPDataSender.class.getSimpleName();  
15 -  
16 - private static LocalUDPDataSender instance = null;  
17 -  
18 - private DatagramSocket remoteUDPSocket = null;  
19 -  
20 -  
21 - public static LocalUDPDataSender getInstance() {  
22 - if (instance == null)  
23 - instance = new LocalUDPDataSender();  
24 - return instance;  
25 - }  
26 -  
27 - private LocalUDPDataSender() {  
28 -  
29 - }  
30 -  
31 - public DatagramSocket resetRemoteUDPSocket() {  
32 - try {  
33 - closeLocalUDPSocket();  
34 - remoteUDPSocket = (MainActivity.port == 0 ?  
35 - new DatagramSocket() : new DatagramSocket(MainActivity.port));//_Utils.LOCAL_UDP_SEND$LISTENING_PORT);  
36 - remoteUDPSocket.setReuseAddress(true);  
37 - return remoteUDPSocket;  
38 - } catch (Exception e) {  
39 - closeLocalUDPSocket();  
40 - return null;  
41 - }  
42 - }  
43 -  
44 - private boolean isRemoteUDPSocketReady() {  
45 - boolean ret = true;  
46 - if(remoteUDPSocket != null) {  
47 - return ret && !remoteUDPSocket.isClosed();  
48 - }  
49 - return false;  
50 - }  
51 -  
52 -  
53 -  
54 - public void closeLocalUDPSocket() {  
55 - try {  
56 - if (remoteUDPSocket != null) {  
57 - remoteUDPSocket.close();  
58 - remoteUDPSocket = null;  
59 - } else {  
60 - }  
61 - } catch (Exception e) {  
62 - }  
63 - }  
64 -  
65 - public DatagramSocket getRemoteDPSocket() {  
66 - if (isRemoteUDPSocketReady()) {  
67 - return remoteUDPSocket;  
68 - } else {  
69 - return resetRemoteUDPSocket();  
70 - }  
71 - }  
72 -  
73 -  
74 -  
75 - /**  
76 - * 需要重载一个函数  
77 - * 如果没有指定服务器IP地址,则只能广播出去,让服务器接收处理  
78 - * @param fullProtocalBytes  
79 - * @param dataLen  
80 - * @return  
81 - */  
82 - public int send(byte[] fullProtocalBytes, int dataLen) {  
83 - DatagramSocket ds = getRemoteDPSocket();  
84 - if (ds != null && !ds.isConnected()) {  
85 - try {  
86 - ds.connect(InetAddress.getByName(MainActivity.serverIp), MainActivity.port);  
87 - } catch (Exception e) {  
88 - return -1;  
89 - }  
90 - }  
91 - return UDPUtils.send(ds, fullProtocalBytes, dataLen) ? 0 : -1;  
92 -  
93 - }  
94 -  
95 -  
96 -}  
C5/testproject/src/main/java/com/sunvote/udptest/LocalUDPSocketProvider.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import java.net.DatagramSocket;  
4 -import java.net.SocketAddress;  
5 -  
6 -/**  
7 - * Created by Elvis on 2017/8/8.  
8 - * Email:Eluis@psunsky.com  
9 - * Description:  
10 - * 本地UDP提供类  
11 - */  
12 -  
13 -public class LocalUDPSocketProvider {  
14 - private final static String TAG = LocalUDPSocketProvider.class.getSimpleName();  
15 -  
16 - private static LocalUDPSocketProvider instance = null;  
17 -  
18 - private DatagramSocket localUDPSocket = null;  
19 -  
20 - public static LocalUDPSocketProvider getInstance() {  
21 - if (instance == null)  
22 - instance = new LocalUDPSocketProvider();  
23 - return instance;  
24 - }  
25 -  
26 - private LocalUDPSocketProvider() {  
27 - //  
28 - }  
29 -  
30 - public DatagramSocket resetLocalUDPSocket() {  
31 - try {  
32 - closeLocalUDPSocket();  
33 - localUDPSocket = new DatagramSocket(Main2Activity.port);//_Utils.LOCAL_UDP_SEND$LISTENING_PORT);  
34 - //Config.getInstance().localUDPPort  
35 - localUDPSocket.setReuseAddress(true);  
36 - localUDPSocket.setSoTimeout(60 * 10000);  
37 - return localUDPSocket;  
38 - } catch (Exception e) {  
39 - closeLocalUDPSocket();  
40 - return null;  
41 - }  
42 - }  
43 -  
44 - private boolean isLocalUDPSocketReady() {  
45 - boolean ret = true;  
46 - if(localUDPSocket != null) {  
47 - SocketAddress socketAddress = localUDPSocket.getRemoteSocketAddress();  
48 - if (socketAddress != null) {  
49 - if(!"".equals(Main2Activity.ip)){  
50 - ret = socketAddress.toString().contains(Main2Activity.ip);  
51 - }  
52 - }  
53 - return ret && !localUDPSocket.isClosed();  
54 - }  
55 - return false;  
56 - }  
57 -  
58 - public DatagramSocket getLocalUDPSocket() {  
59 - if (isLocalUDPSocketReady()) {  
60 - return localUDPSocket;  
61 - } else {  
62 - return resetLocalUDPSocket();  
63 - }  
64 - }  
65 -  
66 - public void closeLocalUDPSocket() {  
67 - try {  
68 - if (localUDPSocket != null) {  
69 - localUDPSocket.close();  
70 - localUDPSocket = null;  
71 - } else {  
72 - }  
73 - } catch (Exception e) {  
74 - }  
75 - }  
76 -}  
C5/testproject/src/main/java/com/sunvote/udptest/Main2Activity.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.os.Handler;  
4 -import android.support.v7.app.AppCompatActivity;  
5 -import android.os.Bundle;  
6 -import android.text.TextUtils;  
7 -import android.view.View;  
8 -import android.widget.Button;  
9 -import android.widget.TextView;  
10 -  
11 -import com.sunvote.util.ByteUtils;  
12 -  
13 -import java.net.DatagramPacket;  
14 -import java.net.DatagramSocket;  
15 -  
16 -public class Main2Activity extends AppCompatActivity {  
17 -  
18 - public static int port = 40003;  
19 -  
20 - public static String ip ;  
21 -  
22 - private TextView display;  
23 - private Button button;  
24 - private int cou = 0 ;  
25 - StringBuilder stringBuilder = new StringBuilder();  
26 - private String count ;  
27 -  
28 - private boolean isCrate = false;  
29 - private Handler handler ;  
30 -  
31 - @Override  
32 - protected void onCreate(Bundle savedInstanceState) {  
33 - super.onCreate(savedInstanceState);  
34 - setContentView(R.layout.activity_main2);  
35 -  
36 - display = (TextView) findViewById(R.id.display);  
37 - button = (Button) findViewById(R.id.clean);  
38 -  
39 - button.setOnClickListener(new View.OnClickListener() {  
40 - @Override  
41 - public void onClick(View v) {  
42 - stringBuilder = new StringBuilder();  
43 - cou = 0 ;  
44 - display.setText("收到" + cou + "条消息\n"+ stringBuilder.toString());  
45 - }  
46 - });  
47 -  
48 - isCrate = true;  
49 - handler = new Handler();  
50 - thread.start();  
51 - }  
52 -  
53 - @Override  
54 - protected void onDestroy() {  
55 - super.onDestroy();  
56 - isCrate = false;  
57 - }  
58 -  
59 - private Thread thread = new Thread(){  
60 - @Override  
61 - public void run() {  
62 - super.run();  
63 -  
64 - DatagramSocket localUDPSocket = LocalUDPSocketProvider.getInstance().getLocalUDPSocket();  
65 - while (isCrate){  
66 - if (localUDPSocket != null && !localUDPSocket.isClosed()) {  
67 - try {  
68 - byte[] data = new byte[1024];  
69 - DatagramPacket packet = new DatagramPacket(data, data.length);  
70 - localUDPSocket.receive(packet);  
71 - stringBuilder.append(ByteUtils.bytesToHexString(packet.getData(),packet.getLength())).append("\n");  
72 - cou ++ ;  
73 - handler.post(new Runnable() {  
74 - @Override  
75 - public void run() {  
76 - display.setText("收到" + cou + "条消息\n"+ stringBuilder.toString());  
77 - }  
78 - });  
79 - }catch (Exception ex){  
80 -  
81 - }  
82 - }  
83 -  
84 - }  
85 - }  
86 - };  
87 -}  
C5/testproject/src/main/java/com/sunvote/udptest/MainActivity.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.support.v7.app.AppCompatActivity;  
4 -import android.os.Bundle;  
5 -import android.text.Html;  
6 -import android.text.TextUtils;  
7 -import android.view.View;  
8 -import android.widget.EditText;  
9 -import android.widget.TextView;  
10 -import android.widget.Toast;  
11 -  
12 -import java.net.DatagramSocket;  
13 -import java.net.InetAddress;  
14 -  
15 -public class MainActivity extends AppCompatActivity {  
16 -  
17 - private EditText sreverIpView;  
18 - private EditText serverPortView;  
19 - private EditText contentView;  
20 -  
21 - private TextView webviewtest;  
22 -  
23 - private View test;  
24 -  
25 - public static String serverIp = "192.168.0.104";  
26 - public static int port ;  
27 - private String content;  
28 -  
29 - @Override  
30 - protected void onCreate(Bundle savedInstanceState) {  
31 - super.onCreate(savedInstanceState);  
32 - setContentView(R.layout.activity_main);  
33 -  
34 - initView();  
35 -  
36 - }  
37 -  
38 - private void initView() {  
39 - sreverIpView = (EditText) findViewById(R.id.server_ip);  
40 - serverPortView = (EditText) findViewById(R.id.server_port);  
41 - contentView = (EditText)findViewById(R.id.content);  
42 - webviewtest = (TextView)findViewById(R.id.webviewtest);  
43 -  
44 - test = findViewById(R.id.test);  
45 -  
46 - webviewtest.setText(Html.fromHtml("<img alt=\"菁优网\" src=\"http://img.jyeoo.net/quiz/images/201410/118/38290219.png\" style=\"vertical-align:middle;FLOAT:right;\" />解:如图所示:∵在△ABC中,∠C=90°,有一点既在BC的对称轴上,又在AC的对称轴上,<br />∴由直角三角形斜边的中点到三角形三个顶点的距离相等,则该点一定是AB中点.<br />故选:D."));  
47 -  
48 - test.setOnClickListener(new View.OnClickListener() {  
49 - @Override  
50 - public void onClick(View view) {  
51 - serverIp = sreverIpView.getText().toString();  
52 - try{  
53 - port = Integer.parseInt(serverPortView.getText().toString());  
54 - }catch (Exception ex){  
55 - Toast.makeText(MainActivity.this,"端口错误",Toast.LENGTH_SHORT).show();  
56 - return;  
57 - }  
58 - content = contentView.getText().toString();  
59 - content = content.replace(" ","");  
60 -  
61 - if(TextUtils.isEmpty(serverIp)){  
62 - Toast.makeText(MainActivity.this,"ip 為空",Toast.LENGTH_SHORT).show();  
63 - return;  
64 - }  
65 -  
66 - if(TextUtils.isEmpty(content)){  
67 - Toast.makeText(MainActivity.this,"ip 輸入發送內容為空",Toast.LENGTH_SHORT).show();  
68 - return;  
69 - }  
70 -  
71 - new Thread(){  
72 - public void run(){  
73 - byte[] datas = hexStringToBytes(content);  
74 - boolean ret = false;  
75 - try{  
76 - InetAddress address = InetAddress.getByName(serverIp);  
77 - ret = LocalUDPDataSender.getInstance().send(datas,datas.length)>=0;  
78 - }catch (Exception ex){  
79 - ret = false;  
80 - }  
81 - final boolean result = ret;  
82 - runOnUiThread(new Runnable() {  
83 - @Override  
84 - public void run() {  
85 - Toast.makeText(MainActivity.this,"send:" + result,Toast.LENGTH_SHORT).show();  
86 - }  
87 - });  
88 - }  
89 - }.start();  
90 - }  
91 - });  
92 - }  
93 -  
94 - public static byte[] hexStringToBytes(String hexString) {  
95 - if (hexString == null || hexString.equals("")) {  
96 - return null;  
97 - }  
98 - hexString = hexString.toUpperCase();  
99 - int length = hexString.length() / 2;  
100 - char[] hexChars = hexString.toCharArray();  
101 - byte[] d = new byte[length];  
102 - for (int i = 0; i < length; i++) {  
103 - int pos = i * 2;  
104 - d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));  
105 - }  
106 - return d;  
107 - }  
108 - /**  
109 - * Convert char to byte  
110 - * @param c char  
111 - * @return byte  
112 - */  
113 - private static byte charToByte(char c) {  
114 - return (byte) "0123456789ABCDEF".indexOf(c);  
115 - }  
116 -}  
C5/testproject/src/main/java/com/sunvote/udptest/ModifyMachCode.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.os.Bundle;  
4 -import android.support.v7.app.AppCompatActivity;  
5 -import android.view.View;  
6 -import android.widget.Button;  
7 -import android.widget.EditText;  
8 -import android.widget.Toast;  
9 -  
10 -import com.sunvote.sunvotesdk.BaseStationManager;  
11 -  
12 -public class ModifyMachCode extends AppCompatActivity {  
13 -  
14 - private Button modify;  
15 - private EditText content;  
16 - @Override  
17 - protected void onCreate(Bundle savedInstanceState) {  
18 - super.onCreate(savedInstanceState);  
19 - setContentView(R.layout.content_modify_mach_code);  
20 -  
21 - BaseStationManager.getInstance().connectSer();  
22 - content = (EditText) findViewById(R.id.content);  
23 - modify = (Button)findViewById(R.id.modify);  
24 - modify.setOnClickListener(new View.OnClickListener() {  
25 - @Override  
26 - public void onClick(View v) {  
27 - String machcode = content.getText().toString();  
28 - if(machcode != null && machcode.length() == 8){  
29 - if(BaseStationManager.getInstance().getBaseStationInfo().isConnected()) {  
30 - BaseStationManager.getInstance().writeMatchCode(machcode);  
31 - Toast.makeText(ModifyMachCode.this,"修改成功",Toast.LENGTH_LONG).show();  
32 - }else{  
33 - Toast.makeText(ModifyMachCode.this,"修改失败",Toast.LENGTH_LONG).show();  
34 - BaseStationManager.getInstance().connectSer();  
35 - }  
36 -  
37 - }else{  
38 - Toast.makeText(ModifyMachCode.this,"配对码输入不正确",Toast.LENGTH_LONG).show();  
39 - }  
40 - }  
41 - });  
42 - }  
43 -  
44 -}  
C5/testproject/src/main/java/com/sunvote/udptest/UDPUtils.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import java.net.DatagramPacket;  
4 -import java.net.DatagramSocket;  
5 -  
6 -/**  
7 - * Created by Elvis on 2017/8/8.  
8 - * Email:Eluis@psunsky.com  
9 - * Description: UDP发送工具类  
10 - */  
11 -  
12 -public class UDPUtils {  
13 -  
14 - private final static String TAG = UDPUtils.class.getSimpleName();  
15 -  
16 - public static boolean send(DatagramSocket skt, byte[] d, int dataLen) {  
17 - if (skt != null && d != null) {  
18 - try {  
19 - return send(skt, new DatagramPacket(d, dataLen));  
20 - } catch (Exception e) {  
21 - return false;  
22 - }  
23 - } else {  
24 - return false;  
25 - }  
26 - }  
27 -  
28 - public synchronized static boolean send(DatagramSocket skt, DatagramPacket p) {  
29 - boolean sendSucess = true;  
30 - if (skt != null && p != null) {  
31 - if (skt.isConnected()) {  
32 - try {  
33 - skt.send(p);  
34 - } catch (Exception e) {  
35 - try{  
36 - skt.close();  
37 - }catch (Exception ex){}  
38 - sendSucess = false;  
39 - }  
40 - }  
41 - } else {  
42 - }  
43 -  
44 - return sendSucess;  
45 - }  
46 -}  
C5/testproject/src/main/java/com/sunvote/udptest/WebActivity.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import android.app.Activity;  
4 -import android.graphics.Bitmap;  
5 -import android.net.http.SslError;  
6 -import android.os.Bundle;  
7 -import android.os.Environment;  
8 -import android.os.Handler;  
9 -import android.os.Message;  
10 -import android.view.KeyEvent;  
11 -import android.webkit.ClientCertRequest;  
12 -import android.webkit.HttpAuthHandler;  
13 -import android.webkit.RenderProcessGoneDetail;  
14 -import android.webkit.SslErrorHandler;  
15 -import android.webkit.WebChromeClient;  
16 -import android.webkit.WebResourceError;  
17 -import android.webkit.WebResourceRequest;  
18 -import android.webkit.WebResourceResponse;  
19 -import android.webkit.WebView;  
20 -import android.webkit.WebViewClient;  
21 -import android.widget.TextView;  
22 -  
23 -import java.io.BufferedReader;  
24 -import java.io.File;  
25 -import java.io.FileNotFoundException;  
26 -import java.io.FileReader;  
27 -import java.io.IOException;  
28 -import java.io.InputStream;  
29 -import java.net.HttpURLConnection;  
30 -import java.net.MalformedURLException;  
31 -import java.net.URL;  
32 -import java.net.URLConnection;  
33 -import java.util.Date;  
34 -  
35 -public class WebActivity extends Activity {  
36 -  
37 - private WebView webView;  
38 - private Handler handler;  
39 - private TextView msg;  
40 - private String url;  
41 - private int errorCount = 0;  
42 - private int successCount = 0;  
43 - private boolean last = true;  
44 - private String current;  
45 -  
46 - @Override  
47 - protected void onCreate(Bundle savedInstanceState) {  
48 - super.onCreate(savedInstanceState);  
49 - setContentView(R.layout.content_base);  
50 - webView = (WebView) findViewById(R.id.webview);  
51 - msg = (TextView) findViewById(R.id.msg);  
52 - handler = new Handler();  
53 - }  
54 -  
55 - @Override  
56 - protected void onResume() {  
57 - super.onResume();  
58 - initIp();  
59 - if (url != null) {  
60 - handler.post(runnable);  
61 - }  
62 -  
63 - }  
64 -  
65 - public void initIp() {  
66 - File file = new File(Environment.getExternalStorageDirectory().getPath() + "/sunvote/serverip.txt");  
67 - FileReader fileReader = null;  
68 - BufferedReader br = null;  
69 - try {  
70 - fileReader = new FileReader(file);  
71 - br = new BufferedReader(fileReader);  
72 - url = br.readLine();  
73 - url = "http://" + url + ":8080";  
74 - } catch (Exception e) {  
75 - e.printStackTrace();  
76 - } finally {  
77 - if (br != null) {  
78 - try {  
79 - br.close();  
80 - } catch (IOException e) {  
81 - e.printStackTrace();  
82 - }  
83 - }  
84 - if (fileReader != null) {  
85 - try {  
86 - fileReader.close();  
87 - } catch (IOException e) {  
88 - e.printStackTrace();  
89 - }  
90 - }  
91 - }  
92 - }  
93 -  
94 - private Runnable runnable = new Runnable() {  
95 - @Override  
96 - public void run() {  
97 - new Thread() {  
98 - public void run() {  
99 - try {  
100 - URL network = new URL(url);  
101 - URLConnection connection = network.openConnection();  
102 - connection.setConnectTimeout(10000);  
103 - connection.setReadTimeout(15000);  
104 - InputStream is = connection.getInputStream();  
105 - if (is != null) {  
106 - byte[] bytes = new byte[1024];  
107 - while (is.read(bytes) > 0) ;  
108 - }  
109 - successCount++;  
110 - last = true;  
111 - } catch (Exception e) {  
112 - e.printStackTrace();  
113 - errorCount++;  
114 - if(last) {  
115 - current = new Date().toString();  
116 - last = false;  
117 - }  
118 - }  
119 - handler.post(new Runnable() {  
120 - @Override  
121 - public void run() {  
122 - msg.setText("成功次数:" + successCount + ",失败次数:" + errorCount + "," + current);  
123 - webView.loadUrl(url);  
124 - }  
125 - });  
126 - handler.postDelayed(runnable, 2000);  
127 - }  
128 - }.start();  
129 -  
130 - }  
131 - };  
132 -  
133 - private Runnable error = new Runnable() {  
134 - @Override  
135 - public void run() {  
136 - error();  
137 - }  
138 - };  
139 -  
140 - private void error() {  
141 - errorCount++;  
142 - handler.post(new Runnable() {  
143 - @Override  
144 - public void run() {  
145 - msg.setText("成功次数:" + successCount + ",失败次数:" + errorCount);  
146 - }  
147 - });  
148 - handler.postDelayed(runnable, 2000);  
149 - }  
150 -  
151 - @Override  
152 - protected void onDestroy() {  
153 - super.onDestroy();  
154 - handler.removeCallbacks(error);  
155 - handler.removeCallbacks(runnable);  
156 - }  
157 -}  
C5/testproject/src/main/res/layout/activity_base.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - xmlns:tools="http://schemas.android.com/tools"  
5 - android:layout_width="match_parent"  
6 - android:layout_height="match_parent"  
7 - tools:context="com.sunvote.udptest.WebActivity">  
8 -  
9 - <android.support.design.widget.AppBarLayout  
10 - android:layout_width="match_parent"  
11 - android:layout_height="wrap_content"  
12 - android:theme="@style/AppTheme.AppBarOverlay">  
13 -  
14 - <android.support.v7.widget.Toolbar  
15 - android:id="@+id/toolbar"  
16 - android:layout_width="match_parent"  
17 - android:layout_height="?attr/actionBarSize"  
18 - android:background="?attr/colorPrimary"  
19 - app:popupTheme="@style/AppTheme.PopupOverlay" />  
20 -  
21 - </android.support.design.widget.AppBarLayout>  
22 -  
23 - <include layout="@layout/content_base" />  
24 -  
25 - <android.support.design.widget.FloatingActionButton  
26 - android:id="@+id/fab"  
27 - android:layout_width="wrap_content"  
28 - android:layout_height="wrap_content"  
29 - android:layout_gravity="bottom|end"  
30 - android:layout_margin="@dimen/fab_margin"  
31 - app:srcCompat="@android:drawable/ic_dialog_email" />  
32 -  
33 -</android.support.design.widget.CoordinatorLayout>  
C5/testproject/src/main/res/layout/activity_font_size_actity.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - xmlns:tools="http://schemas.android.com/tools"  
5 - android:layout_width="match_parent"  
6 - android:layout_height="match_parent"  
7 - tools:context="com.sunvote.udptest.FontSizeActity">  
8 -  
9 -  
10 -  
11 - <include layout="@layout/content_font_size_actity" />  
12 -  
13 -  
14 -</android.support.design.widget.CoordinatorLayout>  
C5/testproject/src/main/res/layout/activity_main.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - xmlns:tools="http://schemas.android.com/tools"  
5 - android:layout_width="match_parent"  
6 - android:layout_height="match_parent"  
7 - tools:context="com.sunvote.udptest.MainActivity">  
8 -  
9 -  
10 - <EditText  
11 - android:id="@+id/server_ip"  
12 - android:layout_width="match_parent"  
13 - android:layout_height="wrap_content"  
14 - android:hint="请输入server IP"  
15 - android:text="192.168.0.170"/>  
16 -  
17 - <EditText  
18 - android:id="@+id/server_port"  
19 - android:layout_width="match_parent"  
20 - android:layout_height="wrap_content"  
21 - android:hint="请输入server 端口"  
22 - android:text="40001"  
23 - android:inputType="number"  
24 - android:layout_below="@+id/server_ip"/>  
25 -  
26 - <EditText  
27 - android:layout_width="match_parent"  
28 - android:layout_height="wrap_content"  
29 - android:hint="请输入发送内容"  
30 - android:id="@+id/content"  
31 - android:text="f5 aa aa 1a 00 00 00 00 91 00 12 00 00 5d 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c9 bb"  
32 - android:layout_below="@id/server_port"/>  
33 -  
34 - <Button  
35 - android:layout_width="match_parent"  
36 - android:layout_height="wrap_content"  
37 - android:text="Test"  
38 - android:id="@+id/test"  
39 - android:layout_below="@id/content"/>  
40 -  
41 -  
42 - <TextView  
43 - android:id="@+id/webviewtest"  
44 - android:layout_below="@id/test"  
45 - android:layout_width="match_parent"  
46 - android:layout_height="match_parent" />  
47 -  
48 -</RelativeLayout>  
C5/testproject/src/main/res/layout/activity_main2.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - android:layout_width="match_parent"  
4 - android:layout_height="match_parent">  
5 -  
6 - <ScrollView  
7 - android:layout_width="match_parent"  
8 - android:layout_height="match_parent">  
9 -  
10 - <TextView  
11 - android:id="@+id/display"  
12 - android:layout_width="match_parent"  
13 - android:layout_height="match_parent" />  
14 -  
15 - </ScrollView>  
16 -  
17 - <Button  
18 - android:id="@+id/clean"  
19 - android:layout_width="100dp"  
20 - android:layout_height="50dp"  
21 - android:layout_alignParentBottom="true"  
22 - android:layout_alignParentRight="true"  
23 - android:layout_marginBottom="20dp"  
24 - android:layout_marginRight="10dp"  
25 - android:text="清除" />  
26 -  
27 -</RelativeLayout>  
C5/testproject/src/main/res/layout/activity_modify_mach_code.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - xmlns:tools="http://schemas.android.com/tools"  
5 - android:layout_width="match_parent"  
6 - android:layout_height="match_parent"  
7 - tools:context="com.sunvote.udptest.ModifyMachCode">  
8 -  
9 - <android.support.design.widget.AppBarLayout  
10 - android:layout_width="match_parent"  
11 - android:layout_height="wrap_content"  
12 - android:theme="@style/AppTheme.AppBarOverlay">  
13 -  
14 - <android.support.v7.widget.Toolbar  
15 - android:id="@+id/toolbar"  
16 - android:layout_width="match_parent"  
17 - android:layout_height="?attr/actionBarSize"  
18 - android:background="?attr/colorPrimary"  
19 - app:popupTheme="@style/AppTheme.PopupOverlay" />  
20 -  
21 - </android.support.design.widget.AppBarLayout>  
22 -  
23 - <include layout="@layout/content_modify_mach_code" />  
24 -  
25 - <android.support.design.widget.FloatingActionButton  
26 - android:id="@+id/fab"  
27 - android:layout_width="wrap_content"  
28 - android:layout_height="wrap_content"  
29 - android:layout_gravity="bottom|end"  
30 - android:layout_margin="@dimen/fab_margin"  
31 - app:srcCompat="@android:drawable/ic_dialog_email" />  
32 -  
33 -</android.support.design.widget.CoordinatorLayout>  
C5/testproject/src/main/res/layout/content_base.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - android:layout_width="match_parent"  
4 - android:layout_height="match_parent">  
5 -  
6 - <WebView  
7 - android:id="@+id/webview"  
8 - android:layout_width="match_parent"  
9 - android:layout_height="match_parent">  
10 - </WebView>  
11 -  
12 -  
13 - <TextView  
14 - android:id="@+id/msg"  
15 - android:layout_width="wrap_content"  
16 - android:layout_height="wrap_content"  
17 - android:layout_centerInParent="true"  
18 - android:textSize="30sp"  
19 - android:textColor="#FF0000"  
20 - android:text="内容"/>  
21 -  
22 -</RelativeLayout>  
C5/testproject/src/main/res/layout/content_font_size_actity.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - xmlns:app="http://schemas.android.com/apk/res-auto"  
4 - xmlns:tools="http://schemas.android.com/tools"  
5 - android:layout_width="match_parent"  
6 - android:layout_height="match_parent"  
7 - android:orientation="vertical">  
8 -  
9 - <TextView  
10 - android:layout_width="match_parent"  
11 - android:layout_height="wrap_content"  
12 - android:textSize="@dimen/big_text_p1"  
13 - android:text="P1 中文 English 50"/>  
14 -  
15 - <TextView  
16 - android:layout_width="match_parent"  
17 - android:layout_height="wrap_content"  
18 - android:textSize="@dimen/big_text_p2"  
19 - android:text="P2 中文 English 30"/>  
20 -  
21 - <TextView  
22 - android:layout_width="match_parent"  
23 - android:layout_height="wrap_content"  
24 - android:textSize="@dimen/big_text_p3"  
25 - android:text="P3 中文 English 22"/>  
26 -  
27 - <TextView  
28 - android:layout_width="match_parent"  
29 - android:layout_height="wrap_content"  
30 - android:textSize="@dimen/big_text_p4"  
31 - android:text="P4 中文 English 18"/>  
32 -  
33 - <TextView  
34 - android:layout_width="match_parent"  
35 - android:layout_height="wrap_content"  
36 - android:textSize="@dimen/big_text_p5"  
37 - android:text="P5 中文 English 14"/>  
38 -  
39 - <TextView  
40 - android:layout_width="match_parent"  
41 - android:layout_height="wrap_content"  
42 - android:textSize="@dimen/big_text_p6"  
43 - android:text="P6 中文 English 10"/>  
44 -  
45 - <TextView  
46 - android:layout_width="match_parent"  
47 - android:layout_height="wrap_content"  
48 - android:textSize="@dimen/big_text_pp1"  
49 - android:layout_marginTop="30dp"  
50 - android:text="PP1 中文 English 10"/>  
51 -  
52 - <TextView  
53 - android:layout_width="match_parent"  
54 - android:layout_height="wrap_content"  
55 - android:textSize="@dimen/big_text_pp2"  
56 - android:text="PP2 中文 English 12"/>  
57 -  
58 - <TextView  
59 - android:layout_width="match_parent"  
60 - android:layout_height="wrap_content"  
61 - android:textSize="@dimen/big_text_pp3"  
62 - android:text="PP3 中文 English 14"/>  
63 -  
64 - <TextView  
65 - android:layout_width="match_parent"  
66 - android:layout_height="wrap_content"  
67 - android:textSize="@dimen/big_text_pp4"  
68 - android:text="PP4 中文 English 16"/>  
69 -  
70 - <TextView  
71 - android:layout_width="match_parent"  
72 - android:layout_height="wrap_content"  
73 - android:textSize="@dimen/big_text_pp5"  
74 - android:text="PP5 中文 English 18"/>  
75 -  
76 - <TextView  
77 - android:layout_width="match_parent"  
78 - android:layout_height="wrap_content"  
79 - android:textSize="@dimen/big_text_pp6"  
80 - android:text="PP6 中文 English 20"/>  
81 -  
82 - <TextView  
83 - android:layout_width="match_parent"  
84 - android:layout_height="wrap_content"  
85 - android:textSize="@dimen/big_text_pp7"  
86 - android:text="PP7 中文 English 22"/>  
87 - <TextView  
88 - android:layout_width="match_parent"  
89 - android:layout_height="wrap_content"  
90 - android:textSize="@dimen/big_text_pp8"  
91 - android:text="PP8 中文 English 24"/>  
92 - <TextView  
93 - android:layout_width="match_parent"  
94 - android:layout_height="wrap_content"  
95 - android:textSize="@dimen/big_text_pp9"  
96 - android:text="PP9 中文 English 26"/>  
97 - <TextView  
98 - android:layout_width="match_parent"  
99 - android:layout_height="wrap_content"  
100 - android:textSize="@dimen/big_text_pp10"  
101 - android:text="PP10 中文 English 28"/>  
102 - <TextView  
103 - android:layout_width="match_parent"  
104 - android:layout_height="wrap_content"  
105 - android:textSize="@dimen/big_text_pp11"  
106 - android:text="PP11 中文 English 30"/>  
107 -  
108 - <TextView  
109 - android:layout_width="match_parent"  
110 - android:layout_height="wrap_content"  
111 - android:textSize="@dimen/big_text_pp12"  
112 - android:text="PP12 中文 English 32"/>  
113 -  
114 - <TextView  
115 - android:layout_width="match_parent"  
116 - android:layout_height="wrap_content"  
117 - android:textSize="@dimen/big_text_pp13"  
118 - android:text="PP13 中文 English 34"/>  
119 -  
120 - <TextView  
121 - android:layout_width="match_parent"  
122 - android:layout_height="wrap_content"  
123 - android:textSize="@dimen/big_text_pp14"  
124 - android:text="PP14 中文 English 36"/>  
125 -  
126 - <TextView  
127 - android:layout_width="match_parent"  
128 - android:layout_height="wrap_content"  
129 - android:textSize="@dimen/big_text_pp15"  
130 - android:text="PP15 中文 English 38"/>  
131 -  
132 - <TextView  
133 - android:layout_width="match_parent"  
134 - android:layout_height="wrap_content"  
135 - android:textSize="@dimen/big_text_pp16"  
136 - android:text="PP16 中文 English 40"/>  
137 -  
138 - <TextView  
139 - android:layout_width="match_parent"  
140 - android:layout_height="wrap_content"  
141 - android:textSize="@dimen/big_text_pp17"  
142 - android:text="PP17 中文 English 45"/>  
143 -  
144 - <TextView  
145 - android:layout_width="match_parent"  
146 - android:layout_height="wrap_content"  
147 - android:textSize="@dimen/big_text_pp18"  
148 - android:text="PP18 中文 English 50"/>  
149 -  
150 -  
151 -  
152 -</LinearLayout>  
C5/testproject/src/main/res/layout/content_modify_mach_code.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3 - android:layout_width="match_parent"  
4 - android:layout_height="match_parent" >  
5 -  
6 - <EditText  
7 - android:id="@+id/content"  
8 - android:layout_width="match_parent"  
9 - android:layout_height="200dp"  
10 - android:maxLength="8"  
11 - android:inputType="text"/>  
12 -  
13 - <Button  
14 - android:id="@+id/modify"  
15 - android:layout_width="match_parent"  
16 - android:layout_height="wrap_content"  
17 - android:text="修改"  
18 - android:layout_below="@id/content"/>  
19 -  
20 -</RelativeLayout>  
C5/testproject/src/main/res/mipmap-hdpi/ic_launcher.png deleted

3.34 KB

C5/testproject/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted

4.11 KB

C5/testproject/src/main/res/mipmap-mdpi/ic_launcher.png deleted

2.15 KB

C5/testproject/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted

2.5 KB

C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher.png deleted

4.73 KB

C5/testproject/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted

5.97 KB

C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted

7.54 KB

C5/testproject/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted

9.82 KB

C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted

10.2 KB

C5/testproject/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted

14.4 KB

C5/testproject/src/main/res/values/colors.xml deleted
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<resources>  
3 -  
4 - <!-- http://www.cnblogs.com/bluestorm/p/3644669.html -->  
5 - <!-- <color name="colorPrimary">#3F51B5</color>  
6 - <color name="colorPrimaryDark">#303F9F</color>  
7 - <color name="colorAccent">#FF4081</color>-->  
8 -  
9 - <color name="colorPrimary">#00000000</color>  
10 - <color name="colorPrimaryDark">#00000000</color>  
11 - <color name="colorAccent">#00000000</color>  
12 -  
13 - <color name="bluebackground">#009fd3</color> <!-- 蓝色背景 -->  
14 - <color name="votebakground">#e0e0e0</color>  
15 - <color name="modifytext">#08c308</color>  
16 - <color name="offline_bg">#ff0000</color>  
17 -  
18 - <color name="white">#FFFFFF</color> <!--白色 -->  
19 - <color name="ivory">#FFFFF0</color> <!--象牙色 -->  
20 - <color name="lightyellow">#FFFFE0</color> <!--亮黄色 -->  
21 - <color name="yellow">#FFFF00</color> <!--黄色 -->  
22 - <color name="snow">#FFFAFA</color> <!--雪白色 -->  
23 - <color name="floralwhite">#FFFAF0</color> <!--花白色 -->  
24 - <color name="lemonchiffon">#FFFACD</color> <!--柠檬绸色 -->  
25 - <color name="cornsilk">#FFF8DC</color> <!--米绸色 -->  
26 - <color name="seashell">#FFF5EE</color> <!--海贝色 -->  
27 - <color name="lavenderblush">#FFF0F5</color> <!--淡紫红 -->  
28 - <color name="papayawhip">#FFEFD5</color> <!--番木色 -->  
29 - <color name="blanchedalmond">#FFEBCD</color> <!--白杏色 -->  
30 - <color name="mistyrose">#FFE4E1</color> <!--浅玫瑰色 -->  
31 - <color name="bisque">#FFE4C4</color> <!--桔黄色 -->  
32 - <color name="moccasin">#FFE4B5</color> <!--鹿皮色 -->  
33 - <color name="navajowhite">#FFDEAD</color> <!--纳瓦白 -->  
34 - <color name="peachpuff">#FFDAB9</color> <!--桃色 -->  
35 - <color name="gold">#FFD700</color> <!--金色 -->  
36 - <color name="pink">#FFC0CB</color> <!--粉红色 -->  
37 - <color name="lightpink">#FFB6C1</color> <!--亮粉红色 -->  
38 - <color name="orange">#FFA500</color> <!--橙色 -->  
39 - <color name="lightsalmon">#FFA07A</color> <!--亮肉色 -->  
40 - <color name="darkorange">#FF8C00</color> <!--暗桔黄色 -->  
41 - <color name="coral">#FF7F50</color> <!--珊瑚色 -->  
42 - <color name="hotpink">#FF69B4</color> <!--热粉红色 -->  
43 - <color name="tomato">#FF6347</color> <!--西红柿色 -->  
44 - <color name="orangered">#FF4500</color> <!--红橙色 -->  
45 - <color name="deeppink">#FF1493</color> <!--深粉红色 -->  
46 - <color name="fuchsia">#FF00FF</color> <!--紫红色 -->  
47 - <color name="magenta">#FF00FF</color> <!--红紫色 -->  
48 - <color name="red">#FF0000</color> <!--红色 -->  
49 - <color name="oldlace">#FDF5E6</color> <!--老花色 -->  
50 - <color name="lightgoldenrodyellow">#FAFAD2</color> <!--亮金黄色 -->  
51 - <color name="linen">#FAF0E6</color> <!--亚麻色 -->  
52 - <color name="antiquewhite">#FAEBD7</color> <!--古董白 -->  
53 - <color name="salmon">#FA8072</color> <!--鲜肉色 -->  
54 - <color name="ghostwhite">#F8F8FF</color> <!--幽灵白 -->  
55 - <color name="mintcream">#F5FFFA</color> <!--薄荷色 -->  
56 - <color name="whitesmoke">#F5F5F5</color> <!--烟白色 -->  
57 - <color name="beige">#F5F5DC</color> <!--米色 -->  
58 - <color name="wheat">#F5DEB3</color> <!--浅黄色 -->  
59 - <color name="sandybrown">#F4A460</color> <!--沙褐色 -->  
60 - <color name="azure">#F0FFFF</color> <!--天蓝色 -->  
61 - <color name="honeydew">#F0FFF0</color> <!--蜜色 -->  
62 - <color name="aliceblue">#F0F8FF</color> <!--艾利斯兰 -->  
63 - <color name="khaki">#F0E68C</color> <!--黄褐色 -->  
64 - <color name="lightcoral">#F08080</color> <!--亮珊瑚色 -->  
65 - <color name="palegoldenrod">#EEE8AA</color> <!--苍麒麟色 -->  
66 - <color name="violet">#EE82EE</color> <!--紫罗兰色 -->  
67 - <color name="darksalmon">#E9967A</color> <!--暗肉色 -->  
68 - <color name="lavender">#E6E6FA</color> <!--淡紫色 -->  
69 - <color name="lightcyan">#E0FFFF</color> <!--亮青色 -->  
70 - <color name="burlywood">#DEB887</color> <!--实木色 -->  
71 - <color name="plum">#DDA0DD</color> <!--洋李色 -->  
72 - <color name="gainsboro">#DCDCDC</color> <!--淡灰色 -->  
73 - <color name="crimson">#DC143C</color> <!--暗深红色 -->  
74 - <color name="palevioletred">#DB7093</color> <!--苍紫罗兰色 -->  
75 - <color name="goldenrod">#DAA520</color> <!--金麒麟色 -->  
76 - <color name="orchid">#DA70D6</color> <!--淡紫色 -->  
77 - <color name="thistle">#D8BFD8</color> <!--蓟色 -->  
78 - <color name="lightgray">#D3D3D3</color> <!--亮灰色 -->  
79 - <color name="lightgrey">#D3D3D3</color> <!--亮灰色 -->  
80 - <color name="tan">#D2B48C</color> <!--茶色 -->  
81 - <color name="chocolate">#D2691E</color> <!--巧可力色 -->  
82 - <color name="peru">#CD853F</color> <!--秘鲁色 -->  
83 - <color name="indianred">#CD5C5C</color> <!--印第安红 -->  
84 - <color name="mediumvioletred">#C71585</color> <!--中紫罗兰色 -->  
85 - <color name="silver">#C0C0C0</color> <!--银色 -->  
86 - <color name="darkkhaki">#BDB76B</color> <!--暗黄褐色-->  
87 - <color name="rosybrown">#BC8F8F</color> <!--褐玫瑰红 -->  
88 - <color name="mediumorchid">#BA55D3</color> <!--中粉紫色 -->  
89 - <color name="darkgoldenrod">#B8860B</color> <!--暗金黄色 -->  
90 - <color name="firebrick">#B22222</color> <!--火砖色 -->  
91 - <color name="powderblue">#B0E0E6</color> <!--粉蓝色 -->  
92 - <color name="lightsteelblue">#B0C4DE</color> <!--亮钢兰色-->  
93 - <color name="paleturquoise">#AFEEEE</color> <!--苍宝石绿 -->  
94 - <color name="greenyellow">#ADFF2F</color> <!--黄绿色 -->  
95 - <color name="lightblue">#ADD8E6</color> <!--亮蓝色 -->  
96 - <color name="darkgray">#A9A9A9</color> <!--暗灰色 -->  
97 - <color name="darkgrey">#A9A9A9</color> <!--暗灰色 -->  
98 - <color name="brown">#A52A2A</color> <!--褐色 -->  
99 - <color name="sienna">#A0522D</color> <!--赭色 -->  
100 - <color name="darkorchid">#9932CC</color> <!--暗紫色 -->  
101 - <color name="palegreen">#98FB98</color> <!--苍绿色 -->  
102 - <color name="darkviolet">#9400D3</color> <!--暗紫罗兰色 -->  
103 - <color name="mediumpurple">#9370DB</color> <!--中紫色 -->  
104 - <color name="lightgreen">#90EE90</color> <!--亮绿色 -->  
105 - <color name="darkseagreen">#8FBC8F</color> <!--暗海兰色 -->  
106 - <color name="saddlebrown">#8B4513</color> <!--重褐色 -->  
107 - <color name="darkmagenta">#8B008B</color> <!--暗洋红 -->  
108 - <color name="darkred">#8B0000</color> <!--暗红色 -->  
109 - <color name="blueviolet">#8A2BE2</color> <!--紫罗兰蓝色 -->  
110 - <color name="lightskyblue">#87CEFA</color> <!--亮天蓝色 -->  
111 - <color name="skyblue">#87CEEB</color> <!--天蓝色 -->  
112 - <color name="gray">#808080</color> <!--灰色 -->  
113 - <color name="grey">#808080</color> <!--灰色 -->  
114 - <color name="olive">#808000</color> <!--橄榄色 -->  
115 - <color name="purple">#800080</color> <!--紫色 -->  
116 - <color name="maroon">#800000</color> <!--粟色 -->  
117 - <color name="aquamarine">#7FFFD4</color> <!--碧绿色 -->  
118 - <color name="chartreuse">#7FFF00</color> <!--黄绿色 -->  
119 - <color name="lawngreen">#7CFC00</color> <!--草绿色 -->  
120 - <color name="mediumslateblue">#7B68EE</color> <!--中暗蓝色 -->  
121 - <color name="lightslategray">#778899</color> <!--亮蓝灰 -->  
122 - <color name="lightslategrey">#778899</color> <!--亮蓝灰 -->  
123 - <color name="slategray">#708090</color> <!--灰石色 -->  
124 - <color name="slategrey">#708090</color> <!--灰石色 -->  
125 - <color name="olivedrab">#6B8E23</color> <!--深绿褐色 -->  
126 - <color name="slateblue">#6A5ACD</color> <!--石蓝色 -->  
127 - <color name="dimgray">#696969</color> <!--暗灰色 -->  
128 - <color name="dimgrey">#696969</color> <!--暗灰色 -->  
129 - <color name="mediumaquamarine">#66CDAA</color> <!--中绿色 -->  
130 - <color name="cornflowerblue">#6495ED</color> <!--菊兰色 -->  
131 - <color name="cadetblue">#5F9EA0</color> <!--军兰色 -->  
132 - <color name="darkolivegreen">#556B2F</color> <!--暗橄榄绿-->  
133 - <color name="indigo">#4B0082</color> <!--靛青色 -->  
134 - <color name="mediumturquoise">#48D1CC</color> <!--中绿宝石 -->  
135 - <color name="darkslateblue">#483D8B</color> <!--暗灰蓝色 -->  
136 - <color name="steelblue">#4682B4</color> <!--钢兰色 -->  
137 - <color name="royalblue">#4169E1</color> <!--皇家蓝 -->  
138 - <color name="turquoise">#40E0D0</color> <!--青绿色 -->  
139 - <color name="mediumseagreen">#3CB371</color> <!--中海蓝 -->  
140 - <color name="limegreen">#32CD32</color> <!--橙绿色 -->  
141 - <color name="darkslategray">#2F4F4F</color> <!--暗瓦灰色 -->  
142 - <color name="darkslategrey">#2F4F4F</color> <!--暗瓦灰色 -->  
143 - <color name="seagreen">#2E8B57</color> <!--海绿色 -->  
144 - <color name="forestgreen">#228B22</color> <!--森林绿 -->  
145 - <color name="lightseagreen">#20B2AA</color> <!--亮海蓝色 -->  
146 - <color name="dodgerblue">#1E90FF</color> <!--闪兰色 -->  
147 - <color name="midnightblue">#191970</color> <!--中灰兰色 -->  
148 - <color name="aqua">#00FFFF</color> <!--浅绿色 -->  
149 - <color name="cyan">#00FFFF</color> <!--青色 -->  
150 - <color name="springgreen">#00FF7F</color> <!--春绿色 -->  
151 - <color name="lime">#00FF00</color> <!--酸橙色 -->  
152 - <color name="mediumspringgreen">#00FA9A</color> <!--中春绿色 -->  
153 - <color name="darkturquoise">#00CED1</color> <!--暗宝石绿 -->  
154 - <color name="deepskyblue">#00BFFF</color> <!--深天蓝色 -->  
155 - <color name="darkcyan">#008B8B</color> <!--暗青色 -->  
156 - <color name="teal">#008080</color> <!--水鸭色 -->  
157 - <color name="green">#008000</color> <!--绿色 -->  
158 - <color name="darkgreen">#006400</color> <!--暗绿色 -->  
159 - <color name="blue">#0000FF</color> <!--蓝色 -->  
160 - <color name="mediumblue">#0000CD</color> <!--中兰色 -->  
161 - <color name="darkblue">#00008B</color> <!--暗蓝色 -->  
162 - <color name="navy">#000080</color> <!--海军色 -->  
163 - <color name="black">#000000</color> <!--黑色 -->  
164 -  
165 -</resources>  
166 \ No newline at end of file 0 \ No newline at end of file
C5/testproject/src/main/res/values/dimens.xml deleted
1 -<resources>  
2 - <dimen name="fab_margin">16dp</dimen>  
3 - <!--文字大小标记设置-->  
4 - <dimen name="big_text_p1">50sp</dimen>  
5 - <dimen name="big_text_p2">30sp</dimen>  
6 - <dimen name="big_text_p3">22sp</dimen>  
7 - <dimen name="big_text_p4">18sp</dimen>  
8 - <dimen name="big_text_p5">14sp</dimen>  
9 - <dimen name="big_text_p6">10sp</dimen>  
10 -  
11 -  
12 - <dimen name="big_text_pp1">10sp</dimen>  
13 - <dimen name="big_text_pp2">12sp</dimen>  
14 - <dimen name="big_text_pp3">14sp</dimen>  
15 - <dimen name="big_text_pp4">16sp</dimen>  
16 - <dimen name="big_text_pp5">18sp</dimen>  
17 - <dimen name="big_text_pp6">20sp</dimen>  
18 - <dimen name="big_text_pp7">22sp</dimen>  
19 - <dimen name="big_text_pp8">24sp</dimen>  
20 - <dimen name="big_text_pp9">26sp</dimen>  
21 - <dimen name="big_text_pp10">28sp</dimen>  
22 - <dimen name="big_text_pp11">30sp</dimen>  
23 - <dimen name="big_text_pp12">32sp</dimen>  
24 - <dimen name="big_text_pp13">34sp</dimen>  
25 - <dimen name="big_text_pp14">36sp</dimen>  
26 - <dimen name="big_text_pp15">38sp</dimen>  
27 - <dimen name="big_text_pp16">40sp</dimen>  
28 - <dimen name="big_text_pp17">45sp</dimen>  
29 - <dimen name="big_text_pp18">50sp</dimen>  
30 -</resources>  
C5/testproject/src/main/res/values/strings.xml deleted
1 -<resources>  
2 - <string name="app_name">测试工具</string>  
3 - <string name="title_activity_font_size_actity">FontSizeActity</string>  
4 - <string name="title_activity_base">BaseActivity</string>  
5 - <string name="title_activity_modify_mach_code">ModifyMachCode</string>  
6 - <string name="title_activity_unlock">解密</string>  
7 -</resources>  
C5/testproject/src/main/res/values/styles.xml deleted
1 -<resources>  
2 -  
3 - <!-- Base application theme. -->  
4 - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">  
5 - <!-- Customize your theme here. -->  
6 - <item name="colorPrimary">@color/colorPrimary</item>  
7 - <item name="colorPrimaryDark">@color/colorPrimaryDark</item>  
8 - <item name="colorAccent">@color/colorAccent</item>  
9 - </style>  
10 -  
11 - <style name="AppTheme.NoActionBar">  
12 - <item name="windowActionBar">false</item>  
13 - <item name="windowNoTitle">true</item>  
14 - </style>  
15 -  
16 - <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />  
17 -  
18 - <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />  
19 -  
20 -</resources>  
C5/testproject/src/test/java/com/sunvote/udptest/ExampleUnitTest.java deleted
1 -package com.sunvote.udptest;  
2 -  
3 -import org.junit.Test;  
4 -  
5 -import static org.junit.Assert.*;  
6 -  
7 -/**  
8 - * Example local unit test, which will execute on the development machine (host).  
9 - *  
10 - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>  
11 - */  
12 -public class ExampleUnitTest {  
13 - @Test  
14 - public void addition_isCorrect() throws Exception {  
15 - assertEquals(4, 2 + 2);  
16 - }  
17 -}  
18 \ No newline at end of file 0 \ No newline at end of file