This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TargetApi(Build.VERSION_CODES.KITKAT) | |
public class TextColorTransition extends Transition { | |
private static final String PROPNAME_TEXT_COLOR = "kvest:textColorTransition:textColor"; | |
private static final String[] TRANSITION_PROPERTIES = {PROPNAME_TEXT_COLOR}; | |
public TextColorTransition() { | |
} | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public TextColorTransition(Context context, AttributeSet attrs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transition transition = new TextColorTransition(); | |
TransitionManager.beginDelayedTransition(root, transition); | |
textView.setTextColor(newColor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent = new Intent(...); | |
... | |
//Shared transitions available only from Lollipop | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
//grab properties for custom transitions | |
Bundle nameExtra = new Bundle(); | |
TextColorTransition.addExtraProperties(nameView, nameExtra); | |
intent.putExtra(transitionName, nameExtra); | |
Bundle frameExtra = new Bundle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RingViewTransition extends Transition { | |
.... | |
public static void addExtraProperties(RingView view, Bundle extra) { | |
extra.putInt(PROPNAME_COLOR, view.getColor()); | |
extra.putFloat(PROPNAME_INNER_RADIUS, view.getInnerCircleRadius()); | |
extra.putFloat(PROPNAME_OUTER_RADIUS, view.getOuterCircleRadius()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextColorTransition extends Transition { | |
.... | |
public static void addExtraProperties(TextView view, Bundle extra) { | |
extra.putInt(PROPNAME_TEXT_COLOR, view.getCurrentTextColor()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextColorTransition extends Transition { | |
... | |
private void captureValues(@NonNull TransitionValues transitionValues) { | |
if (transitionValues.view instanceof TextView) { | |
Bundle extraData = (Bundle)transitionValues.view.getTag(R.id.tag_transition_extra_properties); | |
int color; | |
if (extraData != null && extraData.containsKey(PROPNAME_TEXT_COLOR)) { | |
color = extraData.getInt(PROPNAME_TEXT_COLOR); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RingViewTransition extends Transition { | |
... | |
private void captureValues(RingView view, TransitionValues transitionValues) { | |
Bundle extraData = (Bundle)transitionValues.view.getTag(R.id.tag_transition_extra_properties); | |
if (extraData != null) { | |
transitionValues.values.put(PROPNAME_COLOR, | |
extraData.getInt(PROPNAME_COLOR, view.getColor())); | |
transitionValues.values.put(PROPNAME_INNER_RADIUS, | |
extraData.getFloat(PROPNAME_INNER_RADIUS, view.getInnerCircleRadius())); | |
transitionValues.values.put(PROPNAME_OUTER_RADIUS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
Copyright 2016 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
OlderNewer