-
Notifications
You must be signed in to change notification settings - Fork 32
Support new event in fragment #57
Support new event in fragment #57
Conversation
@@ -245,6 +251,7 @@ public Type type() { | |||
ACTIVITY_CREATED, | |||
VIEW_STATE_RESTORED, | |||
DESTROY_VIEW, | |||
DETACH | |||
DETACH, | |||
VIEW_CREATED |
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.
This should go below CREATE_VIEW
|
@@ -119,4 +119,10 @@ | |||
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |||
base.onRequestPermissionsResult(requestCode, permissions, grantResults); | |||
} | |||
|
|||
@Override | |||
public 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.
Should be ordered below onCreateView()
.
Needs to be added to |
@@ -295,4 +295,9 @@ public void restoreInstanceStatePersistableListener() { | |||
exception.expect(IllegalArgumentException.class); | |||
emitter.addListener(Event.DETACHED_FROM_WINDOW, mock(Listener.class)); | |||
} | |||
|
|||
@Test public void onViewCreatedListener() { |
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.
This test should be verifying that you can use this event, not that it throws an exception.
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.
Additionally, there should be this test in NaviActivityTest
to verify that it doesn't have an onViewCreated()
method.
import android.support.annotation.Nullable; | ||
import android.view.View; | ||
|
||
public class ViewCreated { |
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.
In Kotlin:
data class ViewCreated(val view: View, val bundle: Bundle)
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.
There should be some newlines between stuff, to match formatting of the other models.
public Bundle getBundle() { | ||
return bundle; | ||
} | ||
public View getView() { |
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.
Should just be bundle()
and view()
, to match the other models.
Also should be ordered consistently throughout - always view then bundle.
This is still missing support for the support |
Thanks for all the work! |
can we bump the version for this? :) |
I'll work on getting a release out soon. I've been on vacation for the past week, sorry. |
Fragment.OnViewCreated() is important event of fragment's lifecycle.