`Day42` - Worked on demo app using map API & c...
# 100daysofkotlin-2021
j
Day42
• Worked on demo app using map API & company API ◦ refactored into MVVM ◦ add data binding ◦ minor refactorings - add toggling on markers & polygons etc.
Self-Comment
• Refactoring is not easy.. Actually now I get the basics of MVVM but other issues pop up! Technical debt… ◦ At previous version, I used “fragment activity”, but this time I changed it into “fragment”. Why fragment activity at first? No reason, I just followed some medium tutorial to make a working demo, and that guy used fragment activity. But as I re-organized, I thought that fragment was appropriate, (but still no idea about fragment activity..) so I changed it. ◦ Then I had these issues with “context”. As I re-organized the entire directory & files, putting some to model package.. pulling off methods from activity and putting into view model etc., there were some methods inside view model that needed application context. I had some rough stack overflow-ing time and put out the fire with some messy code.. but I know this is a bad practice. ◦ As app scale becomes larger, there comes multi-dex blah blah issues, and this context thing will torture me if I don’t understand this soon.
Day43
• Initialized settings to use local storage ◦ Add Room dependency, kapt dependency ◦ Add database, dao, entity and the annotations. (Missing some annotations lead to disgusting red errors.) ◦ Faced some other disgusting error. Reason was,, I had to add some TypeConverter class .. .. .. .. .. phew,, • Had to understand the basic logic of our company’s app. (with regard to local storage & server) It was quite confusing, understanding this complicated logic with bunch of rx codes and flat maps .. I didn’t fully understand it yet. I’ll have to continue tomorrow. ◦ (as far as i understood) (just for memo) flow goes like .. ▪︎ 0) user location changes -> 1) GET to server, with location query -> 2) Compare with bikes into local app storage -> 3)Delete, Add done in local app storage -> 4) show markers based on local app storage’s bike locations.
Goals-Tomorrow
• Add deletion method inside in view model/update bike table • finish understanding & implementing this bike fetching flow • move on to next feature : showing bike info on marker click -> info comin from local storage
weekend-goals
Links to check • [context] https://blog.mindorks.com/understanding-context-in-android-application-330913e32514 • [app components] https://developer.android.com/guide/components/fundamentals.html#Components / • [kotlin scope functions] https://blog.yena.io/studynote/2020/04/15/Kotlin-Scope-Functions.html
🔥 1
b
Great to see you questioning some code decisions! Definitely shows you're making a lot of progress in my eyes anyways 😁👍 I laughed when you said "disgusting red errors". I can relate to this one and know how you feel here 😆
j
Haha thanks bryan. Yeah everyday I’m making progress, small and big, I guess. Time flies, and I sometimes feel intimidated too, but still I’m enjoying this. Plus, it’s fascinating to have a mentor/supervisor.