Search in sources :

Example 1 with ChangeText

use of com.transitionseverywhere.ChangeText in project Transitions-Everywhere by andkulikov.

the class ChangeTextSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_change_text, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView textView = (TextView) transitionsContainer.findViewById(R.id.text1);
    textView.setText(TEXT_1);
    textView.setOnClickListener(new View.OnClickListener() {

        boolean mSecondText;

        @Override
        public void onClick(View v) {
            mSecondText = !mSecondText;
            TransitionManager.beginDelayedTransition(transitionsContainer, new ChangeText().setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN));
            textView.setText(mSecondText ? TEXT_2 : TEXT_1);
        }
    });
    return view;
}
Also used : ChangeText(com.transitionseverywhere.ChangeText) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 TextView (android.widget.TextView)1 ChangeText (com.transitionseverywhere.ChangeText)1