android.transition.TransitionSet Java Examples

The following examples show how to use android.transition.TransitionSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DetailActivity.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_detail);

    postponeEnterTransition();

    TransitionSet transitions = new TransitionSet();
    Slide slide = new Slide(Gravity.BOTTOM);
    slide.setInterpolator(AnimationUtils.loadInterpolator(this,
            android.R.interpolator.linear_out_slow_in));
    slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
    transitions.addTransition(slide);
    transitions.addTransition(new Fade());
    getWindow().setEnterTransition(transitions);

    Intent intent = getIntent();
    sharedElementCallback = new DetailSharedElementEnterCallback(intent);
    setEnterSharedElementCallback(sharedElementCallback);
    initialItem = intent.getIntExtra(IntentUtil.SELECTED_ITEM_POSITION, 0);
    setUpViewPager(intent.<Photo>getParcelableArrayListExtra(IntentUtil.PHOTO));

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(navigationOnClickListener);

    super.onCreate(savedInstanceState);
}
 
Example #2
Source File: GridAdapter.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
/**
 * Handles a view click by setting the current position to the given {@code position} and
 * starting a {@link  ImagePagerFragment} which displays the image at the position.
 *
 * @param view the clicked {@link ImageView} (the shared element view will be re-mapped at the
 * GridFragment's SharedElementCallback)
 * @param position the selected view position
 */
@Override
public void onItemClicked(View view, int position) {
  // Update the position.
  MainActivity.currentPosition = position;

  // Exclude the clicked card from the exit transition (e.g. the card will disappear immediately
  // instead of fading out with the rest to prevent an overlapping animation of fade and move).
  ((TransitionSet) fragment.getExitTransition()).excludeTarget(view, true);

  ImageView transitioningView = view.findViewById(R.id.card_image);
  fragment.getFragmentManager()
      .beginTransaction()
      .setReorderingAllowed(true) // Optimize for shared element transition
      .addSharedElement(transitioningView, transitioningView.getTransitionName())
      .replace(R.id.fragment_container, new ImagePagerFragment(), ImagePagerFragment.class
          .getSimpleName())
      .addToBackStack(null)
      .commit();
}
 
Example #3
Source File: AlbumDetailActivity.java    From android-animations-transitions with MIT License 6 votes vote down vote up
private Transition createTransition() {
    TransitionSet set = new TransitionSet();
    set.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);

    Transition tFab = new Scale();
    tFab.setDuration(150);
    tFab.addTarget(fab);

    Transition tTitle = new Fold();
    tTitle.setDuration(150);
    tTitle.addTarget(titlePanel);

    Transition tTrack = new Fold();
    tTrack.setDuration(150);
    tTrack.addTarget(trackPanel);

    set.addTransition(tTrack);
    set.addTransition(tTitle);
    set.addTransition(tFab);

    return set;
}
 
Example #4
Source File: LiveStreamActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
	int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};

	Transition slideTransition = new Slide(Gravity.BOTTOM);
	Transition fadeTransition = new Fade();

	for (int slideTarget : slideTargets) {
		slideTransition.addTarget(slideTarget);
		fadeTransition.excludeTarget(slideTarget, true);
	}

	TransitionSet set = new TransitionSet();
	set.addTransition(slideTransition);
	set.addTransition(fadeTransition);
	return set;
}
 
Example #5
Source File: SearchActivity.java    From android-proguards with Apache License 2.0 6 votes vote down vote up
private void setupTransitions() {
    // grab the position that the search icon transitions in *from*
    // & use it to configure the return transition
    setEnterSharedElementCallback(new SharedElementCallback() {
        @Override
        public void onSharedElementStart(
                List<String> sharedElementNames,
                List<View> sharedElements,
                List<View> sharedElementSnapshots) {
            if (sharedElements != null && !sharedElements.isEmpty()) {
                View searchIcon = sharedElements.get(0);
                if (searchIcon.getId() != R.id.searchback) return;
                int centerX = (searchIcon.getLeft() + searchIcon.getRight()) / 2;
                CircularReveal hideResults = (CircularReveal) TransitionUtils.findTransition(
                        (TransitionSet) getWindow().getReturnTransition(),
                        CircularReveal.class, R.id.results_container);
                if (hideResults != null) {
                    hideResults.setCenter(new Point(centerX, 0));
                }
            }
        }
    });
}
 
