Skip to content

Commit f393d25

Browse files
authored
Merge pull request #400 from Paynehe/master
#5 #66 第五次作业
2 parents 05a134e + 4d968df commit f393d25

File tree

2 files changed

+133
-121
lines changed

2 files changed

+133
-121
lines changed

AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903103/net1414080903103Activity.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package edu.hzuapps.androidlabs.homeworks.net1414080903103;
1+
package edu.hzuapps.androidlabs.homeworks.net1414080903103;
22

33
import java.util.ArrayList;
44
import java.util.HashMap;
@@ -40,11 +40,11 @@ private void findviewByid() {
4040
Button btnStart = (Button) findViewById(R.id.BTN_START);
4141
Button btnStop = (Button) findViewById(R.id.BTN_STOP);
4242
Button btnConnectSvr = (Button) findViewById(R.id.BTN_GETVPNSTATUS);
43-
43+
Button btn_save=(Button) findViewById(R.id.btn_save);
4444
btnStart.setOnClickListener(this);
4545
btnStop.setOnClickListener(this);
4646
btnConnectSvr.setOnClickListener(this);
47-
47+
btn_save.setOnClickListener(this);
4848
}
4949

5050
@Override
@@ -63,7 +63,21 @@ public void onClick(View v) {
6363
break;
6464
}
6565

66-
66+
case R.id.btn_save: {
67+
String saveinfo =edtIP.getText().toString().trim();
68+
FileOutputStream fos;
69+
try {
70+
//保存数据
71+
fos = openFileOutput("data.txt", Context.MODE_APPEND);
72+
fos.write(saveinfo.getBytes());
73+
fos.close();
74+
} catch (Exception e) {
75+
e.printStackTrace();
76+
}
77+
Toast.makeText(TestSVSDKLib.this, "保存成功", Toast.LENGTH_SHORT).show();
78+
break;
79+
80+
}
6781
}
6882
}
6983

AndroidLabs/app/src/main/res/layout/activity_net1414080903103.xml

+115-117
Original file line numberDiff line numberDiff line change
@@ -4,141 +4,139 @@
44
android:layout_width="fill_parent"
55
android:layout_height="fill_parent"
66
>
7-
<TextView
8-
android:layout_width="fill_parent"
9-
android:layout_height="wrap_content"
10-
android:text="@string/app_name"
11-
android:gravity="center_horizontal"
12-
android:padding="10sp"
13-
android:textSize="8pt"
14-
android:textColor="#00FF00" />
15-
16-
<ImageView
17-
android:layout_width="wrap_content"
18-
android:layout_height="wrap_content"
19-
android:layout_gravity="center_horizontal"
20-
android:layout_marginBottom="5dp"
21-
android:layout_marginTop="30dp"
22-
android:src="@drawable/²¶»ñ"/>
7+
<TextView
8+
android:layout_width="fill_parent"
9+
android:layout_height="wrap_content"
10+
android:text="@string/app_name"
11+
android:gravity="center_horizontal"
12+
android:padding="10sp"
13+
android:textSize="8pt"
14+
android:textColor="#00FF00" />
15+
16+
<LinearLayout
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:orientation="vertical" >
2320

2421
<LinearLayout
2522
android:layout_width="match_parent"
26-
android:layout_height="wrap_content"
27-
android:orientation="vertical" >
28-
29-
<LinearLayout
30-
android:layout_width="match_parent"
31-
android:layout_height="wrap_content" >
32-
33-
<TextView
34-
android:layout_width="108dp"
35-
android:layout_height="wrap_content"
36-
android:gravity="center_horizontal"
37-
android:padding="10sp"
38-
android:text="VPN IP"
39-
android:textSize="8pt" />
40-
41-
<EditText
42-
android:id="@+id/edtip"
43-
android:layout_width="wrap_content"
44-
android:layout_height="wrap_content"
45-
android:layout_weight="1"
46-
android:ems="10"
47-
android:text="59.49.15.130" />
48-
49-
</LinearLayout>
50-
51-
<LinearLayout
52-
android:layout_width="match_parent"
53-
android:layout_height="wrap_content" >
54-
55-
<TextView
56-
android:layout_width="108dp"
57-
android:layout_height="wrap_content"
58-
android:gravity="center_horizontal"
59-
android:padding="10sp"
60-
android:text="VPN Port"
61-
android:textSize="8pt" />
62-
63-
<EditText
64-
android:id="@+id/edtport"
65-
android:layout_width="wrap_content"
66-
android:layout_height="wrap_content"
67-
android:layout_weight="1"
68-
android:ems="10"
69-
android:inputType="number"
70-
android:text="443" />
71-
72-
</LinearLayout>
73-
74-
<LinearLayout
75-
android:layout_width="match_parent"
76-
android:layout_height="wrap_content" >
77-
78-
<TextView
79-
android:layout_width="108dp"
80-
android:layout_height="wrap_content"
81-
android:gravity="center_horizontal"
82-
android:padding="10sp"
83-
android:text="Username"
84-
android:textSize="8pt" />
85-
86-
<EditText
87-
android:id="@+id/edtuname"
88-
android:layout_width="wrap_content"
89-
android:layout_height="wrap_content"
90-
android:layout_weight="1"
91-
android:ems="10"
92-
android:text="oa" />
93-
94-
</LinearLayout>
95-
96-
<LinearLayout
97-
android:layout_width="match_parent"
98-
android:layout_height="wrap_content" >
99-
100-
<TextView
101-
android:layout_width="108dp"
102-
android:layout_height="wrap_content"
103-
android:gravity="center_horizontal"
104-
android:padding="10sp"
105-
android:text="Userpwd"
106-
android:textSize="8pt" />
107-
108-
<EditText
109-
android:id="@+id/edtupwd"
110-
android:layout_width="wrap_content"
111-
android:layout_height="wrap_content"
112-
android:layout_weight="1"
113-
android:ems="10"
114-
android:password="true"
115-
android:text="123456" />
116-
117-
</LinearLayout>
23+
android:layout_height="wrap_content" >
24+
25+
<TextView
26+
android:layout_width="108dp"
27+
android:layout_height="wrap_content"
28+
android:gravity="center_horizontal"
29+
android:padding="10sp"
30+
android:text="VPN IP"
31+
android:textSize="8pt" />
32+
33+
<EditText
34+
android:id="@+id/edtip"
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_weight="1"
38+
android:ems="10"
39+
android:text="59.49.15.130" />
11840

