Java Code Examples for android.transition.TransitionSet#setOrdering()

The following examples show how to use android.transition.TransitionSet#setOrdering() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: AlbumDetailActivity.java    From android-animations-transitions with MIT License 4 votes vote down vote up
private void setupTransitions() {
//        Slide slide = new Slide(Gravity.BOTTOM);
//        slide.excludeTarget(android.R.id.statusBarBackground, true);
//        getWindow().setEnterTransition(slide);
//        getWindow().setSharedElementsUseOverlay(false);

        mTransitionManager = new TransitionManager();
        ViewGroup transitionRoot = detailContainer;

        // Expanded scene
        mExpandedScene = Scene.getSceneForLayout(transitionRoot,
                R.layout.activity_album_detail_expanded, this);

        mExpandedScene.setEnterAction(new Runnable() {
            @Override
            public void run() {
                ButterKnife.bind(AlbumDetailActivity.this);
                populate();
                mCurrentScene = mExpandedScene;
            }
        });

        TransitionSet expandTransitionSet = new TransitionSet();
        expandTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
        ChangeBounds changeBounds = new ChangeBounds();
        changeBounds.setDuration(200);
        expandTransitionSet.addTransition(changeBounds);

        Fade fadeLyrics = new Fade();
        fadeLyrics.addTarget(R.id.lyrics);
        fadeLyrics.setDuration(150);
        expandTransitionSet.addTransition(fadeLyrics);

        // Collapsed scene
        mCollapsedScene = Scene.getSceneForLayout(transitionRoot,
                R.layout.activity_album_detail, this);

        mCollapsedScene.setEnterAction(new Runnable() {
            @Override
            public void run() {
                ButterKnife.bind(AlbumDetailActivity.this);
                populate();
                mCurrentScene = mCollapsedScene;
            }
        });

        TransitionSet collapseTransitionSet = new TransitionSet();
        collapseTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);

        Fade fadeOutLyrics = new Fade();
        fadeOutLyrics.addTarget(R.id.lyrics);
        fadeOutLyrics.setDuration(150);
        collapseTransitionSet.addTransition(fadeOutLyrics);

        ChangeBounds resetBounds = new ChangeBounds();
        resetBounds.setDuration(200);
        collapseTransitionSet.addTransition(resetBounds);

        mTransitionManager.setTransition(mExpandedScene, mCollapsedScene, collapseTransitionSet);
        mTransitionManager.setTransition(mCollapsedScene, mExpandedScene, expandTransitionSet);
        mCollapsedScene.enter();

//        postponeEnterTransition();
    }
 
Example 8
Source File: TransitionHelperKitkat.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
static Object createTransitionSet(boolean sequential) {
    TransitionSet set = new TransitionSet();
    set.setOrdering(sequential ? TransitionSet.ORDERING_SEQUENTIAL :
        TransitionSet.ORDERING_TOGETHER);
    return set;
}
 
