Exemplo n.º 1
0
 @Override
 public boolean onTouch(View v, MotionEvent event) {
   if (event.getAction() == MotionEvent.ACTION_DOWN) {
     mFragmentCycler.cycle(thiz);
   }
   return true;
 }
Exemplo n.º 2
0
  private void setupFragments(int currentVisibleIndex) {
    long updateTitleDelay = getResources().getInteger(R.integer.animation_controls_showHide);
    int tabColorEnabled = getResources().getColor(R.color.bright_foreground_dark);
    int tabColorDisabled = getResources().getColor(R.color.bright_foreground_disabled_dark);
    mFragmentCycler =
        new FragmentCycler(
            R.id.conFragments, mTxtTitle, updateTitleDelay, tabColorEnabled, tabColorDisabled);
    mFragmentCycler.setCurrentVisibleIndex(currentVisibleIndex);
    mFragmentCycler.add(
        this, SpeedDisplayFragment.newInstance(), R.id.chkTabSpeed, R.string.display_title_speed);
    mFragmentCycler.add(
        this,
        ElapsedTimeDisplayFragment.newInstance(),
        R.id.chkTabDuration,
        R.string.display_title_duration);
    mFragmentCycler.add(
        this,
        TotalDistanceDisplayFragment.newInstance(),
        R.id.chkTabDistance,
        R.string.display_title_distance);
    mFragmentCycler.add(
        this,
        HeartRateDisplayFragment.newInstance(),
        R.id.chkHeartRate,
        R.string.display_title_heartRate);
    mFragmentCycler.add(
        this,
        CompassDisplayFragment.newInstance(),
        R.id.chkTabCompass,
        R.string.display_title_compass);
    mFragmentCycler.add(
        this,
        CurrentTimeDisplayFragment.newInstance(),
        R.id.chkTabCurrentTime,
        R.string.display_title_currentTime);

    HeartRateManager heartRateManager = HeartRateManager.get();
    mFragmentCycler.setEnabled(
        this,
        HeartRateDisplayFragment.class,
        heartRateManager.isConnected() || heartRateManager.isConnecting());

    mFragmentCycler.show(this);
  }
Exemplo n.º 3
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   outState.putInt(
       "mFragmentCycler.currentVisibleIndex", mFragmentCycler.getCurrentVisibleIndex());
   super.onSaveInstanceState(outState);
 }