com.example.retrofit.R Java Examples

The following examples show how to use com.example.retrofit.R. 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-string-master with MIT License 6 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx_all:
            Intent intentC = new Intent(this, CombinApiActivity.class);
            startActivity(intentC);
            break;
        case R.id.btn_rx:
            manager.doHttpDeal(postEntity);
            break;
        case R.id.btn_rx_uploade:
            manager.doHttpDeal(uplaodApi);
            break;
        case R.id.btn_rx_mu_down:
            Intent intent = new Intent(this, DownLaodActivity.class);
            startActivity(intent);
            break;
    }
}
 
Example #2
Source File: MainActivity.java    From RxjavaRetrofitDemo-master with MIT License 6 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_simple:
            onButton9Click();
            break;
        case R.id.btn_rx:
            simpleDo();
            break;
        case R.id.btn_rx_uploade:
            uploadeDo();
            break;
        case R.id.btn_rx_mu_down:
            Intent intent = new Intent(this, DownLaodActivity.class);
            startActivity(intent);
            break;
    }
}
 
Example #3
Source File: DownLaodActivity.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
private void initWidget(){
    EasyRecyclerView recyclerView=(EasyRecyclerView)findViewById(R.id.rv);
    DownAdapter adapter=new DownAdapter(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    adapter.addAll(listData);
}
 
Example #4
Source File: DownLaodActivity.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_down_laod);
    initResource();
    initWidget();
}
 
Example #5
Source File: DownHolder.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx_down:
            if(apkApi.getState()!= DownState.FINISH){
                manager.startDown(apkApi);
            }
            break;
        case R.id.btn_rx_pause:
            manager.pause(apkApi);
            break;
    }
}
 
Example #6
Source File: DownHolder.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
public DownHolder(ViewGroup parent) {
    super(parent, R.layout.view_item_holder);
    manager= HttpDownManager.getInstance();
    $(R.id.btn_rx_down).setOnClickListener(this);
    $(R.id.btn_rx_pause).setOnClickListener(this);
    progressBar=$(R.id.number_progress_bar);
    tvMsg=$(R.id.tv_msg);
}
 
Example #7
Source File: MvpActivity.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mvp);
    ButterKnife.bind(this);
    plistener = new P(this);
}
 
Example #8
Source File: DownLaodActivity.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
private void initWidget(){
    EasyRecyclerView recyclerView=(EasyRecyclerView)findViewById(R.id.rv);
    DownAdapter adapter=new DownAdapter(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    adapter.addAll(listData);
}
 
Example #9
Source File: DownLaodActivity.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_down_laod);
    initResource();
    initWidget();
}
 
Example #10
Source File: DownHolder.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx_down:
            if(apkApi.getState()!= DownState.FINISH){
                manager.startDown(apkApi);
            }
            break;
        case R.id.btn_rx_pause:
            manager.pause(apkApi);
            break;
    }
}
 
Example #11
Source File: DownHolder.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
public DownHolder(ViewGroup parent) {
    super(parent, R.layout.view_item_holder);
    manager= HttpDownManager.getInstance();
    $(R.id.btn_rx_down).setOnClickListener(this);
    $(R.id.btn_rx_pause).setOnClickListener(this);
    progressBar=$(R.id.number_progress_bar);
    tvMsg=$(R.id.tv_msg);
}
 
Example #12
Source File: MainActivity.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx:
            manager.doHttpDeal(postEntity);
            break;
        case R.id.btn_rx_uploade:
            manager.doHttpDeal(uplaodApi);
            break;
        case R.id.btn_rx_mu_down:
            Intent intent = new Intent(this, DownLaodActivity.class);
            startActivity(intent);
            break;
    }
}
 
Example #13
Source File: MainActivity.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
@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 #14
Source File: DownLaodActivity.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
private void initWidget() {
    EasyRecyclerView recyclerView = (EasyRecyclerView) findViewById(R.id.rv);
    DownAdapter adapter = new DownAdapter(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    adapter.addAll(listData);
}
 
Example #15
Source File: DownLaodActivity.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_down_laod);
    initResource();
    initWidget();
}
 
Example #16
Source File: DownHolder.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx_down:
            if (apkApi.getState() != DownState.FINISH) {
                manager.startDown(apkApi);
            }
            break;
        case R.id.btn_rx_pause:
            manager.pause(apkApi);
            break;
    }
}
 
Example #17
Source File: DownHolder.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
public DownHolder(ViewGroup parent) {
    super(parent, R.layout.view_item_holder);
    manager = HttpDownManager.getInstance();
    $(R.id.btn_rx_down).setOnClickListener(this);
    $(R.id.btn_rx_pause).setOnClickListener(this);
    progressBar = $(R.id.number_progress_bar);
    tvMsg = $(R.id.tv_msg);
}
 
Example #18
Source File: MainActivity.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
@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_simple).setOnClickListener(this);
    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);
    verifyStoragePermissions(this);
}
 
Example #19
Source File: DownLaodActivity.java    From RxjavaRetrofitDemo-string-master with MIT License 5 votes vote down vote up
private void initWidget() {
    EasyRecyclerView recyclerView = (EasyRecyclerView) findViewById(R.id.rv);
    DownAdapter adapter = new DownAdapter(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    adapter.addAll(listData);
}
 
Example #20
Source File: DownLaodActivity.java    From RxjavaRetrofitDemo-string-master with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_down_laod);
    verifyStoragePermissions(this);
    initResource();
    initWidget();
}
 
Example #21
Source File: DownHolder.java    From RxjavaRetrofitDemo-string-master with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_rx_down:
            if (apkApi.getState() != DownState.FINISH) {
                manager.startDown(apkApi);
            }
            break;
        case R.id.btn_rx_pause:
            manager.pause(apkApi);
            break;
    }
}
 
Example #22
Source File: DownHolder.java    From RxjavaRetrofitDemo-string-master with MIT License 5 votes vote down vote up
public DownHolder(ViewGroup parent) {
    super(parent, R.layout.view_item_holder);
    manager = HttpDownManager.getInstance();
    $(R.id.btn_rx_down).setOnClickListener(this);
    $(R.id.btn_rx_pause).setOnClickListener(this);
    progressBar = $(R.id.number_progress_bar);
    tvMsg = $(R.id.tv_msg);
}
 
Example #23
Source File: MvpActivity.java    From RxRetrofit-mvp with MIT License 4 votes vote down vote up
@OnClick(value = R.id.tv_test)
void onTvTestClick(View view) {
    plistener.doTest("1");
}
 
Example #24
Source File: MvpActivity.java    From RxRetrofit-mvp with MIT License 4 votes vote down vote up
@OnClick(value = R.id.tv_msg)
void onTvMsgClick(View view) {
    SubjectPostApi postEntity = new SubjectPostApi();
    postEntity.setAll(true);
    plistener.startPost(MvpActivity.this, postEntity);
}
 
Example #25
Source File: MainActivity.java    From RxjavaRetrofitDemo-string-master with MIT License 4 votes vote down vote up
@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);
}