Example 9
Source File: LegendSignatureView.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setData(int index, long date, ArrayList<LineViewData> lines, boolean animateChanges) {
    int n = holdes.length;
    if (animateChanges) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            TransitionSet transition = new TransitionSet();
            transition.
                    addTransition(new Fade(Fade.OUT).setDuration(100)).
                    addTransition(new ChangeBounds().setDuration(150)).
                    addTransition(new Fade(Fade.IN).setDuration(100));
            transition.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
            TransitionManager.beginDelayedTransition(this, transition);
        }
    }

    if (isTopHourChart) {
        time.setText(String.format(Locale.ENGLISH, "%02d:00", date));
    } else {
        time.setText(formatData(new Date(date)));
        if (useHour) hourTime.setText(hourFormat.format(date));
    }

    int sum = 0;

    for (int i = 0; i < n; i++) {
        if (lines.get(i).enabled) sum += lines.get(i).line.y[index];
    }

    for (int i = 0; i < n; i++) {
        Holder h = holdes[i];

        if (!lines.get(i).enabled) {
            h.root.setVisibility(View.GONE);
        } else {
            ChartData.Line l = lines.get(i).line;
            if (h.root.getMeasuredHeight() == 0) {
                h.root.requestLayout();
            }
            h.root.setVisibility(View.VISIBLE);
            h.value.setText(formatWholeNumber(l.y[index]));
            h.signature.setText(l.name);
            if (l.colorKey != null && Theme.hasThemeKey(l.colorKey)) {
                h.value.setTextColor(Theme.getColor(l.colorKey));
            } else {
                h.value.setTextColor(Theme.getCurrentTheme().isDark() ? l.colorDark : l.color);
            }
            h.signature.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));

            if (showPercentage && h.percentage != null) {
                h.percentage.setVisibility(VISIBLE);
                h.percentage.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
                float v = lines.get(i).line.y[index] / (float) sum;
                if (v < 0.1f && v != 0f) {
                    h.percentage.setText(String.format(Locale.ENGLISH, "%.1f%s", (100f * v), "%"));
                } else {
                    h.percentage.setText(String.format(Locale.ENGLISH, "%d%s", Math.round(100 * v), "%"));
                }
            }
        }
    }

    if (zoomEnabled) {
        canGoZoom = sum > 0;
        chevron.setVisibility(sum > 0 ? View.VISIBLE : View.GONE);
    } else {
        canGoZoom = false;
        chevron.setVisibility(View.GONE);
    }
}
 
Example 10
Source File: LegendSignatureView.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setData(int index, long date, ArrayList<LineViewData> lines, boolean animateChanges) {
    int n = holdes.length;
    if (animateChanges) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            TransitionSet transition = new TransitionSet();
            transition.
                    addTransition(new Fade(Fade.OUT).setDuration(100)).
                    addTransition(new ChangeBounds().setDuration(150)).
                    addTransition(new Fade(Fade.IN).setDuration(100));
            transition.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
            TransitionManager.beginDelayedTransition(this, transition);
        }
    }

    if (isTopHourChart) {
        time.setText(String.format(Locale.ENGLISH, "%02d:00", date));
    } else {
        time.setText(formatData(new Date(date)));
        if (useHour) hourTime.setText(hourFormat.format(date));
    }

    int sum = 0;

    for (int i = 0; i < n; i++) {
        if (lines.get(i).enabled) sum += lines.get(i).line.y[index];
    }

    for (int i = 0; i < n; i++) {
        Holder h = holdes[i];

        if (!lines.get(i).enabled) {
            h.root.setVisibility(View.GONE);
        } else {
            ChartData.Line l = lines.get(i).line;
            if (h.root.getMeasuredHeight() == 0) {
                h.root.requestLayout();
            }
            h.root.setVisibility(View.VISIBLE);
            h.value.setText(formatWholeNumber(l.y[index]));
            h.signature.setText(l.name);
            if (l.colorKey != null && Theme.hasThemeKey(l.colorKey)) {
                h.value.setTextColor(Theme.getColor(l.colorKey));
            } else {
                h.value.setTextColor(Theme.getCurrentTheme().isDark() ? l.colorDark : l.color);
            }
            h.signature.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));

            if (showPercentage && h.percentage != null) {
                h.percentage.setVisibility(VISIBLE);
                h.percentage.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
                float v = lines.get(i).line.y[index] / (float) sum;
                if (v < 0.1f && v != 0f) {
                    h.percentage.setText(String.format(Locale.ENGLISH, "%.1f%s", (100f * v), "%"));
                } else {
                    h.percentage.setText(String.format(Locale.ENGLISH, "%d%s", Math.round(100 * v), "%"));
                }
            }
        }
    }

    if (zoomEnabled) {
        canGoZoom = sum > 0;
        chevron.setVisibility(sum > 0 ? View.VISIBLE : View.GONE);
    } else {
        canGoZoom = false;
        chevron.setVisibility(View.GONE);
    }
}