123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package com.rthoni.stssaguenay.ui.activities;
-
- import android.os.Bundle;
- import android.support.v7.app.AppCompatActivity;
-
- import com.luticate.utils.business.LuPromise;
- import com.rthoni.stssaguenay.R;
- import com.rthoni.stssaguenay.dbo.StopsDbo;
- import com.rthoni.stssaguenay.ui.fragments.StopPickerFragment;
- import com.rthoni.stssaguenay.ui.fragments.StopRoutesPickerFragment;
-
- public class StopPickerActivity extends AppCompatActivity {
-
- private StopPickerFragment _stopPickerFragment;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_stop_picker);
- if (getSupportActionBar() != null) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- }
- goToStops();
- }
-
- @Override
- public boolean onSupportNavigateUp() {
- if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
- return super.onSupportNavigateUp();
- }
- getSupportFragmentManager().popBackStack();
- return true;
- }
-
- public void goToStops()
- {
- StopPickerFragment f = new StopPickerFragment();
- f.setOnStopSelectedConsumer(new LuPromise.LuConsumer<StopsDbo>() {
- @Override
- public void execute(StopsDbo data) {
- goToRoutes(data);
- }
- });
- getSupportFragmentManager()
- .beginTransaction()
- .replace(R.id.container, f)
- .commit();
- }
-
- public void goToRoutes(StopsDbo stopDbo)
- {
- StopRoutesPickerFragment f = new StopRoutesPickerFragment();
- f.setStopsDbo(stopDbo);
- getSupportFragmentManager()
- .beginTransaction()
- .replace(R.id.container, f)
- .addToBackStack("StopRoutesPickerFragment")
- .commit();
- }
- }
|