Skip to content

Commit

Permalink
提高BaseHttpXXX处理结果的灵活性,支持List
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Jan 6, 2018
1 parent e09985e commit a66d966
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void run() {
});
}

/**
/**处理Http请求结果
* @param requestCode = -page {@link #getListAsync(int)}
* @param resultJson
* @param e
Expand All @@ -187,17 +187,25 @@ public void run() {
} else {
page = - requestCode;
}
List<T> array = parseArray(resultJson);

if ((array == null || array.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, array);
}
onResponse(page, parseArray(resultJson), e);
}
});
}

/**处理结果
* @param page
* @param list
* @param e
*/
public void onResponse(int page, List<T> list, Exception e) {
if ((list == null || list.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, list);
}
}


// 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void run() {
});
}

/**
/**处理Http请求结果
* @param requestCode = -page {@link #getListAsync(int)}
* @param resultJson
* @param e
Expand All @@ -207,17 +207,25 @@ public void run() {
} else {
page = - requestCode;
}
List<T> array = parseArray(resultJson);

if ((array == null || array.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, array);
}
onResponse(page, parseArray(resultJson), e);
}
});
}

/**处理结果
* @param page
* @param list
* @param e
*/
public void onResponse(int page, List<T> list, Exception e) {
if ((list == null || list.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, list);
}
}


// 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void run() {
});
}

/**
/**处理Http请求结果
* @param requestCode = -page {@link #getListAsync(int)}
* @param resultJson
* @param e
Expand All @@ -211,17 +211,24 @@ public void run() {
} else {
page = - requestCode;
}
List<T> array = parseArray(resultJson);

if ((array == null || array.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, array);
}
onResponse(page, parseArray(resultJson), e);
}
});
}

/**处理结果
* @param page
* @param list
* @param e
*/
public void onResponse(int page, List<T> list, Exception e) {
if ((list == null || list.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, list);
}
}


// 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void run() {
});
}

/**
/**处理Http请求结果
* @param requestCode = -page {@link #getListAsync(int)}
* @param resultJson
* @param e
Expand All @@ -229,17 +229,24 @@ public void run() {
} else {
page = - requestCode;
}
List<T> array = parseArray(resultJson);

if ((array == null || array.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, array);
}
onResponse(page, parseArray(resultJson), e);
}
});
}

/**处理结果
* @param page
* @param list
* @param e
*/
public void onResponse(int page, List<T> list, Exception e) {
if ((list == null || list.isEmpty()) && e != null) {
onLoadFailed(page, e);
} else {
onLoadSucceed(page, list);
}
}


// 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand Down

0 comments on commit a66d966

Please sign in to comment.