当前位置: 首页>>代码示例>>Java>>正文


Java ResultCallback类代码示例

本文整理汇总了Java中com.zhy.http.okhttp.callback.ResultCallback的典型用法代码示例。如果您正苦于以下问题:Java ResultCallback类的具体用法?Java ResultCallback怎么用?Java ResultCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResultCallback类属于com.zhy.http.okhttp.callback包,在下文中一共展示了ResultCallback类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public OkHttpRequest get(ResultCallback callback)
{
    if (params!=null) {
        if (url.endsWith("/")) url=url.substring(0,url.length()-1);
        url+="?";
        //拼get url
        for (Map.Entry<String, String> entry : params.entrySet()) {
            String key=entry.getKey();
            String value= entry.getValue();
            url=url+key+"="+value+"&";
        }
        url=url.substring(0,url.length()-1);
    }
    OkHttpRequest request = new OkHttpGetRequest(url, tag, params, headers);
    request.invokeAsyn(callback);
    return request;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:18,代码来源:OkHttpRequest.java

示例2: wrapRequestBody

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
@Override
protected RequestBody wrapRequestBody(RequestBody requestBody, final ResultCallback callback)
{
    CountingRequestBody countingRequestBody = new CountingRequestBody(requestBody, new CountingRequestBody.Listener()
    {
        @Override
        public void onRequestProgress(final long bytesWritten, final long contentLength)
        {

            mOkHttpClientManager.getDelivery().post(new Runnable()
            {
                @Override
                public void run()
                {
                    callback.inProgress(bytesWritten * 1.0f / contentLength);
                }
            });

        }
    });
    return countingRequestBody;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:23,代码来源:OkHttpPostRequest.java

示例3: AVGet

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
/**
 * AV get请求
 *
 * @param clazz
 * @param lastTime
 * @param callback
 */
public static void AVGet(String clazz, String lastTime, ResultCallback callback) {
    String url = BASE_URL + clazz + "?limit=10&&order=-createAt";
    if (!TextUtils.isEmpty(lastTime)) {
        url += "&&where={\"createdAt\":{\"$lt\":{\"__type\":\"Date\",\"iso\":\"" + lastTime + "\"}}}";
    }
    String time = String.valueOf(System.currentTimeMillis());
    String sign = EncodeUtil.md5(time + Global.AV_APP_KEY) + "," + time;
    new OkHttpRequest.Builder()
            .addHeader("Content-Type", "application/json")
            .addHeader("X-LC-Sign", sign)
            .addHeader("X-LC-Id", Global.AV_APP_ID)
            .url(url)
            .get(callback);
}
 
开发者ID:pengwei1024,项目名称:AndroidGeek,代码行数:22,代码来源:AVQuery.java

示例4: sendFailResultCallback

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public void sendFailResultCallback(final Request request, final Exception e, final ResultCallback callback)
{
    if (callback == null) return;

    mDelivery.post(new Runnable()
    {
        @Override
        public void run()
        {
            callback.onError(request, e);
            callback.onAfter();
        }
    });
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:15,代码来源:OkHttpClientManager.java

示例5: sendSuccessResultCallback

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public void sendSuccessResultCallback(final Object object, final ResultCallback callback)
{
    if (callback == null) return;
    mDelivery.post(new Runnable()
    {
        @Override
        public void run()
        {
            callback.onResponse(object);
            callback.onAfter();
        }
    });
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:14,代码来源:OkHttpClientManager.java

示例6: prepareInvoked

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
protected void prepareInvoked(ResultCallback callback)
{
    requestBody = buildRequestBody();
    requestBody = wrapRequestBody(requestBody, callback);
    request = buildRequest();
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:7,代码来源:OkHttpRequest.java

示例7: invokeAsyn

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public void invokeAsyn(ResultCallback callback)
{
    prepareInvoked(callback);
    mOkHttpClientManager.execute(request, callback);
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:6,代码来源:OkHttpRequest.java

示例8: wrapRequestBody

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
protected RequestBody wrapRequestBody(RequestBody requestBody, final ResultCallback callback)
{
    return requestBody;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:5,代码来源:OkHttpRequest.java

示例9: post

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public OkHttpRequest post(ResultCallback callback)
{
    OkHttpRequest request = new OkHttpPostRequest(url, tag, params, headers, mediaType, content, bytes, file);
    request.invokeAsyn(callback);
    return request;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:7,代码来源:OkHttpRequest.java

示例10: upload

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public OkHttpRequest upload(ResultCallback callback)
{
    OkHttpRequest request = new OkHttpUploadRequest(url, tag, params, headers, files);
    request.invokeAsyn(callback);
    return request;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:7,代码来源:OkHttpRequest.java

示例11: download

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public OkHttpRequest download(ResultCallback callback)
{
    OkHttpRequest request = new OkHttpDownloadRequest(url, tag, params, headers, destFileName, destFileDir);
    request.invokeAsyn(callback);
    return request;
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:7,代码来源:OkHttpRequest.java

示例12: displayImage

import com.zhy.http.okhttp.callback.ResultCallback; //导入依赖的package包/类
public void displayImage(ResultCallback callback)
{
    OkHttpRequest request = new OkHttpDisplayImgRequest(url, tag, params, headers, imageView, errorResId);
    request.invokeAsyn(callback);
}
 
开发者ID:djun100,项目名称:okhttp-utils,代码行数:6,代码来源:OkHttpRequest.java


注:本文中的com.zhy.http.okhttp.callback.ResultCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。