+
Skip to content

Fix a crash when no presenter is used in a fragment #34

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

Merged

Conversation

alvarez-fabian
Copy link
Contributor

Summary

  • Update build tools version
  • Change WolmoFragmentHandler and DefaultModule to support no presenter o base presenter
  • Remove unused reflection code
  • Remove unused tests

* Update build tools version
* Change WolmoFragmentHandler and DefaultModule to support no presenter o base presenter
* Remove unused reflection code
* Remove unused tests
Copy link
Contributor

@SpicyCactuar SpicyCactuar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small but nice changes. BTW, check if the gradle update works well with AS 3.1.

@@ -120,24 +124,9 @@ View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@SuppressWarnings("unchecked")
void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the @NonNull to the View view parameter. It was added in one of the latest Android API updates. It's nice because, if this method is called, the Fragment has to have a View.

* @since 2014-04-13
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class ReflectionUtils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIP 💀.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Inject T mPresenter;
@Inject ToastFactory mToastFactory;
@Inject Logger mLogger;
private @Nullable T mPresenter;
Copy link
Contributor

@SpicyCactuar SpicyCactuar Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this but we should add a requirePresenter() method that returns a Presenter, if it's not null, or throws an NPE if it isn't. This method should return a @NonNull Presenter which is nice for both Java and Kotlin.

Copy link
Contributor Author

@alvarez-fabian alvarez-fabian Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@alvarez-fabian
Copy link
Contributor Author

I tried to update gradle, but butterknife explodes. So for now it's better to keep gradle outdated. 😞

Copy link
Contributor

@SpicyCactuar SpicyCactuar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvarez-fabian alvarez-fabian merged commit 1bcfb1e into development Apr 3, 2018
@alvarez-fabian alvarez-fabian deleted the hotfix-presenter-check-when-using-base-presenter branch April 3, 2018 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载