本文整理汇总了Java中com.loopj.android.http.AsyncHttpResponseHandler类的典型用法代码示例。如果您正苦于以下问题:Java AsyncHttpResponseHandler类的具体用法?Java AsyncHttpResponseHandler怎么用?Java AsyncHttpResponseHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsyncHttpResponseHandler类属于com.loopj.android.http包,在下文中一共展示了AsyncHttpResponseHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSSL
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
public static void getSSL(String url, AsyncHttpResponseHandler responseHandler) {
try {
URL page = new URL(url); // Process the URL far enough to find the right handler
HttpURLConnection urlConnection = (HttpURLConnection) page.openConnection();
String token = Utility.loadData("token", String.class);
if (token != null) {
urlConnection.setRequestProperty("Authorization", token);
}
urlConnection.setUseCaches(false); // Don't look at possibly cached data
// Read it all and print it out
InputStream stream = urlConnection.getInputStream();
byte[] bytes = IOUtils.toByteArray(stream);
int code = urlConnection.getResponseCode();
if (code >= 200 && code < 400) {
responseHandler.sendSuccessMessage(code, null, bytes);
} else {
responseHandler.sendFailureMessage(code, null, bytes, new IOException());
}
} catch (IOException e) {
e.printStackTrace();
responseHandler.sendFailureMessage(0, null, new byte[1], e);
}
}
示例2: getTeamIssueList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/**
* 获取指定任务列表的任务列表
*
* @param teamId
* @param projectId 项目id(-1获取非项目任务列表, 0获取所有任务列表)
* @param catalogId 任务列表的的目录id
* @param source "[email protected]"(default),"[email protected]","GitHub",如果指定了projectid的值,
* 这个值就是必须的
* @param uid 如果指定该值,则获取该id用户相关的任务
* @param state "all"(default),"opened","closed","outdate"
* @param scope "tome"(default,指派给我的任务),"meto"(我指派的任务)
* @param pageIndex
* @param pageSize
* @param handler
*/
public static void getTeamIssueList(int teamId, int projectId,
int catalogId, String source, int uid, String state, String scope,
int pageIndex, int pageSize, AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("projectid", projectId);
params.put("catalogid", catalogId);
params.put("source", source);
params.put("uid", uid);
params.put("state", state);
params.put("scope", scope);
params.put("pageIndex", pageIndex);
params.put("pageSize", pageSize);
ApiHttpClient.get("action/api/team_issue_list", params, handler);
}
示例3: changeIssueState
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 改变一个任务的状态
*
* @param teamId
* @param issue
* @param target 修改的属性("state" : 状态, "assignee" 指派人, "deadline" : 截止日期)
* @param handler
* @return void
* @author 火蚁 2015-3-6 上午11:44:01
*/
public static void changeIssueState(int teamId, TeamIssue issue,
String target, AsyncHttpResponseHandler handler, Context context) {
if (issue == null)
return;
RequestParams params = new RequestParams();
params.put("uid", AccountHelper.getUserId());
params.put("teamid", teamId);
params.put("target", target);
params.put("issueid", issue.getId());
if (target.equals("state")) {
params.put("state", issue.getState());
} else if (target.equals("assignee")) {
params.put("assignee", issue.getToUser().getId());
} else if (target.equals("deadline")) {
params.put("deadline", issue.getDeadlineTime());
}
ApiHttpClient.post("action/api/team_issue_update", params, handler);
}
示例4: pubTeamNewActive
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 发表一个新的团队动态
*
* @param teamId
* @param content
* @param img
* @param handler
* @return void
* @author 火蚁 2015-3-9 下午2:46:13
*/
public static void pubTeamNewActive(int teamId, String content, File img,
AsyncHttpResponseHandler handler, Context context) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("uid", AccountHelper.getUserId());
params.put("msg", content);
params.put("appid", 3);
if (img != null) {
try {
params.put("img", img);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
ApiHttpClient.post("action/api/team_tweet_pub", params, handler);
}
示例5: updateChildIssue
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 更新子任务属性
*
* @param teamId
* @param target
* @param childIssue
* @param handler
* @return void
* @author 火蚁 2015-3-10 下午4:53:49
*/
public static void updateChildIssue(int teamId, String target,
TeamIssue childIssue, AsyncHttpResponseHandler handler, Context context) {
RequestParams params = new RequestParams();
params.put("uid", AccountHelper.getUserId());
params.put("teamid", teamId);
params.put("childissueid", childIssue.getId());
params.put("target", target);
if (target.equals("state")) {
params.put("state", childIssue.getState());
} else {
params.put("title", childIssue.getTitle());
}
ApiHttpClient.post("action/api/team_issue_update_child_issue", params,
handler);
}
示例6: eventApply
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/**
* 活动报名
*
* @param data
* @param handler
*/
@Deprecated
public static void eventApply(EventApplyData data, AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("event", data.getEvent());
params.put("user", data.getUser());
params.put("name", data.getName());
params.put("gender", data.getGender());
params.put("mobile", data.getPhone());
params.put("company", data.getCompany());
params.put("job", data.getJob());
if (!StringUtils.isEmpty(data.getRemark())) {
params.put("misc_info", data.getRemark());
}
post("action/api/event_apply", params, handler);
}
示例7: post
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
public static void post(Context context,
String url,
Map<String, Object> params,
AsyncHttpResponseHandler responseHandler)
{
String contentType;
JSONObject jsonParams;
StringEntity entity = null;
contentType = "application/json";
jsonParams = new JSONObject(params);
try {
entity = new StringEntity(jsonParams.toString());
} catch (UnsupportedEncodingException e) {
// Do nothing, let the library throw an error
}
client.setUserAgent(USER_AGENT);
client.post(context, getAbsoluteUrl(url), entity, contentType, responseHandler);
}
示例8: refreshTokens
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
public static RequestHandle refreshTokens(Context context, String scopes, AsyncHttpResponseHandler handler) {
SyncHttpClient client = new SyncHttpClient();
RequestParams params = new RequestParams();
params.put("client_id", context.getString(R.string.facebook_app_id));
params.put("redirect_uri", "https://www.facebook.com/connect/login_success.html");
params.put("response_type", "token");
params.put("scopes", scopes);
return client.get("https://www.facebook.com/v2.9/dialog/oauth", params, handler);
}
示例9: getTeamProjectList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/**
* 获取团队项目列表
*
* @param teamId
* @param handler
*/
public static void getTeamProjectList(int teamId,
AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
ApiHttpClient.get("action/api/team_project_list", params, handler);
}
示例10: getTeamCommentList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/**
* 获取team动态列表
*
* @param teamId
* @param activeId
* @param pageIndex
* @param handler
*/
public static void getTeamCommentList(int teamId, int activeId,
int pageIndex, AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("id", activeId);
params.put("pageIndex", pageIndex);
params.put("pageSize", 20);
ApiHttpClient.get("action/api/team_reply_list_by_activeid", params,
handler);
}
示例11: getTeamProjectMemberList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 获取团队绑定项目的成员列表(包括管理员以及开发者)
*
* @param teamId
* @param teamProject
* @param handler
* @return void
* @author 火蚁 2015-2-5 下午6:45:41
*/
public static void getTeamProjectMemberList(int teamId,
TeamProject teamProject, AsyncHttpResponseHandler handler, Context context) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("uid", AccountHelper.getUserId());
params.put("projectid", teamProject.getGit().getId());
String source = teamProject.getSource();
if (source != null && !TextUtils.isEmpty(source)) {
params.put("source", teamProject.getSource());
}
ApiHttpClient.get("action/api/team_project_member_list", params,
handler);
}
示例12: getTeamProjectActiveList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 获取项目的动态列表
*
* @param teamId
* @param project
* @param type "all"(default),"issue","code","other"
* @param page
* @param handler
* @return void
* @author 火蚁 2015-3-2 下午5:18:54
*/
public static void getTeamProjectActiveList(int teamId,
TeamProject project, String type, int page,
AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("projectid", project.getGit().getId());
if (!TextUtils.isEmpty(project.getSource())) {
params.put("source", project.getSource());
}
params.put("type", type);
params.put("pageIndex", page);
ApiHttpClient.get("action/api/team_project_active_list", params,
handler);
}
示例13: getTeamCatalogIssueList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/**
* 获取某项目的任务列表
*
* @param uId 用户id
* @param teamId 团队id
* @param projectId 项目id(当<=0或不设置时,查询非项目的任务列表)
* @param source "[email protected]","GitHub"(只有设置了projectid值,这里才需要设置该值)
*/
public static void getTeamCatalogIssueList(int uId, int teamId,
int projectId, String source, AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("uid", uId);
params.put("teamid", teamId);
params.put("projectid", projectId);
params.put("source", source);
ApiHttpClient.get("action/api/team_project_catalog_list", params,
handler);
}
示例14: getTeamDiscussList
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 获取团队的讨论区列表
*
* @param type
* @param teamId
* @param uid
* @param pageIndex
* @param handler
*/
public static void getTeamDiscussList(String type, int teamId, int uid,
int pageIndex, AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("type", type);
params.put("teamid", teamId);
params.put("uid", uid);
params.put("pageIndex", pageIndex);
params.put("pageSize", AppContext.PAGE_SIZE);
ApiHttpClient.get("action/api/team_discuss_list", params, handler);
}
示例15: getTeamIssueDetail
import com.loopj.android.http.AsyncHttpResponseHandler; //导入依赖的package包/类
/***
* 获取团队任务详情
*
* @author 火蚁 2015-1-27 下午7:47:17
*/
public static void getTeamIssueDetail(int teamId, int issueId,
AsyncHttpResponseHandler handler) {
RequestParams params = new RequestParams();
params.put("teamid", teamId);
params.put("issueid", issueId);
ApiHttpClient.get("action/api/team_issue_detail", params, handler);
}