Search in sources :

Example 1 with VirtualClassFragment

use of ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment in project app by TourLive.

the class MainActivity method setTabMenu.

private void setTabMenu() {
    viewPageAdapter.addFragment(new RaceFragment(), getString(R.string.header_race));
    viewPageAdapter.addFragment(new RiderRaceGroupFragment(), getString(R.string.header_ridergroup));
    viewPageAdapter.addFragment(new SpecialFragment(), getString(R.string.header_special_class));
    viewPageAdapter.addFragment(new VirtualClassFragment(), getString(R.string.header_virtual_class));
    viewPageAdapter.addFragment(new MaillotsFragment(), getString(R.string.header_maillots));
    viewPageAdapter.addFragment(new ImportFragment(), getString(R.string.header_import_data));
}
Also used : RaceFragment(ch.hsr.sa.radiotour.presentation.fragments.RaceFragment) SpecialFragment(ch.hsr.sa.radiotour.presentation.fragments.SpecialFragment) VirtualClassFragment(ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment) MaillotsFragment(ch.hsr.sa.radiotour.presentation.fragments.MaillotsFragment) RiderRaceGroupFragment(ch.hsr.sa.radiotour.presentation.fragments.RiderRaceGroupFragment) ImportFragment(ch.hsr.sa.radiotour.presentation.fragments.ImportFragment)

Example 2 with VirtualClassFragment

use of ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment in project app by TourLive.

the class RiderPresenter method subscribeCallbacks.

@Override
public void subscribeCallbacks() {
    onSaveRiderCallback = new IRiderRepository.OnSaveRiderCallback() {

        @Override
        public void onSuccess() {
            for (Fragment frag : fragments) {
                if (frag instanceof RaceFragment) {
                    handler.post(() -> {
                        RaceFragment rF = (RaceFragment) frag;
                        rF.addRiderToList();
                    });
                } else if (frag instanceof RiderRaceGroupFragment) {
                    handler.post(() -> {
                        RiderRaceGroupFragment riderRaceGroupFragment = (RiderRaceGroupFragment) frag;
                        riderRaceGroupFragment.addRiderToList();
                    });
                } else {
                // Do nothing because a not supported fragment
                }
            }
        }

        @Override
        public void onError(String message) {
        // Not needed and therefore not implemented
        }
    };
    onGetAllRidersCallback = new IRiderRepository.OnGetAllRidersCallback() {

        @Override
        public void onSuccess(RealmList<Rider> riders) {
            for (Fragment frag : fragments) {
                if (frag instanceof RaceFragment) {
                    RaceFragment rF = (RaceFragment) frag;
                    rF.showRiders(riders);
                } else if (frag instanceof RiderRaceGroupFragment) {
                    RiderRaceGroupFragment riderRaceGroupFragment = (RiderRaceGroupFragment) frag;
                    riderRaceGroupFragment.showRiders(riders);
                } else if (frag instanceof VirtualClassFragment) {
                    VirtualClassFragment virtualClassFragment = (VirtualClassFragment) frag;
                    virtualClassFragment.updateRiders(riders);
                } else {
                // Do nothing because a not supported fragment
                }
            }
        }

        @Override
        public void onError(String message) {
        // Not needed and therefore not implemented
        }
    };
    onUpdateRiderStateCallback = new IRiderRepository.OnUpdateRiderStageCallback() {

        @Override
        public void onSuccess() {
        // Not needed and therefore not implemented
        }

        @Override
        public void onError(String message) {
        // Not needed and therefore not implemented
        }
    };
}
Also used : RaceFragment(ch.hsr.sa.radiotour.presentation.fragments.RaceFragment) IRiderRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IRiderRepository) VirtualClassFragment(ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment) RiderRaceGroupFragment(ch.hsr.sa.radiotour.presentation.fragments.RiderRaceGroupFragment) VirtualClassFragment(ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment) RiderRaceGroupFragment(ch.hsr.sa.radiotour.presentation.fragments.RiderRaceGroupFragment) Fragment(android.support.v4.app.Fragment) RaceFragment(ch.hsr.sa.radiotour.presentation.fragments.RaceFragment) Rider(ch.hsr.sa.radiotour.dataaccess.models.Rider)

Aggregations

RaceFragment (ch.hsr.sa.radiotour.presentation.fragments.RaceFragment)2 RiderRaceGroupFragment (ch.hsr.sa.radiotour.presentation.fragments.RiderRaceGroupFragment)2 VirtualClassFragment (ch.hsr.sa.radiotour.presentation.fragments.VirtualClassFragment)2 Fragment (android.support.v4.app.Fragment)1 IRiderRepository (ch.hsr.sa.radiotour.dataaccess.interfaces.IRiderRepository)1 Rider (ch.hsr.sa.radiotour.dataaccess.models.Rider)1 ImportFragment (ch.hsr.sa.radiotour.presentation.fragments.ImportFragment)1 MaillotsFragment (ch.hsr.sa.radiotour.presentation.fragments.MaillotsFragment)1 SpecialFragment (ch.hsr.sa.radiotour.presentation.fragments.SpecialFragment)1