Skip to content

Commit 3efdcce

Browse files
committed
v2.4.1 for Android 6.0+ release!
1 parent e150c90 commit 3efdcce

File tree

14 files changed

+173
-87
lines changed

14 files changed

+173
-87
lines changed

BUILDING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Building the app
2+
1. 安装以下软件:
3+
- Android SDK:
4+
http://developer.android.com/sdk/index.html
5+
- Gradle:
6+
http://www.gradle.org/downloads
7+
- Android Studio:
8+
http://developer.android.com/sdk/installing/studio.html
9+
2. 运行sdk manager(可以在Android Studio中工具栏上点击按钮或者在命令行中输入android打开),确保以下内容已安装:
10+
- Tools > Android SDK Platform-tools (rev 22 or above)
11+
- Tools > Android SDK Tools (rev 24.3.3 or above)
12+
- Tools > Android SDK Build-tools version 20
13+
- Tools > Android SDK Build-tools version 21 (rev 22.0.1 or above)
14+
- Android 4.0.3 > SDK Platform (API 15)
15+
- Android 5.0.1 > SDK Platform (API 21)
16+
3. 将工程导入Android Studio:
17+
1. 点击 File > Import Project
18+
2. 切换到工程中的 settings.gradle 文件并选择
19+
3. 点击 OK
20+
4. 点击运行或者使用快捷键shift+F10

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ AutoConnect Android App
44

55
AutoConnect是一个用于安卓手机连接到NJU-WLAN后自动登陆p.nju.edu.cn的Android程序,代替手动打开浏览器登陆的繁琐操作,做到有NJU-WLAN的地方总是保持网络连接。
66

7-
<h2>特色</h2>
8-
9-
- 极简:功能简单,操作简单,代码简洁。
10-
- 不流氓:不要求多余权限,用户可决定是否开机自启,占用资源小。
11-
127
<h2>适用平台</h2>
138
Android 4.0+
149

@@ -27,19 +22,22 @@ Android 4.0+
2722
<img src="screenshot4.png" width="355" height="631">
2823

2924
<h2>功能说明</h2>
30-
- 可以手动进行登陆,下线
31-
- 可以开启后台服务,将在连接上NJU-WLAN时自动登陆
32-
33-
<h2>使用说明</h2>
34-
35-
- 设置中选择允许开机自启后,才会开启后台自动登陆功能。
25+
- 可手动进行登陆,下线
26+
- 默认开启后台服务,将在连接上NJU-WLAN时自动登陆
3627

3728
<h2>下载</h2>
3829
| 系统要求 | 版本号 | 下载链接 |文件大小|
3930
| :------------ |:-------:|:--------:|:---:|
40-
| android 4.0+ | 2.4 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/newUI/app/app-release.apk) |未知大小|
41-
| android 5.0+ | 2.4 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/minAPI21/app/app-release.apk) |未知大小|
42-
| android 6.0+ | 2.4 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/minAPI23/app/app-release.apk) |未知大小|
31+
| android 4.0+ | 2.4.1 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/newUI/app/app-release.apk) |1016KB|
32+
| android 5.0+ | 2.4.1 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/minAPI21/app/app-release.apk) |416KB|
33+
| android 6.0+ | 2.4.1 | [apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/minAPI23/app/app-release.apk) |416KB|
34+
35+
<h2>To Do</h2>
36+
- [x] 数据加密传输
37+
- [ ] 数据加密存储
38+
- [ ] widget小组件
39+
- [ ] 显示登陆,账单,等详单列表
40+
- [ ] 账号共享
4341

4442
<h2>更新日志</h2>
4543

