andkulikov / Transitions-Everywhere

Set of extra Transitions on top of Jetpack Transitions Library
Apache License 2.0
4.83k stars 486 forks source link

Alternative to styleables while migrating from 1.x to 2 #97

Closed nimeacuerdo closed 5 years ago

nimeacuerdo commented 5 years ago

Hi,

we have a transition with the following code

  TypedArray a = context.obtainStyledAttributes(attrs, com.transitionseverywhere.R.styleable.Transition);
  long duration = a.getInt(com.transitionseverywhere.R.styleable.Transition_duration, -1);
  if (duration >= 0) {
      setDuration(duration);
  } else {
      duration = a.getInt(com.transitionseverywhere.R.styleable.Transition_android_duration, -1);
      if (duration >= 0) {
          setDuration(duration);
      }
  }

that needs to be migrated to version 2.

Transition and Transition_duration are not available when changing from com.transitionseverywhere to androidx.transition as indicated in the migration guide.

Can you help us with this?

andkulikov commented 5 years ago

Hey. I don't think you need this code anymore. I guess the duration will be correctly resolved if you just call super inside your constructor with the signature (Context context, AttributeSet attrs). this will resolve android_duration attribute. And there is no Transition_duration from transitionseverywhere anymore

nimeacuerdo commented 5 years ago

Cool, thanks for the update @andkulikov !