Exemple #1
0
  private void hideControls() {
    mControlsVisible = false;
    int duration = getResources().getInteger(R.integer.animation_controls_showHide);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      // Landscape: tab containers slide to left / right
      mConTabsA
          .animate()
          .alpha(0)
          .translationX(-mConTabsA.getWidth())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(0)
          .translationX(mConTabsB.getWidth())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
    } else {
      // Portrait: tab containers slide to top / bottom
      mConTabsA
          .animate()
          .alpha(0)
          .translationY(-mConTabsA.getHeight())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(0)
          .translationY(mConTabsB.getHeight())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
    }

    // 'Uncompress' the main fragment
    mConFragments
        .animate()
        .scaleX(1f)
        .scaleY(1f)
        .setInterpolator(new AccelerateInterpolator())
        .setDuration(duration);

    // Record button
    mChkRecord
        .animate()
        .alpha(0)
        .translationY(-mChkRecord.getHeight())
        .setInterpolator(new AccelerateInterpolator())
        .setDuration(duration);

    // Show the title
    mTxtTitle.animate().alpha(1f).setDuration(duration).setStartDelay(duration);
  }
Exemple #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow()
        .addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // TODO only if setting says so

    mRideUri = getIntent().getData();

    setContentView(R.layout.display);

    mChkRecord = (CheckableRelativeLayout) findViewById(R.id.chkRecord);
    mChkRecord.setEnabled(false);
    mChkRecordText = (TextView) findViewById(R.id.chkRecord_text);
    mChkRecordTextAnimator = AnimatorInflater.loadAnimator(this, R.animator.blink);
    mChkRecordTextAnimator.setTarget(mChkRecordText);
    mImgGpsStatus = (ImageView) findViewById(R.id.imgGpsStatus);
    ((AnimationDrawable) mImgGpsStatus.getDrawable()).start();
    findViewById(R.id.vieFragmentCycle).setOnTouchListener(mFragmentCycleOnTouchListener);
    mConTabsA = findViewById(R.id.conTabsA);
    mConTabsB = findViewById(R.id.conTabsB);
    mConFragments = findViewById(R.id.conFragments);
    mTxtTitle = (TextView) findViewById(R.id.txtTitle);

    setupFragments(
        savedInstanceState == null
            ? 0
            : savedInstanceState.getInt("mFragmentCycler.currentVisibleIndex"));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      setupNavigationBarHiding();
    }
    scheduleHideControls();

    setupFragmentContainer();
  }
Exemple #3
0
 @Override
 public void onActivated(Uri rideUri) {
   if (!rideUri.equals(mRideUri)) return;
   mChkRecord.setChecked(true, false);
   mChkRecordText.setText(R.string.display_chkRecord_active);
   if (!mChkRecordTextAnimator.isStarted()) mChkRecordTextAnimator.start();
 }
Exemple #4
0
 @Override
 public void onPaused(Uri rideUri) {
   if (!rideUri.equals(mRideUri)) return;
   mChkRecord.setChecked(false, false);
   mChkRecordText.setText(R.string.display_chkRecord_paused);
   if (mChkRecordTextAnimator.isStarted()) mChkRecordTextAnimator.cancel();
   mChkRecordText.setAlpha(1f);
 }
Exemple #5
0
  private void showControls() {
    if (mControlsVisible) return;
    mControlsVisible = true;
    int duration = getResources().getInteger(R.integer.animation_controls_showHide);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      // Landscape: tab containers slide from left / right
      mConTabsA
          .animate()
          .alpha(1)
          .translationX(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(1)
          .translationX(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
    } else {
      // Portrait: tab containers slide from top / bottom
      mConTabsA
          .animate()
          .alpha(1)
          .translationY(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(1)
          .translationY(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
    }

    // 'Compress' the main fragment, to make space for the tab containers
    PointF shrinkPercents = getShrinkPercents();
    mConFragments
        .animate()
        .scaleX(shrinkPercents.x)
        .scaleY(shrinkPercents.y)
        .setInterpolator(new DecelerateInterpolator())
        .setDuration(duration);

    // Record button
    mChkRecord
        .animate()
        .alpha(1)
        .translationY(0)
        .setInterpolator(new DecelerateInterpolator())
        .setDuration(duration);

    mTxtTitle.animate().alpha(0).setDuration(duration).setStartDelay(0);
  }