use of com.transitionseverywhere.extra.Scale in project Transitions-Everywhere by andkulikov.
the class ScaleSample method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_scale, container, false);
final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
final TextView text1 = (TextView) transitionsContainer.findViewById(R.id.text1);
transitionsContainer.findViewById(R.id.button1).setOnClickListener(new VisibleToggleClickListener() {
@Override
protected void changeVisibility(boolean visible) {
TransitionManager.beginDelayedTransition(transitionsContainer, new Scale());
text1.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
});
final TextView text2 = (TextView) transitionsContainer.findViewById(R.id.text2);
transitionsContainer.findViewById(R.id.button2).setOnClickListener(new VisibleToggleClickListener() {
@Override
protected void changeVisibility(boolean visible) {
TransitionSet set = new TransitionSet().addTransition(new Scale(0.7f)).addTransition(new Fade()).setInterpolator(visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
TransitionManager.beginDelayedTransition(transitionsContainer, set);
text2.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
});
return view;
}
use of com.transitionseverywhere.extra.Scale in project Transitions-Everywhere by andkulikov.
the class TransitionInflater method createTransitionFromXml.
//
// Transition loading
//
private Transition createTransitionFromXml(XmlPullParser parser, AttributeSet attrs, Transition parent) throws XmlPullParserException, IOException {
Transition transition = null;
// Make sure we are on a start tag.
int type;
int depth = parser.getDepth();
TransitionSet transitionSet = (parent instanceof TransitionSet) ? (TransitionSet) parent : null;
while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
if (type != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if ("fade".equals(name)) {
transition = new Fade(mContext, attrs);
} else if ("changeBounds".equals(name)) {
transition = new ChangeBounds(mContext, attrs);
} else if ("slide".equals(name)) {
transition = new Slide(mContext, attrs);
} else if ("explode".equals(name)) {
transition = new Explode(mContext, attrs);
} else if ("changeImageTransform".equals(name)) {
transition = new ChangeImageTransform(mContext, attrs);
} else if ("changeTransform".equals(name)) {
transition = new ChangeTransform(mContext, attrs);
} else if ("changeClipBounds".equals(name)) {
transition = new ChangeClipBounds(mContext, attrs);
} else if ("autoTransition".equals(name)) {
transition = new AutoTransition(mContext, attrs);
} else if ("recolor".equals(name)) {
transition = new Recolor(mContext, attrs);
} else if ("changeScroll".equals(name)) {
transition = new ChangeScroll(mContext, attrs);
} else if ("transitionSet".equals(name)) {
transition = new TransitionSet(mContext, attrs);
} else if ("scale".equals(name)) {
transition = new Scale(mContext, attrs);
} else if ("translation".equals(name)) {
transition = new TranslationTransition(mContext, attrs);
} else if ("transition".equals(name)) {
transition = (Transition) createCustom(attrs, Transition.class, "transition");
} else if ("targets".equals(name)) {
getTargetIds(parser, attrs, parent);
} else if ("arcMotion".equals(name)) {
parent.setPathMotion(new ArcMotion(mContext, attrs));
} else if ("pathMotion".equals(name)) {
parent.setPathMotion((PathMotion) createCustom(attrs, PathMotion.class, "pathMotion"));
} else if ("patternPathMotion".equals(name)) {
parent.setPathMotion(new PatternPathMotion(mContext, attrs));
} else {
throw new RuntimeException("Unknown scene name: " + parser.getName());
}
if (transition != null) {
if (!parser.isEmptyElementTag()) {
createTransitionFromXml(parser, attrs, transition);
}
if (transitionSet != null) {
transitionSet.addTransition(transition);
transition = null;
} else if (parent != null) {
throw new InflateException("Could not add transition to another transition.");
}
}
}
return transition;
}
Aggregations