Example #6
Source File: CoverActivity.java    From GyroscopeImageDemo with Apache License 2.0 6 votes vote down vote up
/**
 * 模拟入场动画
 */
private void runEnterAnim() {
  getScreenSize();
  mIvCover.post(new Runnable() {
    @Override public void run() {
      FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(mScreenWidth, mScreenHeight);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ChangeImageTransform changeImageTransform = new ChangeImageTransform();
        AutoTransition autoTransition = new AutoTransition();
        changeImageTransform.setDuration(TRANSITIONS_DURATION);
        autoTransition.setDuration(TRANSITIONS_DURATION);
        TransitionSet transitionSet = new TransitionSet();
        transitionSet.addTransition(autoTransition);
        transitionSet.addTransition(changeImageTransform);
        TransitionManager.beginDelayedTransition(mTransitionsContainer, transitionSet);
        mIvCover.setLayoutParams(params);
        mIvCover.setScaleType(ImageView.ScaleType.CENTER_CROP);
      } else {
        mIvCover.setLayoutParams(params);
        mIvCover.setScaleType(ImageView.ScaleType.CENTER_CROP);
      }
    }
  });
}
 
Example #7
Source File: DefaultShareElementTransitionFactory.java    From YcShareElement with Apache License 2.0 6 votes vote down vote up
protected TransitionSet buildShareElementsTransition(List<View> shareViewList) {
    TransitionSet transitionSet = new TransitionSet();
    if (shareViewList == null || shareViewList.size() == 0) {
        return transitionSet;
    }
    transitionSet.addTransition(new ChangeClipBounds());
    transitionSet.addTransition(new ChangeTransform());
    transitionSet.addTransition(new ChangeBounds());
    transitionSet.addTransition(new ChangeTextTransition());
    if (mUseDefaultImageTransform) {
        transitionSet.addTransition(new ChangeImageTransform());
    } else {
        transitionSet.addTransition(new ChangeOnlineImageTransition());
    }
    return transitionSet;
}
 
Example #8
Source File: TransitionUtils.java    From android-proguards with Apache License 2.0 6 votes vote down vote up
public static @Nullable Transition findTransition(
        @NonNull TransitionSet set,
        @NonNull Class<? extends Transition> clazz,
        @IdRes int targetId) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            if (transition.getTargetIds().contains(targetId)) {
                return transition;
            }
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz, targetId);
            if (child != null) return child;
        }
    }
    return null;
}
 
Example #9
Source File: Simple1Fragment.java    From YcShareElement with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final View imgView = view.findViewById(R.id.s1_img);
    imgView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            TransitionSet simple2Transition = new TransitionSet();
            simple2Transition.addTransition(new ChangeImageTransform());
            simple2Transition.addTransition(new ChangeBounds());

            Simple2Fragment simple2Fragment = new Simple2Fragment();
            simple2Fragment.setSharedElementEnterTransition(simple2Transition);
            simple2Fragment.setSharedElementReturnTransition(simple2Transition);
            FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
            fragmentTransaction.addSharedElement(imgView, imgView.getTransitionName());
            fragmentTransaction.replace(R.id.simple_container, simple2Fragment, "simple2");
            fragmentTransaction.addToBackStack("simple2");
            fragmentTransaction.commit();
        }
    });
}
 
