| |
---|
| | import android.widget.SeekBar; |
---|
| | |
---|
| | import java.util.concurrent.TimeUnit; |
---|
| | |
---|
| | import io.reactivex.android.schedulers.AndroidSchedulers; |
---|
| | import io.reactivex.schedulers.Schedulers; |
---|
| | |
---|
| | /** |
---|
| | * Created by matsumoto_k on 2017/11/11. |
---|
| | */ |
---|
| | public class JavaMainActivity extends AppCompatActivity { |
---|
| | JavaRxProcess rxProcess = new JavaRxProcess(); |
---|
| | AddressHttpConnection addressHttpConnection = new AddressHttpConnection(); |
---|
| | |
---|
| | @Override |
---|
| | protected void onCreate(Bundle savedInstanceState) { |
---|
| | super.onCreate(savedInstanceState); |
---|
| |
---|
| | findViewById(R.id.empty_btn).setOnClickListener(view -> rxProcess.empy()); |
---|
| | findViewById(R.id.flatmap_1_btn).setOnClickListener(view -> rxProcess.flatmap1()); |
---|
| | findViewById(R.id.flatmap_2_btn).setOnClickListener(view -> rxProcess.flatmap2()); |
---|
| | findViewById(R.id.meeting_btn).setOnClickListener(view -> rxProcess.meetingTest()); |
---|
| | |
---|
| | SeekBar seekBar = findViewById(R.id.seek_bar); |
---|
| | seekBar.setMax(1000); |
---|
| | seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { |
---|
| | @Override |
---|
| |
---|
| | |
---|
| | rxProcess.getPublishSubject() |
---|
| | .throttleLast(500, TimeUnit.MILLISECONDS) |
---|
| | .subscribe(progress -> System.out.println(progress)); |
---|
| | |
---|
| | findViewById(R.id.address_api_btn).setOnClickListener(view -> { |
---|
| | addressHttpConnection.addPathParam("api"); |
---|
| | addressHttpConnection.addPathParam("search"); |
---|
| | addressHttpConnection.addQueryParam("zipcode", "6731102"); |
---|
| | addressHttpConnection.doGet() |
---|
| | .subscribeOn(Schedulers.computation()) |
---|
| | .observeOn(AndroidSchedulers.mainThread()) |
---|
| | .subscribe( |
---|
| | response -> System.out.println(response), |
---|
| | error -> error.printStackTrace(), |
---|
| | () -> System.out.println("onComplete")); |
---|
| | }); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |