-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support new onAttach(Context) on Fragment's lifecycle #64
Support new onAttach(Context) on Fragment's lifecycle #64
Conversation
…) is deprecated since API 23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what it does not appear here but a test failed : com.soundcloud.lightcycle.LightCycleProcessorTest > shouldGenerateInjectorForParameterizeDispatcher FAILED
The fix is to add
@Override
public void onAttach(T fragment, Context context) { }
to lightcycle/lightcycle-processor/src/test/resources/com/soundcloud/lightcycle/FragmentLightCycleDispatcher.java
I know the setup is not ideal (and maybe reworked later(.
public interface FragmentLightCycle<T extends Fragment> { | ||
void onAttach(T fragment, Activity activity); | ||
@TargetApi(23) void onAttach(T fragment, Context context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you break the line after @TargetApi(23)
, please ?
Not your fault, we did not setup a proper code formatter and checker.
#65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, Fixed!
Thank your for your contributions ! |
You are welcome! About the lightcycle-processor's test, I added the function per your request. The problem might be my environment though... |
Unfortunately, they do not run in the IDE only in the command line (It used to work in AS, tho). @michaelengland mentioned looking into it. |
I think the tests dno not past because of |
Sorry forgot to push! I see, I think the other alternative is to rewrite the test to separate test per usage (Activity, Fragment, SupportFragment) and write the source directly in the test file. |
Still does not build. The import is missing you can run them with |
Added the import for Context, and then the build was successful in my machine. Hope this can solve the problem. |
Fix the lightcycle-processor test to run in the IDE. - Remove unnecessary header - Inline Java source string constants #64
Add onAttach(Context) on Fragment's lifecycle since onAttach(Activity) is deprecated since API 23
Reference : https://developer.android.com/reference/android/app/Fragment.html#onAttach(android.app.Activity)