Example #10
Source File: StreamActivity.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private TransitionSet constructTransitions() {
    int[] slideTargets = {R.id.ChatRecyclerView, R.id.chat_input, R.id.chat_input_divider};

    Transition slideTransition = new Slide(Gravity.BOTTOM);
    Transition fadeTransition = new Fade();

    for (int slideTarget : slideTargets) {
        slideTransition.addTarget(slideTarget);
        fadeTransition.excludeTarget(slideTarget, true);
    }

    TransitionSet set = new TransitionSet();
    set.addTransition(slideTransition);
    set.addTransition(fadeTransition);
    return set;
}
 
Example #11
Source File: DetailsFragment.java    From mosby with Apache License 2.0 6 votes vote down vote up
@TargetApi(21) private void initTransitions() {

    Window window = getActivity().getWindow();
    window.setEnterTransition(
        new ExplodeFadeEnterTransition(senderNameView, senderMailView, separatorLine));
    window.setExitTransition(new ExcludedExplodeTransition());
    window.setReenterTransition(new ExcludedExplodeTransition());
    window.setReturnTransition(new ExcludedExplodeTransition());

    TransitionSet textSizeSet = new TransitionSet();
    textSizeSet.addTransition(
        TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));
    TextSizeTransition textSizeTransition = new TextSizeTransition();
    textSizeTransition.addTarget(R.id.subject);
    textSizeTransition.addTarget(getString(R.string.shared_mail_subject));

    textSizeSet.addTransition(textSizeTransition);
    textSizeSet.setOrdering(TransitionSet.ORDERING_TOGETHER);

    window.setSharedElementEnterTransition(textSizeSet);
    getActivity().setEnterSharedElementCallback(
        new TextSizeEnterSharedElementCallback(getActivity()));
  }
 
Example #12
Source File: FragmentTransition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * This method adds views as targets to the transition, but only if the transition
 * doesn't already have a target. It is best for views to contain one View object
 * that does not exist in the view hierarchy (state.nonExistentView) so that
 * when they are removed later, a list match will suffice to remove the targets.
 * Otherwise, if you happened to have targeted the exact views for the transition,
 * the replaceTargets call will remove them unexpectedly.
 */
public static void addTargets(Transition transition, ArrayList<View> views) {
    if (transition == null) {
        return;
    }
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            addTargets(child, views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (isNullOrEmpty(targets)) {
            // We can just add the target views
            int numViews = views.size();
            for (int i = 0; i < numViews; i++) {
                transition.addTarget(views.get(i));
            }
        }
    }
}
 
Example #13
Source File: FragmentTransition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * This method removes the views from transitions that target ONLY those views and
 * replaces them with the new targets list.
 * The views list should match those added in addTargets and should contain
 * one view that is not in the view hierarchy (state.nonExistentView).
 */
public static void replaceTargets(Transition transition, ArrayList<View> oldTargets,
        ArrayList<View> newTargets) {
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (int i = 0; i < numTransitions; i++) {
            Transition child = set.getTransitionAt(i);
            replaceTargets(child, oldTargets, newTargets);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == oldTargets.size() &&
                targets.containsAll(oldTargets)) {
            // We have an exact match. We must have added these earlier in addTargets
            final int targetCount = newTargets == null ? 0 : newTargets.size();
            for (int i = 0; i < targetCount; i++) {
                transition.addTarget(newTargets.get(i));
            }
            for (int i = oldTargets.size() - 1; i >= 0; i--) {
                transition.removeTarget(oldTargets.get(i));
            }
        }
    }
}
 
Example #14
Source File: FragmentTransition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * After the transition has started, remove all targets that we added to the transitions
 * so that the transitions are left in a clean state.
 */
private static void scheduleRemoveTargets(final Transition overalTransition,
        final Transition enterTransition, final ArrayList<View> enteringViews,
        final Transition exitTransition, final ArrayList<View> exitingViews,
        final TransitionSet sharedElementTransition, final ArrayList<View> sharedElementsIn) {
    overalTransition.addListener(new TransitionListenerAdapter() {
        @Override
        public void onTransitionStart(Transition transition) {
            if (enterTransition != null) {
                replaceTargets(enterTransition, enteringViews, null);
            }
            if (exitTransition != null) {
                replaceTargets(exitTransition, exitingViews, null);
            }
            if (sharedElementTransition != null) {
                replaceTargets(sharedElementTransition, sharedElementsIn, null);
            }
        }
    });
}
 
