Example usage for android.transition TransitionManager beginDelayedTransition

List of usage examples for android.transition TransitionManager beginDelayedTransition

Introduction

In this page you can find the example usage for android.transition TransitionManager beginDelayedTransition.

Prototype

public static void beginDelayedTransition(final ViewGroup sceneRoot, Transition transition) 

Source Link

Document

Convenience method to animate to a new scene defined by all changes within the given scene root between calling this method and the next rendering frame.

Usage

From source file:com.andremion.music.MusicCoverView.java

private void morphToRect() {
    if (mIsMorphing) {
        return;//from ww w .j av  a  2 s. co m
    }
    TransitionManager.beginDelayedTransition((ViewGroup) getParent(), mCircleToRectTransition);
    setScaleType(ScaleType.CENTER_CROP);
}

From source file:com.andremion.music.MusicCoverView.java

private void morphFromSquareToSquare() {
    if (mIsMorphing) {
        return;// ww  w.  j a  va 2 s.  c  o  m
    }
    TransitionManager.beginDelayedTransition((ViewGroup) getParent(), mSquareToSquareTransition);
    setScaleType(ScaleType.CENTER_INSIDE);
    setScaleType(ScaleType.CENTER_CROP);
}

From source file:io.plaidapp.ui.SearchActivity.java

private void clearResults() {
    adapter.clear();//from ww  w . j  a  v a2 s  .  c  om
    dataManager.clear();
    TransitionManager.beginDelayedTransition(container, auto);
    results.setVisibility(View.GONE);
    progress.setVisibility(View.GONE);
    fab.setVisibility(View.GONE);
    confirmSaveContainer.setVisibility(View.GONE);
    resultsScrim.setVisibility(View.GONE);
    setNoResultsVisibility(View.GONE);
}

From source file:com.hannesdorfmann.search.SearchActivity.java

private void clearResults() {
      adapter.clear();/*from   ww  w  .ja v  a2s  .  c o  m*/
      TransitionManager.beginDelayedTransition(container, auto);
      results.setVisibility(View.GONE);
      progress.setVisibility(View.GONE);
      errorView.setVisibility(View.GONE);
      fab.setVisibility(View.GONE);
      confirmSaveContainer.setVisibility(View.GONE);
      resultsScrim.setVisibility(View.GONE);
      setNoResultsVisibility(View.GONE);
  }

From source file:babbq.com.searchplace.SearchActivity.java

private void clearResults() {
    mAdapter.setList(null);//w ww .  j a v  a2s .c  om
    dataManager.clear();
    TransitionManager.beginDelayedTransition(container, auto);
    results.setVisibility(View.GONE);
    progress.setVisibility(View.GONE);
    fab.setVisibility(View.GONE);
    confirmSaveContainer.setVisibility(View.GONE);
    resultsScrim.setVisibility(View.GONE);
    setNoResultsVisibility(View.GONE);
}

From source file:com.desno365.mods.DesnoUtils.java

public static void expandTextView(ViewGroup container, TextView tv) {
    // animation/*from  ww w .j  a v a  2 s. co m*/
    if (Build.VERSION.SDK_INT >= 19) {
        TransitionManager.beginDelayedTransition(container, new AutoTransition()
                .setDuration(SharedConstants.CHANGELOG_TEXT_ANIMATION_DURATION_PER_LINE * tv.getLineCount()));
    }

    // expand the TextView with setMaxLines
    tv.setMaxLines(Integer.MAX_VALUE);
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@Override
  public void showContent() {

      castedViewState().setShowContent(adapter.getItems());

      if (adapter.getItemCount() > 0) {
          if (results.getVisibility() != View.VISIBLE) {
              if (!isRestoringViewState()) {
                  TransitionManager.beginDelayedTransition(container, auto);
              }//from  www .java  2s . c  o m
              errorView.setVisibility(View.GONE);
              progress.setVisibility(View.GONE);
              results.setVisibility(View.VISIBLE);
              fab.setVisibility(View.VISIBLE);
              fab.setAlpha(0.6f);
              fab.setScaleX(0f);
              fab.setScaleY(0f);
              fab.animate().alpha(1f).scaleX(1f).scaleY(1f).setStartDelay(800L).setDuration(300L)
                      .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                              android.R.interpolator.linear_out_slow_in));
          }
      } else {
          if (!isRestoringViewState()) {
              TransitionManager.beginDelayedTransition(container, auto);
          }
          progress.setVisibility(View.GONE);
          errorView.setVisibility(View.GONE);
          setNoResultsVisibility(View.VISIBLE);
      }
  }

From source file:com.desno365.mods.DesnoUtils.java

public static void collapseTextView(ViewGroup container, final TextView tv, int collapsedHeight) {

    if (Build.VERSION.SDK_INT >= 19) {
        int lines = tv.getLineCount();

        // animation
        TransitionManager.beginDelayedTransition(container, new AutoTransition()
                .setDuration(SharedConstants.CHANGELOG_TEXT_ANIMATION_DURATION_PER_LINE * lines));

        // collapse the view by setting the collapsed height
        DesnoUtils.setViewHeight(tv, collapsedHeight);

        // restore initial state of the TextView when the animation finishes
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override/*from  www  .j  a v a  2  s .  c o  m*/
            public void run() {
                DesnoUtils.setViewHeight(tv, ViewGroup.LayoutParams.WRAP_CONTENT);
                tv.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES);
            }
        }, SharedConstants.CHANGELOG_TEXT_ANIMATION_DURATION_PER_LINE * lines + 100);
    } else {
        // no animation without the new APIs :/
        tv.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES);
    }

}

From source file:com.betterAlarm.deskclock.timer.TimerFragment.java

@Override
public void onLeftButtonClick(View view) {
    // Respond to delete timer
    final TimerObj timer = getCurrentTimer();
    if (timer == null) {
        return; // Prevent NPE if user click delete faster than the fade animation
    }/*from  w w  w  .ja  v  a 2 s. c om*/
    if (timer.mState == TimerObj.STATE_TIMESUP) {
        mNotificationManager.cancel(timer.mTimerId);
    }
    if (mAdapter.getCount() == 1) {
        final AnimatorListenerAdapter adapter = new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mTimerView.setScaleX(1.0f); // Reset the scale for timer view
                deleteTimer(timer);
            }
        };
        createRotateAnimator(adapter, true).start();
    } else {
        TransitionManager.beginDelayedTransition(mContentView, mDeleteTransition);
        deleteTimer(timer);
    }
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@Override
  public void showLoading() {
      castedViewState().setShowLoading();

      if (!isRestoringViewState()) {
          TransitionManager.beginDelayedTransition(container, auto);
      }/* ww  w .j a  v a  2s  . co m*/

      progress.setVisibility(View.VISIBLE);
      results.setVisibility(View.GONE);
      errorView.setVisibility(View.GONE);
  }