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


Java DoneCallback类代码示例

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


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

示例1: onGoogleButtonClick

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onGoogleButtonClick() {
    final String profilePictureEndpoint = "https://www.googleapis.com/plus/v1/people/me";
    final String authUrl = "https://accounts.google.com/o/oauth2/auth";
    final String appClientId = "60734886159-99bmoevf41sott6sa2cijltc85orhc18.apps.googleusercontent.com";
    final String scope = "https://www.googleapis.com/auth/plus.login";
    requestor.req(profilePictureEndpoint)
            .auth(new OAuth2ByHeader(authUrl, appClientId, scope))
            .get(JavaScriptObject.class)
            .done(new DoneCallback<JavaScriptObject>() {
                @Override
                public void onDone(JavaScriptObject result) {
                    final JavaScriptObject image = Overlays.getObject(result, "image");
                    final String imageUrl = Overlays.getString(image, "url");
                    view.addImage(imageUrl);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:19,代码来源:AuthActivity.java

示例2: onFacebookButtonClick

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onFacebookButtonClick() {
    final String profilePictureEndpoint = "https://graph.facebook.com/v2.3/me/picture?redirect=false";
    final String authUrl = "https://www.facebook.com/dialog/oauth";
    final String appClientId = "366496696889929";
    final String scope = "public_profile";
    requestor.req(profilePictureEndpoint)
            .auth(new OAuth2ByQueryParam(authUrl, appClientId, scope))
            .get(JavaScriptObject.class)
            .done(new DoneCallback<JavaScriptObject>() {
                @Override
                public void onDone(JavaScriptObject result) {
                    final JavaScriptObject data = Overlays.getObject(result, "data");
                    final String imageUrl = Overlays.getString(data, "url");
                    view.addImage(imageUrl);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:19,代码来源:AuthActivity.java

示例3: onWindowsButtonClick

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onWindowsButtonClick() {
    final String profilePictureEndpoint = "https://apis.live.net/v5.0/me";
    final String authUrl = "https://login.live.com/oauth20_authorize.srf";
    final String appClientId = "000000004015498F";
    final String scope = "wl.basic";
    requestor.req(profilePictureEndpoint)
            .auth(new OAuth2ByQueryParam(authUrl, appClientId, scope))
            .get(JavaScriptObject.class)
            .done(new DoneCallback<JavaScriptObject>() {
                @Override
                public void onDone(JavaScriptObject result) {
                    final String userId = Overlays.getObject(result, "id");
                    final String imageUrl = "https://apis.live.net/v5.0/" + userId + "/picture";
                    view.addImage(imageUrl);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:19,代码来源:AuthActivity.java

示例4: then

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public Promise<D, F, P> then(DoneCallback<D> doneCallback, FailCallback<F> failCallback,
                             ProgressCallback<P> progressCallback) {
    done(doneCallback);
    fail(failCallback);
    progress(progressCallback);
    return this;
}
 
开发者ID:reinert,项目名称:gdeferred,代码行数:9,代码来源:AbstractPromise.java

示例5: triggerDone

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
protected void triggerDone(D resolved) {
    for (DoneCallback<D> callback : doneCallbacks) {
        try {
            triggerDone(callback, resolved);
        } catch (Exception e) {
            log.log(Level.SEVERE, "An uncaught exception occurred in a DoneCallback", e);
        }
    }
}
 
开发者ID:reinert,项目名称:gdeferred,代码行数:10,代码来源:AbstractPromise.java

示例6: onXmlObjectGet

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlObjectGet() {
    requestor.req("http://www.mocky.io/v2/54aa8cf807b5f2bc0f21ba08")
            .get(MyObject.class)
            .done(new DoneCallback<MyObject>() {
                @Override
                public void onDone(MyObject result) {
                    view.setSingleXmlGetText(result.toString());
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:12,代码来源:SerializationActivity.java

示例7: onXmlObjectPost

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlObjectPost() {
    requestor.req("http://httpbin.org/post")
            .contentType("application/xml")
            .payload(new MyObject("Lorem", 1900, new Date(1420416000000L)))
            .post(String.class)
            .done(new DoneCallback<String>() {
                @Override
                public void onDone(String result) {
                    view.setSingleXmlPostText(result);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:14,代码来源:SerializationActivity.java

示例8: onXmlCollectionPost

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onXmlCollectionPost() {
    requestor.req("http://httpbin.org/post")
            .contentType("application/xml")
            .payload(Arrays.asList(
                    new MyObject("Lorem", 1900, new Date(1420416000000L)),
                    new MyObject("Ipsum", 210, new Date(1420070400000L))))
            .post(String.class)
            .done(new DoneCallback<String>() {
                @Override
                public void onDone(String result) {
                    view.setCollectionXmlPostText(result);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:16,代码来源:SerializationActivity.java

示例9: onJsonObjectGet

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonObjectGet() {
        requestor.req("http://www.mocky.io/v2/54aa93c307b5f2671021ba0c")
                .get(MyObject.class)
                .done(new DoneCallback<MyObject>() {
                    @Override
                    public void onDone(MyObject result) {
                        view.setSingleJsonGetText(result.toString());
                    }
                });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:12,代码来源:SerializationActivity.java

示例10: onJsonObjectPost

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonObjectPost() {
    requestor.req("http://httpbin.org/post")
            .contentType("application/json")
            .payload(new MyObject("Lorem", 1900, new Date(1420416000000L)))
            .post(String.class)
            .done(new DoneCallback<String>() {
                @Override
                public void onDone(String result) {
                    view.setSingleJsonPostText(result);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:14,代码来源:SerializationActivity.java

示例11: onJsonCollectionPost

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onJsonCollectionPost() {
    requestor.req("http://httpbin.org/post")
            .contentType("application/json")
            .payload(Arrays.asList(
                    new MyObject("Lorem", 1900, new Date(1420416000000L)),
                    new MyObject("Ipsum", 210, new Date(1420070400000L))))
            .post(String.class)
            .done(new DoneCallback<String>() {
                @Override
                public void onDone(String result) {
                    view.setCollectionJsonPostText(result);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:16,代码来源:SerializationActivity.java

示例12: onCustomButtonClick

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public void onCustomButtonClick(String key) {
    requestor.req("http://httpbin.org/headers")
            .auth(new MyAuth(key))
            .get(String.class)
            .done(new DoneCallback<String>() {
                @Override
                public void onDone(String result) {
                    view.setCustomText(result);
                }
            });
}
 
开发者ID:reinert,项目名称:requestor,代码行数:13,代码来源:AuthActivity.java

示例13: done

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
@Override
public Promise<D, F, P> done(DoneCallback<D> callback) {
    doneCallbacks.add(callback);
    if (isResolved()) triggerDone(callback, resolveResult);
    return this;
}
 
开发者ID:reinert,项目名称:gdeferred,代码行数:7,代码来源:AbstractPromise.java

示例14: getDoneCallbacks

import io.reinert.gdeferred.DoneCallback; //导入依赖的package包/类
protected List<DoneCallback<D>> getDoneCallbacks() {
    return doneCallbacks;
}
 
开发者ID:reinert,项目名称:gdeferred,代码行数:4,代码来源:AbstractPromise.java


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