Java Code Examples for com.example.retrofit.entity.api.SubjectPostApi#setAll()
The following examples show how to use
com.example.retrofit.entity.api.SubjectPostApi#setAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From RxjavaRetrofitDemo-master with MIT License | 5 votes |
/*************************************************封装完请求*******************************************************/ // 完美封装简化版 private void simpleDo() { SubjectPostApi postEntity = new SubjectPostApi(simpleOnNextListener, this); postEntity.setAll(true); HttpManager manager = HttpManager.getInstance(); manager.doHttpDeal(postEntity); }
Example 2
Source File: MainActivity.java From Rx-Retrofit with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvMsg = (TextView) findViewById(R.id.tv_msg); findViewById(R.id.btn_rx).setOnClickListener(this); findViewById(R.id.btn_rx_mu_down).setOnClickListener(this); findViewById(R.id.btn_rx_uploade).setOnClickListener(this); img = (ImageView) findViewById(R.id.img); progressBar = (NumberProgressBar) findViewById(R.id.number_progress_bar); /*初始化数据*/ manager = new HttpManager(this, this); postEntity = new SubjectPostApi(); postEntity.setAll(true); /*上传接口内部接口有token验证,所以需要换成自己的接口测试,检查file文件是否手机存在*/ uplaodApi = new UploadApi(); File file = new File("/storage/emulated/0/Download/11.jpg"); RequestBody requestBody = RequestBody.create(MediaType.parse("image/jpeg"), file); MultipartBody.Part part = MultipartBody.Part.createFormData("file_name", file.getName(), new ProgressRequestBody (requestBody, new UploadProgressListener() { @Override public void onProgress(long currentBytesCount, long totalBytesCount) { tvMsg.setText("提示:上传中"); progressBar.setMax((int) totalBytesCount); progressBar.setProgress((int) currentBytesCount); } })); uplaodApi.setPart(part); }
Example 3
Source File: MainActivity.java From Rx-Retrofit with MIT License | 5 votes |
private void simpleDo() { /*初始化数据*/ manager = new HttpManager(this, this); postEntity = new SubjectPostApi(); postEntity.setAll(true); manager.doHttpDeal(postEntity); }
Example 4
Source File: MainActivity.java From RxjavaRetrofitDemo-string-master with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvMsg = (TextView) findViewById(R.id.tv_msg); findViewById(R.id.btn_rx).setOnClickListener(this); findViewById(R.id.btn_rx_all).setOnClickListener(this); findViewById(R.id.btn_rx_mu_down).setOnClickListener(this); findViewById(R.id.btn_rx_uploade).setOnClickListener(this); img = (ImageView) findViewById(R.id.img); progressBar = (NumberProgressBar) findViewById(R.id.number_progress_bar); /*初始化数据*/ manager = new HttpManager(this, this); postEntity = new SubjectPostApi(); postEntity.setAll(true); /*上传接口内部接口有token验证,所以需要换成自己的接口测试,检查file文件是否手机存在*/ uplaodApi = new UploadApi(); File file = new File("/storage/emulated/0/Download/11.jpg"); RequestBody requestBody = RequestBody.create(MediaType.parse("image/jpeg"), file); MultipartBody.Part part = MultipartBody.Part.createFormData("file_name", file.getName(), new ProgressRequestBody (requestBody, new UploadProgressListener() { @Override public void onProgress(final long currentBytesCount, final long totalBytesCount) { /*回到主线程中,可通过timer等延迟或者循环避免快速刷新数据*/ Observable.just(currentBytesCount).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() { @Override public void call(Long aLong) { tvMsg.setText("提示:上传中"); progressBar.setMax((int) totalBytesCount); progressBar.setProgress((int) currentBytesCount); } }); } })); uplaodApi.setPart(part); }
Example 5
Source File: MvpActivity.java From RxRetrofit-mvp with MIT License | 4 votes |
@OnClick(value = R.id.tv_msg) void onTvMsgClick(View view) { SubjectPostApi postEntity = new SubjectPostApi(); postEntity.setAll(true); plistener.startPost(MvpActivity.this, postEntity); }