11941
</LinearLayout>
12042

12143
<LinearLayout
12244
android:layout_width="match_parent"
12345
android:layout_height="wrap_content" >
12446

125-
<Button
126-
android:id="@+id/BTN_START"
47+
<TextView
48+
android:layout_width="108dp"
49+
android:layout_height="wrap_content"
50+
android:gravity="center_horizontal"
51+
android:padding="10sp"
52+
android:text="VPN Port"
53+
android:textSize="8pt" />
54+
55+
<EditText
56+
android:id="@+id/edtport"
12757
android:layout_width="wrap_content"
12858
android:layout_height="wrap_content"
129-
android:text="StartVPN" />
59+
android:layout_weight="1"
60+
android:ems="10"
61+
android:inputType="number"
62+
android:text="443" />
13063

131-
<Button
132-
android:id="@+id/BTN_STOP"
64+
</LinearLayout>
65+
66+
<LinearLayout
67+
android:layout_width="match_parent"
68+
android:layout_height="wrap_content" >
69+
70+
<TextView
71+
android:layout_width="108dp"
72+
android:layout_height="wrap_content"
73+
android:gravity="center_horizontal"
74+
android:padding="10sp"
75+
android:text="Username"
76+
android:textSize="8pt" />
77+
78+
<EditText
79+
android:id="@+id/edtuname"
13380
android:layout_width="wrap_content"
13481
android:layout_height="wrap_content"
135-
android:text="StopVPN" />
82+
android:layout_weight="1"
83+
android:ems="10"
84+
android:text="oa" />
13685

137-
<Button
138-
android:id="@+id/BTN_GETVPNSTATUS"
86+
</LinearLayout>
87+
88+
<LinearLayout
89+
android:layout_width="match_parent"
90+
android:layout_height="wrap_content" >
91+
92+
<TextView
93+
android:layout_width="108dp"
94+
android:layout_height="wrap_content"
95+
android:gravity="center_horizontal"
96+
android:padding="10sp"
97+
android:text="Userpwd"
98+
android:textSize="8pt" />
99+
100+
<EditText
101+
android:id="@+id/edtupwd"
139102
android:layout_width="wrap_content"
140103
android:layout_height="wrap_content"
141-
android:text="GetVPNStatus" />
104+
android:layout_weight="1"
105+
android:ems="10"
106+
android:password="true"
107+
android:text="123456" />
108+
142109
</LinearLayout>
143110

144111
</LinearLayout>
112+
113+
<LinearLayout
114+
android:layout_width="match_parent"
115+
android:layout_height="wrap_content" >
116+
117+
<Button
118+
android:id="@+id/BTN_START"
119+
android:layout_width="wrap_content"
120+
android:layout_height="wrap_content"
121+
android:text="Start VPN" />
122+
123+
<Button
124+
android:id="@+id/BTN_STOP"
125+
android:layout_width="wrap_content"
126+
android:layout_height="wrap_content"
127+
android:text="Stop VPN" />
128+
129+
<Button
130+
android:id="@+id/BTN_GETVPNSTATUS"
131+
android:layout_width="wrap_content"
132+
android:layout_height="wrap_content"
133+
android:text="Get VPN Status" />
134+
135+
<Button
136+
android:id="@+id/btn_save"
137+
android:layout_width="wrap_content"
138+
android:layout_height="wrap_content"
139+
android:text="Save VPN INFO"/>
140+
</LinearLayout>
141+
142+
</LinearLayout>

0 commit comments

Comments
 (0)