RetrofitUtils

Introduction: 对 Retrofit 的简单封装:设置缓存、公共参数、添加 headers、自定义响应体和统一的 callback;
More: Author   ReportBugs   
Tags:
网络请求-测试版-

请求:

     RetrofitUtils.getInstance(this)
                    .create(ApiService.class)
                    .addPara(2, 20)
                    .enqueue(new BaseCallback<BaseModel<TestModel>>() {

                        @Override
                        protected void onAfter() {
                            dismissProgress();
                        }

                        @Override
                        protected void onSuccess(BaseModel<TestModel> response) {

                            tvResult.setText("status:" + response.isStatus() + "\n" + response.getData().get(0).getDescription());
                        }

                        @Override
                        protected void onNoData(String msg) {
                            showToast(msg);
                        }

                        @Override
                        protected void onFail(String msg) {
                            showToast(msg);
                        }
                    });
Support Me
Apps
About Me
Google+: Trinea trinea
GitHub: Trinea