-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Migrate in-app gallery to Jetpack Compose #468
base: main
Are you sure you want to change the base?
Conversation
3bf2d2b
to
24a686b
Compare
app/src/main/java/app/grapheneos/camera/ui/composable/screen/GalleryScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/app/grapheneos/camera/ui/composable/screen/GalleryScreen.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/app/grapheneos/camera/ui/composable/components/TopBarActions.kt
Outdated
Show resolved
Hide resolved
17b5b55
to
3d31d6b
Compare
What's the purpose of new (de)serializers for CapturedItem and Uri? They can be (de)serialized already since they implement the Parcelable interface. |
Both the Kotlin Serializable and the new Parcelable implementations are needed for using type-safe navigation/custom objects in nav types. Initially, we were passing CapturedItem and List of CapturedItem (s) to specific routes/screen as parameters, but we later switched to having an activity-level repository to manage the captured items which is a much better and cleaner approach. The only serializer and parcelable implementation we are currently using in the app is VideoUriSerializer class and the Parcelable implemented within the VideoUri class itself. I have kept the other classes just in case if we need them later within the camera app or the gallery app. Type-safe navigation isn't very well documented unfortunately, a lot of the limitations it has isn't very clearly mentioned, so having the other serializable and nav type classes as reference would be helpful for future use |
What I'm saying is that Kotlin (de)serializers can reuse the implementation of Parcelable (de)serializers instead of duplicating them. |
I'm sorry but am really unable to get you, serializer/serialization and parcelable are two different concepts/techniques. Is there some library to encode/decode a parcelable to/from a string or work directly with parcelables? |
Parcelization is a form of serialization. Any Parcelable object can be transformed into a sequence of bytes by writing it to a Parcel and then calling |
A better solution in this case would probably be to not use route objects at all, since they don't work well with Parcelables. There's an option to pass route arguments as a Bundle instead. Bundle supports Parcelables directly. |
Route objects help us to do type-safe navigation by ensuring the right parameters are called (with respect to their type, order and in avoiding null check/assertions), and also improving the code readability while performing navigate calls apart from the compile-time checks it provides. Since we have already written the code for the same, I feel it's better to go ahead with the standard type-safe navigation approach |
124a21c
to
c9b9389
Compare
(represents the entry point of the composable app)
(and setup CapturedItemsRepository for use)
(related to views framework)
(for InAppGallery and VideoPlayer activities)
d73a3a3
to
39d04a5
Compare
(the color was removed in a different PR but is continued to being used here)
39d04a5
to
6a9a485
Compare
(currently causes unexpected UI behavior; can be dealt with while migrating the rest of the camera app to Compose)
(when clicking on an image in extended gallery)
(in gallery FAB)
No description provided.