-
Notifications
You must be signed in to change notification settings - Fork 5
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
ViewBinding Migration #629
Conversation
…homeAdapter to viewBinding) and GsrBuildingAdapter viewBinding implementation
…l crash out worthy debug session)
…why does diningsettings use views from laundry lmao)
…oadingpanel fixes
…o-refresh implmentation in onResume so we don't need to manually hide the no internet view on PottruckFragment
… the switches as the fragment has no access to the layout anymore (and also how do we even access PennCourseAlerts?)
@@ -164,39 +143,32 @@ class HomeAdapter( | |||
} | |||
|
|||
else -> { |
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.
Why don't the DiningCell, CalendarCell, and LaundryCell get their own ViewHolders? Although it's less code since they share the same views (for now), I don't think it's a good idea to blend all of these into one. Ultimately, they are different things and may have different needs in the future.
Maybe better is to make a base holder (e.g., HomeBaseHolder) that all of the other ViewHolders in the home page inherent from. Then, in this case you can basically have a "HomeDiningHolder" that just inherits from HomeBaseHolder without any fields of its own. IMO things are more natural this way.
Everything else seems good to me though. Great job, this is huge! |
… binding instead of findviewbyid
…ls can have their own viewholders
PennMobile/src/main/java/com/pennapps/labs/pennmobile/viewholders/HomeBaseHolder.kt
Show resolved
Hide resolved
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.
LGTM!!!
Yessirrrr |
Changes:
Access
toolbar
frommActivity.findViewById
as it is a component of theinclude_main
layoutSince all views that require
loadingPanel
already has access to the reuseable layout throughinclude
, I mostly just referenced it throughview.findViewById
or through the bindingAs
no_results
is also a reusable layout, I gave all views that require the layout access throughinclude
For most adapters, I rewrote them such that their viewholders would take in bindings so they can access and reference the view objects directly through the binding and bind the views inside the viewholders OR functions in the adapter can take in these viewholders as arguments and bind the view (The case of
HomeAdapter
)Also additionally added viewbinding for some fragments that don't use it.
Changed the Parcelize package used in
SavedState
to the non-deprecated version (enabled by the kotlin-parcelize gradle plugin)Removed abundant "not connected to internet" banner/toolbar in DiningHolderFragment since
DiningFragment
andDiningInsightsFragment
already handle these logics themselves (and there would be two toolbars that pops up when there is no internet)Some other lifecycle tweaks (so that we won't do any view work during
onCreate
and crash the app)Now, after this, we can start upgrading basically everything without too much issues. I have successfully implemented compose currently on a branch with kotlin ver. 1.8.0, but I think it's best to review the migration and we can finalize all the upgrades/implementation in a meeting in person