use of org.mazhuang.guanggoo.data.entity.UserProfile in project guanggoo-android by mzlogin.
the class UserProfilePresenter method getUserProfile.
@Override
public void getUserProfile(String url) {
mView.startLoading();
NetworkTaskScheduler.getInstance().execute(new GetUserProfileTask(url, new OnResponseListener<UserProfile>() {
@Override
public void onSucceed(UserProfile data) {
mView.stopLoading();
mView.onGetUserProfileSucceed(data);
}
@Override
public void onFailed(String msg) {
mView.stopLoading();
mView.onGetUserProfileFailed(msg);
}
}));
}
use of org.mazhuang.guanggoo.data.entity.UserProfile in project guanggoo-android by mzlogin.
the class GetUserProfileTask method run.
@Override
public void run() {
Document doc;
try {
doc = get(mUrl);
} catch (IOException e) {
e.printStackTrace();
failedOnUI(e.getMessage());
return;
}
Elements userProfileElements = doc.select("div.user-page .profile");
if (userProfileElements.isEmpty()) {
failedOnUI("获取用户资料失败");
return;
}
Elements headerElements = userProfileElements.select("div.ui-header");
if (headerElements.isEmpty()) {
failedOnUI("获取用户资料失败");
return;
}
UserProfile profile = new UserProfile();
profile.setUrl(mUrl);
profile.setAvatar(headerElements.select("img.avatar").attr("src"));
profile.setUsername(headerElements.select("div.username").text());
profile.setNumber(headerElements.select("div.user-number .number").text());
profile.setSince(headerElements.select("div.user-number .since").text());
if (profile.isValid()) {
successOnUI(profile);
} else {
failedOnUI("获取用户资料出错");
}
}
Aggregations