-
Notifications
You must be signed in to change notification settings - Fork 223
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
androidx: started migration #162
Conversation
|
||
testImplementation "junit:junit:$rootProject.ext.junitVersion" | ||
testImplementation "org.mockito:mockito-core:2.13.0" | ||
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-alpha03" | ||
testImplementation "org.robolectric:robolectric:3.7" | ||
testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT' |
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.
Had to upgrade to 4.0 because 3.x didn't support API 28
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.
4.1.0 stable is available now
@@ -118,7 +126,7 @@ class FragNavController constructor(private val fragmentManger: FragmentManager, | |||
} else { | |||
//Else try to find one in the FragmentManager | |||
val fragmentManager: FragmentManager = getFragmentManagerForDialog() | |||
mCurrentDialogFrag = fragmentManager.fragments?.firstOrNull { it is DialogFragment } as DialogFragment? | |||
mCurrentDialogFrag = fragmentManager.fragments.firstOrNull { it is DialogFragment } as DialogFragment? |
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.
The compiler was suggesting to remove safe calls as they're not nullable anymore.
@@ -277,7 +285,11 @@ class FragNavController constructor(private val fragmentManger: FragmentManager, | |||
} else { | |||
fragment = getRootFragment(currentStackIndex) | |||
// Handle special case of indexes, restore tag of removed fragment | |||
var tag = fragment.tag ?: fragmentStacksTags[index].peek() | |||
var tag = fragment.tag | |||
// TODO: Better empty stack handling |
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 one was throwing StackEmptyException in NavDrawer example (NavDrawer example > Open NavDrawer > Click any menu) and in tests.
// TODO: Better null handling | ||
if (sharedElement.first != null) { | ||
addSharedElement( | ||
sharedElement.first!!, |
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.
addSharedElement
now requires a non-null view.
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.
The safest way to do sharedElement.first!! is either calling firstOrNull() like sharedElement?.firstOrNull() or to getOrNull(0)
What do you mean it's good? They are same support libraries with different name and package. |
@alashow thank you for the PR and sorry for the delay. As @mateherber mentioned, this migration has been included in #178 and will be released as part of 3.1.0 #187 Apologies for not getting to this sooner and your help is appreciated! |
Resolves #161
Had a couple of issues with tests and null handling that needs to be improved. Marked with
TODO
and will add comments in review.