Example #15
Source File: FragmentTransition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the epicenter for the exit transition.
 *
 * @param sharedElementTransition The shared element transition
 * @param exitTransition The transition for the outgoing fragment's views
 * @param outSharedElements Shared elements in the outgoing fragment
 * @param outIsPop Is the outgoing fragment being removed as a pop transaction?
 * @param outTransaction The transaction that caused the fragment to be removed.
 */
private static void setOutEpicenter(TransitionSet sharedElementTransition,
        Transition exitTransition, ArrayMap<String, View> outSharedElements, boolean outIsPop,
        BackStackRecord outTransaction) {
    if (outTransaction.mSharedElementSourceNames != null &&
            !outTransaction.mSharedElementSourceNames.isEmpty()) {
        final String sourceName = outIsPop
                ? outTransaction.mSharedElementTargetNames.get(0)
                : outTransaction.mSharedElementSourceNames.get(0);
        final View outEpicenterView = outSharedElements.get(sourceName);
        setEpicenter(sharedElementTransition, outEpicenterView);

        if (exitTransition != null) {
            setEpicenter(exitTransition, outEpicenterView);
        }
    }
}
 
Example #16
Source File: FragmentTransition.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a TransitionSet containing the shared element transition. The wrapping TransitionSet
 * targets all shared elements to ensure that no other Views are targeted. The shared element
 * transition can then target any or all shared elements without worrying about accidentally
 * targeting entering or exiting Views.
 *
 * @param inFragment The incoming fragment
 * @param outFragment the outgoing fragment
 * @param isPop True if this is a pop transaction or false if it is a normal (add) transaction.
 * @return A TransitionSet wrapping the shared element transition or null if no such transition
 * exists.
 */
private static TransitionSet getSharedElementTransition(Fragment inFragment,
        Fragment outFragment, boolean isPop) {
    if (inFragment == null || outFragment == null) {
        return null;
    }
    Transition transition = cloneTransition(isPop
            ? outFragment.getSharedElementReturnTransition()
            : inFragment.getSharedElementEnterTransition());
    if (transition == null) {
        return null;
    }
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(transition);
    return transitionSet;
}
 
Example #17
Source File: Fragment.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static Transition loadTransition(Context context, TypedArray typedArray,
        Transition currentValue, Transition defaultValue, int id) {
    if (currentValue != defaultValue) {
        return currentValue;
    }
    int transitionId = typedArray.getResourceId(id, 0);
    Transition transition = defaultValue;
    if (transitionId != 0 && transitionId != com.android.internal.R.transition.no_transition) {
        TransitionInflater inflater = TransitionInflater.from(context);
        transition = inflater.inflateTransition(transitionId);
        if (transition instanceof TransitionSet &&
                ((TransitionSet)transition).getTransitionCount() == 0) {
            transition = null;
        }
    }
    return transition;
}
 
Example #18
Source File: GalleryFragment.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
public GalleryFragment() {

        final Fade fade = new Fade();
        fade.addTarget(R.id.appbar);

        Explode explode = new Explode();
        explode.excludeTarget(R.id.appbar, true);

        Elevation elevation = new Elevation();
        elevation.addTarget(R.id.gallery_card);
        elevation.setStartDelay(250); // arbitrarily chosen delay

        TransitionSet exit = new TransitionSet();
        exit.addTransition(fade);
        exit.addTransition(explode);
        exit.addTransition(elevation);

        setExitTransition(exit);
    }
 
