• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResponseInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: uploadApply

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void uploadApply(final String certificate, final String name, final String position, final String introduction, final String investorsProjects){
    RequestParams params = new RequestParams();
    params.addHeader("authorization", loginData.getToken());
    params.addBodyParameter("certificate", certificate);
    params.addBodyParameter("name", name);
    params.addBodyParameter("position", position);
    params.addBodyParameter("introduction", introduction);
    params.addBodyParameter("investorsProjects", investorsProjects);

    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpMethod.POST, "http://116.62.228.37:8000/mine/investors", params, new RequestCallBack<String>() {
        @Override
        public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
            Toast.makeText(delegate.getActivity(), "已提交申请", Toast.LENGTH_SHORT).show();
            delegate.setStatus(3);
        }

        @Override
        public void onFailure(HttpException e, String s) {
            ToastUtil.showToast("uploadFiles failed", delegate.getActivity());
            Log.e("aaa", e.getMessage());
            Log.e("aaa", s);
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:26,代码来源:InvestorsPresenter.java


示例2: uploadphoto

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void uploadphoto(File file) {
    if (StringUtils.isNotEmpty(token)) {
        UpCompletionHandler handler = new UpCompletionHandler() {
            @Override
            public void complete(String key, ResponseInfo info, JSONObject res) {
                //res包含hash、key等信息,具体字段取决于上传策略的设置
                if (info.isOK()) {
                    Log.i("qiniu", "Upload Success");
                    try {
                        ImgPath = BuildConfig.QiniuBase+ res.getString("key");
                        delegate.setmImgAdd(ImgPath);

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                } else {
                    Log.i("qiniu", "Upload Fail");
                    //如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
                }
                Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
            }
        };
        QiniuUpload.getInstance().uploadFile(token, file, handler);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:27,代码来源:CreateActPresenter.java


示例3: upload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void upload(String uploadToken, File avatarFile) {
    if (this.uploadManager == null) {
        this.uploadManager = new UploadManager();
    }

    final String uploadFilKey = AppUtility.generateUUID();
    this.uploadManager.put(avatarFile, uploadFilKey, uploadToken, new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info, JSONObject response) {
            if (info.isOK()) {
                String fileKey = response.optString("key");
                otherLogin(fileKey); // 新用户登录
            }
        }
    }, null);
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:17,代码来源:BindActivity.java


示例4: updateAvatarToQiniu

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void updateAvatarToQiniu(File avatarFile) {
    UploadManager uploadManager = new UploadManager();
    // 指定七牛服务上的文件名
    final String genKey = AppUtility.generateUUID();
    Logger.d(genKey);
    String token = QiniuHelper.getUpToken();
    uploadManager.put(avatarFile, genKey, token,
            new UpCompletionHandler() {
                @Override
                public void complete(String key, ResponseInfo info, JSONObject res) {
                    //  res 包含hash、key等信息,具体字段取决于上传策略的设置。
                    Logger.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
                    updateAvatarKey(genKey);
                }
            }, null);
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:17,代码来源:PerfectDataActivity.java


示例5: upload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void upload(String uploadToken, final File avatarFile, final int type) {
    if (this.uploadManager == null) {
        this.uploadManager = new UploadManager();
    }
    String uploadFilKey = AppUtility.generateUUID();
    this.uploadManager.put(avatarFile, uploadFilKey, uploadToken, new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info, JSONObject response) {
            if (info.isOK()) {
                String fileKey = response.optString("key");
                Logger.d(fileKey);
                if (type == 0) {//修改头像
                    updateAvatarKey(fileKey, avatarFile);
                } else if (type == 1) {//修改背景墙
                    updateBackGroud(fileKey, avatarFile);
                }

            }
        }
    }, null);
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:MyUserFragment.java


示例6: upload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void upload(String uploadToken, File avatarFile) {
    if (this.uploadManager == null) {
        this.uploadManager = new UploadManager();
    }

    String uploadFilKey = AppUtility.generateUUID();
    this.uploadManager.put(avatarFile, uploadFilKey, uploadToken, new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info, JSONObject response) {
            if (info.isOK()) {
                String fileKey = response.optString("key");
                Logger.d(fileKey);
                updateAvatarKey(fileKey);
            }
        }
    }, null);
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:18,代码来源:EditUserDataActivity.java


示例7: imgUpload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
/**
 * 通过七牛上传文件
 */
private void imgUpload() {
    mViewModel.upLoad(new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info,
                             JSONObject response) {
            if (info.isOK()) {
                httpCoachInfo();
            } else {
                dismissProgressDialog();
                Logger.e("imgUpload", info.error);
                UIHelper.shortToast(info.error);
            }
        }
    });
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:19,代码来源:RecordActivity.java


示例8: imgUpload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
/**
 * 通过七牛上传图片
 */
private void imgUpload() {
    mViewModel.upLoad(new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info,
                             JSONObject response) {
            if (info.isOK()) {
                httpUserInfo();
            } else {
                dismissProgressDialog();
                Logger.e("imgUpload", info.error);
                UIHelper.shortToast(info.error);
            }
        }
    });
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:19,代码来源:AvatarActivity.java


示例9: imgUpload

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
/**
 * 通过七牛上传图片
 */
private void imgUpload() {
    mViewModel.upLoad(new UpCompletionHandler() {
        @Override
        public void complete(String key, ResponseInfo info,
                             JSONObject response) {
            if (info.isOK()) {
                httpCoachInfo();
            } else {
                dismissProgressDialog();
                Logger.e("imgUpload", info.error);
                UIHelper.shortToast(info.error);
            }
        }
    });
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:19,代码来源:QrCodeActivity.java


示例10: doInBackground

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
@Override
protected String doInBackground() {
    uploadManager.put(file, null, token,
            new UpCompletionHandler() {
                @Override
                public void complete(String key, ResponseInfo info, JSONObject response) {
                    try {
                        if (info.statusCode == 200) {
                            // 上传图片返回key值
                            callback.onSuccess(file, JsonUtils.getString("key", response));
                        } else {
                            callback.onError(info.statusCode);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        callback.onError(1);
                    }
                }
            }, null);
    return null;
}
 
开发者ID:huijimuhe,项目名称:Luban-Circle-Demo,代码行数:22,代码来源:QiniuUtils.java


示例11: uploadPortrait

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
/**
 * 上传头像
 */
private void uploadPortrait() {
	if(mKeyToken == null) {
		ToastUtils.showMessage(getApplicationContext(), R.string.set_portrait_fail);
		return;
	}
	UploadManager uploadManager = new UploadManager();
	File file = new File(Environment.getExternalStorageDirectory()
			+ "/" + IMAGE_FILE_NAME);
	uploadManager.put(file, mKeyToken.getKey(),
			mKeyToken.getToken(), new UpCompletionHandler() {
				@Override
				public void complete(String fileName, ResponseInfo responseInfo,
						JSONObject jsonObject) {
					mPortraitURL = Constants.UPLOADFILE_PRE + fileName;
					if (responseInfo.isOK()) {
						//上传成功,更新用户头像
						mUserService.setPortrait(mHandler, String.valueOf(App.currentUser.getId()), mPortraitURL);
					} else {
						ToastUtils.showMessage(getApplicationContext(),
								R.string.set_portrait_fail);
						ProgressDialogUtils.dismiss();
					}
				}
			}, null);
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:29,代码来源:CreateUserInfoActivity.java


示例12: ResumeUploader

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
ResumeUploader(Client client, Configuration config, File f, String key, UpToken token, final
UpCompletionHandler completionHandler, UploadOptions options, String recorderKey) {
    this.client = client;
    this.config = config;
    this.f = f;
    this.recorderKey = recorderKey;
    this.size = (int) f.length();
    this.key = key;
    this.headers = new StringMap().put("Authorization", "UpToken " + token.token);
    this.completionHandler = new UpCompletionHandler() {
        public void complete(String key, ResponseInfo info, JSONObject response) {
            if (ResumeUploader.this.file != null) {
                try {
                    ResumeUploader.this.file.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            completionHandler.complete(key, info, response);
        }
    };
    if (options == null) {
        options = UploadOptions.defaultOptions();
    }
    this.options = options;
    this.chunkBuffer = new byte[config.chunkSize];
    this.contexts = new String[((int) ((long) (((this.size + Configuration.BLOCK_SIZE) - 1) /
            Configuration.BLOCK_SIZE)))];
    this.modifyTime = f.lastModified();
    this.token = token;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:32,代码来源:ResumeUploader.java


示例13: run

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void run() {
    int offset = recoveryFromRecord();
    try {
        this.file = new RandomAccessFile(this.f, "r");
        nextTask(offset, 0, this.config.up.address);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        this.completionHandler.complete(this.key, ResponseInfo.fileError(e), null);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ResumeUploader.java


示例14: makeBlock

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void makeBlock(URI address, int offset, int blockSize, int chunkSize, ProgressHandler
        progress, CompletionHandler _completionHandler, UpCancellationSignal c) {
    String path = String.format(Locale.ENGLISH, "/mkblk/%d", new Object[]{Integer.valueOf
            (blockSize)});
    try {
        this.file.seek((long) offset);
        this.file.read(this.chunkBuffer, 0, chunkSize);
        this.crc32 = Crc32.bytes(this.chunkBuffer, 0, chunkSize);
        post(newURI(address, path), this.chunkBuffer, 0, chunkSize, progress,
                _completionHandler, c);
    } catch (IOException e) {
        this.completionHandler.complete(this.key, ResponseInfo.fileError(e), null);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:ResumeUploader.java


示例15: putChunk

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
private void putChunk(URI address, int offset, int chunkSize, String context, ProgressHandler
        progress, CompletionHandler _completionHandler, UpCancellationSignal c) {
    int chunkOffset = offset % Configuration.BLOCK_SIZE;
    String path = String.format(Locale.ENGLISH, "/bput/%s/%d", new Object[]{context, Integer
            .valueOf(chunkOffset)});
    try {
        this.file.seek((long) offset);
        this.file.read(this.chunkBuffer, 0, chunkSize);
        this.crc32 = Crc32.bytes(this.chunkBuffer, 0, chunkSize);
        post(newURI(address, path), this.chunkBuffer, 0, chunkSize, progress,
                _completionHandler, c);
    } catch (IOException e) {
        this.completionHandler.complete(this.key, ResponseInfo.fileError(e), null);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:ResumeUploader.java


示例16:

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
UploadManager$4(UploadManager this$0, UpCompletionHandler upCompletionHandler, String str,
                ResponseInfo responseInfo) {
    this.this$0 = this$0;
    this.val$completionHandler = upCompletionHandler;
    this.val$key = str;
    this.val$info = responseInfo;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:UploadManager$4.java


示例17:

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
UploadManager$2(UploadManager this$0, UpCompletionHandler upCompletionHandler, String str,
                ResponseInfo responseInfo) {
    this.this$0 = this$0;
    this.val$completionHandler = upCompletionHandler;
    this.val$key = str;
    this.val$info = responseInfo;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:UploadManager$2.java


示例18: uploadphoto

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void uploadphoto(File file) {
    if (StringUtils.isNotEmpty(token)) {
        UpCompletionHandler handler = new UpCompletionHandler() {
            @Override
            public void complete(String key, ResponseInfo info, JSONObject res) {
                //res包含hash、key等信息,具体字段取决于上传策略的设置
                if (info.isOK()) {
                    Log.i("qiniu", "Upload Success");
                    try {
                        String photoName = res.getString("key");
                        ArrayList<String> data = new ArrayList<>();
                        data.add(BuildConfig.QiniuBase + photoName);
                        delegate.setData(data);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                } else {
                    Log.i("qiniu", "Upload Fail");
                    //如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
                }
                Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
            }
        };
        QiniuUpload.getInstance().uploadFile(token, file, handler);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:28,代码来源:ReleaseDynPresenter.java


示例19: uploadphoto

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void uploadphoto(File file) {
        if (StringUtils.isNotEmpty(token)) {
            UpCompletionHandler handler = new UpCompletionHandler() {
                @Override
                public void complete(String key, ResponseInfo info, JSONObject res) {
                    //res包含hash、key等信息,具体字段取决于上传策略的设置
                    if (info.isOK()) {
                        Log.i("qiniu", "Upload Success");
                        try {
                            String photoName = res.getString("key");
//                            ArrayList<String> data = new ArrayList<>();
//                            data.add(photoName);
                            PicPath = BuildConfig.QiniuBase+photoName;
                            delegate.setmImgPic(photoName);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    } else {
                        Log.i("qiniu", "Upload Fail");
                        //如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
                    }
                    Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
                }
            };
            QiniuUpload.getInstance().uploadFile(token, file, handler);
        }
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:29,代码来源:CircleInfoPresenter.java


示例20: uploadPhoto

import com.qiniu.android.http.ResponseInfo; //导入依赖的package包/类
public void uploadPhoto(File file, final int type) {
        if (StringUtils.isNotEmpty(token)) {
            UpCompletionHandler handler = new UpCompletionHandler() {
                @Override
                public void complete(String key, ResponseInfo info, JSONObject res) {
                    //res包含hash、key等信息,具体字段取决于上传策略的设置
                    if (info.isOK()) {
                        Log.i("qiniu", "Upload Success");
                        try {
                            if (type == 0) {
                                ImgPath = BuildConfig.QiniuBase + res.getString("key");
                                delegate.setImgAdd(ImgPath);

                            } else if (type == 1) {
                                pics.add(BuildConfig.QiniuBase + res.getString("key"));
                                delegate.setData(pics);
                            }
//                            } else if (type == 1) {
//                                pics.add(BuildConfig.QiniuBase + res.getString("key"));
//                                delegate.setData(pics);
//                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    } else {
                        Log.i("qiniu", "Upload Fail");
                        //如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
                    }
                    Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
                }
            };
            QiniuUpload.getInstance().uploadFile(token, file, handler);
        }
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:37,代码来源:ProjectCreatePresenter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransactionManager类代码示例发布时间:2022-05-21
下一篇:
Java InnerFoo类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap