use of com.transitionseverywhere.ChangeBounds in project Transitions-Everywhere by andkulikov.
the class PathMotionSample method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_path, container, false);
final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
final View button = transitionsContainer.findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
boolean mToRightAnimation;
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(transitionsContainer, new ChangeBounds().setPathMotion(new ArcMotion()).setDuration(500));
mToRightAnimation = !mToRightAnimation;
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.BOTTOM) : (Gravity.LEFT | Gravity.TOP);
button.setLayoutParams(params);
}
});
return view;
}
use of com.transitionseverywhere.ChangeBounds in project Transitions-Everywhere by andkulikov.
the class TransitionNameSample method onCreateView.
@Nullable
@Override
@SuppressLint("DefaultLocale")
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_names, container, false);
final ViewGroup layout = (ViewGroup) view.findViewById(R.id.transitions_container);
final Button button = (Button) view.findViewById(R.id.button1);
final List<String> titles = new ArrayList<>();
for (int i = 0; i < 5; i++) {
titles.add(String.format("Item %d", i + 1));
}
createViews(inflater, layout, titles);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(layout, new ChangeBounds());
Collections.shuffle(titles);
createViews(inflater, layout, titles);
}
});
return view;
}
use of com.transitionseverywhere.ChangeBounds in project Transitions-Everywhere by andkulikov.
the class ImageTransformSample method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_image_transform, container, false);
final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
final ImageView imageView = (ImageView) transitionsContainer.findViewById(R.id.image);
imageView.setOnClickListener(new View.OnClickListener() {
boolean mExpanded;
@Override
public void onClick(View v) {
mExpanded = !mExpanded;
TransitionManager.beginDelayedTransition(transitionsContainer, new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeImageTransform()));
ViewGroup.LayoutParams params = imageView.getLayoutParams();
params.height = mExpanded ? ViewGroup.LayoutParams.MATCH_PARENT : ViewGroup.LayoutParams.WRAP_CONTENT;
imageView.setLayoutParams(params);
imageView.setScaleType(mExpanded ? ImageView.ScaleType.CENTER_CROP : ImageView.ScaleType.FIT_CENTER);
}
});
return view;
}
use of com.transitionseverywhere.ChangeBounds in project Transitions-Everywhere by andkulikov.
the class InterpolatorDurationStartDelaySample method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_interpolator, container, false);
final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
final View button = transitionsContainer.findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
boolean mToRightAnimation;
@Override
public void onClick(View v) {
mToRightAnimation = !mToRightAnimation;
Transition transition = new ChangeBounds();
transition.setDuration(mToRightAnimation ? 700 : 300);
transition.setInterpolator(mToRightAnimation ? new FastOutSlowInInterpolator() : new AccelerateInterpolator());
transition.setStartDelay(mToRightAnimation ? 0 : 500);
TransitionManager.beginDelayedTransition(transitionsContainer, transition);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.TOP) : (Gravity.LEFT | Gravity.TOP);
button.setLayoutParams(params);
}
});
return view;
}
Aggregations