Skip to content

Commit

Permalink
v2.5.1 release,修复了一些小问题
Browse files Browse the repository at this point in the history
1.修改账号信息后数据不能立即被更新
2.退出程序时可能会产生一次后台登陆
3.在主界面显示用户信息
  • Loading branch information
padeoe committed Jun 4, 2016
1 parent fa043d1 commit a867032
Show file tree
Hide file tree
Showing 49 changed files with 513 additions and 1,625 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NJUNet Android App
======================

NJUNet是一个用于安卓手机连接到NJU-WLAN后自动登陆p.nju.edu.cn的Android程序,代替手动打开浏览器登陆的繁琐操作,做到有NJU-WLAN的地方总是保持网络连接。
NJUNet是一个用于安卓手机连接到南大校园网(包括宿舍WiFi)后自动登陆p.nju.edu.cn的Android程序,代替手动打开浏览器登陆的繁琐操作,做到有NJU-WLAN的地方总是保持网络连接。

<h2>适用平台</h2>
Android 4.0+
Expand All @@ -22,15 +22,15 @@ Android 4.0+

<h2>功能说明</h2>
- 可手动进行登陆,下线,查看登陆数据(时长,余额等)
- 默认开启后台服务,将在连接上南大校园网WLAN时自动登陆
- 默认开启后台服务,将在连接上南大校园网WLAN(包括宿舍路由器无线网)时自动登陆
- 可以使用状态栏通知快捷登陆

