當前位置: 首頁>>代碼示例>>Java>>正文


Java AsyncHttpResponseHandler類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:TheUberCatman,項目名稱:crates-io-android,代碼行數:24,代碼來源:Utility.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:31,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:29,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:28,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:26,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:22,代碼來源:OSChinaApi.java

示例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);
}
 
開發者ID:wepay,項目名稱:wecrowd-android,代碼行數:23,代碼來源:APIClient.java

示例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);
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:10,代碼來源:Graph.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:13,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:19,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:24,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:26,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:19,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:20,代碼來源:OSChinaTeamApi.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:13,代碼來源:OSChinaTeamApi.java


注:本文中的com.loopj.android.http.AsyncHttpResponseHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。