Java 类com.android.volley.extra.util.VolleyUtil 实例源码

项目:android-common-utils    文件:WeixinHelper.java   
private void getAccessToken(String unionKey,String code) {
   VolleyUtil.get(SdkConfig.URL_WEIXIN_ACCESS_TOKEN, new ApiParams()
                   .with("appid", SdkFactory.ShareConfig.sWeixin_app_Id)
                   .with("secret", SdkFactory.ShareConfig.sWeixin_app_secret)
                   .with("code", code)
                   .with("grant_type", "authorization_code"),
           this, new HttpCallbackImpl(unionKey) {
               @Override
               public void onResponse(String url, String response) {
                   final AccessTokenResult result = new JsonParser(response).parse(AccessTokenResult.class);
                   if(!result.isOk()){
                       WeixinHelper.this.callbackWithRequestFailed(getUnionKey(), url, response);
                   }else{
                        WeixinHelper.this.mAccessTokenResult = result;
                       // getUserInfo
                       getUserInfo(getUnionKey(), result);
                   }
               }
           }
   );
}
项目:android-common-utils    文件:WeixinHelper.java   
private void getUserInfo(String unionKey,final AccessTokenResult result2) {
    VolleyUtil.get(SdkConfig.URL_WEIXIN_USER_INFO, new ApiParams()
                    .with("access_token", result2.accessToken)
                    .with("openid", result2.openid)
            , this, new HttpCallbackImpl(unionKey) {
                @Override
                public void onResponse(String url, String response) {
                    final UserInfoResult result = new JsonParser(response).parse(UserInfoResult.class);
                    if (!result.isOk()) {
                        WeixinHelper.this.callbackWithRequestFailed(getUnionKey(), url, response);
                    } else {
                        if (!TextUtils.isEmpty(result.nickname)) {
                            try {
                                result.nickname = new String(result.nickname.getBytes("iso8859-1"), "utf-8");
                            } catch (UnsupportedEncodingException e) {
                                e.printStackTrace();
                            }
                        }
                        result.accessToken = result2.accessToken;
                        callbackWithUserInfo(getUnionKey(), result);
                    }
                }

            }
    );
}
项目:Adapter-CountDownTimer    文件:BaseActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mIntentExecutor = new IntentExecutor();
    mHttpExecutor = new VolleyUtil.HttpExecutor();
    mToaster = new Toaster(this);
    mViewHelper = new ViewHelper(getWindow().getDecorView());

    onPreSetContentView();
    setContentView(getlayoutId());
    ButterKnife.inject(this);

    initView();
    initData(savedInstanceState);
}
项目:android-drag-FlowLayout    文件:BaseActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mIntentExecutor = new IntentExecutor();
    mHttpExecutor = new VolleyUtil.HttpExecutor();
    mToaster = new Toaster(this);
    mViewHelper = new ViewHelper(getWindow().getDecorView());

    onPreSetContentView();
    setContentView(getlayoutId());
    ButterKnife.inject(this);

    initView();
    initData(savedInstanceState);
}
项目:android-common-util-light    文件:BaseActivity.java   
public VolleyUtil.HttpExecutor getHttpExecutor(){
    return mHttpExecutor;
}
项目:Adapter-CountDownTimer    文件:BaseActivity.java   
public VolleyUtil.HttpExecutor getHttpExecutor(){
    return mHttpExecutor;
}
项目:source-path-track    文件:BaseActivity.java   
public VolleyUtil.HttpExecutor getHttpExecutor(){
    return mHttpExecutor;
}
项目:android-drag-FlowLayout    文件:BaseActivity.java   
public VolleyUtil.HttpExecutor getHttpExecutor(){
    return mHttpExecutor;
}
项目:android-common-utils    文件:WeixinHelper.java   
@Override
public void reset() {
    mTaskManager.reset();
    VolleyUtil.cancelAll(this);
    mCallbackMap.clear();
}