Example #19
Source File: TransitionKitKat.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public Object getAudioTransition() {
    final ChangeText tc = new ChangeText();
    tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
    final TransitionSet inner = new TransitionSet();
    inner.addTransition(tc).addTransition(new ChangeBounds());
    final TransitionSet tg = new TransitionSet();
    tg.addTransition(new Fade(Fade.OUT)).addTransition(inner).
            addTransition(new Fade(Fade.IN));
    tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    tg.setDuration(TRANSITION_DURATION);
    return tg;
}
 
Example #20
Source File: ViewActivity.java    From recurrence with GNU General Public License v3.0 5 votes vote down vote up
public void setupTransitions() {
    // Add shared element transition animation if on Lollipop or later
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Enter transitions
        TransitionSet setEnter = new TransitionSet();

        Transition slideDown = new Explode();
        slideDown.addTarget(headerView);
        slideDown.excludeTarget(scrollView, true);
        slideDown.setDuration(500);
        setEnter.addTransition(slideDown);

        Transition fadeOut = new Slide(Gravity.BOTTOM);
        fadeOut.addTarget(scrollView);
        fadeOut.setDuration(500);
        setEnter.addTransition(fadeOut);

        // Exit transitions
        TransitionSet setExit = new TransitionSet();

        Transition slideDown2 = new Explode();
        slideDown2.addTarget(headerView);
        slideDown2.setDuration(570);
        setExit.addTransition(slideDown2);

        Transition fadeOut2 = new Slide(Gravity.BOTTOM);
        fadeOut2.addTarget(scrollView);
        fadeOut2.setDuration(280);
        setExit.addTransition(fadeOut2);

        getWindow().setEnterTransition(setEnter);
        getWindow().setReturnTransition(setExit);
    }
}
 
Example #21
Source File: DraweeTransition.java    From fresco with MIT License 5 votes vote down vote up
public static TransitionSet createTransitionSet(
    ScalingUtils.ScaleType fromScale,
    ScalingUtils.ScaleType toScale,
    @Nullable PointF fromFocusPoint,
    @Nullable PointF toFocusPoint) {
  TransitionSet transitionSet = new TransitionSet();
  transitionSet.addTransition(new ChangeBounds());
  transitionSet.addTransition(
      new DraweeTransition(fromScale, toScale, fromFocusPoint, toFocusPoint));
  return transitionSet;
}
 
Example #22
Source File: TransitionKitKat.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public Object getAudioTransition() {
    final ChangeText tc = new ChangeText();
    tc.setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN);
    final TransitionSet inner = new TransitionSet();
    inner.addTransition(tc).addTransition(new ChangeBounds());
    final TransitionSet tg = new TransitionSet();
    tg.addTransition(new Fade(Fade.OUT)).addTransition(inner).
            addTransition(new Fade(Fade.IN));
    tg.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
    tg.setDuration(TRANSITION_DURATION);
    return tg;
}
 
Example #23
Source File: TransitionUtils.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
public static @Nullable Transition findTransition(
        @NonNull TransitionSet set, @NonNull Class<? extends Transition> clazz) {
    for (int i = 0; i < set.getTransitionCount(); i++) {
        Transition transition = set.getTransitionAt(i);
        if (transition.getClass() == clazz) {
            return transition;
        }
        if (transition instanceof TransitionSet) {
            Transition child = findTransition((TransitionSet) transition, clazz);
            if (child != null) return child;
        }
    }
    return null;
}
 