@@ -48,6 +46,8 @@ Android 4.0+
4846
<h2>如何使用源代码构建并运行</h2>
4947
- [查看build instruction](https://github.com/padeoe/AutoConnect/blob/newUI/BUILDING.md)
5048

49+
<h2>特别感谢</h2>
50+
- 技术顾问[@Nifury](https://github.com/Nifury)
5151

5252
<h2>许可证</h2>
5353
在最为宽松的MIT许可下开源

UPDATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
更新日志
22
=======
3-
<h2>v2.4(2015年9月21日)</h2>
3+
<h2>v2.4.1(2015年11月21日)</h2>
4+
- 性能优化
5+
6+
<h2>v2.4(2015年10月28日)</h2>
47
- 加密传输密码
58
- DNS缓存
69
- 全新的登陆,查询接口(但是目前没有界面显示),代码重构

app/app-release.apk

-80.9 KB
Binary file not shown.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
applicationId "com.padeoe.autoconnect"
1818
minSdkVersion 23
1919
targetSdkVersion 23
20-
versionCode 1
21-
versionName "2.4"
20+
versionCode 2312241
21+
versionName "2.4.1"
2222
}
2323
buildTypes {
2424
release {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</activity>
4343

4444
<service
45-
android:name=".service.WiFiDetectService"
45+
android:name=".service.ConnectService"
4646
android:enabled="true"
4747
android:exported="true">
4848
<intent-filter>

app/src/main/java/com/padeoe/autoconnect/activity/App.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
import android.app.Application;
44
import android.content.Context;
55

6+
import com.avos.avoscloud.AVOSCloud;
7+
68
/**
79
* Created by padeoe on 2015/7/2.
810
*/
911
public class App extends Application {
10-
public static final String LOGINURL = "http://219.219.114.15/portal_io/login";
11-
public static final String LOGOUTURL = "http://219.219.114.15/portal_io/logout";
1212
public static Context context;
1313

1414
@Override
1515
public void onCreate() {
1616
super.onCreate();
1717
context = getApplicationContext();
18+
//添加LeanCloud用户统计分析,下面一行代码中的key仅用于测试,发布的apk中使用的不同
19+
AVOSCloud.initialize(this, "rfdbmj8hpdbo3dwx2unrqmvhfb2y8r6d3xrsaiwwoewr2bc4", "c6n60q7onyffn97vey1jywk3bje590xlntp8ddasdo0hnvcy");
1820
}
1921

2022
}

app/src/main/java/com/padeoe/autoconnect/activity/MainActivity.java

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
import com.avos.avoscloud.AVObject;
3838
import com.avos.avoscloud.AVQuery;
3939
import com.avos.avoscloud.FindCallback;
40+
import com.padeoe.autoconnect.service.ConnectService;
4041
import com.padeoe.autoconnect.service.InstallService;
4142
import com.padeoe.autoconnect.ui.CaptivePortalLoginFragment;
4243
import com.padeoe.autoconnect.ui.ExplainPermissionFragment;
4344
import com.padeoe.autoconnect.util.ResultUtils;
4445
import com.padeoe.autoconnect.R;
45-
import com.padeoe.autoconnect.service.WiFiDetectService;
4646
import com.padeoe.autoconnect.ui.AboutDialogFragment;
4747
import com.padeoe.autoconnect.ui.CheckUpdateFragment;
4848
import com.padeoe.autoconnect.ui.SettingDialogFragment;
@@ -65,23 +65,26 @@ public class MainActivity extends Activity implements CheckUpdateFragment.Update
6565

6666
@Override
6767
protected void onCreate(Bundle savedInstanceState) {
68+
/* Log.e("time", "开始计时");
69+
Timer t = new Timer();
70+
t.start();*/
71+
6872
super.onCreate(savedInstanceState);
6973
setContentView(R.layout.activity_main);
70-
//添加LeanCloud用户统计分析,下面一行代码中的key仅用于测试,发布的apk中使用的不同
71-
AVOSCloud.initialize(this, "rfdbmj8hpdbo3dwx2unrqmvhfb2y8r6d3xrsaiwwoewr2bc4", "c6n60q7onyffn97vey1jywk3bje590xlntp8ddasdo0hnvcy");
72-
7374
//获取现有配置
7475
sharedPreferences = App.context.getSharedPreferences("DataFile", MODE_PRIVATE);
7576
editor = sharedPreferences.edit();
76-
String username = sharedPreferences.getString("username", null);
77-
String password = sharedPreferences.getString("password", null);
77+
/* String username = sharedPreferences.getString("username", null);
78+
String password = sharedPreferences.getString("password", null);*/
79+
String username=ConnectService.getUsername();
80+
String password=ConnectService.getPassword();
7881
//显示现有配置
7982
usernameEdit = (EditText) findViewById(R.id.username);
8083
passwordEdit = (EditText) findViewById(R.id.password);
8184
if (username != null) usernameEdit.setText(username);
8285
if (password != null) passwordEdit.setText(password);
8386
if (username != null & password != null) {
84-
this.startService(new Intent(this, WiFiDetectService.class));
87+
this.startService(new Intent(this, ConnectService.class));
8588
}
8689

8790
final ListView listview = (ListView) findViewById(R.id.listview);
@@ -137,7 +140,7 @@ public void onClick(DialogInterface dialog, int id) {
137140
AlertDialog dialog = builder.create();
138141
dialog.show();
139142
}
140-
143+
/*Log.e("time", t.end() + "ms");*/
141144
}
142145

143146
/**
@@ -264,7 +267,7 @@ public void connectNow() {
264267
ReturnData returnData = null;
265268
returnData = ReturnData.getFromJson(connectResult);
266269
if (returnData != null && returnData.getReply_message().equals("登录成功!")) {
267-
App.context.startService(new Intent(App.context, WiFiDetectService.class));
270+
App.context.startService(new Intent(App.context, ConnectService.class));
268271
if (sharedPreferences.getString("username", null) == null) {
269272
storeInfo();
270273
}
@@ -289,14 +292,10 @@ public void connectNow() {
289292
public void storeInfo() {
290293
String username = usernameEdit.getText().toString();
291294
String password = passwordEdit.getText().toString();
292-
editor.putString("username", username);
293-
editor.putString("password", password);
294-
editor.commit();
295295
if (username.length() > 0 && password.length() > 0) {
296-
editor.putString("username", username);
297-
editor.putString("password", password);
298-
editor.commit();
299-
App.context.startService(new Intent(App.context, WiFiDetectService.class));
296+
ConnectService.setUsername(username);
297+
ConnectService.setPassword(password);
298+
App.context.startService(new Intent(App.context, ConnectService.class));
300299
Log.i("配置文件", "保存了用户名密码");
301300
Log.i("保存", " 保存后开启了服务");
302301
ShowOnMainActivity((String) getResources().getText(R.string.saved_success));
@@ -367,8 +366,7 @@ public void allowStatics(View view) {
367366
}
368367

369368
public void staticsButtonOnClicked(boolean allow) {
370-
editor.putBoolean("allow_statistics", allow);
371-
editor.commit();
369+
ConnectService.setAllowStatistics(allow);
372370
if (allow) {
373371
Toast.makeText(App.context, (String) getResources().getText(R.string.have_allowed_statistics), Toast.LENGTH_SHORT).show();
374372
AVObject Like = new AVObject("AllowData");
@@ -407,7 +405,8 @@ public void downloadNewVersionApp() {
407405
FragmentManager fm = MainActivity.this.getFragmentManager();
408406
new ExplainPermissionFragment().show(fm, "s");
409407

410-
} else {
408+
}
409+
else{
411410
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
412411
// app-defined int constant
413412
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
@@ -525,3 +524,17 @@ public void done(List<AVObject> avObjects, AVException e) {
525524

526525
};
527526

527+
/**
528+
* 用于实验缓存多大时文件读写速度最快,测量所用时间
529+
*/
530+
/*class Timer {
531+
long s;
532+
public long start() {
533+
s = System.currentTimeMillis();
534+
return s;
535+
}
536+
public long end() {
537+
return System.currentTimeMillis() - s;
538+
}
539+
}*/
540+

app/src/main/java/com/padeoe/autoconnect/receiver/BootReceiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import android.content.Intent;
66
import android.content.SharedPreferences;
77

8-
import com.padeoe.autoconnect.service.WiFiDetectService;
8+
import com.padeoe.autoconnect.service.ConnectService;
99

1010
public class BootReceiver extends BroadcastReceiver {
1111
@Override
@@ -15,7 +15,7 @@ public void onReceive(Context context, Intent intent) {
1515
boolean isBanned = sharedPreferences.getBoolean("isBanned", false);
1616
String PostData = sharedPreferences.getString("PostData", null);
1717
if (!isBanned && PostData != null && PostData.length() > 0) {
18-
context.startService(new Intent(context, WiFiDetectService.class));
18+
context.startService(new Intent(context, ConnectService.class));
1919
}
2020
}
2121
}

app/src/main/java/com/padeoe/autoconnect/receiver/NetworkConnectChangedReceiver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import android.util.Log;
1111

1212
import com.avos.avoscloud.AVAnalytics;
13-
import com.padeoe.autoconnect.service.WiFiDetectService;
13+
import com.padeoe.autoconnect.service.ConnectService;
1414
import com.padeoe.nicservice.njuwlan.service.LoginService;
1515

1616
/**
@@ -32,19 +32,19 @@ public void onReceive(final Context context, Intent intent) {
3232
WifiInfo wifiInfo = mWifi.getConnectionInfo();
3333
Log.d("wifiInfo:", wifiInfo.getSSID());
3434
if (wifiInfo.getSSID().equals("\"NJU-FAST\"") || wifiInfo.getSSID().equals("\"NJU-WLAN\"")) {
35-
Log.d("后台wifi连接检测", "是目标wifi");
35+
Log.i("后台登陆", "是目标ssid");
3636
if (i == 1) {
3737
new Thread() {
3838
@Override
3939
public void run() {
4040
try {
41-
if (WiFiDetectService.username != null & WiFiDetectService.password != null) {
41+
if (ConnectService.getUsername() != null & ConnectService.getPassword() != null) {
4242
Thread.sleep(200);
4343
for (int i = 0; i < 5; i++) {
4444
Log.i("后台登陆","第"+i+"次尝试");
45-
if (LoginService.getInstance().isLoginSuccess(LoginService.getInstance().connect(WiFiDetectService.username, WiFiDetectService.password))) {
45+
if (LoginService.isLoginSuccess(LoginService.getInstance().connect(ConnectService.getUsername(), ConnectService.getPassword()))) {
4646
Log.i("后台登陆","后台登陆成功");
47-
if (WiFiDetectService.allowStatistics) {
47+
if (ConnectService.isAllowStatistics()) {
4848
AVAnalytics.onEvent(context, "后台自动登陆NJU-WLAN成功");
4949
}
5050
break;
@@ -65,7 +65,7 @@ public void run() {
6565
} else
6666
i++;
6767
} else {
68-
Log.i("RESULT", "SSID不是目标");
68+
Log.i("RESULT", "SSID不是目标,SSID是"+wifiInfo.getSSID());
6969
}
7070
}
7171
}

0 commit comments

Comments
 (0)