<h2>下载</h2>
[<img src="http://developer.android.com/images/brand/en_generic_rgb_wo_60.png">](https://play.google.com/store/apps/details?id=com.padeoe.njunet)


[apk download](https://raw.githubusercontent.com/padeoe/AutoConnect/newUI/app/app-release.apk)
[apk-v2.5.1](https://raw.githubusercontent.com/padeoe/AutoConnect/newUI/app/app-release.apk)

<h2>更新日志</h2>

Expand Down
9 changes: 8 additions & 1 deletion UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
更新日志
=======
====
<h2>v2.5.1(2016年6月4日)</h2>
修复了一些小问题

- 修改账号信息后数据不能立即被更新
- 退出程序时可能会产生一次后台登陆
- 在主界面显示用户信息

<h2>v2.5(2016年6月1日)</h2>
- 更新了所有界面及风格
- 可以显示详单
Expand Down
Binary file modified app/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.padeoe.njunet"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "2.5"
versionCode 2
versionName "2.5.1"
}
buildTypes {
release {
Expand Down
17 changes: 12 additions & 5 deletions app/src/main/java/com/padeoe/bookplus/BookPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.padeoe.icroom.util.NetworkUtils;
import com.padeoe.utils.LoginException;

import java.io.IOException;
import java.util.HashMap;

/**
Expand All @@ -21,7 +22,7 @@ public class BookPlus {
* @param password <a href="http://book.njulib.cn/">南京大学图书馆Book+</a>的密码:初始密码是用户名
* @throws LoginException 登陆失败
*/
public BookPlus(String username, String password) throws LoginException {
public BookPlus(String username, String password) throws LoginException, IOException {
String[] returnInfo = login(username, password);
cookie = returnInfo[1];
}
Expand All @@ -43,7 +44,7 @@ public BookPlus(String cookie) {
* @return 一个长度为2的字符数组,第一个元素是服务器返回的数据,第二个是获取的cookie
* @throws LoginException 登陆失败
*/
public static String[] login(String username, String password) throws LoginException {
public static String[] login(String username, String password) throws LoginException, IOException {
double random = Math.random();
String url = "http://book.njulib.cn/smarty_lib/control/controller.php?control=control_log&action=user_login&user_id=" + username + "&user_pwd=" + password + "&rand=" + random;
String returnInfo[] = NetworkUtils.myPostAndGetCookie("control=control_log&action=user_login&user_id=" + username + "&user_pwd=" + password + "&rand=" + random, url, 2000);
Expand All @@ -61,7 +62,7 @@ public static String[] login(String username, String password) throws LoginExcep
*
* @return 服务器返回的包括姓名和性别的html文本
*/
public String showReaderInfo() {
public String showReaderInfo() throws IOException {
HashMap<String, String> attr = new HashMap<>();
attr.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
attr.put("Accept-Encoding", "gzip, deflate, sdch");
Expand All @@ -78,8 +79,14 @@ public String showReaderInfo() {
* @return 用户的性别,“男”或“女”
*/
public String showGender() {
String returnData = showReaderInfo();
return getGender(returnData);
String returnData = null;
try {
returnData = showReaderInfo();
return getGender(returnData);
} catch (IOException e) {
e.printStackTrace();
return "";
}
}

/**
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/com/padeoe/icroom/ICRoom.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.padeoe.icroom.util.NetworkUtils;
import com.padeoe.utils.LoginException;

import java.io.IOException;

/**
* 该类用于实现 <a href="http://114.212.7.24/ClientWeb/xcus/IC2/">南京大学IC空间管理系统</a> 的接口
* @author padeoe
Expand All @@ -18,7 +20,7 @@ public class ICRoom {
* @param username 用户名:学号/工号
* @param password <a href="http://114.212.7.24/ClientWeb/xcus/IC2/">南京大学IC空间管理系统</a>的密码:初始值是用户名
*/
public ICRoom(String username, String password) throws LoginException {
public ICRoom(String username, String password) throws LoginException, IOException {
String[] returnData = login(username, password);
cookie = returnData[1];
}
Expand All @@ -43,7 +45,7 @@ public ICRoom(String cookie) {
* @return 数组长度为2,第一个元素是服务器返回的原始数据,第二个元素是cookie
* @throws LoginException 登陆失败
*/
public static String[] login(String username, String password) throws LoginException {
public static String[] login(String username, String password) throws LoginException, IOException {
String returnInfo[] = NetworkUtils.myPostAndGetCookie("id=" + username + "&pwd=" + password + "&act=login", "http://114.212.7.24/ClientWeb/pro/ajax/login.aspx", 10000);
if (returnInfo == null || returnInfo[0] == null || returnInfo[0].startsWith("{\"ret\":0")) {
if (returnInfo != null &&returnInfo[0] != null)
Expand All @@ -60,7 +62,7 @@ public static String[] login(String username, String password) throws LoginExcep
* @param ID 用户名:学号/工号
* @return 服务器返回的用户信息字符串,非json格式,需要调用 {@link #parse(String)}方法处理成json格式
*/
public String queryStudentInfo(String ID) {
public String queryStudentInfo(String ID) throws IOException {
String time = String.valueOf(System.currentTimeMillis());
return NetworkUtils.mygetWithCookie("type=&&term=" + ID + "&_=" + time, "http://114.212.7.24/ClientWeb/pro/ajax/data/searchAccount.aspx?type=&&term=" + ID + "&_=" + time,
cookie, 20000);
Expand Down Expand Up @@ -95,7 +97,7 @@ public static String parse(String result){
* @param ID 用户名:学号/工号
* @return 用户信息的对象格式 {@link ICRoomUser}
*/
public ICRoomUser queryStudentInfo_Object(String ID){
public ICRoomUser queryStudentInfo_Object(String ID) throws IOException {
String result = queryStudentInfo(ID);
String newResult=parse(result);
return ICRoomUser.getFromJson(newResult);
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/padeoe/icroom/util/NetworkUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.padeoe.utils.network.MyHttpRequest;

import java.io.IOException;
import java.util.HashMap;

/**
Expand All @@ -10,15 +11,15 @@
* Date: 2016/3/7
*/
public class NetworkUtils {
public static String mygetWithCookie(String data,String URL,String cookie,int timeout){
public static String mygetWithCookie(String data,String URL,String cookie,int timeout) throws IOException {
HashMap<String,String> attr=new HashMap<>();
attr.put("Accept","application/json, text/javascript, */*; q=0.01");
attr.put("Referer", "http://114.212.7.24/ClientWeb/xcus/IC2/Default.aspx");
attr.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36");
attr.put("X-Requested-With", "XMLHttpRequest");
return MyHttpRequest.getWithCookie(data,URL,attr,cookie,"UTF-8", "UTF-8",timeout);
}
public static String[] myPostAndGetCookie(String data,String URL,int timeout){
public static String[] myPostAndGetCookie(String data,String URL,int timeout) throws IOException {
HashMap<String,String> attr=new HashMap<>();
attr.put("Accept","application/json, text/javascript, */*; q=0.01");
attr.put("Referer", "http://114.212.7.24/ClientWeb/xcus/IC2/Default.aspx");
Expand Down
42 changes: 0 additions & 42 deletions app/src/main/java/com/padeoe/nicservice/njuwlan/object/Acct.java

This file was deleted.

Loading

0 comments on commit a867032

Please sign in to comment.