-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix a crash when no presenter is used in a fragment #34
Conversation
* Update build tools version * Change WolmoFragmentHandler and DefaultModule to support no presenter o base presenter * Remove unused reflection code * Remove unused tests
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.
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) { |
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.
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 { |
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.
RIP 💀.
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.
👍
@Inject T mPresenter; | ||
@Inject ToastFactory mToastFactory; | ||
@Inject Logger mLogger; | ||
private @Nullable T mPresenter; |
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 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.
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.
Done!
I tried to update gradle, but butterknife explodes. So for now it's better to keep gradle outdated. 😞 |
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.
Summary