Example #24
Source File: CacheControlActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updateStorageUsageRow() {
    View view = layoutManager.findViewByPosition(storageUsageRow);
    if (view instanceof StroageUsageView) {
        StroageUsageView stroageUsageView = ((StroageUsageView) view);
        long currentTime =  System.currentTimeMillis();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) {
            TransitionSet transition = new TransitionSet();
            ChangeBounds changeBounds = new ChangeBounds();
            changeBounds.setDuration(250);
            changeBounds.excludeTarget(stroageUsageView.legendLayout,true);
            Fade in = new Fade(Fade.IN);
            in.setDuration(290);
            transition
                    .addTransition(new Fade(Fade.OUT).setDuration(250))
                    .addTransition(changeBounds)
                    .addTransition(in);
            transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
            transition.setInterpolator(CubicBezierInterpolator.EASE_OUT);
            TransitionManager.beginDelayedTransition(listView, transition);
        }
        stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize);
        RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow);
        if (holder != null) {
            stroageUsageView.setEnabled(listAdapter.isEnabled(holder));
        }
    } else {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example #25
Source File: CacheControlActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updateStorageUsageRow() {
    View view = layoutManager.findViewByPosition(storageUsageRow);
    if (view instanceof StroageUsageView) {
        StroageUsageView stroageUsageView = ((StroageUsageView) view);
        long currentTime =  System.currentTimeMillis();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && currentTime - fragmentCreateTime > 250) {
            TransitionSet transition = new TransitionSet();
            ChangeBounds changeBounds = new ChangeBounds();
            changeBounds.setDuration(250);
            changeBounds.excludeTarget(stroageUsageView.legendLayout,true);
            Fade in = new Fade(Fade.IN);
            in.setDuration(290);
            transition
                    .addTransition(new Fade(Fade.OUT).setDuration(250))
                    .addTransition(changeBounds)
                    .addTransition(in);
            transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
            transition.setInterpolator(CubicBezierInterpolator.EASE_OUT);
            TransitionManager.beginDelayedTransition(listView, transition);
        }
        stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize);
        RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(storageUsageRow);
        if (holder != null) {
            stroageUsageView.setEnabled(listAdapter.isEnabled(holder));
        }
    } else {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example #26
Source File: AutoSharedElementCallback.java    From native-navigation with MIT License 5 votes vote down vote up
@TargetApi(TARGET_API) private Transition getDefaultTransition() {
  TransitionSet set = new TransitionSet();
  set.addTransition(new ChangeBounds());
  set.addTransition(new Fade());
  set.addTransition(new ChangeImageTransform());
  set.setInterpolator(new FastOutSlowInInterpolator());
  return set;
}
 
Example #27
Source File: FileExplorerActivity.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
@Override
public void onSwipeFinish(int dir) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setReturnTransition(new TransitionSet()
                .setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Slide(dir > 0 ? Gravity.TOP : Gravity.BOTTOM))
                .addTransition(new Fade())
                .setInterpolator(new AccelerateDecelerateInterpolator()));
    }
    this.finish();
}
 
Example #28
Source File: BottomNavigationAnimationHelperKitkat.java    From MiPushFramework with GNU General Public License v3.0 5 votes vote down vote up
BottomNavigationAnimationHelperKitkat() {
    mSet = new AutoTransition();
    mSet.setOrdering(TransitionSet.ORDERING_TOGETHER);
    mSet.setDuration(ACTIVE_ANIMATION_DURATION_MS);
    mSet.setInterpolator(new FastOutSlowInInterpolator());
    TextScale textScale = new TextScale();
    mSet.addTransition(textScale);
}
 
Example #29
Source File: AlbumActivity.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
@Override
public void onSwipeFinish(int dir) {
    if (recyclerViewAdapter.isSelectorModeActive()) {
        recyclerViewAdapter.cancelSelectorMode(null);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setReturnTransition(new TransitionSet()
                .setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Slide(dir > 0 ? Gravity.TOP : Gravity.BOTTOM))
                .addTransition(new Fade())
                .setInterpolator(new AccelerateDecelerateInterpolator()));
    }
    finish();
}
 
Example #30
Source File: AboutActivity.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
@Override
public void onSwipeFinish(int dir) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setReturnTransition(new TransitionSet()
                .addTransition(new Slide(dir > 0 ? Gravity.TOP : Gravity.BOTTOM))
                .setInterpolator(new AccelerateDecelerateInterpolator()));
    }
    onBackPressed();
}