lsilbers / codepathAndroidTodo

Very basic todo app for the Android platform
0 stars 0 forks source link

[Andoid Prework] TodoApp ready for initial review #1

Open lsilbers opened 9 years ago

lsilbers commented 9 years ago

My basic Todo app is complete, please review /cc @codepathreview @codepath

I look forward to improving it :)

lsilbers commented 9 years ago

Added ActiveAndroid to enable easy support for storing objects in the database. What is the right way to refresh data from the database? Should I be using the DB as a way of passing my objects around between activities and fragments or should I be passing serialized forms and only load from db once per app start? I was also unclear as to the benefits of using a cursor adapter with ORM as it seems to sort of defeat the point by forcing you to refer to column names in the db.

lsilbers commented 9 years ago

Moved editing of items to a DialogFragment

nidhi1608 commented 9 years ago

The best practice is to pass your serialized model classes for passing data between components in Android. In professional Android app development, you will most likely use another concept called Parcelable, however for the purpose of this class, Serializable will suffice.

As we dive deeper into Android app development, you'll see the advantages of using an ORM. The alternative is to use the underlying SQlite database as is using sqliteopenhelper, but it gets hard to manage once you start working with a bit complex schema. Also, you'll find yourself using the custom adapter for a bunch of other things including event handling, navigation and persistence.

nidhi1608 commented 9 years ago

Your app looks great! I am glad you got a chance to play around with most of the optionals. This was intended in part to give you an introduction to the general rhythm of this course. The course is entirely project based with an app being assigned each week and then due the following week. Each project builds on the last to help each engineer to learn all practical Android development and best practices as quickly as possible. We also do a code review for each submitted project. Nice job with the project, hope you found it as a helpful introduction.

We are reviewing the submissions right now and will get in touch with you via email a few days after the submission closing date, October 2nd, 2015. In the mean time, you may consider working on improving the look and feel of your app.

lsilbers commented 9 years ago

Thanks for the feedback Nidhi, I have added some new UX features as well as moved to passing my TodoItems as serializable arguments to the dialog. I am passing them to the dialog but not receiving them back just reloading the list of items as the order may likely change when the list is reloaded (if priorities are changed). Is it better to manually remove and reinsert the item into the list (and notify the adapter) or is it ok to reload the list from the db?

nidhi1608 commented 9 years ago

In this case its better and more efficient to load the items from db. This way you are not passing in the item by value using intents and can always have the latest list of items. This especially becomes important once its a multi user app. E.g. in a social media app, you might not have the latest like count if you pass your record by value via an intent. Not to mention, it saves you the trouble of manually sorting the items.

lsilbers commented 8 years ago

Right, I guessed as much but it is nice to have confirmation. I have added the ability to take a photo (or choose one) to customize the background. I hope you don't mind all my questions - I am saving the string representation of the Uri to the image in the preferences but I'm not sure exactly how to know where to load the image from. I put in a switch based on the Uri "Scheme" but I have no idea if that holds in an environment outside the emulator (plus hardcoded strings always seems like a bad idea). How would you normally do this - do you just make sure to keep good track of where the data source is or is there some way that you can effectively just do getImage(uriToMyImage)?

nidhi1608 commented 8 years ago

Of course I don't mind the questions. :smile: One way to do this is to save the image locally within your sandbox, however if you use the intents to pick images, they are content URIs so what you have should be fine (if they are http: URIs you will need to download them and save them locally within your sandbox).